<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/include/sound/soc.h, branch linux-5.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2019-04-08T07:15:44Z</updated>
<entry>
<title>ASoC: core: conditionally increase module refcount on component open</title>
<updated>2019-04-08T07:15:44Z</updated>
<author>
<name>Ranjani Sridharan</name>
<email>ranjani.sridharan@linux.intel.com</email>
</author>
<published>2019-04-05T16:57:08Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b4ed6b51f356224c6c71540ed94087f7f09b84af'/>
<id>urn:sha1:b4ed6b51f356224c6c71540ed94087f7f09b84af</id>
<content type='text'>
Recently, for Intel platforms the "ignore_module_refcount" field
was introduced for the component driver. In order to avoid a
deadlock preventing the PCI modules from being removed
even when the card was idle, the refcounts were not incremented
for the device driver module during component probe.

However, this change introduced a nasty side effect:
the device driver module can be unloaded while a pcm stream is open.

This patch proposes to change the field to be renamed as
"module_get_upon_open". When this field is set, the module
refcount should be incremented on pcm open amd decremented
upon pcm close. This will enable modules to be removed
when no PCM playback/capture happens and prevent removal
when the component is actually in use.

Also, align with the skylake component driver with the new name.

Fixes: b450b878('ASoC: core: don't increase component module refcount
                 unconditionally'
Signed-off-by: Ranjani Sridharan &lt;ranjani.sridharan@linux.intel.com&gt;
Acked-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: dpcm: prevent snd_soc_dpcm use after free</title>
<updated>2019-03-11T16:58:49Z</updated>
<author>
<name>KaiChieh Chuang</name>
<email>kaichieh.chuang@mediatek.com</email>
</author>
<published>2019-03-08T05:05:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a9764869779081e8bf24da07ac040e8f3efcf13a'/>
<id>urn:sha1:a9764869779081e8bf24da07ac040e8f3efcf13a</id>
<content type='text'>
The dpcm get from fe_clients/be_clients
may be free before use

Add a spin lock at snd_soc_card level,
to protect the dpcm instance.
The lock may be used in atomic context, so use spin lock.

Use irq spin lock version,
since the lock may be used in interrupts.

possible race condition between
void dpcm_be_disconnect(
	...
	list_del(&amp;dpcm-&gt;list_be);
	list_del(&amp;dpcm-&gt;list_fe);
	kfree(dpcm);
	...

and
	for_each_dpcm_fe()
	for_each_dpcm_be*()

race condition example
Thread 1:
    snd_soc_dapm_mixer_update_power()
        -&gt; soc_dpcm_runtime_update()
            -&gt; dpcm_be_disconnect()
                -&gt; kfree(dpcm);
Thread 2:
    dpcm_fe_dai_trigger()
        -&gt; dpcm_be_dai_trigger()
            -&gt; snd_soc_dpcm_can_be_free_stop()
                -&gt; if (dpcm-&gt;fe == fe)

Excpetion Scenario:
	two FE link to same BE
	FE1 -&gt; BE
	FE2 -&gt;

	Thread 1: switch of mixer between FE2 -&gt; BE
	Thread 2: pcm_stop FE1

Exception:

Unable to handle kernel paging request at virtual address dead0000000000e0

pc=&lt;&gt; [&lt;ffffff8960e2cd10&gt;] dpcm_be_dai_trigger+0x29c/0x47c
	sound/soc/soc-pcm.c:3226
		if (dpcm-&gt;fe == fe)
lr=&lt;&gt; [&lt;ffffff8960e2f694&gt;] dpcm_fe_dai_do_trigger+0x94/0x26c

Backtrace:
[&lt;ffffff89602dba80&gt;] notify_die+0x68/0xb8
[&lt;ffffff896028c7dc&gt;] die+0x118/0x2a8
[&lt;ffffff89602a2f84&gt;] __do_kernel_fault+0x13c/0x14c
[&lt;ffffff89602a27f4&gt;] do_translation_fault+0x64/0xa0
[&lt;ffffff8960280cf8&gt;] do_mem_abort+0x4c/0xd0
[&lt;ffffff8960282ad0&gt;] el1_da+0x24/0x40
[&lt;ffffff8960e2cd10&gt;] dpcm_be_dai_trigger+0x29c/0x47c
[&lt;ffffff8960e2f694&gt;] dpcm_fe_dai_do_trigger+0x94/0x26c
[&lt;ffffff8960e2edec&gt;] dpcm_fe_dai_trigger+0x3c/0x44
[&lt;ffffff8960de5588&gt;] snd_pcm_do_stop+0x50/0x5c
[&lt;ffffff8960dded24&gt;] snd_pcm_action+0xb4/0x13c
[&lt;ffffff8960ddfdb4&gt;] snd_pcm_drop+0xa0/0x128
[&lt;ffffff8960de69bc&gt;] snd_pcm_common_ioctl+0x9d8/0x30f0
[&lt;ffffff8960de1cac&gt;] snd_pcm_ioctl_compat+0x29c/0x2f14
[&lt;ffffff89604c9d60&gt;] compat_SyS_ioctl+0x128/0x244
[&lt;ffffff8960283740&gt;] el0_svc_naked+0x34/0x38
[&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: KaiChieh Chuang &lt;kaichieh.chuang@mediatek.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: core: don't increase component module refcount unconditionally</title>
<updated>2019-02-08T18:00:20Z</updated>
<author>
<name>Pierre-Louis Bossart</name>
<email>pierre-louis.bossart@linux.intel.com</email>
</author>
<published>2019-02-01T17:22:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b450b87847b157d69dbf9af7aefb4cec29e89cc9'/>
<id>urn:sha1:b450b87847b157d69dbf9af7aefb4cec29e89cc9</id>
<content type='text'>
The ASoC core has for the longest time increased the module reference
counts, even before the transition to the component model. This is
probably fine on most platforms, but it introduces a deadlock case on
Intel devices with the Skylake and SOF drivers which cannot be removed
due to their reference counts being modified by the core.

In these 2 cases, the PCI or ACPI driver .probe creates a platform
device to let the machine driver .probe register the audio
card. Conversely the PCI or ACPI driver .remove will unregister the
platform device which results in the card being removed by the machine
driver .remove.

With ascii art, this can be represented as

modprobe
snd_soc_skl/
soc-pci-dev/sof-acpci-dev  ----------&gt; pci/acpi probe
       ^                                    |
       |                     ---------------|
       |                    |               |
       |                    V               V
    increase            register        register machine
    refcount            component       platform_device
       ^                                    |
       |                                    |
       |                                    V
    component &lt;----   register card  &lt;---- probe
    probe

The issue is that by playing with the component's module reference
counts during the card registration, it's no longer possible to remove
the module which controls the component. This can be shown, e.g. with
the following error:

root@plb-XPS-13-9350:~# lsmod | grep snd_soc_skl
snd_soc_skl           110592  1

root@plb-XPS-13-9350:~# rmmod snd_soc_skl
rmmod: ERROR: Module snd_soc_skl is in use

Increasing the reference count during the component probe is not
useful. If the PCI/ACPI module is removed, the card will be removed
anyway.

To avoid breaking existing platforms and allowing Intel platforms to
safely deal with module load/unload cases, this patch introduces a
flag which needs to be set during the component initialization. This
is a strictly opt-in capability that should only be used when the
handling of the component module does not require a reference count
increase to prevent removal during use.

Note that this solution is not directly applicable to the legacy
Atom/SST driver, which uses a different device hierarchy. There are
however additional refcount issues which prevent the ACPI driver from
being removed. This is a different issue which would need a different
patch.

Signed-off-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: add helper to change platform name for all dailinks</title>
<updated>2019-01-28T18:05:38Z</updated>
<author>
<name>Pierre-Louis Bossart</name>
<email>pierre-louis.bossart@linux.intel.com</email>
</author>
<published>2019-01-25T20:34:55Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=cb50358b83846e4dcb37137c431327c4dd68561b'/>
<id>urn:sha1:cb50358b83846e4dcb37137c431327c4dd68561b</id>
<content type='text'>
To reuse the same machine drivers with Atom/SST, Skylake and SOF, we
need to change the default platform_name (or platforms-&gt;name in the
"modern" representation).

So far, this override was done with an automatic override, which was
broken by a set of changes for DT platforms related to deferred probe
handling.

This automatic override is actually not really needed, the machine
driver can already receive the platform name as a platform_data
parameter. This is used e.g. for HDaudio support where we have
different PCI aliases used for different platforms. We can reuse the
same mechanism and modify the machine drivers to override the dailinks
prior to registrating the card.

This will require additional work for SOF, but with this helper it'll
be just two lines of additional code per machine driver which is
reused, not the end of the world.

This helper can be simplified when all drivers have transitioned to
the "modern" representation of dailinks.

Signed-off-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core: add .num_platform for dai_link</title>
<updated>2019-01-21T18:12:19Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2019-01-21T00:32:32Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=910fdcabedd2354d161b1beab6ad7dc7e859651d'/>
<id>urn:sha1:910fdcabedd2354d161b1beab6ad7dc7e859651d</id>
<content type='text'>
Current snd_soc_dai_link is starting to use snd_soc_dai_link_component
(= modern) style for Platform, but it is still assuming single Platform
so far. We will need to have multi Platform support in the not far
future.

Currently only simple card is using it as sound card driver,
and other drivers are converted to it from legacy style by
snd_soc_init_platform().
To avoid future problem of multi Platform support, let's add
num_platforms before it is too late.

In the same time, to make it same naming mothed, "platform" should
be "platforms". This patch fixup it too.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc.h: add explanation of legacy/modern style of dai_link</title>
<updated>2019-01-18T19:14:43Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2019-01-18T02:20:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=62bc79d35ebb55451112979babea864975cfd16d'/>
<id>urn:sha1:62bc79d35ebb55451112979babea864975cfd16d</id>
<content type='text'>
Current ALSA SoC is assuming 1 CPU 1 Platform (= DMA) style system.
Because of this background, it is directly using
xxx_name / xxx_of_node / xxx_dai_name on dai_link.
Let's call it as legacy style here.

More complex style system like multi CPU multi Platform (= DMA) will
coming. To supporting it, we can use snd_soc_dai_link_component on
dai_link. Let's call it as modern style here.
But current ALSA SoC can't support it so far. Thus, we need to have
multi CPU / multi Codec / multi Platform style in the future on ALSA SoC.

Currently we already have multi Codec support. Platform is starting to
use modern style on dai_link, but still style only. Multi Platform is
not yet implemented. And we still don't have multi CPU support on ALSA
SoC, and not have modern style either.

Currently, if driver is using legacy style Codec/Platform, it will be
converted to modern style on soc-core. This means, we are using glue code
for legacy vs modern style so far on ALSA SoC.
We can fully switch to modern style on all drivers if ALSA SoC supported
modern style for CPU, and then, legacy style code will be removed from
ALSA SoC.
Untile then, we need to keep both legacy/modern style and its glue code.
This patch adds such future plan and background on soc.h

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core: fix init platform memory handling</title>
<updated>2019-01-14T22:48:16Z</updated>
<author>
<name>Curtis Malainey</name>
<email>cujomalainey@chromium.org</email>
</author>
<published>2019-01-11T00:21:04Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=09ac6a817bd687e7f5dac00470262efdd72f9319'/>
<id>urn:sha1:09ac6a817bd687e7f5dac00470262efdd72f9319</id>
<content type='text'>
snd_soc_init_platform initializes pointers to snd_soc_dai_link which is
statically allocated and it does this by devm_kzalloc. In the event of
an EPROBE_DEFER the memory will be freed and the pointers are left
dangling. snd_soc_init_platform sees the dangling pointers and assumes
they are pointing to initialized memory and does not reallocate them on
the second probe attempt which results in a use after free bug since
devm has freed the memory from the first probe attempt.

Since the intention for snd_soc_dai_link-&gt;platform is that it can be set
statically by the machine driver we need to respect the pointer in the
event we did not set it but still catch dangling pointers. The solution
is to add a flag to track whether the pointer was dynamically allocated
or not.

Signed-off-by: Curtis Malainey &lt;cujomalainey@chromium.org&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-4.20' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-4.21 intel dep</title>
<updated>2018-12-13T14:36:46Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2018-12-13T14:36:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8fe8915b6c0b5298fa547be21957b3860c39c46e'/>
<id>urn:sha1:8fe8915b6c0b5298fa547be21957b3860c39c46e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ASoC: soc.h: makes snd_soc_of_parse_audio_prefix() inline</title>
<updated>2018-11-26T12:23:22Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2018-11-26T01:21:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2708bccf9c6f142c3ef5a27f15d34febe751ce4c'/>
<id>urn:sha1:2708bccf9c6f142c3ef5a27f15d34febe751ce4c</id>
<content type='text'>
commit 3b7103562c03c ("ASoC: soc-core: add
snd_soc_of_parse_node_prefix()") maked snd_soc_of_parse_audio_prefix()
as #define. But it'd be better to make this a static inline rather than
a #define. It helps with error messages and type safety.
This patch makes it inline.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ASoC: soc-core: add snd_soc_of_parse_node_prefix()</title>
<updated>2018-11-23T14:01:47Z</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2018-11-22T00:55:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3b7103562c03cffb1a351f8c235b3bba2acd9e9b'/>
<id>urn:sha1:3b7103562c03cffb1a351f8c235b3bba2acd9e9b</id>
<content type='text'>
Current ASoC has snd_soc_of_parse_audio_prefix() to get codec_conf
settings from DT which is used to avoid DAI naming conflict when
CPU/Codec matching.

Currently, it is parsing from "top node",
but, we want to parse from "each sub node" if sound card had multi
cpus/codecs.

This patch adds new snd_soc_of_parse_node_prefix() to allow parsing
settings from selected node.
It is keeping existing snd_soc_of_parse_audio_prefix() by using macro.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
</feed>
