Commit graph

1192 commits

Author SHA1 Message Date
Amadeusz Sławiński
7db53c21b1
ASoC: core: Remove invalid snd_soc_component_set_jack call
If snd_soc_component_set_jack() is called after
snd_soc_component_remove() it may operate on memory which is freed in
->remove handler.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211015161257.27052-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-29 16:49:40 +01:00
Mark Brown
bfceb9c216
Merge branch 'asoc-5.15' into asoc-5.16 2021-10-18 21:15:13 +01:00
Kuninori Morimoto
7db07e37e1
ASoC: soc-core: accept zero format at snd_soc_runtime_set_dai_fmt()
Do nothing if format was zero at snd_soc_runtime_set_dai_fmt().
soc-core.c can be more simple code by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ee8jt7d3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:40 +01:00
Kuninori Morimoto
41b1774fb8
ASoC: soc-core: tidyup empty function
This patch makes empty function to 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fsszt7dd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:38 +01:00
Kuninori Morimoto
01e90ee15e
ASoC: soc-component: add snd_soc_component_is_codec()
Checking .non_legacy_dai_naming is not readable.
Let's add new snd_soc_component_is_codec().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:37 +01:00
Yang Yingliang
c448b7aa3e
ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()
'component' is allocated in snd_soc_register_component(), but component->list
is not initalized, this may cause snd_soc_del_component_unlocked() deref null
ptr in the error handing case.

KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:__list_del_entry_valid+0x81/0xf0
Call Trace:
 snd_soc_del_component_unlocked+0x69/0x1b0 [snd_soc_core]
 snd_soc_add_component.cold+0x54/0x6c [snd_soc_core]
 snd_soc_register_component+0x70/0x90 [snd_soc_core]
 devm_snd_soc_register_component+0x5e/0xd0 [snd_soc_core]
 tas2552_probe+0x265/0x320 [snd_soc_tas2552]
 ? tas2552_component_probe+0x1e0/0x1e0 [snd_soc_tas2552]
 i2c_device_probe+0xa31/0xbe0

Fix by adding INIT_LIST_HEAD() to snd_soc_component_initialize().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211009065840.3196239-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 13:19:14 +01:00
Kuninori Morimoto
51a3dd5842
ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:2931:9: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, ret;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8alyl67.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:45 +01:00
Kuninori Morimoto
99c68653a5
ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:2777:25: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, j, num_widgets, ret;
                        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmv1yl6b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:44 +01:00
Kuninori Morimoto
eaf2469c34
ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:2239:6: style: The scope of the variable 'err' can be reduced. [variableScope]
 int err, i;
     ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1fhyl6f.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:43 +01:00
Kuninori Morimoto
5600f3d5ac
ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:2719:28: style: The scope of the variable 'component' can be reduced. [variableScope]
 struct snd_soc_component *component;
                           ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sfzxyl6k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:42 +01:00
Kuninori Morimoto
5ad76775a5
ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:3056:11: style: The scope of the variable 'i' can be reduced. [variableScope]
 int ret, i;
          ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tukdyl6p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:41 +01:00
Kuninori Morimoto
bce00560a2
ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name()
This patch cleanups below cppcheck warning.

sound/soc/soc-core.c:3203:22: style: The scope of the variable 'component_of_node' can be reduced. [variableScope]
 struct device_node *component_of_node;
                     ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v94tyl6t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:40 +01:00
Kuninori Morimoto
cdb76568b0
ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name()
This patch cleanups below cppcheck warning.

 const char *vendor, *product, *product_version, *board;
                                ^

sound/soc/soc-core.c:1721:33: style: The scope of the variable 'product_version' can be reduced. [variableScope]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnp9yl6y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-29 15:35:39 +01:00
Takashi Iwai
50de417b7a ASoC: Updates for v5.14
This release sees a nice new feature in the core from Morimoto-san,
 support for automatic negotiation of DAI formats between the components
 on the link.  Otherwise the big highlight was the merging of the Tegra
 machine drivers into a single driver avoiding a bunch of duplication.
 
  - Support for automatic negotiation of DAI formats.
  - Accessory detection support for several Qualcomm parts.
  - Support for IEC958 control with hdmi-codec.
  - Merging of Tegra machine drivers into a single driver.
  - Support for AmLogic SM1 TOACODEC, Intel AlderLake-M, several NXP
    i.MX8 variants, NXP TFA1 and TDF9897, Rockchip RK817, Qualcomm
    Quinary MI2S, Texas Instruments TAS2505
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmDZzCgACgkQJNaLcl1U
 h9DmKAf+IhmeYLxMuSe7uC/BZHQN1PFFHDb9rNyznqYD0kCzgfqvt7RIbbpOB83g
 Rw6+SnKWq1k2LOtJc7nVfFXfCrWTCH/GkqH22YoDWUjc2ZLTLE4V/dZhrYzggkjz
 qE4bOUNBHUyqO0Xir1iMFCdr9V4+Fc5iYT83FccHB+hF+o8GNcU0MkovUKgiTeuz
 EChmQlfsOHxKU6DbRUQrO30plSTaCQZ9CHAOXlGRQnGaYH/99ecav2O7sM1F4SrI
 uHR544UuJUiZ26PcZ5M66GvuwAOoSw/v6Tr/OykBulgFUX8wafDcHq7vGK5A6WCE
 qGwWpe12E+veMsJjn7wzifryaxJ9zQ==
 =F1Zu
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.14' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v5.14

This release sees a nice new feature in the core from Morimoto-san,
support for automatic negotiation of DAI formats between the components
on the link.  Otherwise the big highlight was the merging of the Tegra
machine drivers into a single driver avoiding a bunch of duplication.

 - Support for automatic negotiation of DAI formats.
 - Accessory detection support for several Qualcomm parts.
 - Support for IEC958 control with hdmi-codec.
 - Merging of Tegra machine drivers into a single driver.
 - Support for AmLogic SM1 TOACODEC, Intel AlderLake-M, several NXP
   i.MX8 variants, NXP TFA1 and TDF9897, Rockchip RK817, Qualcomm
   Quinary MI2S, Texas Instruments TAS2505
2021-07-01 08:36:12 +02:00
Takashi Iwai
5c89c2c7fb ASoC: Fixes for v5.13
A final batch of fixes for v5.13, this is larger than I'd like due to
 the fixes for a series of suspend issues that Intel turned up in their
 testing this week.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmDTZ30ACgkQJNaLcl1U
 h9C5dQf6AjDh6y0SfB264cv2kSCLtYsOstSeamrEv3HBjqGiWEDgzfdB5Z+5d+EJ
 ScWsfsZ8eMr7WcMZJ+wEGNKxcZO2uHEaC29dpNrDeE4Ffr9hsSucPhJ8Fm+K0qDH
 VqX4kDPFY+OiuOf5RipDyAgoHo4zhIeaE9Rgxd4lbNH/xpWtgalN22iyYLpiYZLP
 YJk+/8L37ZcKYX3uCImMEe4yseH3AFzGz7yi/tyyWCUP7GEwtWgzv2vadxewjY5E
 h12ToqsTMQIrix0ZfMbYW9KJ7ANn6PFBz10vH8XuGbUlBW33pVzqP+Wr9adXGG4N
 XLs6wRpbDbdJc3aDpDjA1nRlBl5XEg==
 =h2+R
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.13-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Fixes for v5.13

A final batch of fixes for v5.13, this is larger than I'd like due to
the fixes for a series of suspend issues that Intel turned up in their
testing this week.
2021-06-24 10:02:45 +02:00
Kuninori Morimoto
8439c5861c
ASoC: soc-core: remove snd_soc_of_parse_daifmt()
No driver is using snd_soc_of_parse_daifmt().
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgvtuuro.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21 13:05:22 +01:00
Kuninori Morimoto
7766861d1f
ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider()
snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider
parsing part is one of headacke, because we are assuming below both cases.

A)	node {
		bitclock-master;
		frame-master;
		...
	};

B)	link {
		bitclock-master = <&xxx>;
		frame-master = <&xxx>;
		...
	};

The original was style A), and style B) was added later
by commit b3ca11ff59 ("ASoC: simple-card: Move dai-link level
properties away from dai subnodes").

snd_soc_of_parse_daifmt() parses it as style A),
and user need to update it to style B) if needed.

To handle it more flexibile, this patch adds new functions
which separates snd_soc_of_parse_daifmt() helper function.

 snd_soc_daifmt_parse_format()			 :for DAI format
 snd_soc_daifmt_parse_clock_provider_as_flag()	 :for style A)
 snd_soc_daifmt_parse_clock_provider_as_phandl() :for style B)
 snd_soc_daifmt_parse_clock_provider_as_bitmap() :use with _from_bitmap

This means

 snd_soc_of_parse_daifmt() ==
	snd_soc_daifmt_parse_format() |
	snd_soc_daifmt_parse_clock_provider_as_flag()

This patch also indicate relatesionship comment for
snd_soc_daifmt_clock_provider_from_bitmap().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877dixw9ej.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21 13:05:17 +01:00
Kuninori Morimoto
b44a67f893
ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped()
Sometimes we want to get CLOCK_PROVIDER fliped dai_fmt.
This patch adds new snd_soc_daifmt_clock_provider_fliped() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878s3dw9ex.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21 13:05:16 +01:00
Kuninori Morimoto
91ae447762
ASoC: soc-core: add snd_soc_daifmt_clock_provider_from_bitmap()
This patch adds snd_soc_daifmt_clock_provider_from_bitmap() function
to judge clock/frame master from its bitmap.
This is prepare for snd_soc_of_parse_daifmt() cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6ntw9f5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21 13:05:15 +01:00
Zhen Lei
7d3865a10b
ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
When devm_kcalloc() fails, the error code -ENOMEM should be returned
instead of -EINVAL.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210617103729.1918-1-thunder.leizhen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-17 13:47:04 +01:00
Kuninori Morimoto
640eac4c84
ASoC: soc-core: don't use discriminatory terms on snd_soc_runtime_get_dai_fmt()
snd_soc_runtime_get_dai_fmt() is using discriminatory terms.
This patch fixup it.

Fixes: ba9e82a1c8 ("ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874ke9dxkp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:47 +01:00
Kuninori Morimoto
ba9e82a1c8
ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()
ASoC is using dai_link which specify DAI format (= dai_link->dai_fmt),
and it is selected by "Sound Card" driver in corrent implementation.
In other words, Sound Card *needs* to setup it.
But, it should be possible to automatically selected from CPU and
Codec driver settings.

This patch adds new .auto_selectable_formats support
at snd_soc_dai_ops.

By this patch, dai_fmt can be automatically selected from each
driver if both CPU / Codec driver had it.
Automatically selectable *field* is depends on each drivers.

For example, some driver want to select format "automatically",
but want to select other fields "manually", because of complex limitation.
Or other example, in case of both CPU and Codec are possible to be
clock provider, but the quality was different.
In these case, user need/want to *manually* select each fields
from Sound Card driver.

This .auto_selectable_formats can set priority.
For example, no limitaion format can be HI priority,
supported but has picky limitation format can be next priority, etc.

It uses Sound Card specified fields preferentially, and try to select
non-specific fields from CPU and Codec driver automatically
if all drivers have .auto_selectable_formats.

In other words, we can select all dai_fmt via Sound Card driver
same as before.

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ionc8s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:12 +01:00
Kuninori Morimoto
4d1a98b5f1
ASoC: soc-core: move snd_soc_runtime_set_dai_fmt() to upside
This patch moves snd_soc_runtime_set_dai_fmt() to upside.
This is prepare to support snd_soc_runtime_get_dai_fmt().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im34nc9r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:11 +01:00
Mark Brown
d4e9889b02
Merge branch 'for-5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.14 2021-05-25 16:44:26 +01:00
Takashi Iwai
b6cc78da36 ALSA: Drop superfluous argument from snd_power_wait()
The power_state argument of snd_power_wait() is superfluous, receiving
only SNDRV_POWER_STATE_D0.  Let's drop it in all callers for
simplicity.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210523090920.15345-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-25 08:49:39 +02:00
Kefeng Wang
41daf6ba59
ASoC: core: Fix Null-point-dereference in fmt_single_name()
Check the return value of devm_kstrdup() in case of
Null-point-dereference.

Fixes: 45dd9943fc ("ASoC: core: remove artificial component and DAI name constraint")
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Link: https://lore.kernel.org/r/20210524024941.159952-1-wangkefeng.wang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:49:28 +01:00
YueHaibing
5a3f869c5b
ASoC: soc-core: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210514081100.16196-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-18 14:04:31 +01:00
Pierre-Louis Bossart
e2290daefe
ASoC: soc-core: fix always-false condition
cppcheck warning:

sound/soc/soc-core.c:2784:6: style: Condition '!num_routes' is always
false [knownConditionTrueFalse]
 if (!num_routes) {
     ^
sound/soc/soc-core.c:2777:17: note: Assuming that condition
'num_routes<0' is not redundant
 if (num_routes < 0 || num_routes & 1) {
                ^
sound/soc/soc-core.c:2783:2: note: Compound assignment '/=', assigned
value is 0
 num_routes /= 2;
 ^
sound/soc/soc-core.c:2784:6: note: Condition '!num_routes' is always
false
 if (!num_routes) {
     ^

The documentation for of_property_count_string reads

"
 * Returns the number of strings on
 * success, -EINVAL if the property does not exist, -ENODATA if property
 * does not have a value, and -EILSEQ if the string is not null-terminated
 * within the length of the property data.
"

Since the case for num_routes == 0 is not possible, let's remove this
test.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:31 +01:00
Pierre-Louis Bossart
d3b47a888f
ASoC: soc-core: fix signed/unsigned issue
cppcheck warning:

sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 1)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^
sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 2)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:30 +01:00
Mark Brown
ac22cf5252
Merge series "ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

I noticed if we have...

	1) Sound Card used DPCM
	2) It exchanges rate to 48kHz by using .be_hw_params_fixup()
	3) Codec had symmetric_rate = 1

We will get below error.
I didn't confirm, but maybe same things happen
if it exchanged channels/sample_bits.

	# aplay 44100.wav
	# aplay 44100.wav
=>	[kernel] be.ak4613-hifi: ASoC: unmatched rate symmetry: snd-soc-dummy-dai:44100 - soc_pcm_params_symmetry:48000
	[kernel] be.ak4613-hifi: ASoC: hw_params BE failed -22
	[kernel] fe.rsnd-dai.0: ASoC: hw_params BE failed -22
	aplay: set_params:1407: Unable to install hw params:
	ACCESS:  RW_INTERLEAVED
	FORMAT:  S16_LE
	SUBFORMAT:  STD
	SAMPLE_BITS: 16
	FRAME_BITS: 32
	CHANNELS: 2
	RATE: 44100
	PERIOD_TIME: (23219 23220)
	PERIOD_SIZE: 1024
	PERIOD_BYTES: 4096
	PERIODS: 4
	BUFFER_TIME: (92879 92880)
	BUFFER_SIZE: 4096
	BUFFER_BYTES: 16384
	TICK_TIME: 0

This patch-set solves this issue.
patch 1) - 3) are just cleanup patches.
4) is fot this issue.

Link: https://lore.kernel.org/r/87a6q0z4xt.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (4):
  ASoC: soc-pcm: don't use "name" on __soc_pcm_params_symmetry() macro
  ASoC: soc-pcm: indicate DAI name if soc_pcm_params_symmetry() failed
  ASoC: soc-utils: add snd_soc_component_is_dummy()
  ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry()

 include/sound/soc-component.h |  1 +
 sound/soc/soc-core.c          |  2 +-
 sound/soc/soc-pcm.c           | 14 ++++++++------
 sound/soc/soc-utils.c         |  6 ++++++
 4 files changed, 16 insertions(+), 7 deletions(-)

--
2.25.1
2021-04-16 16:55:31 +01:00
Kuninori Morimoto
8f1a16818a
ASoC: soc-utils: add snd_soc_component_is_dummy()
There is snd_soc_dai_is_dummy(), but not for component.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgxzxa2t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 14:34:12 +01:00
Daniel Baluta
d971400339
ASoC: core: Don't set platform name when of_node is set
A DAI link has 3 components:
	* CPU
	* platform
	* codec(s)

A component is specified via:
	* name
	* of_node
	* dai_name

In order to avoid confusion when building a sound card we disallow
matching by both name and of_node (1).

soc_check_tplg_fes allows overriding certain BE links by overriding
BE link name. This doesn't work well if BE link was specified via DT,
because we end up with a link with both name and of_node specified
which is conflicting with (1).

In order to fix this we need to:
	* override of_node if component was specified via DT
	* override name, otherwise.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20210414101212.65573-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 13:43:21 +01:00
Kuninori Morimoto
5fa7553dcd
ASoC: soc-core: use device_unregister() if rtd allocation failed
Because soc_free_pcm_runtime(rtd) checks rtd pointer and freeing
rtd->xxx, it doesn't work correctly in case of rtd allocation failed.

We need to use device_unregister(dev) in such case.
This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1jxxldd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-31 18:02:23 +01:00
Kuninori Morimoto
f1b3ee789f
ASoC: soc-core: add comment for rtd freeing
We don't need to mind freeing for rtd,
because it was created from devm_kzalloc(dev, xxx) which is rtd->dev.

This means, if rtd->dev was freed, rtd will be also freed
automatically.

	soc_new_pcm_runtime(...)
	{
		...
		rtd = devm_kzalloc(dev, ...);
		rtd->dev = dev;
		...
	}

This explanation was missing at soc_free_pcm_runtime() comment.
This patch indicates it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg4dxldn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-31 18:02:22 +01:00
Kuninori Morimoto
60adbd8fbf
ASoC: don't indicate error message for snd_soc_[pcm_]component_xxx()
All snd_soc_component_xxx() and snd_soc_pcm_component_xxx() itself
indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

All snd_soc_component_xxx() indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878s6puta6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-19 12:24:05 +00:00
Kuninori Morimoto
62462e0182
ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx()
All snd_soc_dai_xxx() and snd_soc_pcm_dai_xxx() itself
indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6r5utaa.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-19 12:24:04 +00:00
Pierre-Louis Bossart
c68fded79a
ASoC: soc-core: fix DMI handling
When DMI information is not present, trying to assign the card long
name results in the following warning.

WARNING KERN tegra-audio-graph-card sound: ASoC: no DMI vendor name!

The initial solution suggested was to test if the card device is an
ACPI one. This causes a regression visible to userspace on all Intel
platforms, with UCM unable to load card profiles based on DMI
information: the card devices are not necessarily ACPI ones, e.g. when
the parent creates platform devices on Intel devices.

To fix this problem, this patch exports the existing dmi_available
variable and tests it in the ASoC core.

Fixes: c014170408 ("ASoC: soc-core: Prevent warning if no DMI table is present")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/r/20210310193928.108850-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-11 13:25:09 +00:00
Krzysztof Kozlowski
933f98be60
ASoC: constify of_phandle_args in snd_soc_get_dai_name()
The pointer to of_phandle_args passed to snd_soc_get_dai_name() and
of_xlate_dai_name() implementations is not modified.  Since it is being
used only to translate passed OF node to a DAI name, it should not be
modified, so mark it as const for correctness and safer code.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210221153024.453583-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 13:07:14 +00:00
Jon Hunter
7de14d581d
ASoC: soc-core: Prevent warning if no DMI table is present
Many systems do not use ACPI and hence do not provide a DMI table. On
non-ACPI systems a warning, such as the following, is printed on boot.

 WARNING KERN tegra-audio-graph-card sound: ASoC: no DMI vendor name!

The variable 'dmi_available' is not exported and so currently cannot be
used by kernel modules without adding an accessor. However, it is
possible to use the function is_acpi_device_node() to determine if the
sound card is an ACPI device and hence indicate if we expect a DMI table
to be present. Therefore, call is_acpi_device_node() to see if we are
using ACPI and only parse the DMI table if we are booting with ACPI.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20210303115526.419458-1-jonathanh@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:50:55 +00:00
Mark Brown
4ecc08b2f5 Auxiliary Bus support tag for 5.11-rc1
This is a signed tag for other subsystems to be able to pull in the
 auxiliary bus support into their trees for the 5.11-rc1 merge.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCX8oseA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylqGQCdF2TND5jjcETWHIrunPAX6iEDLecAnjyIMc4q
 cIr5piwCq+m6/S2gSCpA
 =t7EL
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl/KnpUACgkQJNaLcl1U
 h9CWvQf9EdHZFlsDiP8PbbSLtMzpkqaJOlmg3A1Rn6XOYjztDEDQQp12vYC9jOmJ
 PkBz8kh+0dohTt6TIx5IEt+r1pbYWAzFOkX7v3QzYp8+nrmd1bT/RDRglOrmydLH
 ntd9XNE1BA8k9n4YQQBWrspDEnwnpCygSw4lP/QXz7OyyhnZ7fYGOG3hPXKw+Sdj
 gQugmSAnUYaVti4d7K6Cuhj08HT13FvGFqrkLYljTmsnnVw0T4kXNFtiODMe1QMq
 YYeKiHCFI8ysk2hK0sYdmwr5rz5eWT5mGnSXPGsD3o876NF1uw+Q5iTX57uydDrp
 GijjnCOGz+yZ7dfBi2MAflP5Xsw4ew==
 =SVwj
 -----END PGP SIGNATURE-----

Merge tag 'auxbus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core into asoc-5.11

Auxiliary Bus support tag for 5.11-rc1

This is a signed tag for other subsystems to be able to pull in the
auxiliary bus support into their trees for the 5.11-rc1 merge.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-04 20:39:45 +00:00
Kuninori Morimoto
9e8434a008
ASoC: soc-core: tidyup jack.h
soc-core.c don't need sound/jack.h anymore, but asoc.h needs it.
This patch fixup header magic.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2iju3zm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 12:54:01 +00:00
Kuninori Morimoto
baed393e85
ASoC: soc-core: add soc_dapm_suspend_resume()
snd_soc_suspend() and soc_resume_deferred() are calling
same snd_soc_dapm_stream_event() with same logic with different parameter.
This patch adds new soc_dapm_suspend_resume() and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im9rekfp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-27 13:50:26 +00:00
Kuninori Morimoto
d4c1d9eb66
ASoC: soc-core: add soc_playback_digital_mute()
snd_soc_suspend() and soc_resume_deferred() are calling
same snd_soc_dai_digital_mute() with same logic with different parameter.
This patch adds new soc_playback_digital_mute() and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0u7ekfv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-27 13:50:25 +00:00
Sameer Pujar
3256ef984b
ASoC: soc-core: Fix component name_prefix parsing
The "prefix" can be defined in DAI link node or it can be specified as
part of the component node itself. Currently "sound-name-prefix" defined
in a component is not taking effect. Actually the property is not getting
parsed. It can be fixed by parsing "sound-name-prefix" property whenever
"prefix" is missing in DAI link Codec node.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1604329814-24779-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-10 17:28:18 +00:00
Mauro Carvalho Chehab
f7b6603c66 ALSA: fix kernel-doc markups
Kernel-doc markups should use this format:
        identifier - description

There is a common comment marked, instead, with kernel-doc
notation.

Some identifiers have different names between their prototypes
and the kernel-doc markup.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/535182d6f55d7a7de293dda9676df68f5f60afc6.1603469755.git.mchehab+huawei@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-10-26 15:26:31 +01:00
Mark Brown
fd6b519a30 Linux 5.9-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl9epdgeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG9IMH/jHCRSbcsIXHuQHn
 xcRLlhrDHfXoBza7auHfPWx2+9DZsmaSJs/SEiTGNag0Bi7jBcWcwBpsep7iVG/+
 WiftD5uOMhZigyuvfMFrt0mjr2Kr3wg5p58lwMBeBdm8iL5uKV8ehKsh05/Fral2
 6hu3jP8L0PCZMpF+sZ7s2jlhfVUMmjA8VzXZCvgQtmhoraHiF3mzfkcSMxnHwBPO
 HLo+TDDm49u+LbVsJT7+cSTiWxuUJCbix9Q4PCTx/BGg4ezYsjc6v0BnYRaYtrrA
 1uYiT6PVBEUkYYBHKQlD3N2KnUmbKx7dGUF4t+peTg5/JiocAJMNi1N9Qzvv7N6Q
 CqTiuio=
 =q+kJ
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl98iv4THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0KpvB/9X9BTa/SRvi2kxkji2wt8dq2DZpvyR
 wuwuNhs0P49A6um6qYNdeXTdNH7lpf3JIdsznMpJAK8ztD0F2tUe3iRxSAcleSCO
 D2YhL4Ptkap1IwzN0mw/POju8kz+gj3Oj/eYafXe7lUVK+RSI4IAyxnKy4WDrcnp
 I7CWLd5RgSz2t9v9/s34nOUJC4+U/Bk2p46VDLlMu73wQ+m8gIoizWDU6a38pr1V
 7v2srCRzbEdvT/Am43XSBo4haZgubjoCYOuniTRM6Z3HN/C6PD5ssFMFlIUXnCZK
 s3WBU7M79GLATEpPIiSvwf99dbQDnhsCFuEi/s0SLj5phUlAO43NNRGX
 =S5ik
 -----END PGP SIGNATURE-----

Merge tag 'v5.9-rc5' into asoc-5.10

Linux 5.9-rc5
2020-10-06 16:19:24 +01:00
Qinglang Miao
ad61b78ea8
ASoC: soc-core: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112933.46977-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-30 12:40:30 +01:00
Dmitry Baryshkov
45dd9943fc
ASoC: core: remove artificial component and DAI name constraint
Current fmt_single_name code limits maximum name of a DAI or component
to 32 bytes. On some systems corresponding device names might be longer
than that (e.g.
17300000.remoteproc:glink-edge:apr:apr-service@8:routing). This will
result in duplicate DAI/component names. Rewrite fmt_single_name() to
remove such length limitations.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20200827205100.1479331-1-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-28 15:49:41 +01:00
Kuninori Morimoto
c1c277b2c4
ASoC: soc-core: add snd_soc_find_dai_with_mutex()
commit 25612477d2 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
And client_mutex is soc-core.c local.

	struct snd_soc_dai *snd_soc_find_dai(xxx)
	{
		...
(B)		lockdep_assert_held(&client_mutex);
		...
	}

	void snd_soc_dai_link_set_capabilities(xxx)
	{
		...
		for_each_pcm_streams(direction) {
			...
			for_each_link_cpus(dai_link, i, cpu) {
(A)				dai = snd_soc_find_dai(cpu);
				...
			}
			...
			for_each_link_codecs(dai_link, i, codec) {
(A)				dai = snd_soc_find_dai(codec);
				...
			}
		}
		...
	}

Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.

	WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
	CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
	Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
	Workqueue: events deferred_probe_work_func
	pstate: 60000005 (nZCv daif -PAN -UAO)
	pc : snd_soc_find_dai+0xf8/0x100
	lr : snd_soc_find_dai+0xf4/0x100
	...
	Call trace:
	 snd_soc_find_dai+0xf8/0x100
	 snd_soc_dai_link_set_capabilities+0xa0/0x16c
	 graph_dai_link_of_dpcm+0x390/0x3c0
	 graph_for_each_link+0x134/0x200
	 graph_probe+0x144/0x230
	 platform_drv_probe+0x5c/0xb0
	 really_probe+0xe4/0x430
	 driver_probe_device+0x60/0xf4

snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
mutex lock, and (Y) Card driver without mutex lock.
This snd_soc_dai_link_set_capabilities() is for Card driver,
this means called without mutex.
This patch adds snd_soc_find_dai_with_mutex() to solve it.

Fixes: 25612477d2 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-27 14:43:25 +01:00
Gustavo A. R. Silva
df561f6688 treewide: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-23 17:36:59 -05:00