platform/kernel/linux-rpi.git
14 months agoASoC: intel: sof_sdw: Move range check of codec_conf into inner loop
Charles Keepax [Tue, 8 Aug 2023 13:20:09 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Move range check of codec_conf into inner loop

There are two problems with the current range check on the codec_conf
array.

Firstly, adr_link_next->num_adr refers to the number of devices
on the current SoundWire link, but adr_index refers to the first
SoundWire link involved in the DAI link. This means that subtracting
these two numbers is only meaningful on the first SoundWire link in the
DAI and broken on later links.

Secondly, the intention of the range check is to add the number
of remaining devices on the currently link to the current index
and ensure enough space remains. However, this assumes that all
remaining devices on the SoundWire link will be added to the current
DAI link. Ideally this would not be the case, and devices could be
grouped as the user desired.

Moving the range check into the inner loop both simplifies the code (no
need to add and subtract offsets) and allows future refactoring such
that devices on a single SoundWire link don't have to all be grouped onto
a single DAI link. The check will be processed slightly more often since
it is processed for each device rather each link but this is probe time
and the numbers involved are very small here (4 links, likely no more
than 2-4 devices per link).

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-8-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Update DLC index each time one is added
Charles Keepax [Tue, 8 Aug 2023 13:20:08 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Update DLC index each time one is added

In create_sdw_dailink, rather than bulk updating the index into the
DAI link components array, at the end of processing a link, do so each
time the code adds a new component. This simplifies things slightly,
as an intermediate variable is no longer needed to track the current
place in the DAI link components array.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Pull device loop up into create_sdw_dailink
Charles Keepax [Tue, 8 Aug 2023 13:20:07 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Pull device loop up into create_sdw_dailink

The loops which fill the codec DAI link component structures are split
across create_sdw_dailink and create_codec_dai_name. This causes the
code to be rather confusing, needing to return out the function to allow
the upper loop to iterate. Remove the create_codec_dai_name helper and
pull its code up into create_sdw_dailink, this makes it more obvious
what is happening in the code. This patch makes no functional change
just hoists the code up a level.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-6-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Add helper to create a single codec DLC
Charles Keepax [Tue, 8 Aug 2023 13:20:06 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Add helper to create a single codec DLC

Add a helper function to create a single codec DAI link component
structure. This sets things up for more refactoring of the creating of
the DAI links.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof-sdw: Move check for valid group id to get_dailink_info
Charles Keepax [Tue, 8 Aug 2023 13:20:05 +0000 (14:20 +0100)]
ASoC: intel: sof-sdw: Move check for valid group id to get_dailink_info

Move the check for a valid group id into get_dailink_info as
well. This does cause a slight change in behaviour in that the system
will return an error rather than just ignoring the link with an
invalid group id. There are presently no systems with invalid group
ids in mainline and failing seems more appropriate since it will
better highlight the code needs fixing.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Check link mask validity in get_dailink_info
Charles Keepax [Tue, 8 Aug 2023 13:20:04 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Check link mask validity in get_dailink_info

As get_dailink_info spins through all the links anyway simply check the
link masks there. This saves an extra check and means the code will
fail earlier if the mask is invalid.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Remove duplicate NULL check on adr_link
Charles Keepax [Tue, 8 Aug 2023 13:20:03 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Remove duplicate NULL check on adr_link

get_dailink_info already checked if the adr_link pointer was NULL so
there is no need to recheck later in sof_card_dai_links_create.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: intel: sof_sdw: Printk's should end with a newline
Charles Keepax [Tue, 8 Aug 2023 13:20:02 +0000 (14:20 +0100)]
ASoC: intel: sof_sdw: Printk's should end with a newline

Add the missing new lines.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230808132013.889419-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: imx-audio-rpmsg: Remove redundant initialization owner in imx_audio_rpmsg_driver
Li Zetao [Tue, 8 Aug 2023 02:17:28 +0000 (10:17 +0800)]
ASoC: imx-audio-rpmsg: Remove redundant initialization owner in imx_audio_rpmsg_driver

The module_rpmsg_driver() will set "THIS_MODULE" to driver.owner when
register a rpmsg_driver driver, so it is redundant initialization to set
driver.owner in the statement. Remove it for clean code.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Link: https://lore.kernel.org/r/20230808021728.2978035-1-lizetao1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: amd: acp3x-rt5682-max9836: Configure jack as not detecting Line Out
Alper Nebi Yasak [Sat, 5 Aug 2023 16:22:16 +0000 (19:22 +0300)]
ASoC: amd: acp3x-rt5682-max9836: Configure jack as not detecting Line Out

The RT5682, RT1015 and RT1015p codecs used in this driver do not seem
capable of distinguishing Line Out connections from Headphone, but
the driver configures its jack object as if it can. Remove the wrong
value from the jack creation call to avoid any confusion.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Link: https://lore.kernel.org/r/20230805162216.441410-1-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: add LunarLake support
Mark Brown [Tue, 8 Aug 2023 12:28:53 +0000 (13:28 +0100)]
ASoC: SOF: Intel: add LunarLake support

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset first fixes a number of errors made in the hda-mlink
support, then adds Lunar Lake definitions. The main contribution is
the hda-dai changes where the HDaudio DMA is now used for SSP, DMIC
and SoundWire. In previous hardware the GPDMA (aka DesignWare) was
used and controlled by the audio firmware. The volume of code is
minimized with the abstraction added in previous kernel cycles.

Due to cross-dependencies between ASoC and SoundWire trees, the full
support for jack detection will be deferred to the next kernel
cycle. There's not much point to ask for a sync of the two trees to
support one patch for each tree - we are at -rc5 already.

14 months agoASoC: SOF: Intel: hda-mlink: add sublink to dev_dbg() log
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:59 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-mlink: add sublink to dev_dbg() log

When using more than one sublink for amplifier aggregation, we need to
add the sublink info to debug the programming sequences.

No functional change, only additional precisions in the log.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: IPC4: clarify 'pipeline_ids' usage and logs
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:58 +0000 (16:09 -0500)]
ASoC: SOF: IPC4: clarify 'pipeline_ids' usage and logs

A pipeline is identified by two indices: 'instance_id' and 'pipeline_id'

This is clearly seen in kernel logs when creating a pipeline

"Create widget pipeline.20 instance 0 - pipe 20 - core 0"

but other logs are less clear

"ipc4 set pipeline 1 state 4"

Change definitions and logs to make sure the logs clearly identify
which of the two indices are used in state transitions.

No functional change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai-ops: reset device count for SoundWire DAIs
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:57 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai-ops: reset device count for SoundWire DAIs

The solution used before LunarLake relies on a 'Multi-gateway'
firmware configuration. This is no longer needed with the DMA hardware
handling multiple links directly. To avoid adding a platform-specific
quirk in the generic IPC4 code, this patch resets the device count
when fetching the stream context.

Suggested-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-mlink: add helper to get sublink LSDIID register
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:56 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-mlink: add helper to get sublink LSDIID register

We need to retrieve the current value to deal with the HDAudio
WAKEEN/WAKESTS setup.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: add abstraction for SoundWire wake-ups
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:55 +0000 (16:09 -0500)]
ASoC: SOF: Intel: add abstraction for SoundWire wake-ups

The existing code cannot work for LunarLake, let's add a layer of
abstraction.

No functional change in this patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda: add hw_params/free/trigger callbacks
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:54 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda: add hw_params/free/trigger callbacks

These callbacks are just wrappers to keep the code relatively clean.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai: add helpers for SoundWire callbacks
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:53 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai: add helpers for SoundWire callbacks

During the hw_params and hw_free stages, we need to map the stream tag
and channels in the PCMSyCM registers.

The trigger callback is just a wrapper.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai-ops: add ops for SoundWire
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:52 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai-ops: add ops for SoundWire

Same abstraction as SSP/DMIC, with only the get_hlink helper changing.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai-ops: only allocate/release streams for first CPU DAI
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:51 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai-ops: only allocate/release streams for first CPU DAI

When we have multiple CPU DAIs in a dailink, typically for SoundWire
aggregated solutions with amplifiers on multiple links, we only want
to allocate one HDaudio stream_tag. The simplest solution is to
allocate the hext_stream/stream_tag for the DAI with index 0 in the
dailink, and reuse the same stream for all other CPU DAIs.

This assumption relies on serialization of DAIs by the ASoC core,
where all CPU DAIs are handled in a loop.

The stream release follows the same idea of releasing the tag for the
first DAI only. Ideally we would want the loop to be handled in
reverse-order to summetry, but there is no risk of reusing a
stream_tag which is no longer valid.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai: add DMIC support
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:50 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai: add DMIC support

We can reuse the same helpers as for SSP, with just the link type
being different.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai: add ops for SSP
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:49 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai: add ops for SSP

Add new ops for SSP.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-dai-ops: add/select DMA ops for SSP
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:48 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-dai-ops: add/select DMA ops for SSP

The DMA widget ops are almost similar to the HDaudio ones, with the
exception of codec_dai_set_hext_stream() which is not relevant and the
format calculation which isn't dependent on the codec dai.

The DMA ops can be selected only starting with ACE_2_0.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: LNL: enable DMIC/SSP offload in probe/resume
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:47 +0000 (16:09 -0500)]
ASoC: SOF: Intel: LNL: enable DMIC/SSP offload in probe/resume

In the LunarLake hardware, the default IP ownership changed to the
host driver, instead of the firmware in previous generation.

In the absence of any capability negotiation, we need to assume a
fixed partitioning between host driver and firmware. The OFLEN bit
needs to be set as early as possible for resources handled by the
firmware, since we can't control when the firmware might try to access
the resources.

For now DMIC and SSP are handled by the DSP firmware. SoundWire is a
separate case, the OFLEN bit can be set when starting-up and resuming
the aux device for each link.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: split MTL and LNL operations
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:46 +0000 (16:09 -0500)]
ASoC: SOF: Intel: split MTL and LNL operations

It was just a matter of time before we found a case where we needed
separate ops for MTL and LNL. For LNL we need to set the DMIC/SSP
OFLEN bit in the probe and resume steps, and this can only be done
cleanly with separate ops.

The function prototypes in mtl.h were added in the same order as their
implementation in mtl.c.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: LNL: Add support for Lunarlake platform
Ranjani Sridharan [Mon, 7 Aug 2023 21:09:45 +0000 (16:09 -0500)]
ASoC: SOF: Intel: LNL: Add support for Lunarlake platform

Add initial support for Lunarlake. For now only HDAudio interfaces are
supported, DMIC/SSP/SoundWire require additional work so that the DAIs
reuse the HDaudio DMA stream allocation.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda: add interface definitions for ACE2.x
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:44 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda: add interface definitions for ACE2.x

All interfaces are accessible without the DSP and rely on the HDaudio
DMA only.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: ipc4-topology: restore gateway config length
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:43 +0000 (16:09 -0500)]
ASoC: SOF: ipc4-topology: restore gateway config length

The initial code had a logic flaw where the gateway config length kept
increasing after each playback/capture trigger, with the DMA config
TLV being added at every call of sof_ipc4_prepare_copier_module()

This didn't cause any issues with regular playback/capture, but this
was flagged as an error by firmware in the case of multiple amplifiers
on different links.

Fixes: a0659f81c348 ("ASoC: SOF: ipc4-topology: add DMA config TLV to IPC data")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: ipc4: avoid uninitialized default instance 0
Ranjani Sridharan [Mon, 7 Aug 2023 21:09:42 +0000 (16:09 -0500)]
ASoC: SOF: ipc4: avoid uninitialized default instance 0

When a pipeline contains multiple DAI widgets, the pipe_widget is not
set up except for the first DAI. This result in the pipe_widget having
a default instance 0, which can conflict with another real the
pipeline instance 0 and leads to spurious transitions.

This patch makes sure the instance_id is properly initialized to a
-EINVAL value.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: fix u16/32 confusion in LSDIID
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:41 +0000 (16:09 -0500)]
ASoC: SOF: Intel: fix u16/32 confusion in LSDIID

Likely a combination of copy-paste and test coverage problem. Oops.

Fixes: 87a6ddc0cf1c ("ASoC: SOF: Intel: hda-mlink: program SoundWire LSDIID registers")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: Intel: hda-mlink: fix off-by-one error
Pierre-Louis Bossart [Mon, 7 Aug 2023 21:09:40 +0000 (16:09 -0500)]
ASoC: SOF: Intel: hda-mlink: fix off-by-one error

The HCHAN parameter should be the highest channel number, not the
channel count.

While we're at it, handle LCHAN with the dual __ffs helper.

Fixes: ccc2f0c1b6b6 ("ASoC: SOF: Intel: hda-mlink: add helper to program SoundWire PCMSyCM registers")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SOF: ipc3-dtrace: Switch to memdup_user_nul() helper
Yang Yingliang [Tue, 25 Jul 2023 12:02:47 +0000 (20:02 +0800)]
ASoC: SOF: ipc3-dtrace: Switch to memdup_user_nul() helper

Use memdup_user_nul() helper instead of open-coding to
simplify the code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230725120247.509422-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: lower "no backend DAIs enabled for ... Port" log severity
Hans de Goede [Sat, 5 Aug 2023 17:14:35 +0000 (19:14 +0200)]
ASoC: lower "no backend DAIs enabled for ... Port" log severity

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking
frontend and backend have not been setup yet this results in
e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 lines getting logged
after the user has logged into a GNOME session.

Change the actual "no backend DAIs enabled for ... Port" error to
dev_err_once() to avoid it getting repeated 48 times. While at it
also improve the error by hinting the user how to fix this.

To not make developing new UCM profiles harder, also log the error
at dev_dbg() level all the time (vs once). So that e.g. dyndbg can
be used to (re)enable the messages.

Also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix
the other error getting logged 48 times. Userspace passing wrong
parameters should not lead to dmesg messages.

Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3407
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230805171435.31696-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Map missing jack kcontrols
Mark Brown [Mon, 7 Aug 2023 18:51:47 +0000 (19:51 +0100)]
ASoC: Map missing jack kcontrols

Merge series from Alper Nebi Yasak <alpernebiyasak@gmail.com>:

This patchset adds missing jack kcontrols for each independently
detectable audio peripheral and maps jack pins to those kcontrols
accordingly, with the primary intent to enable/improve jack detection
handling in PulseAudio and PipeWire through JackControl UCM values.

Usually it's just splitting a joint anything-is-connected "Headset Jack"
kcontrol (from [1]) into those like "Headphone Jack" and "Headset Mic"
(similar to a previous series for Intel Chromebooks [2]). This split is
important to avoid automatically switching to a nonexistent external
microphone when a headphone-only device is connected.

When the underlying hardware seems to support it, this also adds a "Line
Out" kcontrol. This is important in case the hardware can actually
support a line-level connection via a different configuration (bypassing
output amplifiers?), or simply for userspace to display "Line Out"
instead of "Headphones" to the user for connected line-out devices.

Beyond the mappings, I had to add PIN_SWITCH card kcontrols and DAPM
widgets to avoid "unknown pin" errors on my devices, so tried to do them
for all. For Intel devices I saw a pattern of routing things to
"Platform Clock" and added to that as well. Looking at patch 5/7 of a
Mediatek-related series [3], I can only guess that routes could be
further improved, but don't know exactly how for each device. And one
more concern is I don't know if the names conflict with any controls
from codecs, although I tried to keep to names of existing widgets.

As far as I can tell, the root cause for most of why these are missing
originates to things being developed for ChromeOS, whose userspace reads
the jack input device and doesn't care for these kcontrols. There's
non-ChromeOS cases as well, maybe things got copy-pasted around and
people didn't need or couldn't figure out how to get more specific than
a single jack kcontrol. The secondary intent in this patchset is to fix
this *everywhere*, so future copy-pastes result in the right behaviour.

For more context also see:

[1] ASoC: soc-card: Create jack kcontrol without pins
https://lore.kernel.org/alsa-devel/20220408041114.6024-1-akihiko.odaki@gmail.com/

[2] ASoC: Intel: Chromebooks: remap jack pins
https://lore.kernel.org/alsa-devel/20220616214055.134943-1-pierre-louis.bossart@linux.intel.com/

[3] ASoC: mediatek: Allow separate handling of headphone and headset mic jack
https://lore.kernel.org/alsa-devel/20220922235951.252532-1-nfraprado@collabora.com/

[4] ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection
https://lore.kernel.org/alsa-devel/20200721182709.6895-1-alpernebiyasak@gmail.com/

This applies onto next-20230802. Unfortunately most of it is untested
except for a few Chromebooks I have (Kevin, Lick, Hana, Cozmo), because
I'm intentionally generalizing to everything.

14 months agoASoC: codecs: Add awinic AW88261 audio amplifier
Mark Brown [Mon, 7 Aug 2023 18:51:39 +0000 (19:51 +0100)]
ASoC: codecs: Add awinic AW88261 audio amplifier

Merge series from wangweidong.a@awinic.com:

The awinic AW88261 is an I2S/TDM input, high efficiency digital Smart K
audio amplifier.

14 months agoASoC: SoundWire codecs: improve pm_runtime handling
Mark Brown [Mon, 7 Aug 2023 18:51:32 +0000 (19:51 +0100)]
ASoC: SoundWire codecs: improve pm_runtime handling

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset improves the pm_runtime behavior in rare corner cases
identified by the Intel CI in the last 6 months.

a) in stress-tests, it's not uncommon to see the following type of
warnings when the codec reports as ATTACHED

    "rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
    sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This warning was not correlated with any functional issue, but it
exposed a design issue on when to enable pm_runtime. The recommended
practice in the pm_runtime documentation is to keep the devices in
'suspended' mode and mark them as 'active' when they are really
functional.

b) enabling pm_runtime when the codec reports as ATTACHED also creates
a problematic case when the ASoC pm_runtime_get_sync() will silently
fail due to the -EACCESS error handling. This can happen when playback
starts before the codec is enumerated.

This patchset modifies the initial stages so that codecs are
pm_runtime enabled in the .probe() callback, but become pm_runtime
'active' only when they report present. This is better aligned with
the design of the pm_runtime helpers and improved CI results
significantly.

This patchset modifies all existing SoundWire codecs (except Qualcomm
ones), but the pattern of changes is exactly the same in all patches.

14 months agoASoC: codecs: Add aw88261 amplifier driver
Weidong Wang [Fri, 4 Aug 2023 11:47:49 +0000 (19:47 +0800)]
ASoC: codecs: Add aw88261 amplifier driver

Add i2c and amplifier registration for
aw88261 and their associated operation functions.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230804114749.215460-4-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: Add code for bin parsing compatible with aw88261
Weidong Wang [Fri, 4 Aug 2023 11:47:48 +0000 (19:47 +0800)]
ASoC: codecs: Add code for bin parsing compatible with aw88261

Add aw88261 compatible code to the aw88395_lib.c file
so that it can parse aw88261's bin file.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230804114749.215460-3-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: dt-bindings: Add schema for "awinic,aw88261"
Weidong Wang [Fri, 4 Aug 2023 11:47:47 +0000 (19:47 +0800)]
ASoC: dt-bindings: Add schema for "awinic,aw88261"

Add the awinic,aw88261 property to the awinic,aw88395.yaml file.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230804114749.215460-2-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: jz4740: Update to use maple tree register cache
Mark Brown [Wed, 12 Jul 2023 11:14:21 +0000 (12:14 +0100)]
ASoC: jz4740: Update to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache. In
v6.5 it has also acquired the ability to generate multi-register writes in
sync operations, bringing performance up to parity with the rbtree cache
there.

Update the jz4740 driver to use the more modern data structure.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230712-asoc-jz-maple-v1-1-3f745adf96e5@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: max9892x: Reformat to coding style
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:26 +0000 (22:18 +0200)]
ASoC: codecs: max9892x: Reformat to coding style

Reformat the code to match Linuxn coding style: re-indent continued
lines and stop too-early line wrapping, drop unneeded {} brackets.  No
functional impact.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: max9892x: Unify interleave mode OF property
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:25 +0000 (22:18 +0200)]
ASoC: codecs: max9892x: Unify interleave mode OF property

MAX98926 and MAX98927 are quite similar and use the same bindings,
although drivers were not implementing them in the same way:
MAX98926 has boolean "interleave-mode" but MAX98927 has uint32
"interleave_mode".  Unify them under maxim,interleave-mode, already used
in other Maxim device.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: dt-bindings: Convert maxim,max98925 to DT schema
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:24 +0000 (22:18 +0200)]
ASoC: dt-bindings: Convert maxim,max98925 to DT schema

Convert the Maxim Integrated MAX98925/MAX98926/MAX98927 speaker
amplifier bindings to DT schema format.  Changes during conversion:
1. Add "sound-dai-cells", already used by DTS.
2. Use "maxim,interleave-mode" instead previous "interleave-mode" and
   undocumented but used interleave_mode.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: samsung: midas_wm1811: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:37 +0000 (20:57 +0300)]
ASoC: samsung: midas_wm1811: Map missing jack kcontrols

This driver does not map jack pins to kcontrols that PulseAudio/PipeWire
need to handle jack detection events. The WM1811 codec used here seems
to support detecting Headphone and Headset Mic connections. Expose each
to userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-28-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:36 +0000 (20:57 +0300)]
ASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone

This driver has correctly mapped jack kcontrols for Headphone and
Headset Mic. However, it is also mapping Line Out jack detection events
to the Headphone kcontrol.

The WM5100 codec used here can distinguish Line Out connections from
Headphone connections. Decouple the two, expose Line Out to userspace as
an independent kcontrol and add the necessary widget.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-27-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: samsung: littlemill: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:35 +0000 (20:57 +0300)]
ASoC: samsung: littlemill: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The WM8958 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-26-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:34 +0000 (20:57 +0300)]
ASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here supports detecting Headphone and Headset Mic connections. Expose
both to userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-25-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:33 +0000 (20:57 +0300)]
ASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol

Commit d0508b4f1604 ("ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols
for jack detection") maps kcontrols for Headphones and Headset Mic jacks
for this driver so that PulseAudio and PipeWire can handle insertion
events for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widget.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-24-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: qcom: sdm845: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:32 +0000 (20:57 +0300)]
ASoC: qcom: sdm845: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5663 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-23-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: qcom: sc7280: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:31 +0000 (20:57 +0300)]
ASoC: qcom: sc7280: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682 and
RT5682s codecs used here can detect Headphone and Headset Mic
connections. Expose each to userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-22-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: qcom: sc7180: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:30 +0000 (20:57 +0300)]
ASoC: qcom: sc7180: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682 and
RT5682s codecs used here can detect Headphone and Headset Mic
connections. Expose each to userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-21-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: qcom: apq8016_sbc: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:29 +0000 (20:57 +0300)]
ASoC: qcom: apq8016_sbc: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. It seems to support
detecting Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-20-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:28 +0000 (20:57 +0300)]
ASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack kcontrols

Commit 8e9867486806 ("ASoC: mediatek: mt8186-da7219: Expose individual
headset jack pins") maps kcontrols for Headphone and Headset Mic jacks
for this driver so that PulseAudio and PipeWire can handle jack
detection events for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-19-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:27 +0000 (20:57 +0300)]
ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The TS3A227 component
used here can detect Headphones and Headset Mic connections. Expose each
to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-18-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:26 +0000 (20:57 +0300)]
ASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-17-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:25 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-16-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:24 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-15-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:23 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-14-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:22 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack

This driver has correctly mapped jack kcontrols for Headphone and
Headset Mic. However, it is configuring the jack to only care about
Headphone events. The MAX98090 codec used here can detect both
connections, so configure the jack as such.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-13-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: imx-es8328: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:21 +0000 (20:57 +0300)]
ASoC: imx-es8328: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. It seems to have a
single detection GPIO pin used to report everything as a Headset. But it
has widgets for Headphone and Mic Jack, so expose both to userspace as
kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-12-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:20 +0000 (20:57 +0300)]
ASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol

Commit 2913bb1f6830 ("ASoC: Intel: sof_da7219_max98373: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-11-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:19 +0000 (20:57 +0300)]
ASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol

Commit b9f53b9fc14e ("ASoC: Intel: kbl_da7219_max98927: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-10-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:18 +0000 (20:57 +0300)]
ASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol

Commit c2065d43ae85 ("ASoC: Intel: kbl_da7219_max98357a: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-9-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:17 +0000 (20:57 +0300)]
ASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol

Commit ecd77d494ec9 ("ASoC: Intel: bytcr_wm5102: Add jack detect
support") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The WM5102 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-8-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:16 +0000 (20:57 +0300)]
ASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol

Commit bbdd4ea2190b4 ("ASoC: Intel: bxt_da7219_max98357a: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle detection events for
these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-7-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: avs: da7219: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:15 +0000 (20:57 +0300)]
ASoC: Intel: avs: da7219: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-6-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:14 +0000 (20:57 +0300)]
ASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682, RT1015
and RT1015p codecs used here can detect Headphone and Headset Mic
connections. Expose the former two to userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-5-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: amd: acp: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:13 +0000 (20:57 +0300)]
ASoC: amd: acp: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682, RT5682s,
NAU8825 and NAU8821 codecs used here can detect Headphone and Headset
Mic connections. Expose both to userspace as kcontrols and add the
necessary widgets. Split the jack and pin structs per-codec to
accommodate for per-codec differences.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-4-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: amd: acp-rt5645: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:12 +0000 (20:57 +0300)]
ASoC: amd: acp-rt5645: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-3-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:11 +0000 (20:57 +0300)]
ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-2-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: max98373-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:29 +0000 (10:36 -0500)]
ASoC: max98373-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: max98363: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:28 +0000 (10:36 -0500)]
ASoC: max98363: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:27 +0000 (10:36 -0500)]
ASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt1318-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:26 +0000 (10:36 -0500)]
ASoC: rt1318-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt1316-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:25 +0000 (10:36 -0500)]
ASoC: rt1316-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt1308-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:24 +0000 (10:36 -0500)]
ASoC: rt1308-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt715-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:23 +0000 (10:36 -0500)]
ASoC: rt715-sdca: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:22 +0000 (10:36 -0500)]
ASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt712-sdca-dmic: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:21 +0000 (10:36 -0500)]
ASoC: rt712-sdca-dmic: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt1712-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:20 +0000 (10:36 -0500)]
ASoC: rt1712-sdca: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt700: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:19 +0000 (10:36 -0500)]
ASoC: rt700: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt711-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:18 +0000 (10:36 -0500)]
ASoC: rt711-sdca: enable pm_runtime in probe, keep status as 'suspended'

In stress cases involving module insertion/removal followed by
playback/capture, it can happen that capture/playback is started
before the codec enumeration completes.

The codec driver registers its components with the ASoC framework
during the probe stage, so there is currently no way for the card
creation to wait for the codec enumeration/initialization to complete.

In addition, when the capture/playback starts, the ASoC framework uses
pm_runtime_get_sync() to properly refcount and power-manage
devices. This is problematic in the SoundWire case because pm_runtime
is enabled during the enumeration/initialization stage, so
pm_runtime_get_sync() will return -EACCESS which is
ignored. Additional errors will happen when setting the pm_runtime
status as 'active' because the parent is not properly resumed,
resulting in an error such as:

"rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This patch suggests enabling pm_runtime during the probe, but marking
the device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

Closes: https://github.com/thesofproject/linux/issues/4328
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt711: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:17 +0000 (10:36 -0500)]
ASoC: rt711: enable pm_runtime in probe, keep status as 'suspended'

In stress cases involving module insertion/removal followed by
playback/capture, it can happen that capture/playback is started
before the codec enumeration completes.

The codec driver registers its components with the ASoC framework
during the probe stage, so there is currently no way for the card
creation to wait for the codec enumeration/initialization to complete.

In addition, when the capture/playback starts, the ASoC framework uses
pm_runtime_get_sync() to properly refcount and power-manage
devices. This is problematic in the SoundWire case because pm_runtime
is enabled during the enumeration/initialization stage, so
pm_runtime_get_sync() will return -EACCESS which is
ignored. Additional errors will happen when setting the pm_runtime
status as 'active' because the parent is not properly resumed,
resulting in an error such as:

"rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This patch suggests enabling pm_runtime during the probe, but marking
the device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

Closes: https://github.com/thesofproject/linux/issues/4328
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: rt5682-sdw: make regmap cache-only in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:16 +0000 (10:36 -0500)]
ASoC: rt5682-sdw: make regmap cache-only in probe

The RT5682 needs specific attention: there are two regmap in
rt5682_priv struct, one is sdw_regmap which is for IO transfer, and
the other is used for registers control.

We need to set both regmaps when we set cache only. Because if we set
rt5682->sdw_regmap only, rt5682->regmap won't set/get the right value
when it call regmap_write/read(rt5682->sdw_regmap, ...). If we set
rt5682->regmap only, regmap_write(rt5682->sdw_regmap, ...) is used
in rt5682_clock_config which will be called by the ..bus_config ops.

Signed-off-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/20230802153629.53576-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SoundWire codecs: make regmap cache-only in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:15 +0000 (10:36 -0500)]
ASoC: SoundWire codecs: make regmap cache-only in probe

The SoundWire bus may start after the probe where the SoundWire ASoC
components are registered. This creates a time window where the card
can be created and the registers be accessed.

As discussed on the mailing list, we can't really control when codecs
are enumerated and initialized, but we can make sure the access to the
codecs is cached until the hardware is accessible.

This patch configures regcache_cache_only() with a 'true' parameter in
the probe function, and a 'false' parameter in the io_init routine.

The rt5682 is handled through a different patch due to its specific
cache handling.

Link: https://lore.kernel.org/alsa-devel/20230503144102.242240-1-krzysztof.kozlowski@linaro.org/
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: SoundWire codecs: return error status in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:14 +0000 (10:36 -0500)]
ASoC: SoundWire codecs: return error status in probe

For some reason the first batch of SoundWire codec drivers squelch
errors in the SoundWire probe callback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ti: davinci-evm: simplify the code with module_platform_driver
Yang Yingliang [Fri, 4 Aug 2023 08:54:02 +0000 (16:54 +0800)]
ASoC: ti: davinci-evm: simplify the code with module_platform_driver

The init/exit() of driver only calls platform_driver_register/unregister,
it can be simpilfied with module_platform_driver.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230804085402.1328033-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: wm8960: Add support for the power supplies
Fabio Estevam [Thu, 3 Aug 2023 21:55:06 +0000 (18:55 -0300)]
ASoC: wm8960: Add support for the power supplies

WM8960 has the following power supplies:

- AVDD
- DBVDD
- DCVDD
- SPKVDD1
- SPKVDD1

Add support for them.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803215506.142922-2-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: wlf,wm8960: Describe the power supplies
Fabio Estevam [Thu, 3 Aug 2023 21:55:05 +0000 (18:55 -0300)]
ASoC: dt-bindings: wlf,wm8960: Describe the power supplies

WM8960 has the following power supplies:

- AVDD
- DBVDD
- DCVDD
- SPKVDD1
- SPKVDD1

Add them to bindings to improve the hardware description.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803215506.142922-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: mediatek: mt8186 modify dram type as non-cache
Trevor Wu [Thu, 3 Aug 2023 07:50:28 +0000 (15:50 +0800)]
ASoC: SOF: mediatek: mt8186 modify dram type as non-cache

To prevent incorrect access between the host and DSP sides, we need to
modify DRAM as a non-cache memory type. Additionally, we can retrieve
the size of shared DMA from the device tree.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Kuan-Hsun Cheng <Allen-KH.Cheng@mediatek.com>
Link: https://lore.kernel.org/r/20230803075028.32170-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoALSA: hda/i915: extend connectivity check to cover Intel ARL
Kai Vehmanen [Wed, 2 Aug 2023 15:01:05 +0000 (10:01 -0500)]
ALSA: hda/i915: extend connectivity check to cover Intel ARL

Expand the HDA/I915 connectivity check to correctly handle
the PCI topology used in some Intel Arrow Lake products.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: "T, Arun" <arun.t@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 months agoALSA: hda: intel-dsp-cfg: add LunarLake support
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:04 +0000 (10:01 -0500)]
ALSA: hda: intel-dsp-cfg: add LunarLake support

One more PCI ID for the road.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 months agoALSA: hda: intel-dsp-cfg: use common include for MeteorLake
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:03 +0000 (10:01 -0500)]
ALSA: hda: intel-dsp-cfg: use common include for MeteorLake

This was not updated in Commit 0cd0a7c2c599 ("ALSA: intel-dsp-config: Convert to PCI device IDs defines")

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 months agoALSA: hda: add HD Audio PCI ID for Intel Arrow Lake-S
Kai Vehmanen [Wed, 2 Aug 2023 15:01:02 +0000 (10:01 -0500)]
ALSA: hda: add HD Audio PCI ID for Intel Arrow Lake-S

Add HD Audio PCI ID for Intel Arrow Lake-S platform.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 months agoPCI: add ArrowLake-S PCI ID for Intel HDAudio subsystem.
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:01 +0000 (10:01 -0500)]
PCI: add ArrowLake-S PCI ID for Intel HDAudio subsystem.

Add part ID to common include file

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 months agoASoC: soc-acpi: Add missing kernel doc
Charles Keepax [Thu, 3 Aug 2023 16:23:12 +0000 (17:23 +0100)]
ASoC: soc-acpi: Add missing kernel doc

The UID field in snd_soc_acpi_link_adr is not documented, add kernel doc
for it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803162312.117771-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8186: Remove unused mutex.
Sebastian Andrzej Siewior [Thu, 3 Aug 2023 08:39:08 +0000 (10:39 +0200)]
ASoC: mediatek: mt8186: Remove unused mutex.

The mutex mutex_request_dram has no user.

Remove mutex_request_dram.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230803083908.9DxbPvOK@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Use SET_SYSTEM_SLEEP_PM_OPS to simplify PM
Chancel Liu [Wed, 2 Aug 2023 05:21:17 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Use SET_SYSTEM_SLEEP_PM_OPS to simplify PM

Use SET_SYSTEM_SLEEP_PM_OPS to simplify suspend and resume function.
fsl_micfil_suspend() and fsl_micfil_resume() can be deleted.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-4-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Add fsl_micfil_use_verid function
Chancel Liu [Wed, 2 Aug 2023 05:21:16 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Add fsl_micfil_use_verid function

fsl_micfil_use_verid() can help to parse the version info in VERID and
PARAM registers. Since the two registers are added only on i.MX93
platform, a member flag called use_verid is introduced to soc data
structure which indicates acquiring MICFIL version.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-3-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Add new registers and new bit definition
Chancel Liu [Wed, 2 Aug 2023 05:21:15 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Add new registers and new bit definition

MICFIL IP is upgraded on i.MX93 platform. These new registers and new
bit definition are added to complete the register list.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-2-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>