Commit Graph

3672 Commits

Author SHA1 Message Date
Takashi Iwai e069642059 ASoC: Fixes for v6.8
A bunch of small fixes that come in during the merge window, mainly
 fixing issues from some core refactoring around dummy components that
 weren't detected until things reached mainline.
 
 The TAS driver changes are a little larger than normal for a device ID
 addition due to some shuffling around of where things are registered and
 DT updates but aren't really any more substantial than normal.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmWmnFEACgkQJNaLcl1U
 h9Dzvgf/RfM1g44TeC/hSX0+qdrL6QYg5wPeMWPtV4xgLqx2oqftU9eIcBLHPz03
 N1hdutFFqNTR3W5GiTmyV5mLdgJpZBgkYU5dkhXCrlI7xJ6tV7Wsx86Q9ClSmEBH
 Z4ZR2oAmCQIt3swshOBvwYUI6MOcG/zSqDBcRQ6t6d98TOkp2m3PPrjEYqEA2ja9
 tyr73WXsdammYXZVYPu9oYoNE2Ef6Io5nkyds1F4irCcx1EXiS95cZjF3/OZ9OPP
 iGpzVkXvgwb0Jbq+NsBogydsIsSAu4pyNNcu3P9Xcr1rkNqVwz1X1KYvvnSHDqdw
 ZbmU6r83dCUpizpgFA4wv8irNn+aKw==
 =Rr9L
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v6.8-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.8

A bunch of small fixes that come in during the merge window, mainly
fixing issues from some core refactoring around dummy components that
weren't detected until things reached mainline.

The TAS driver changes are a little larger than normal for a device ID
addition due to some shuffling around of where things are registered and
DT updates but aren't really any more substantial than normal.
2024-01-16 17:37:17 +01:00
Takashi Iwai 0205f3753d ASoC: Updates for v6.8
This is a relatively quiet release, there's a lot of driver specific
 changes and the usual high level of activity in the SOF core but the
 one big core change was Mormioto-san's work to support more N:M
 CPU:CODEC mapping cases.  Highlights include:
 
  - Enhanced support for N:M CPU:CODEC mappings in the core and in
    audio-graph-card2.
  - Support for falling back to older SOF IPC versions where firmware for
    new versions is not available.
  - Support for notification of control changes generated by SOF firmware
    with IPC4.
  - Device tree support for describing parts of the card which can be
    active over suspend (for very low power playback or wake word use
    cases).
  - ACPI parsing support for the ES83xx driver, reducing the number of
    quirks neede for x86 systems.
  - Support for more AMD and Intel systems, NXP i.MX8m MICFIL, Qualcomm
    SM8250, SM8550, SM8650 and X1E80100.
  - Removal of Freescale MPC8610 support, the SoC is no longer supported
    by Linux.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmWbJ5EACgkQJNaLcl1U
 h9CZTwf/c8CPwoKABZear8jiQpZLUhFLuGQwSShPYVZ7XPzzTMp9BwVmd40DCnUi
 NeSc22t2UgT0H06nx3QK8sKOhrpQoBQVrIajf2AaxD44TJbsOYGGe4pMh1sXKAMF
 c0ybp8uRgsjiv2Y++SBXZLexGC11/b8eTFLV1nTK/i2nygGjbfWSJ9s4PpB9V6cA
 nZrQ/p+x/ZwaBejFUnvE06M7GHtCD6lxrB9Q1EmWA4RxcW7RNUtIN5gr16HlaMiC
 3gix4mg40llhBFF9s4eBjRBNKL2paiejPZwcYkAC8w+SkZ/roXaeN55g0avmDWyW
 AN9o096vaEVWKhZ/jdTHmFVf2PV2Iw==
 =rbT5
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v6.8

This is a relatively quiet release, there's a lot of driver specific
changes and the usual high level of activity in the SOF core but the
one big core change was Mormioto-san's work to support more N:M
CPU:CODEC mapping cases.  Highlights include:

 - Enhanced support for N:M CPU:CODEC mappings in the core and in
   audio-graph-card2.
 - Support for falling back to older SOF IPC versions where firmware for
   new versions is not available.
 - Support for notification of control changes generated by SOF firmware
   with IPC4.
 - Device tree support for describing parts of the card which can be
   active over suspend (for very low power playback or wake word use
   cases).
 - ACPI parsing support for the ES83xx driver, reducing the number of
   quirks neede for x86 systems.
 - Support for more AMD and Intel systems, NXP i.MX8m MICFIL, Qualcomm
   SM8250, SM8550, SM8650 and X1E80100.
 - Removal of Freescale MPC8610 support, the SoC is no longer supported
   by Linux.
2024-01-08 08:18:02 +01:00
Shenghao Ding e9aa44736c
ASoC: tas2781: Add tas2563 into header file for DSP mode
Move tas2563 from tas2562 header file to tas2781 header file to unbind
tas2563 from tas2562 driver code and bind it to tas2781 driver code,
because tas2563 only work in bypass-DSP mode with tas2562 driver. In
order to enable DSP mode for tas2563, it has been moved to tas2781
driver. As to the hardware part, such as register setting and DSP
firmware, all these are stored in the binary firmware. What tas2781
drivder does is to parse the firmware and download it to the chip,
then power on the chip. So, tas2781 driver can be resued as tas2563
driver. Only attention will be paid to downloading corresponding firmware.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://msgid.link/r/20240104145721.1398-3-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-05 13:27:17 +00:00
Gergo Koteles c3ca4458cc ALSA: hda/tas2781: add TAS2563 support for 14ARB7
The INT8866 belongs to the Lenovo Yoga 7 Gen 7 AMD 14ARB7
laptop. It has two TAS2563 amplifier. Add the PNP ID
and calibration functions to handle them.

ACPI excerpt:

Scope (_SB.I2CD)
{
    Device (TAS)
    {
        Name (_HID, "INT8866")  // _HID: Hardware ID
        Name (_UID, Zero)  // _UID: Unique ID
        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            Name (RBUF, ResourceTemplate ()
            {
                I2cSerialBusV2 (0x004C, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.I2CD",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                I2cSerialBusV2 (0x004D, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.I2CD",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                GpioInt (Edge, ActiveLow, SharedAndWake, PullNone, 0x0000,
                    "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0020
                    }
             })
             Return (RBUF) /* \_SB_.I2CD.TAS_._CRS.RBUF */
        }

        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            Return (0x0F)
        }
    }
}

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/3b8d4c602e1a46922f53bc9afc8b705d55aa4872.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:15:28 +01:00
Gergo Koteles c021ca729f ALSA: hda/tas2781: add configurable global i2c address
Make the global i2c address configurable to support compatible amplifiers
with different global i2c address.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/a252f1efeed5049f027f01e699c9e10e1e05bf9e.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:15:09 +01:00
Gergo Koteles 76f5f55c45 ALSA: hda/tas2781: add ptrs to calibration functions
Make calibration functions configurable to support different calibration
data storage modes.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/5859c77ffef752b8a9784713b412d815d7e2688c.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:14:01 +01:00
Greg Kroah-Hartman 66e82d2199 ALSA: mark all struct bus_type as const
Now that the driver core can properly handle constant struct bus_type,
move all of the sound subsystem struct bus_type structures as const,
placing them into read-only memory which can not be modified at runtime.

Note, this fixes a duplicate definition of ac97_bus_type, which somehow
was declared extern in a .h file, and then static as a prototype in a .c
file, and then properly later on in the same .c file.  Amazing that no
compiler warning ever showed up for this.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dawei Li <set_pte_at@outlook.com>
Cc: Yu Liao <liaoyu15@huawei.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: linux-sound@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/2023121945-immersion-budget-d0aa@gregkh
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 10:10:41 +01:00
Kuninori Morimoto 13f58267cd
ASoC: soc.h: don't create dummy Component via COMP_DUMMY()
Many ASoC drivers define CPU/Codec/Platform dai_link by below macro.

	SND_SOC_DAILINK_DEFS(link,
(A)		     DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")),
(B)		     DAILINK_COMP_ARRAY(COMP_CODEC("codec", "dai1"),
(B)					COMP_CODEC("codec", "dai2")),
(C)		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

In this case, this macro will be converted to like below

	[o] = static struct snd_soc_dai_link_component

(A)	[o] link_cpus[]      = {{ .dai_name = "cpu_dai" }};
(B)	[o] link_codecs[]    = {{ .dai_name = "dai1", .name = "codec" },
				{ .dai_name = "dai2", .name = "codec" }}
(C)	[o] link_platforms[] = {{ }};

CPU and Codec info will be filled by COMP_CPU() / COMP_CODEC (= A,B),
and Platform will have empty data by COMP_EMPTY() (= C) in this case.

Platform empty info will be filled when driver probe()
(most of case, CPU info will be copied to use soc-generic-dmaengine-pcm).

For example in case of DPCM FE/BE, it will be like below.
Codec will be dummy Component / DAI in this case (X).

	SND_SOC_DAILINK_DEFS(link,
		     DAILINK_COMP_ARRAY(COMP_CPU(...)),
(X)		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

(X) part will converted like below

	[o] link_codecs[]    = {{ .name = "snd-soc-dummy",
				  .dai_name = "snd-soc-dummy-dai", }}

Even though we already have common asoc_dummy_dlc for dummy
Component / DAI, this macro will re-create new dummy dlc.
Some drivers defines many dai_link info via SND_SOC_DAILINK_DEFS(),
this means many dummy dlc also will be re-created. This is waste of
memory.

If we can use existing common asoc_dummy_dlc at (X),
we can avoid to re-creating dummy dlc, then, we can save the memory.

At that time, we want to keep existing code as much as possible, because
too many drivers are using this macro. But because of its original style,
using common asoc_dummy_dlc from it is very difficult or impossible.

So let's change the mind. The macro is used like below

	SND_SOC_DAILINK_DEFS(link,
		     DAILINK_COMP_ARRAY(COMP_CPU(...)),
(x)		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

	static struct snd_soc_dai_link dai_links[] = {
	{
		.name = ...,
		.stream_name = ...,
(y)		SND_SOC_DAILINK_REG(link),
	},

(y) part will be like below

        static struct snd_soc_dai_link dai_links[] = {
        {
                .name = ...,
                .stream_name = ...,
 ^		...
 |		.codecs		= link_codecs,
(y)		.num_codecs	= ARRAY_SIZE(link_codecs),
 v		...
	}

This patch try to use trick on COMP_DUMMY()

-	#define COMP_DUMMY()	{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
+	#define COMP_DUMMY()

By this tric, (x) part will be like below.

before
	[o] link_codecs[] = {{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }}
after
	[o] link_codecs[] = { };

This is same as below

	[o] link_codecs[0];

This means it has pointer (link_codecs), but the array size is 0.
(y) part will be like below.

	static struct snd_soc_dai_link dai_links[] = {
	{
		...
		.codecs		= link_codecs,
		.num_codecs	= 0,
		...
	},

This is very special settings that normal use usually not do,
but new macro do.
We can find this special settings on soc-core.c and fill it as
"dummy DAI" (= asoc_dummy_dlc). By this tric, we can avoid to re-create
dummy dlc and save the memory.

This patch add tric at COMP_DUMMY() and add snd_soc_fill_dummy_dai()
to fill dummy DAI.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://msgid.link/r/871qbi93qu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-19 13:23:46 +00:00
Rander Wang 57cd29a825
ASoC: SOF: IPC4: synchronize fw_config_params with fw definitions
Update fw_config_params in driver.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20231215083102.3064200-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-15 12:57:56 +00:00
Daniel Baluta d29351e8c2
ASoC: audio-graph-card2: Introduce playback-only/capture-only DAI link flags
We need this to support MICFIL PDM found on i.MX8MP where the DAI link
supports only capture direction.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20231128081119.106360-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-14 10:56:47 +00:00
Mark Brown 885f68fec0
GPIO descriptor cleanup for some Wolfson codecs
Merge series from Linus Walleij <linus.walleij@linaro.org>:

This converts the remaining Wolfson ASoC codecs to
use GPIO descriptors.

These Wolfson codecs are mostly used with different
Samsung S3C (especially Cragganmore 6410) board files,
so the in-tree users are fixed up in the process.
2023-12-09 00:16:04 +00:00
Linus Walleij 729f02ec02
ASoC: wm8996: Convert to GPIO descriptors
This converts the WM8996 codec to use GPIO descriptors, an a similar
way to WM5100.

The driver is instantiating a GPIO chip named wm8996, and we get
rid of the base address for the GPIO chip from the platform data and
just use dynamic numbering. Move base and ngpio into the static
gpio_chip template.

Fix up the only in-tree user which is the Cragganmore 6410 module.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-5-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:32:00 +00:00
Linus Walleij 8563cfe39b
ASoC: wm5100: Convert to GPIO descriptors
This converts the WM5100 codec to use GPIO descriptors, a pretty
straight-forward conversion with the following peculiarities:

- The driver is instantiating a GPIO chip named wm5100, and the
  headphone polarity detection GPIO is lifted from there. We add
  this to the GPIO descriptor table as well, and we can then get
  rid of also the base address for the GPIO chip from the
  platform data and just use dynamic numbering.

- Fix up the only in-tree user which is the Cragganmore 6410
  module.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-4-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:59 +00:00
Linus Walleij 0119b2a24e
ASoC: wm2200: Convert to GPIO descriptors
This converts the WM2200 codec to use GPIO descriptors.
This is a pretty straight-forward conversion, and it also
switches over the single in-tree user in the S3C
Cragganmore module for S3C 6410.

This coded does not seem to get selected or be selectable
through Kconfig, I had to hack another soundcard Kconfig
entry to select it for compile tests.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-3-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:59 +00:00
Linus Walleij 10a366f36e
ASoC: wm1250-ev1: Convert to GPIO descriptors
This converts the WM1250-EV1 codec to use GPIO descriptors.
It turns out that the platform data was only used to pass some
global GPIO numbers from a board file, so we get rid of this
and also switch over the single in-tree user in the S3C
Cragganmore module for S3C 6410.

The driver obtains two GPIO lines named OSR and master and just
pull them low, we leave this behaviour as it was.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-2-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:58 +00:00
Linus Walleij b53d477756
ASoC: wm0010: Convert to GPIO descriptors
This converts the WM0010 codec to use GPIO descriptors.
It's a pretty straight-forward conversion also switching over
the single in-tree user in the S3C Cragganmore module
for S3C 6410.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-1-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:57 +00:00
Baofeng Tian 8ec56af3da
ASoC: SOF: add alignment for topology header file struct definition
sof header file requires these struct with 4 byte aligned, so
add same alignment in sof driver definition.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231204214713.208951-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-04 21:49:21 +00:00
Baofeng Tian 6c4df324d7
ASoC: SOF: align topology header file with sof topology header
Add missed definition and align variable names with sof topology
header file.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231204214713.208951-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-04 21:49:20 +00:00
Linus Walleij 42d1178d22
ASoC: cs4271: Convert to GPIO descriptors
This converts the Cirrus CS4271 ASoC codec driver to use
GPIO descriptors.

It turns out that there are two in-kernel users of the platform
data passing mechanism so these are switched over as well.

One locally defined GPIO "gpio_disabled" is declared in the
state struct but completely unused in the driver, so we delete
it.

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231201-descriptors-sound-cirrus-v2-6-ee9f9d4655eb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-01 16:59:21 +00:00
Peter Ujfalusi 1162d267ea
ASoC: SOF: Add placeholder for platform IPC type and path overrides
Add a struct sof_loadable_file_profile which can be filled by platforms
(sof-acpi-dev.c, sof-of-dev.c and sof-acpi-dev.c) to be able to use common,
generic code to handle path customization.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231129125327.23708-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-29 13:25:06 +00:00
Cezary Rojewski dfd6ba6813 ALSA: hda: Drop snd_hdac_calc_stream_format()
There are no users of the function.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-15-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:28:47 +01:00
Cezary Rojewski d24f1a090d ALSA: hda: Upgrade stream-format infrastructure
Introduce a set of functions that ultimately facilite SDxFMT-related
calculations in atomic manner:

First, introduce snd_pcm_subformat_width() and snd_pcm_hw_params_bits()
helpers that separate the base functionality from the HDAudio-specific
one.

snd_hdac_format_normalize() - format converter. S20_LE, S24_LE and their
unsigned and BE friends are invalid from HDAudio perspective but still
can be specified as function argument due to compatibility reasons.

snd_hdac_stream_format_bits() - obtain just the bits-per-sample value.
Does not ignore subformat and msbits parameters.

snd_hdac_stream_format() and snd_hdac_spdif_stream_format() - obtain the
SDxFMT value given the audio format parameters. The former is stripped
away of spdif-related information. Useful for users that do not care
about them.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-5-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:41 +01:00
Cezary Rojewski 4a6ba09e89 ASoC: pcm: Honor subformat when configuring runtime
Subformat options are ignored when setting up hardware parameters and
assigning PCM stream capabilities. Account for them to allow for
granular format selection.

As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. Such approach allows for alloc/free-less code until there are
more users on the horizon.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:20 +01:00
Cezary Rojewski a7fc8b862f ALSA: hda: Honor subformat when querying PCMs
Update mechanism for querying supported PCMs to allow for granular
format selection when container size is 32 bits. Currently always the
highest bit depth is selected, regardless of how many actual formats
codec in question supports.

Acked-by: Mark Brown <broonie@kernel.org>
Co-developed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231117120610.1755254-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:24:27 +01:00
Jaroslav Kysela 2112aa0349 ALSA: pcm: Introduce MSBITS subformat interface
Improve granularity of format selection for S32/U32 formats by adding
constants representing 20, 24 and MAX most significant bits.

The MAX means the maximum number of significant bits which can
the physical format hold. For 32-bit formats, MAX is related
to 32 bits. For 8-bit formats, MAX is related to 8 bits etc.

As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. The approach of subformat being part of struct snd_pcm_hardware
is a compromise between ALSA and ASoC allowing for
hw_params-intersection code to be alloc/free-less while not adding any
new responsibilities to ASoC runtime structures.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Co-developed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231117120610.1755254-2-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:24:26 +01:00
Kuninori Morimoto 45cc50d134
ASoC: makes CPU/Codec channel connection map more generic
Current ASoC CPU:Codec = N:M connection is using connection mapping idea,
but it is used for N < M case only. We want to use it for any case.

By this patch, not only N:M connection, but all existing connection
(1:1, 1:N, N:N) will use same connection mapping. Then, because it will
use default mapping, no conversion patch is needed to exising drivers.

More over, CPU:Codec = N:M (N > M) also supported in the same time.

ch_maps array will has CPU/Codec index by this patch.

Image
	CPU0 <---> Codec0
	CPU1 <-+-> Codec1
	CPU2 <-/

ch_map
	ch_map[0].cpu = 0	ch_map[0].codec = 0
	ch_map[1].cpu = 1	ch_map[1].codec = 1
	ch_map[2].cpu = 2	ch_map[2].codec = 1

Link: https://lore.kernel.org/r/87fs6wuszr.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/878r7yqeo4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/87ttpq4f2c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-27 13:44:00 +00:00
Peter Ujfalusi 1a307538c9
ASoC: SOF: ipc4: Add data struct for module notification message from firmware
With the module notification message the information about the notification
is provided via the mailbox with the sof_ipc4_notify_module_data struct.

It contains the module and instance id of the sender of the notification,
the event_id and optionally additional data which is module and event
specific.

At the same time add definitions to identify ALSA kcontrol change
notification.
These notifications use standardized event_id, modules must follow this if
they support such notifications:
upper 16 bit: 0xA15A as a magic identification value
lower 16 bit: param_id of the changed control

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231124150853.18648-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-24 15:38:00 +00:00
Stefan Binding d04ce4113c ALSA: cs35l41: Fix for old systems which do not support command
Some older laptops using cs35l41 use firmware which does not support
the CSPL_MBOX_CMD_SPK_OUT_ENABLE command.
Firmware versions v0.28.0 and older do not support this command.

Fixes: fa3efcc36a ("ALSA: cs35l41: Use mbox command to enable speaker output for external boost")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231117163609.823627-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-20 12:37:01 +01:00
Jack Yu 577d715448
ASoC: rt5682s: Add LDO output selection for dacref
Add LDO output selection for dacref.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/62cad4e51c044108bad872ab349e36f8@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-14 17:39:27 +00:00
Daniel Baluta 89ef42088b
ASoC: SOF: Add support for configuring PDM interface from topology
Currently we only support configuration for number of channels and
sample rate.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20231109135900.88310-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13 00:43:06 +00:00
Takashi Iwai 2dc15ff73b ASoC: Updates for v6.7
More updates for v6,7 following the early merge request:
 
   - Fixes for handling of component name prefixing when name prefixes
     are used by the machine driver.
   - Fixes for noise when stopping some Sounwire CODECs.
   - Support for AMD ACP 6.3 and 7.0, Awinc AW88399, more Intel
     platforms and more Qualcomm SC7180 platforms.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmU/rAQACgkQJNaLcl1U
 h9AXVwf/SwWrxTus3+O2hS5rwusjqQBn1t2mzlnxsYNVCYGBcjOpMGL4HrJzn++e
 DJXoMyWis5FNKFWyPtKMGE1kZYdUUE/g7LpZOBew4P47nBv6SQWRvUxPfoq8mdOg
 Xb4+kjBzTq1dhwZnZPvNdsknvM7cLfx/lyo2vUJR4peDL0rzgnx72fhRZAjzh2OH
 CSz69aTjpliqikp+V7JVFYf2yma2LjTOCL2saiIF/PcxsqUUa73XTggg610EPY+R
 pOFb2MBRDbZuJrETbaiytLwtcPuvrpiHRHhxuClsjHGVTDbGfE7GzePS+yUu66y9
 LO8oAl7kJebw+WWffIOoL2IjXcG9tA==
 =nn11
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v6.7

More updates for v6,7 following the early merge request:

  - Fixes for handling of component name prefixing when name prefixes
    are used by the machine driver.
  - Fixes for noise when stopping some Sounwire CODECs.
  - Support for AMD ACP 6.3 and 7.0, Awinc AW88399, more Intel
    platforms and more Qualcomm SC7180 platforms.
2023-10-31 09:01:25 +01:00
Mark Brown bdb7e19220
ASoC: Merge up workaround for CODECs that play noise on stopped stream
This was sent too late to actually make it for v6.6 but was sent against
v6.6 so merge it up here.
2023-10-27 22:33:15 +01:00
Srinivas Kandagatla f0220575e6
ASoC: soc-dai: add flag to mute and unmute stream during trigger
In some setups like Speaker amps which are very sensitive, ex: keeping them
unmute without actual data stream for very short duration results in a
static charge and results in pop and clicks. To minimize this, provide a way
to mute and unmute such codecs during trigger callbacks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231027105747.32450-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-27 17:44:04 +01:00
Stefan Binding 76c121821a ASoC: cs35l41: Detect CSPL errors when sending CSPL commands
The existing code checks for the correct state transition after sending
a command. However, it is possible for the message box to return -1,
which indicates an error, if an error has occurred in the firmware.
We can detect if the error has occurred, and return a different error.
In addition, there is no recovering from a CSPL error, so the retry
mechanism is not needed in this case, and we can return immediately.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231026150558.2105827-9-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:29 +02:00
Stefan Binding 2ee06ff5d7 ALSA: hda: cs35l41: Force a software reset after hardware reset
To ensure the chip has correctly reset during probe and system suspend,
we need to force a software reset, in case of systems where the
hardware reset is not available.

The software reset register was labelled as volatile but not readable,
however, it is readable, (just returns 0x0). Adding it to readable
registers means it will be correctly treated as volatile, and thus
will not be cached.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:20 +02:00
Takashi Iwai ba238233e4 ALSA: wavefront: Drop obsoleted comments and definitions
The header file contains lots of outdated comments and definitions.
Drop those as cleanup.

Link: https://lore.kernel.org/r/20231025132314.5878-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:24 +02:00
Takashi Iwai 0e646fc3a2 ALSA: wavefront: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:20 +02:00
Takashi Iwai 9ffbedf07d ALSA: opl3: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:15 +02:00
Uwe Kleine-König 393df6f321
ASoC: simple-card-utils: Make simple_util_remove() return void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code.  However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

simple_util_remove() returned zero unconditionally. Make it return void
instead and convert all users to struct platform_device::remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20231013221945.1489203-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-23 13:29:45 +01:00
Takashi Iwai 39cd06e3f7 ASoC: Updates for v6.7
This is quite a large set of changes but mostly due to API cleanups and
 in driver specific ways rather than due to anything subsystem wide.
 Highlights include:
 
  - Standardisation of API prefixes on snd_soc_, removing asoc_.
  - GPIO API usage improvements.
  - Support for HDA patches.
  - Lots of work on SOF, including crash dump support.
  - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
    platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
    and Texas Instruments TAS575x.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUy6X8ACgkQJNaLcl1U
 h9Cv7Qf+PO4ucl/rFITWAp2Ta9fw7Z5J6UCiXiR54TPgAiLJrpKSi3rbYTXjO90Y
 1NNOdoMKr109zdOpdSZI7EX0GgWQbGbdB40nxESdTcojAloRH0jt4RaF7G7B7+86
 b8PGlVPLLV/4zFf9f2gpEKPcKhRRRKYOBIEB+amfjWpdXVrqPD3zS/S16Q3Hn4Gy
 Fx9b9X/lVDG9uqJomHpunEdViZjkm5CCNzdyAhHH99afiqSe//pevx6/FpzAHyng
 AZgE9Yfq4Xw4pdzDdGVfYC+L1GZiHIDRzsusz6aPA5nrMhSn0ru8PMGtmQQTzyhb
 PLYw0OW8cWymfqwal8wrNGJfSZ8IGA==
 =lN5P
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v6.7

This is quite a large set of changes but mostly due to API cleanups and
in driver specific ways rather than due to anything subsystem wide.
Highlights include:

 - Standardisation of API prefixes on snd_soc_, removing asoc_.
 - GPIO API usage improvements.
 - Support for HDA patches.
 - Lots of work on SOF, including crash dump support.
 - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
   platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
   and Texas Instruments TAS575x.

[ the merge conflicts around SOF Intel HD-audio and CS35L41 subcodec
  drivers are resolved here -- tiwai ]
2023-10-21 09:49:15 +02:00
Maarten Lankhorst e6d0c13e9f ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init
Now that all drivers have moved from modprobe loading to
handling -EPROBE_DEFER, we can remove the argument again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-14-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:56:25 +02:00
Maarten Lankhorst 32f4e921fe ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
Xe is a new GPU driver that re-uses the display (and sound) code from
i915. It's no longer possible to load i915, as the GPU can be driven
by the xe driver instead.

The new behavior will return -EPROBE_DEFER, and wait for a compatible
driver to be loaded instead of modprobing i915.

Converting all drivers at the same time is a lot of work, instead we
will convert each user one by one.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-8-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:55:27 +02:00
Takashi Iwai 87543ce503 Merge branch 'for-linus' into for-next
For applying HD-audio EPROBE_DEFER series cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:51:12 +02:00
Mark Brown 3c716e7f8a
ASoC: Merge fixes for consistent cs42l43 schema
We have adjacent changes for the cs42l43 DT schema, merge the fixes
branch up so that there's a single thing for people to base future
changes on.
2023-10-10 17:07:17 +01:00
Krzysztof Kozlowski 76aca10ccb
ASoC: soc-dapm: Add helper for comparing widget name
Some drivers use one event callback for multiple widgets but still need
to perform a bit different actions based on actual widget.  This is done
by comparing widget name, however drivers tend to miss possible name
prefix.  Add a helper to solve common mistakes.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231003155710.821315-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-09 13:03:28 +01:00
Cezary Rojewski 5eb4ff884f ALSA: hda: Add code_loading parameter to stream setup
AudioDSP firmware is the one who kicks SDxFIFOS calculation when a
stream is decoupled mode. During firmware bring up procedure, there is
no firmware running and the code-loading stream is always a decoupled
one. So, there is none to trigger the calculation and we end up with
false-positive timeout (-110) messages.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231006102857.749143-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 14:30:39 +02:00
Simon Trimmer 3df761bdbc
ASoC: cs35l56: Wake transactions need to be issued twice
As the dummy wake is a toggling signal (either I2C or SPI activity) it
is not guaranteed to meet the minimum asserted hold time for a wake
signal. In this case the wake must guarantee rising edges separated by
at least the minimum hold time.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231006111039.101914-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-06 12:30:27 +01:00
Cezary Rojewski 88320b74ef ALSA: hda: Introduce HOST stream setup mechanism
HDAudio stream setup procedure differs between revisions of the
controller device. Currently the differences are handled directly within
AudioDSP platform drivers with if-statements. Implement a more generic
approach and expose a function that a platform driver may use to ensure
the correct procedure is followed each time.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20230926080623.43927-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:39 +02:00
Cezary Rojewski 2ee2c75c58 ALSA: hda: Poll SDxFIFOS after programming SDxFMT
Software shall read SDxFIFOS calculated by the hardware and notify if
invalid value is programmed before continuing the stream preparation.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20230926080623.43927-2-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:39 +02:00
Kees Cook 80e698e2df
ASoC: soc-dapm: Annotate struct snd_soc_dapm_widget_list with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct snd_soc_dapm_widget_list.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: alsa-devel@alsa-project.org
Cc: linux-hardening@vger.kernel.org
Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1]
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20231003232852.work.257-kees@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-04 12:56:21 +01:00