Commit graph

24799 commits

Author SHA1 Message Date
Shengjiu Wang
f331ae5fa5
ASoC: imx-card: Fix mclk calculation issue for akcodec
Transfer the refined slots and slot_width to akcodec_get_mclk_rate()
for mclk calculation, otherwise the mclk frequency does not match
with the slots and slot_width for S16_LE format, because the default
slot_width is 32.

Fixes: aa736700f4 ("ASoC: imx-card: Add imx-card machine driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1641292835-19085-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-06 13:55:44 +00:00
Shengjiu Wang
3349b3d0c6
ASoC: imx-card: Need special setting for ak4497 on i.MX8MQ
The SAI on i.MX8MQ don't support one2one ratio for mclk:bclk, so
the mclk frequency exceeds the supported range of codec for
the case that sample rate is larger than 705kHZ and format is
S32_LE. Update the supported width for such case.

Fixes: aa736700f4 ("ASoC: imx-card: Add imx-card machine driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1641292835-19085-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-06 13:55:43 +00:00
Takashi Iwai
e4c35e7520
ASoC: ak4375: Fix unused function error
A randconfig caught a compile warning that is now treated as a fatal
error:
  sound/soc/codecs/ak4375.c:415:13: error: ‘ak4375_power_off’ defined but not used [-Werror=unused-function]

where ak4375_power_off() is used only from the PM handler.

As both suspend and resumes are already marked with __maybe_unused,
let's rip off the superfluous ifdef CONFIG_PM, so that the error above
can be avoided.

Fixes: 53778b8292 ("ASoC: Add AK4375 support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220105162409.20635-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 16:32:32 +00:00
Mark Brown
570010b82e
Add low power hibernation support to cs35l41
Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

This patch series adds support for the low power hibernation feature
on cs35l41. This allows the DSP memory to be retained whilst the
device enters a very low power state.
2022-01-05 15:59:21 +00:00
Takashi Iwai
dec36c09a5 ASoC: Updates for v5.17
Not much going on framework release this time, but a big update for
 drivers especially the Intel and SOF ones.
 
  - Refinements and cleanups around the delay() APIs.
  - Wider use of dev_err_probe().
  - Continuing cleanups and improvements to the SOF code.
  - Support for pin switches in simple-card derived cards.
  - Support for AMD Renoir ACP, Asahi Kasei Microdevices AKM4375, Intel
    systems using NAU8825 and MAX98390, Mediatek MT8915, nVidia Tegra20
    S/PDIF, Qualcomm systems using ALC5682I-VS and Texas Instruments
    TLV320ADC3xxx.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmHVprgACgkQJNaLcl1U
 h9CGVQf8DQ0SsUiOKQOdGIcw/Os38EiR/rhGnDH5IxhbqqASrkFMTRe2fED2x2zr
 AifAWehuMuloX/xufAkZPDP6v58mv4ZrXY+NSSFU+IRaeM5TgyxFfOlU/saNaHYC
 zxIldSEopok9Hmpg48mVrWePIJ8qEln6NidS7qpt6ylJ+U9LSt5rVkp6Rj86/va1
 /JCJ8qaN9FRP+mTVWVMcd1lFG4lsZbqlUiipdhNLZT1p2/2mfGxTOhjiYnygG4l0
 PU+lIUFv+fTrjsMm9B9ZRFCZO/K5zop65O+wKyBZYwkH/UXmeGi6f1AvzAWf174z
 5fRIosTgCDWKVIWrFrXYV8Qyp2kAMg==
 =bHj3
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v5.17

Not much going on framework release this time, but a big update for
drivers especially the Intel and SOF ones.

 - Refinements and cleanups around the delay() APIs.
 - Wider use of dev_err_probe().
 - Continuing cleanups and improvements to the SOF code.
 - Support for pin switches in simple-card derived cards.
 - Support for AMD Renoir ACP, Asahi Kasei Microdevices AKM4375, Intel
   systems using NAU8825 and MAX98390, Mediatek MT8915, nVidia Tegra20
   S/PDIF, Qualcomm systems using ALC5682I-VS and Texas Instruments
   TLV320ADC3xxx.
2022-01-05 15:39:24 +01:00
Takashi Iwai
f81483aaeb Merge branch 'for-next' into for-linus
Pull 5.17 materials.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-01-05 15:38:34 +01:00
Fabio Estevam
a319cb32e7
ASoC: cs4265: Add a remove() function
When the reset_gpio GPIO is used, it is better to put the codec
back into reset state when the driver unbinds.

Add a remove() function to accomplish that.

Suggested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220104180613.639317-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:58 +00:00
Charles Keepax
ba235634b1
ASoC: wm_adsp: Add support for "toggle" preloaders
In the case a device can support retaining the firmware memory across
low power states it is useful for the preloader widget to only power up
whilst actually loading/unloading the core, as opposed to the normal
operation where the widget is powered for the entire time a firmware is
preloaded onto the core. Add support for this mode and a flag to enable
it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:54 +00:00
Charles Keepax
5f2f539901
ASoC: cs35l41: Correct handling of some registers in the cache
It makes no sense to cache the test/user key registers, since they
require values written at specific times, mark them volatile. It is
probably best if they can't be accessed from user-space either, so
mark them precious as well.

The interrupt force, edge, polarity and debounce are all settings
applied to the IRQ rather than status bits and as such should not be
volatile.

The OTP trim values will require re-application in the event of a
cache sync and as such should not be volatile. The OTPID however
should be volatile.

The DSP scratch registers are used to read back an error/debug code
from the DSP on shutdown, as such these should be marked volatile.

Finally, add some missing defaults, add TST_FS_MON0, and allow the
DSP core control register to be cached.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:52 +00:00
Charles Keepax
56852cf4b2
ASoC: cs35l41: Correct DSP power down
The wm_adsp_event should be called before the early_event on power
down, event stops the core running and early_event then powers down
the core. Additionally, the core should only be stopped if it was
actually running in the first place.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:51 +00:00
Charles Keepax
4e7c3cd87d
ASoC: cs35l41: Remove incorrect comment
The IRQ is not used for the PDN_DONE bit, this is polled during the DAPM
sequence, remove the misleading comment.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:50 +00:00
David Rhodes
dcf8213194
ASoC: cs35l41: Add cs35l51/53 IDs
Add IDs for the CS35L51/53 variants, the functionality is shared with
CS35L41.

Signed-off-by: David Rhodes <david.rhodes@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05 13:53:49 +00:00
Alyssa Ross
9f3d45318d
ASoC: fsl_mqs: fix MODULE_ALIAS
modprobe can't handle spaces in aliases.

Fixes: 9e28f6532c ("ASoC: fsl_mqs: Add MQS component driver")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Link: https://lore.kernel.org/r/20220104132218.1690103-1-hi@alyssa.is
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-04 14:59:37 +00:00
Mark Brown
a155b7526e
ASoC: mediatek: mt8195: repair pcmif BE dai
Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches repairs some problems for pcmif BE dai.
The unexpected control flow is corrected, and the missing playback
support of DPCM is added.
2021-12-31 14:38:47 +00:00
Mark Brown
85b57de332
ASoC: Add support for CS35L41 in HDA systems
Merge series from Lucas Tanure <tanureal@opensource.cirrus.com>:

Initial refactoring to support use of cs35l41 from the HDA driver stack.
2021-12-31 14:38:45 +00:00
Mark Brown
8b974c122b
ASoC: Merge fixes
So we can send to Linus.
2021-12-31 13:23:28 +00:00
Lucas Tanure
e8e4fcc047
ASoC: cs35l41: Create shared function for boost configuration
ASoC and HDA will use the same registers to configure
internal boost for the device

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-7-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:06 +00:00
Lucas Tanure
3bc3e3da65
ASoC: cs35l41: Create shared function for setting channels
ASoC and HDA will use the same register to set channels
for the device

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-6-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:04 +00:00
Lucas Tanure
8b2278604b
ASoC: cs35l41: Create shared function for errata patches
ASoC and HDA systems require the same errata patches, so
move it to the shared code using a function the correctly
applies the patches by revision

Also, move CS35L41_DSP1_CCM_CORE_CTRL write to errata
patch function as is required to be written at boot,
but not in regmap_register_patch sequence as will affect
waking up from hibernation

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-5-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:03 +00:00
Lucas Tanure
062ce05933
ASoC: cs35l41: Move power initializations to reg_sequence
ASoC and HDA systems for all revisions of CS35L41 will benefit
from having this initialization, so add it to reg_sequence of
each revision

By moving to reg_sequence all gains are set to zero. And boost,
monitoring parts, and class D amplifier are disabled.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-4-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:02 +00:00
Lucas Tanure
fe120d4cb6
ASoC: cs35l41: Move cs35l41_otp_unpack to shared code
ASoC and HDA will do the same cs35l41_otp_unpack, so move it
to shared code

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-3-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:01 +00:00
Lucas Tanure
a87d42227c
ASoC: cs35l41: Convert tables to shared source code
To support CS35L41 in HDA systems the HDA driver
for CS35L41 would have to duplicate some functions
that already exist on ASoC driver
So instead of duplicate the code, use the new lib
source as a shared resource for both ASoC and HDA

Also, change the way CONFIG_SND_SOC_CS35L41 is
selected, as reported by Intel Kernel test robot,
it is possible to build SND_SOC_CS35L41_SPI/I2C
without the main driver, which would lead to build
failures.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20211217115708.882525-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:21:00 +00:00
Trevor Wu
db5e1c209b
ASoC: mediatek: mt8195: add playback support to PCM1_BE dai_link
PCM1_BE should be a dai_link for both playback and capture.
In the patch, the missing DPCM playback support is added.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211230084731.31372-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:20:58 +00:00
Trevor Wu
2355028c0c
ASoC: mediatek: mt8195: correct pcmif BE dai control flow
Originally, the conditions for preventing reentry are not correct.
dai->component->active is not the state specifically for pcmif dai, so it
is not a correct condition to indicate the status of pcmif dai.
On the other hand, snd_soc_dai_stream_actvie() in prepare ops for both
playback and capture possibly return true at the first entry when these
two streams are opened at the same time.

In the patch, I refer to the implementation in mt8192-dai-pcm.c.
Clock and enabling bit for PCMIF are managed by DAPM, and the condition
for prepare ops is replaced by the status of dai widget.

Fixes: 1f95c01911 ("ASoC: mediatek: mt8195: support pcm in platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211230084731.31372-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:20:57 +00:00
Derek Fang
cc5c978810
ASoC: rt5682: Register wclk with its parent_hws instead of parent_data
The mclk might not be registered as a fixed clk name "mclk" on some
platforms.
In those platforms, if the mclk needed to be controlled by codec driver
and acquired by a fixed name, it would be a problem.

This patch to fix the issue that wclk becomes an orphan due to the fixed
mclk's name.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211227055446.27563-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:49 +00:00
Trevor Wu
c5ab93e289
ASoC: mediatek: mt8195: update control for RT5682 series
Playback pop is observed and the root cause is the reference clock
provided by MT8195 is diabled before RT5682 finishes the control flow.

To ensure the reference clock supplied to RT5682 is disabled after RT5682
finishes all register controls. We replace BCLK with MCLK for RT5682
reference clock, and makes use of set_bias_level_post to handle MCLK
which guarantees MCLK is off after all RT5682 register access.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211228064821.27865-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:48 +00:00
Jiasheng Jiang
3ecb46755e
ASoC: samsung: idma: Check of ioremap return value
Because of the potential failure of the ioremap(), the buf->area could
be NULL.
Therefore, we need to check it and return -ENOMEM in order to transfer
the error.

Fixes: f09aecd50f ("ASoC: SAMSUNG: Add I2S0 internal dma driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20211228034026.1659385-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:46 +00:00
Tzung-Bi Shih
3667a037e5
ASoC: mediatek: use of_device_get_match_data()
Uses of_device_get_match_data() helper to clean some boilerplate code.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211227062153.3887447-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:45 +00:00
Fabio Estevam
8f85317292
ASoC: cs4265: Fix part number ID error message
The Chip ID - Register 01h contains the following description
as per the CS4265 datasheet:

"Bits 7 through 4 are the part number ID, which is 1101b (0Dh)"

The current error message is incorrect as it prints CS4265_CHIP_ID,
which is the register number, instead of printing the expected
part number ID value.

To make it clearer, also do a shift by 4, so that the error message
would become:

[    4.218083] cs4265 1-004f: CS4265 Part Number ID: 0x0 Expected: 0xd

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211222141920.1482451-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:44 +00:00
Pierre-Louis Bossart
12054f0ce8 ALSA/ASoC: hda: move/rename snd_hdac_ext_stop_streams to hdac_stream.c
snd_hdac_ext_stop_streams() has really nothing to do with the
extension, it just loops over the bus streams.

Move it to the hdac_stream layer and rename to remove the 'ext'
prefix and add the precision that the chip will also be stopped.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216231128.344321-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-12-25 09:11:09 +01:00
Mark Brown
10674ca9ea
ASoC/SoundWire: improve suspend flows and use set_stream() instead of set_tdm_slots() for HDAudio
Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

This series contains three topics.
1. SoundWire: Intel: remove pdm support
2. ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire
3. ASoC/SOF/SoundWire: fix suspend-resume on pause with dynamic pipelines

The topics are independent but the changes are dependent. So please
allow me to send them in one series.
2021-12-24 16:15:47 +00:00
V sujith kumar Reddy
5c5f08f7fc
ASoC: amd: acp: Power on/off the speaker enable gpio pin based on DAPM callback.
Configure the speaker gpio pin based on power sequence of the DAPM
speaker events.
Enable speaker after widget power up and Disable before widget  powerdown.

Signed-off-by: V sujith kumar Reddy <vsujithkumar.reddy@amd.com>
Link: https://lore.kernel.org/r/20211224150058.2444776-1-vsujithkumar.reddy@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:59 +00:00
chiminghao
b2fde4deff
ASoC: remove unneeded variable
return value form directly instead of
taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cm>
Signed-off-by: chiminghao <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20211209015707.409870-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:58 +00:00
Tzung-Bi Shih
082482a502
ASoC: mediatek: mt8195: release device_node after snd_soc_register_card
Device nodes can be released after components have bound.

Shortens the lifecycle of the device nodes.  Releases the reference
counts after snd_soc_register_card.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-5-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:56 +00:00
Tzung-Bi Shih
db3f5abe68
ASoC: mediatek: mt8173: reduce log verbosity in probe()
Eliminates error messages if snd_soc_register_card() failed.  Kernel
emits messages if device probe error anyway.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:55 +00:00
Tzung-Bi Shih
cb006006fe
ASoC: mediatek: mt8183: fix device_node leak
Fixes the device_node leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:53 +00:00
Tzung-Bi Shih
493433785d
ASoC: mediatek: mt8173: fix device_node leak
Fixes the device_node leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:52 +00:00
Pierre-Louis Bossart
636110411c
ASoC: Intel/SOF: use set_stream() instead of set_tdm_slots() for HDAudio
Overloading the tx_mask with a linear value is asking for trouble and
only works because the codec_dai hw_params() is called before the
cpu_dai hw_params().

Move to the more generic set_stream() API to pass the hdac_stream
information.

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@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20211224021034.26635-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:48 +00:00
Pierre-Louis Bossart
e8444560b4
ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire
The HDAudio ASoC support relies on the set_tdm_slots() helper to store
the HDaudio stream tag in the tx_mask. This only works because of the
pre-existing order in soc-pcm.c, where the hw_params() is handled for
codec_dais *before* cpu_dais. When the order is reversed, the
stream_tag is used as a mask in the codec fixup functions:

	/* fixup params based on TDM slot masks */
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
	    codec_dai->tx_mask)
		soc_pcm_codec_params_fixup(&codec_params,
					   codec_dai->tx_mask);

As a result of this confusion, the codec_params_fixup() ends-up
generating bad channel masks, depending on what stream_tag was
allocated.

We could add a flag to state that the tx_mask is really not a mask,
but it would be quite ugly to persist in overloading concepts.

Instead, this patch suggests a more generic get/set 'stream' API based
on the existing model for SoundWire. We can expand the concept to
store 'stream' opaque information that is specific to different DAI
types. In the case of HDAudio DAIs, we only need to store a stream tag
as an unsigned char pointer. The TDM rx_ and tx_masks should really
only be used to store masks.

Rename get_sdw_stream/set_sdw_stream callbacks and helpers as
get_stream/set_stream. No functionality change beyond the rename.

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@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20211224021034.26635-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:47 +00:00
Pierre-Louis Bossart
b86947b52f
ASoC/soundwire: intel: simplify callbacks for params/hw_free
We don't really need to pass a substream to the callback, we only need
the direction. No functionality change, only simplification to enable
improve suspend with paused streams.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20211224021034.26635-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:45 +00:00
Pierre-Louis Bossart
da893a93ea
ASOC: SOF: Intel: use snd_soc_dai_get_widget()
We have a helper, use it to simplify widget lookup

Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20211224021034.26635-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:43 +00:00
Mark Brown
2f15d3cebd
ASoC: qcom: Parse "pin-switches" and "widgets" from DT
Merge series from Stephan Gerhold <stephan@gerhold.net>:

Some sound card setups might require extra pin switches to allow
turning off certain audio components. simple-card supports this
already using the "pin-switches" and "widgets" device tree property.
This series makes it possible to use the same properties for the Qcom
sound cards.

To implement that, the function that parses the "pin-switches" property
in simple-card-utils.c is first moved into the ASoC core. Then two
simple function calls are added to the common Qcom sound card DT parser.
Finally there is a small patch for the msm8916-wcd-analog codec to make
it possible to model sound card setups used in some MSM8916 smartphones.
(See PATCH 2/4 for an explanation of some real example use cases.)

Using pin switches rather than patching codec drivers with switches was
originally suggested by Mark Brown on a patch for the tfa989x codec:
https://lore.kernel.org/alsa-devel/YXaMVHo9drCIuD3u@sirena.org.uk/
2021-12-23 19:38:13 +00:00
Stephan Gerhold
319a05330f
ASoC: msm8916-wcd-analog: Use separate outputs for HPH_L/HPH_R
The analog codec has separate output paths for the left headphone channel
(HPH_L) and the right headphone channel (HPH_R). While they are usually
used together for actual headphones output, some devices also have an
analog speaker amplifier connected to one of the headphone channels.

To allow modelling that properly (and to avoid powering on the unneeded
output path), HPH_L and HPH_R should be represented by separate outputs
rather than a shared HEADPHONE output that always activates both paths.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211214142049.20422-5-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 18:34:27 +00:00
Stephan Gerhold
2623e66de1
ASoC: qcom: common: Parse "pin-switches" and "widgets" from DT
Use the DT helpers in the ASoC core to parse the "pin-switches" and
"widgets" properties from the device tree. This allows adding extra
mixers to disable e.g. an extra speaker amplifier that would be
normally powered on automatically because it is connected to a shared
output pin.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211214142049.20422-4-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 18:34:26 +00:00
Stephan Gerhold
3d4641a42c
ASoC: core: Add snd_soc_of_parse_pin_switches() from simple-card-utils
The ASoC core already has several helpers to parse card properties
from the device tree. Move the parsing code for "pin-switches" from
simple-card-utils to a shared snd_soc_of_parse_pin_switches() function
so other drivers can also use it to set up pin switches configured in
the device tree.

Cc: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211214142049.20422-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 18:34:23 +00:00
Tzung-Bi Shih
4e28491a7a
ASoC: mediatek: mt8192-mt6359: fix device_node leak
The of_parse_phandle() document:
    >>> Use of_node_put() on it when done.

The driver didn't call of_node_put().  Fixes the leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211214040028.2992627-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 17:36:44 +00:00
Mark Brown
1d194b6b3d
ASoC: SOF: Re-visit firmware state and panic tracking/handling
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

this series will improve how we are tracking the firmware's state to be able to
avoid communication with it when it is not going to answer due to a panic and
we will attempt to force power cycle the DSP to recover at the next runtime
suspend time.

The state handling brings in other improvements on the way the kernel reports
errors and DSP panics to reduce the printed lines for normal users, but at the
same time allowing developers (or for bug reports) to have more precise
information available to track down the issue.

We can now place messages easily in the correct debug level and not bound to the
static ERROR for some of the print chains, causing excess amount or partial
information to be printed, confusing users and machines (CI).

I would have prefered to split this series up, but it was developed together to
achieve a single goal to reduce the noise, but also provide the details we need
to be able to rootcause issues.
2021-12-23 17:15:58 +00:00
Yang Yingliang
8a2d8e4fed
ASoC: codec: tlv320adc3xxx: Fix missing clk_disable_unprepare() on error in adc3xxx_i2c_probe()
Fix the missing clk_disable_unprepare() before return
from adc3xxx_i2c_probe() in the error handling case.

Fixes: e9a3b57efd ("ASoC: codec: tlv320adc3xxx: New codec driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211223082212.3342184-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:36 +00:00
Peter Ujfalusi
34bfba9a63
ASoC: SOF: Intel: hda: Use DEBUG log level for optional prints
If the user requested to see all dumps (even the optional ones) then use
KERN_DEBUG level for the optional dumps as they are only for debugging
purposes.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-21-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:30 +00:00
Peter Ujfalusi
0152b8a2f0
ASoC: SOF: debug: Use DEBUG log level for optional prints
If the user requested to see all dumps (even the optional ones) then use
KERN_DEBUG level for the optional dumps as they are only for debugging
purposes.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-20-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:29 +00:00
Peter Ujfalusi
beb6ade168
ASoC: SOF: Add clarifying comments for sof_core_debug and DSP dump flags
Update the comment for the global SOF level debug flags and add one for
the flags used to control the DSP dump functionality.

Document the expected behavior when the SOF_DBG_DUMP_OPTIONAL is passed
for the DSP dump:
Only print the dump if SOF_DBG_PRINT_ALL_DUMPS is set
Print must use KERN_DEBUG log level

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-19-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:27 +00:00
Peter Ujfalusi
4995ffce2c
ASoC: SOF: Rename snd_sof_get_status() and add kernel log level parameter
The snd_sof_get_status() is not the best name for a function which in fact
is tasked to print out DSP oops and stack. Rename it to
sof_print_oops_and_stack().

At the same time add a new parameter to specify the desired kernel log
level to be used for the prints.

When updating the users of the function, pass KERN_ERR for now to make sure
that there is no functional change happens.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-18-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:26 +00:00
Peter Ujfalusi
b9f0bfd16d
ASoC: SOF: dsp_arch_ops: add kernel log level parameter for oops and stack
To allow custom log level to be used for the DSP oops and stack print, add
a kernel log level parameter to the two ops.

Modify the xtensa oops and stack functions tom use this new log level
parameter.

Pass KER_ERR from snd_sof_get_status() to make sure that there is no
functional change with this new parameter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-17-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:25 +00:00
Peter Ujfalusi
fdc573b1c2
ASoC: SOF: ops: Always print DSP Panic message but use different message
Never suppress the DSP panic dump as it is always originates from an
assert() or panic() call within the firmware.

Use different message for DSP panics when there will be recovery attempt
going to be done compared to a definitive DSP panic.

Suggested-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-16-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:24 +00:00
Peter Ujfalusi
9f89a988d5
ASoc: SOF: core: Update the FW boot state transition diagram
Update the state flow diagram to reflect the current implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-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/20211223113628.18582-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:23 +00:00
Peter Ujfalusi
b54b3a4e08
ASoC: SOF: pm: Force DSP off on suspend in BOOT_FAILED state also
Try to force the DSP to be turned off next time if the fw_state is either
CRASHED or BOOT_FAILED when a suspend happens in order to attempt a clean
boot to recover.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-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/20211223113628.18582-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:22 +00:00
Peter Ujfalusi
e2406275be
ASoC: SOF: Set SOF_FW_BOOT_FAILED in case we have failure during boot
Change the fw_state to SOF_FW_BOOT_FAILED if we encountered an error during
booting the firmware.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-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/20211223113628.18582-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:20 +00:00
Peter Ujfalusi
9421ff7665
ASoC: SOF: ipc: Only allow sending of an IPC in SOF_FW_BOOT_COMPLETE state
If the state of the firmware is not BOOT_COMPLETE, it means that the
firmware is not functioning, thus it is not capable of handling IPC
messages.
Do not try to send IPC if the state is not BOOT_COMPLETE

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-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/20211223113628.18582-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:19 +00:00
Peter Ujfalusi
d41607d37c
ASoC: SOF: Rename 'enum snd_sof_fw_state' to 'enum sof_fw_state'
Since there is nothing SND about the firmware state, rename the enum
from `snd_sof_fw_state` to simply `sof_fw_state`

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20211223113628.18582-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:18 +00:00
Peter Ujfalusi
fc179420fd
ASoC: SOF: Move the definition of enum snd_sof_fw_state to global header
Move the enum snd_sof_fw_state to include/sound/sof.h to be accessible
outside of the core SOF stack.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20211223113628.18582-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:17 +00:00
Peter Ujfalusi
b2e9eb3adb
ASoC: SOF: Introduce new firmware state: SOF_FW_BOOT_READY_OK
The SOF_FW_BOOT_READY_OK fw_state indicates that the boot ready message has
been received and there were no errors found.

The SOF_FW_BOOT_COMPLETE state will be reached after the
snd_sof_dsp_post_fw_run() completes without error.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20211223113628.18582-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:16 +00:00
Peter Ujfalusi
4e1f864821
ASoC: SOF: Introduce new firmware state: SOF_FW_CRASHED
The SOF_FW_CRASHED state is meant to indicate the unfortunate case when the
firmware has crashed after a successful boot.

IPC tx timeout is not treated as indication of a firmware crash as it tends
to happen regularly while the firmware is operational.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20211223113628.18582-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:15 +00:00
Peter Ujfalusi
2f148430b9
ASoC: SOF: Add a 'message' parameter to snd_sof_dsp_dbg_dump()
When snd_sof_dsp_dbg_dump() is called we have an explanatory message to
give some hint on the reason why we have the dump on the caller level.

Pass this message to snd_sof_dsp_dbg_dump() and handle the print according
to the dump rules.

This way we can finally print information on the HDA boot iteration if all
dumps are enabled.

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:14 +00:00
Peter Ujfalusi
b2b10aa79f
ASoC: SOF: Add 'non_recoverable' parameter to snd_sof_dsp_panic()
Some platforms use retries during firmware boot to overcome DSP startup
issues.
In these cases we might receive a DSP panic message which should not be
treated as fatal if it happens during boot.

Pass this information to snd_sof_dsp_panic() and omit the panic print if
it is not fatal or the user does not want to see all dumps.

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:13 +00:00
Peter Ujfalusi
12b401f4de
ASoC: SOF: Use sof_debug_check_flag() instead of sof_core_debug directly
The sof_debug_check_flag() is available for checking flags set in
sof_core_debug.

sof_core_debug can be marked static in core.c

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:12 +00:00
Peter Ujfalusi
f902b21adb
ASoC: SOF: core: Add simple wrapper to check flags in sof_core_debug
The sof_debug_check_flag() can be used to check a flag or a combination of
them in sof_core_debug.

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:10 +00:00
Peter Ujfalusi
b2539ef00e
ASoC: SOF: Intel: hda-loader: Avoid re-defining the HDA_FW_BOOT_ATTEMPTS
HDA_FW_BOOT_ATTEMPTS is defined in hda.h, do not define it again locally
in hda-loader.c

At the same time correct the indentation for the define in hda.h

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:09 +00:00
Peter Ujfalusi
72b8ed83f7
ASoC: SOF: ops: Use dev_warn() if the panic offsets differ
Catch the cases when the stored sdev->dsp_oops_offset and the offset
received via the panic message differs and print a warning, but keep using
the dsp_oops_offset for the oops query.

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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 13:38:08 +00:00
Takashi Iwai
065807d758 ASoC: Fixes for v5.16
This is a relatively large set of driver specific changes so it may make
 sense to hold off to v5.17, though picking some over might be good.
 It's a combination of new device IDs and fixes for various driver
 specific things which are all small and of the usual "really bad if
 you're running into them" level, especially the Tegra ones.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmHAujcACgkQJNaLcl1U
 h9BlCQf/dCcwkh8e80lJwlRhqZUc71ZiXE9gw8aR+9qn+TLabIlNW+lCU/RWGx5h
 EXZxBapZ2GbTNf16ZpyTVPfLWUwIZnxOiahigtdSwW97KtfY8oTU5wRdTMmc7NDl
 mJy5rqn7sjeoZcXe8NZtX2BmbBRHMq9AhECt56ji6Z7jS2OwPKPYHegA7EFrJ6lX
 zBntFWxDkffj2tsfdn7HPLbcILjvm5+3Q8Fu8XfKh1f6qtGKqd19ldcKzJUL2IqR
 HaKvMSMQOtDVKCCtFVZ2WMwoZyRQOEmHWjM0I4tKEIVsRrE/VujpUr8TILLenl7R
 9LWqe9FFQzwLjsUKZi1+xcMul+o8KA==
 =gLlq
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v5.16

This is a relatively large set of driver specific changes so it may make
sense to hold off to v5.17, though picking some over might be good.
It's a combination of new device IDs and fixes for various driver
specific things which are all small and of the usual "really bad if
you're running into them" level, especially the Tegra ones.
2021-12-22 18:07:27 +01:00
Vincent Knecht
37daf8d9e0
ASoC: codecs: ak4375: Change invert controls to a stereo switch
Don't use enums for DACL/DACR Signal Invert controls,
and change them into a stereo "DAC Signal Invert Switch" control.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Link: https://lore.kernel.org/r/20211222135403.2991657-1-vincent.knecht@mailoo.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-22 14:57:07 +00:00
Vincent Knecht
53778b8292
ASoC: Add AK4375 support
AK4375 is a 32-bit stereo DAC with headphones amplifier.
There's no documentation for it on akm.com, and only a brief
datasheet can be found floating on the internets [1].

Thanks to Oriane BAYERD <obayerd@eurocomposant.fr>
for finally answering my inquiries through akm.com, if only to tell
me that this chip is EOL following AKM factory burning in october 2020
and thus no detailed documentation is available anymore...

AK4331 is advertised [2] as pin and register compatible with AK4375
so some scraps of its datasheet were used and this driver might be
used as a base for it, but this is totally untested.

So this driver is mainly based on downstream code [3] and [4]
by Hu Jin from AKM (no known email).

Tested on msm8916-alcatel-idol347 and msm8939-alcatel-idol3,
which both use PLL driven clock with bypass of SRC (sample rate
converter), so only this setup is supported for now.

[1] https://datasheetspdf.com/pdf-file/1400317/AKM/AK4375A/1
[2] https://www.akm.com/content/dam/documents/products/audio/audio-dac/ak4331ecb/ak4331ecb-en-datasheet.pdf
[3] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/alcatel-idol347/sound/soc/codecs/idol347/ak4375.c
[4] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/alcatel-idol347/sound/soc/codecs/ak4375.c

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Link: https://lore.kernel.org/r/20211220193725.2650356-2-vincent.knecht@mailoo.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:45 +00:00
Lad Prabhakar
5de035c270
ASoC: bcm: Use platform_get_irq() to get the interrupt
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

While at it also drop "r_irq" member from struct bcm_i2s_priv as there
are no users of it.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20211221170100.27423-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:43 +00:00
Lad Prabhakar
c2efaf8f2d
ASoC: xlnx: Use platform_get_irq() to get the interrupt
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20211221170100.27423-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:42 +00:00
Ajit Kumar Pandey
15443f6cab
ASoC: amd: acp: Remove duplicate dependency in Kconfig
Remove duplicate depends on statement in Kconfig file.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211221171912.237792-1-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:41 +00:00
Dan Carpenter
ac1e6bc146
ASoC: qdsp6: fix a use after free bug in open()
This code frees "graph" and then dereferences to save the error code.
Save the error code first and then use gotos to unwind the allocation.

Fixes: 59716aa3f9 ("ASoC: qdsp6: Fix an IS_ERR() vs NULL bug")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211217150007.GB16611@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:40 +00:00
Pierre-Louis Bossart
2dc643cd75
ASoC: SOF: AMD: simplify return status handling
cppcheck warning:

sound/soc/sof/amd/acp.c:222:9: warning: Identical condition and return
expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/sof/amd/acp.c:213:6: note: If condition 'ret' is true, the
function will return/exit
 if (ret)
     ^
sound/soc/sof/amd/acp.c:222:9: note: Returning identical expression 'ret'
 return ret;
        ^

Just return 0; on success.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211221165802.236843-1-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 18:05:39 +00:00
Ajit Kumar Pandey
0082e3299a
ASoC: amd: acp-config: Update sof_tplg_filename for SOF machines
SOF machines support different codec end points and hence required
different topologies configuration. Update tplg filename in machine
struct to load different topology files for SOF machines.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211221161814.236318-3-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 16:40:25 +00:00
Ajit Kumar Pandey
f487201343
ASoC: amd: acp-config: Enable SOF audio for Google chrome boards.
We need to support sof audio on different variants of Google boards.
Add new entry in dmi table to enable SOF flag on Google chrome boards.
Also add newer machines to sof_machines list with codecs and amps acpi
id check to register sof sound cards on different variants.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Link: https://lore.kernel.org/r/20211221161814.236318-2-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-21 16:40:24 +00:00
Mark Brown
38fa8d3cac
ASoC: Use dev_err_probe() helper
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

This patch-set tries to use dev_err_probe() helper function
instead of manual dev_err() code.
I hope ASoC will be more clean code by this patch-set.
2021-12-21 02:48:48 +00:00
Tzung-Bi Shih
98bf33ca3f
ASoC: mediatek: mt8195-mt6359: reduce log verbosity in probe()
Eliminates error messages if snd_soc_register_card() failed.  Kernel
emits messages if device probe error anyway.

This is mainly for removing the following error messages during boot.
    >>> snd_soc_register_card fail -517

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211220093408.207206-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 20:26:53 +00:00
Ricard Wanderlof
e9a3b57efd
ASoC: codec: tlv320adc3xxx: New codec driver
New codec driver for Texas Instruments TLV320ADC3001 and
TLV320ADC3101 audio ADCs.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2112151801370.27889@lap5cg0092dnk.se.axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:31 +00:00
Kuninori Morimoto
11a95c583c
ASoC: sunxi: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-23-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:24 +00:00
Kuninori Morimoto
efc162cbd4
ASoC: stm: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-22-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:23 +00:00
Kuninori Morimoto
27c6eaebcf
ASoC: samsung: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-21-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:22 +00:00
Kuninori Morimoto
b3a66d22a2
ASoC: rockchip: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-20-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:21 +00:00
Kuninori Morimoto
ab6c3e68ab
ASoC: qcom: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-19-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:20 +00:00
Kuninori Morimoto
7a17f6a95a
ASoC: mxs: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-18-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:18 +00:00
Kuninori Morimoto
2ff4e003e8
ASoC: meson: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-17-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:17 +00:00
Kuninori Morimoto
ef12f373f2
ASoC: img: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-16-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:16 +00:00
Kuninori Morimoto
7a0299e13b
ASoC: generic: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-15-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:15 +00:00
Kuninori Morimoto
2e6f557ca3
ASoC: fsl: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-14-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:14 +00:00
Kuninori Morimoto
88fb6da3f4
ASoC: ti: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-13-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:13 +00:00
Kuninori Morimoto
0624dafa6a
ASoC: ateml: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-12-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:12 +00:00
Kuninori Morimoto
7ff27faec8
ASoC: codecs: tlv320aic31xx: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-11-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:11 +00:00
Kuninori Morimoto
382ae99559
ASoC: codecs: ssm2305: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-10-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:10 +00:00
Kuninori Morimoto
17d7044715
ASoC: codecs: simple-mux: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-9-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:09 +00:00
Kuninori Morimoto
2c16636a8b
ASoC: codecs: simple-amplifier: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-8-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:08 +00:00
Kuninori Morimoto
ec1e0e72a8
ASoC: codecs: sgtl5000: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-7-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:07 +00:00
Kuninori Morimoto
526f6ca95a
ASoC: codecs: pcm3168a: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-6-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:06 +00:00
Kuninori Morimoto
edfe9f451a
ASoC: codecs: max9860: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-5-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:05 +00:00
Kuninori Morimoto
6df96c8f5b
ASoC: codecs: max9759: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-4-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:03 +00:00
Kuninori Morimoto
900b4b911a
ASoC: codecs: es7241: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-3-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:02 +00:00
Kuninori Morimoto
5ea4e76b73
ASoC: codecs: ak4118: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-2-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:47:01 +00:00
Trevor Wu
30e693ee82
ASoC: mediatek: mt8195: correct default value
mt8195_cg_patch is used to reset the default value of audio cg, so the
register value could be consistent with CCF reference count.
Nevertheless, AUDIO_TOP_CON1[1:0] is used to control an internal mux,
and it's expected to keep the default value 0.

This patch corrects the default value in case an unexpected behavior
happens in the future.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211216022424.28470-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:45:17 +00:00
Mark Brown
c50384d7e3
ASoC: Intel: catpt: Dma-transfer fix and couple
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Set is made of one fix for dma-transfer so that result of
dmaengine_submit() is tested before moving on, and few cleanups:

- two non-impactful, where catpt_component_open() layout gets improved
  slightly as well as relocation of couple of locals found in
  PCM-functions so that they look more cohesive
- no need to expose catpt-driver board-matching information globally.
  Most fields are not by it and it's the sole user of haswell_machines
  table. By having them locally it is clear what is actually being used

Cezary Rojewski (5):
  ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
  ASoC: Intel: catpt: Reduce size of catpt_component_open()
  ASoC: Intel: catpt: Streamline locals declaration for PCM-functions
  ASoC: Intel: catpt: Drop SND_SOC_ACPI_INTEL_MATCH dependency
  ASoC: Intel: Drop legacy HSW/BDW board-match information

 include/sound/soc-acpi-intel-match.h          |  1 -
 sound/soc/intel/Kconfig                       |  2 +-
 sound/soc/intel/catpt/device.c                | 33 +++++++++++++++--
 sound/soc/intel/catpt/dsp.c                   | 14 ++++++-
 sound/soc/intel/catpt/pcm.c                   | 37 +++++++++----------
 .../common/soc-acpi-intel-hsw-bdw-match.c     | 16 --------
 6 files changed, 61 insertions(+), 42 deletions(-)

--
2.25.1
2021-12-17 17:32:48 +00:00
Mark Brown
be1d03eecc
Support HDMI audio on NVIDIA Tegra20
Merge series from Dmitry Osipenko <digetx@gmail.com>:

This series revives Tegra20 S/PDIF driver which was upstreamed long time
ago, but never was used. It also turns Tegra DRM HDMI driver into HDMI
audio CODEC provider. Finally, HDMI audio is enabled in device-trees.
For now the audio is enable only for Acer A500 tablet and Toshiba AC100
netbook because they're already supported by upstream, later on ASUS TF101
tablet will join them.

I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
that removes obsolete slave_id. This eases merging of the patches by
removing the merge conflict. This is a note for Mark Brown.

I also based this series on top of power management series [2]. I.e. [2]
should be applied first, otherwise "Add S/PDIF node to Tegra20 device-tree"
patch should have merge conflict. This is a note for Thierry.

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=273312
[2] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=274534

Changelog:

v4: - Added patches that update multi_v7_defconfig with the enabled S/PDIF
      and APB DMA drivers.

v3: - Renamed S/PDIF device-tree clocks as was suggested by Rob Herring.

    - Added r-bs and acks that were given by Rob Herring to v2.

v2: - Corrected I2S yaml problem that was reported by the DT bot for v1
      by removing the non-existent required clock-names property.

    - Removed assigned-clocks property from S/PDIF yaml since this property
      is now inherited from the clocks property.

    - Reordered the "tegra20: spdif: Set FIFO trigger level" patch, making
      it the first sound/soc patch in the series, like it was suggested by
      Mark Brown in the comment to v1. Also reworded commit message of this
      patch to *not* make it looks like it should be backported to stable
      kernels.

Arnd Bergmann (1):
  ASoC: tegra20-spdif: stop setting slave_id

Dmitry Osipenko (21):
  ASoC: dt-bindings: Add binding for Tegra20 S/PDIF
  ASoC: dt-bindings: tegra20-i2s: Convert to schema
  ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate
    property
  dt-bindings: host1x: Document optional HDMI sound-dai-cells
  ASoC: tegra20: spdif: Set FIFO trigger level
  ASoC: tegra20: spdif: Support device-tree
  ASoC: tegra20: spdif: Improve driver's code
  ASoC: tegra20: spdif: Use more resource-managed helpers
  ASoC: tegra20: spdif: Reset hardware
  ASoC: tegra20: spdif: Support system suspend
  ASoC: tegra20: spdif: Filter out unsupported rates
  ASoC: tegra20: i2s: Filter out unsupported rates
  drm/tegra: hdmi: Unwind tegra_hdmi_init() errors
  drm/tegra: hdmi: Register audio CODEC on Tegra20
  ARM: tegra_defconfig: Enable S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 APB DMA driver
  ARM: tegra: Add S/PDIF node to Tegra20 device-tree
  ARM: tegra: Add HDMI audio graph to Tegra20 device-tree
  ARM: tegra: acer-a500: Enable S/PDIF and HDMI audio
  ARM: tegra: paz00: Enable S/PDIF and HDMI audio

 .../display/tegra/nvidia,tegra20-host1x.txt   |   1 +
 .../bindings/sound/nvidia,tegra20-i2s.txt     |  30 ---
 .../bindings/sound/nvidia,tegra20-i2s.yaml    |  77 +++++++
 .../bindings/sound/nvidia,tegra20-spdif.yaml  |  85 ++++++++
 .../boot/dts/tegra20-acer-a500-picasso.dts    |   8 +
 arch/arm/boot/dts/tegra20-paz00.dts           |   8 +
 arch/arm/boot/dts/tegra20.dtsi                |  40 +++-
 arch/arm/configs/multi_v7_defconfig           |   2 +
 arch/arm/configs/tegra_defconfig              |   1 +
 drivers/gpu/drm/tegra/Kconfig                 |   3 +
 drivers/gpu/drm/tegra/hdmi.c                  | 168 +++++++++++++--
 sound/soc/tegra/tegra20_i2s.c                 |  49 +++++
 sound/soc/tegra/tegra20_spdif.c               | 197 ++++++++++++------
 sound/soc/tegra/tegra20_spdif.h               |   1 +
 sound/soc/tegra/tegra_pcm.c                   |   6 +
 sound/soc/tegra/tegra_pcm.h                   |   1 +
 16 files changed, 574 insertions(+), 103 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml

--
2.33.1
2021-12-17 17:32:46 +00:00
Mark Brown
a92c1cd335
ASoC: SOF: couple of cleanups
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Guennadi spotted inconsistencies with our 'const' handling, Ajit Kumar
flagged a missing check for a null pointer and we missed the
definition of debug zones.
2021-12-17 17:32:45 +00:00
Mark Brown
f7c7ecaba4
ASoC: SOF: remove suport for TRIGGER_RESUME
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

None of the SOF platforms support INFO_RESUME, and rely on the
indirect path used by the ALSA core with the prepare and TRIGGER_START
steps.

Let's remove the left-over dead code.
2021-12-17 17:32:44 +00:00
Heiner Kallweit
f04b4fb47d
ASoC: sh: rz-ssi: Check return value of pm_runtime_resume_and_get()
The return value of pm_runtime_resume_and_get() needs to be checked to
avoid a usage count imbalance in the error case. This fix is basically
the same as 92c959bae2 ("reset: renesas: Fix Runtime PM usage"),
and the last step before pm_runtime_resume_and_get() can be annotated
as __must_check.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/9fed506d-b780-55cd-45a4-9bd2407c910f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 16:21:17 +00:00
Cezary Rojewski
a62a02986d
ASoC: Intel: catpt: Streamline locals declaration for PCM-functions
Group all the catpt_xxx structs together in PCM related functions so
they look more cohesive.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 16:20:38 +00:00
Cezary Rojewski
dad492cfd2
ASoC: Intel: catpt: Reduce size of catpt_component_open()
With some improved if-logy, function's size can be reduced slightly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 16:20:37 +00:00
Cezary Rojewski
2a9a72e290
ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
After calling dmaengine_submit(), the submitted transfer descriptor
belongs to the DMA engine. Pointer to that descriptor may no longer be
valid after the call and should be tested before awaiting transfer
completion.

Reported-by: Kevin Tian <kevin.tian@intel.com>
Suggested-by: Dave Jiang <dave.jiang@intel.com>
Fixes: 4fac9b31d0 ("ASoC: Intel: Add catpt base members")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 16:20:36 +00:00
Dmitry Osipenko
bfa4671db1
ASoC: tegra20: i2s: Filter out unsupported rates
Support new nvidia,fixed-parent-rate device-tree property which instructs
I2S that board wants parent clock rate to stay at a fixed rate. This allows
to play audio over S/PDIF and I2S simultaneously. The root of the problem
is that audio components on Tegra share the same audio PLL, and thus, only
a subset of rates can be supported if we want to play audio simultaneously.
Filter out audio rates that don't match parent clock rate if device-tree
has the nvidia,fixed-parent-rate property.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-14-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:14:01 +00:00
Dmitry Osipenko
9d8f51cd1f
ASoC: tegra20: spdif: Filter out unsupported rates
SPDIF and other SoC components share audio PLL on Tegra, thus only one
component may set the desired base clock rate. This creates problem for
HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock
doesn't exactly match standard audio rate since some receivers may reject
audio in that case. Filter out audio rates which SPDIF output can't
support, assuming that other components won't change rate at runtime.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-13-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:59 +00:00
Dmitry Osipenko
d51693092e
ASoC: tegra20: spdif: Support system suspend
Support system suspend by enforcing runtime PM suspend/resume.
Now there is no doubt that h/w is indeed stopped during suspend
and that h/w state will be properly restored after resume.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-12-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:58 +00:00
Dmitry Osipenko
ec1b4545d7
ASoC: tegra20: spdif: Reset hardware
Reset S/PDIF controller on runtime PM suspend/resume to ensure that we
always have a consistent hardware state.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-11-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:57 +00:00
Dmitry Osipenko
150f4d573f
ASoC: tegra20: spdif: Use more resource-managed helpers
Use resource-managed helpers to make code cleaner. Driver's remove callback
isn't needed anymore since driver is completely resource-managed now.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-10-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:56 +00:00
Dmitry Osipenko
117aeed439
ASoC: tegra20: spdif: Improve driver's code
- Clean up whitespaces, defines and variables.

- Remove obsolete code.

- Adhere to upstream coding style.

- Don't override returned error code.

- Replace pr_err with dev_err.

No functional changes are made by this patch. This is a minor code's
refactoring that will ease further maintenance of the driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-9-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:55 +00:00
Dmitry Osipenko
c0000fc618
ASoC: tegra20: spdif: Support device-tree
Tegra20 S/PDIF driver was added in a pre-DT era and was never used since
that time. Revive driver by adding device-tree support.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-8-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:54 +00:00
Dmitry Osipenko
16736a0221
ASoC: tegra20: spdif: Set FIFO trigger level
FIFO trigger level must be not less than the size of DMA burst, otherwise
audio will be played x4 faster that it should be because part of the DMA
data will be dropped on FIFO input buffer overflow.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-6-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:13:53 +00:00
Mark Brown
5a49d926da dmaengine_topic_slave_id_removal_5.17
Tag for dmaengine slave_id removal topic branch which should be merged
 into v5.17
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmG8J+UACgkQfBQHDyUj
 g0cmEQ/9H5sOft40t02H4tKkdIm8ZvEL4p58+Dzkv09YR7PjGH9pOWoPikzMozNe
 aQVIoMs+0QAe9HmaHNOqEgXX3yCswm+PTl9KoULOzMZGMIbw9KxeippVvpqybgtH
 flxVPBN/u++WEyPUHRWkr8TCHRzDZjzOQDlHVfOFTl09oNM302Mmz7XasArDwQkI
 X3FIpI4mDsWxXOE2hX+A6zqUTqhakV+KBg7a7/JpPnJ558REsvdOxTTRVyW8dQiW
 O5EXvrCqus6Ahtu+NIJ3wHjEHcn2pUBeuDRGJgo729f9tBa4ERcZIWSoMXPNLqZm
 jbmyoUZIBt6DCTwwd+k35BtreN47dfxY7KIjX3D3qdWDPOBrWsVUIhbEjkzIUqOa
 mnEJf6mdDs9z6qCDTYm+Fly7n0bFaOSs94wLWbccxf5PK1ZnS8yI7XcWrA37WRl/
 5196CvFoMx4n68QJeyv1PdMEzSMb2aubniOohgfMrPE1HxBdRYcikzoNExiwZeGs
 m5oIAQ0bCAu/Jp1c1m/wMN5hE2KSzGQY6L/8h0Jl4ML1jn2x6QGQa6NkHhpVH2AX
 5aNF2tOUFNUN8MxunU7eNTE3icpIwhWnW5emfRwrW7sbhPvssbN+O6Pv30TgjA5e
 gvtytGO8sXFhRFKoVpMEPI/CYyYz8hxGJKLnLFSvcLYkZN9yvig=
 =Mpf8
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmG8cOYACgkQJNaLcl1U
 h9D+Wgf+PdDgmb/kBATZNCfSa13y0A18EVC0ETrCn7EBQt6UbyU5Zx/rVOe8Sjw+
 d/kuqc0WCV3UrSdnZHh1pYpn/eqRh6KJCufMJFQiYAEwjJi5TQ5eYDHf7sd0oEI8
 NOkTJbl26UImAsnsHcC35moHyTH2U8sKoEeva5i/MIXxBpn+3cIWnmjUi7ZUEzLu
 qmZDPEYHVRklcbFEWI7oehb68hJlTHz2PY9ARM+sTUica9owlTiaGRD2WX+Wtc5G
 fx0rWoIiFUGnW2qoRBX7yNOBKvzmT6m+pqPMQ/LAjE1Xa4Cb0e87fm33b1QFhuEk
 CYFHAAzKem/3GskXlR57fY4p8CvJmQ==
 =6fXc
 -----END PGP SIGNATURE-----

Merge tag 'dmaengine_topic_slave_id_removal_5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine into v4_20211204_digetx_support_hdmi_audio_on_nvidia_tegra20

dmaengine_topic_slave_id_removal_5.17

Tag for dmaengine slave_id removal topic branch which should be merged
into v5.17
2021-12-17 11:13:39 +00:00
Peter Ujfalusi
4941cd7cc8
ASoC: SOF: Kconfig: Make the SOF_DEVELOPER_SUPPORT depend on SND_SOC_SOF
SND_SOC_SOF_DEVELOPER_SUPPORT contains options affecting how the built
SOF driver stack will behave, enables debug options and other features.

These options have no meaning if the SND_SOC_SOF is not even enabled.

If we have SOF client options under developer_support and debug they can
be selected to be built even without the core, but they do need symbols
from the core (the sof-client API) which can result build failure.

In Kconfig we can have
SND_SOC_SOF_TOPLEVEL=y
SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST=y

for example, which will make the flood client to be built, but the SOF core
is not as SND_SOC_SOF is not selected.

Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216230350.343857-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:22 +00:00
Ajit Kumar Pandey
182b682b9a
ASoC: SOF: ipc: Add null pointer check for substream->runtime
When pcm stream is stopped "substream->runtime" pointer will be set
to NULL by ALSA core. In case host received an ipc msg from firmware
of type IPC_STREAM_POSITION after pcm stream is stopped, there will
be kernel NULL pointer exception in ipc_period_elapsed(). This patch
fixes it by adding NULL pointer check for "substream->runtime".

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216232422.345164-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:18 +00:00
Guennadi Liakhovetski
cb515f105c
ASoC: SOF: avoid casting "const" attribute away
Casting "const" attribute away is dangerous, obtain a writable
pointer instead to avoid that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216232422.345164-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:16 +00:00
Ranjani Sridharan
35218cf618
ASoC: SOF: Intel: hda: remove support for RESUME in platform trigger
The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
component driver trigger op. So, remove handling the RESUME trigger in
the platform trigger op for HDA platforms.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216231628.344687-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:15 +00:00
Ranjani Sridharan
9b465060d1
ASoC: SOF: Intel: hda: remove support for RESUME trigger
The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
HDA DAI BE trigger op.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216231628.344687-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:13 +00:00
Ranjani Sridharan
eed5391f67
ASoC: SOF: pcm: remove support for RESUME trigger
The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
component driver trigger op.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216231628.344687-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-17 11:06:12 +00:00
Arnd Bergmann
0725ac9ac4 ASoC: tegra20-spdif: stop setting slave_id
The DMA resource is never set up anywhere, and passing this as slave_id
has not been the proper procedure in a long time.

As a preparation for removing all slave_id references from the ALSA code,
remove this one.

According to Dmitry Osipenko, this driver has never been used and
the mechanism for configuring DMA would not work as it is implemented,
so this part will get rewritten when the driver gets put into use
again in the future.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-2-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-12-17 11:23:38 +05:30
Mark Brown
0f2ee77d26
ASoC: Changes to SOF kcontrol data set/get ops
Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

This set of patches deals with modifications to the signature of kcontrol
get/set data functions to make them more intuitive. The last patch deals
with initializing the binary control data size after boot up.
2021-12-16 02:19:14 +00:00
Pierre-Louis Bossart
fb6c83cab3
ASoC: AMD: fix depend/select mistake on SND_AMD_ACP_CONFIG
on i386 or x86_64:

when # CONFIG_ACPI is not set,
so SND_SOC_ACPI is not set:

WARNING: unmet direct dependencies detected for SND_AMD_ACP_CONFIG
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
  SND_SOC_ACPI [=n]
  Selected by [y]:
  - SND_SOC_AMD_ACP_COMMON [=y] && SOUND [=y] && !UML && SND [=y] &&
  SND_SOC [=y] && X86 [=y] && PCI [=y]

This problem is due to the unconditional selection of
SND_AMD_ACP_CONFIG in other options. Using 'depends on' solved an
initial problem but exposed another, let's use select instead.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: d9b994cd76 ('ASoC: AMD: acp-config: fix missing dependency on SND_SOC_ACPI')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211215163511.151286-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:51 +00:00
Ranjani Sridharan
fc5adc2bb1
ASoC: SOF: topology: read back control data from DSP
Read back the control data from the DSP to initialize the control data
size to match that of the data in the DSP. This is particularly useful
for volatile read-only kcontrols in static pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:48 +00:00
Peter Ujfalusi
47d7328f8c
ASoC: SOF: Drop ctrl_type parameter for snd_sof_ipc_set_get_comp_data()
The SOF_CTRL_TYPE_VALUE_COMP_* type is not used by the firmware nor in the
kernel side.
It is also not clear what action should be taken for such type.

With this in mind:
The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_CTRL_TYPE_DATA_*
otherwise SOF_CTRL_TYPE_VALUE_CHAN_*.

The SET or GET direction can be selected with the use of `set` parameter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:47 +00:00
Peter Ujfalusi
68be4f0ed4
ASoC: SOF: control: Do not handle control notification with component type
The component type is not used in firmware nor in the kernel currently and
it is not even clear how it should be handled.

Do not even try to handle it to avoid errors.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:46 +00:00
Peter Ujfalusi
dd2fef982f
ASoC: SOF: sof-audio: Drop the cmd member from struct snd_sof_control
There is no need to use two variables to store and check the same
information, the scontrol->cmd is the same as scontrol->control_data->cmd.

Drop the former one and when it is needed, access the cmd from the
control_data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:44 +00:00
Peter Ujfalusi
9182f3c40b
ASoC: SOF: Drop ctrl_cmd parameter for snd_sof_ipc_set_get_comp_data()
The scontrol->control_data->cmd has been configured during initialization
to the correct sof_ipc_ctrl_cmd.

No need to pass duplicated information, let's use the already available
one via scontrol.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:43 +00:00
Peter Ujfalusi
8af783723f
ASoC: SOF: topology: Set control_data->cmd alongside scontrol->cmd
Set the scontrol->control_data->cmd early to the same as scontrol->cmd.

This is a preparatory patch to remove the ctrl_cmd parameter for the
snd_sof_ipc_set_get_comp_data() function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:42 +00:00
Peter Ujfalusi
d4a06c4334
ASoC: SOF: Drop ipc_cmd parameter for snd_sof_ipc_set_get_comp_data()
The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_IPC_COMP_*_DATA
otherwise SOF_IPC_COMP_*_VALUE.

The SET or GET direction can be selected with the use of `set` parameter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:41 +00:00
Peter Ujfalusi
9d562fdcd5
ASoC: SOF: ipc: Rename send parameter in snd_sof_ipc_set_get_comp_data()
Rename the send parameter to set in snd_sof_ipc_set_get_comp_data() and
sof_set_get_large_ctrl_data() to be more aligned with the function name.

No functional change.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 22:16:40 +00:00
Jiasheng Jiang
2167c0b205
ASoC: rt5663: Handle device_property_read_u32_array error codes
The return value of device_property_read_u32_array() is not always 0.
To catch the exception in case that devm_kzalloc failed and the
rt5663->imp_table was NULL, which caused the failure of
device_property_read_u32_array.

Fixes: 450f0f6a8f ("ASoC: rt5663: Add the manual offset field to compensate the DC offset")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 14:02:52 +00:00
Daniel Baluta
28084f4a0e
ASoC: SOF: OF: Avoid reverse module dependency
Similar with commit 8a49cd11e6 ("ASoC: SOF: ACPI: avoid reverse
module dependency") we will be having hardware specific drivers that
link against a common "helper" framework.

sof-of-dev.c becomes a library with the interface defined in the newly
created file sof-of-dev.h.

This is the final step started with Kconfig simplification in
commit 7548a391c5 ("ASoC: SOF: i.MX: simplify Kconfig")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211215085703.137414-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-15 14:02:50 +00:00
Mark Brown
9e376b14ef
ASoC : soc-pcm: fix trigger race conditions with shared BE
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

We've been adding a 'deep buffer' PCM device to several SOF topologies
in order to reduce power consumption. The typical use-case would be
music playback over a headset: this additional PCM device provides
more buffering and longer latencies, leaving the rest of the system
sleep for longer periods. Notifications and 'regular' low-latency
audio playback would still use the 'normal' PCM device and be mixed
with the 'deep buffer' before rendering on the headphone endpoint. The
tentative direction would be to expose this alternate device to
PulseAudio/PipeWire/CRAS via the UCM SectionModifier definitions.

That seemed a straightforward topology change until our automated
validation stress tests started reporting issues on SoundWire
platforms, when e.g. two START triggers might be send and conversely
the STOP trigger is never sent. The SoundWire stream state management
flagged inconsistent states when the two 'normal' and 'deep buffer'
devices are used concurrently with rapid play/stop/pause monkey
testing.

Looking at the soc-pcm.c code, it seems that the BE state
management needs a lot of love.

a) there is no consistent protection for the BE state. In some parts
of the code, the state updates are protected by a spinlock but in the
trigger they are not. When we open/play/close the two PCM devices in
stress tests, we end-up testing a state that is being modified. That
can't be good.

b) there is a conceptual deadlock: on stop we check the FE states to
see if a shared BE can be stopped, but since we trigger the BE first
the FE states have not been modified yet, so the TRIGGER_STOP is never
sent.

This patchset suggests the removal of the dedicated 'dpcm_lock' and
follows the design suggested by Takashi Iwai.  By default the
protection relies on the 'pcm_mutex', except for the FE and BE
triggers where the mutex cannot be used.  In this case, the FE PCM
lock is used instead. In the cases where a BE is added/removed, the
pcm_mutex and FE PCM lock are both taken.  In addition, the BE PCM
lock is used to serialize access to a shared BE.

With these patches I am able to run our entire validation suite
without any issues with this new 'deep buffer' topology, and no
regressions on existing solutions [1]. The tests were reproduced by
Bard Liao for SoundWire devices.

One might ask 'how come we didn't see this earlier'? The answer is
probably that the .trigger callbacks in most implementations seems to
perform DAPM operations, and sending the triggers multiple times is
not an issue. In the case of SoundWire, we do use the .trigger
callback to reconfigure the bus using the 'bank switch' mechanism. It
could be acceptable to tolerate a trigger multiple times, but the
deadlock on stop cannot be fixed at the SoundWire level alone.

Opens:

1) The issues reported by Nvidia on the RFCv3 may or may not be
present. We'd need test results to make sure the locking update does
not introduce a regression on Tegra.

2) There are other reports of kernel oopses [2] that seem related to
the lack of protection. I'd be good to confirm if this patchset solve
these problems as well.

[1] https://github.com/thesofproject/linux/pull/3146
[2] https://lore.kernel.org/alsa-devel/002f01d7b4f5$c030f4a0$4092dde0$@samsung.com/

changes since RFCv3:
Used two patches from Takashi. We now use the pcm_mutex, the FE stream
lock when adding and deleting a BE, and the BE stream lock to handle
concurrency between streams using the same BE.
Added a patch to use GFP_ATOMIC for the DPCM structure.
Fixed PAUSE_RELEASE transition (GitHub comment from Kai Vehmanen)

changes since RFCv2:
Removal of dpcm_lock to use FE PCM locks (credits to Takashi Iwai for
the suggestion). The FE PCM lock is now used before each use of
for_each_dpcm_be() - with the exception of the trigger where the lock
is already taken. This change is also applied in drivers which make
use of this loop (compress, SH, FSL).
Addition of BE PCM lock to deal with mutual exclusion between triggers
for the same BE.
Alignment of the BE atomicity on the FE on connections, this is
required to avoid sleeping in atomic context.
Additional cleanups (indentation, static functions)

changes since RFC v1:
Removed unused function
Removed exported symbols only used in soc-pcm.c, used static instead
Use a mutex instead of a spinlock
Protect all for_each_dpcm_be() loops
Fix bugs introduced in the refcount

Pierre-Louis Bossart (4):
  ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure
  ASoC: soc-pcm: align BE 'atomicity' with that of the FE
  ASoC: soc-pcm: test refcount before triggering
  ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE

Takashi Iwai (2):
  ASoC: soc-pcm: Fix and cleanup DPCM locking
  ASoC: soc-pcm: serialize BE triggers

 include/sound/soc-dpcm.h |   2 +
 include/sound/soc.h      |   2 -
 sound/soc/soc-core.c     |   1 -
 sound/soc/soc-pcm.c      | 351 +++++++++++++++++++++++++++------------
 4 files changed, 246 insertions(+), 110 deletions(-)

--
2.25.1
2021-12-15 02:02:41 +00:00
Miaoqian Lin
59716aa3f9
ASoC: qdsp6: Fix an IS_ERR() vs NULL bug
The function gpr_alloc_port return ERR_PTR on errors, it doesn't return
null.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20211211065840.1221-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:52 +00:00
Judy Hsiao
833a94aac5
ASoC: qcom: Distinguish headset codec by codec_dai->name
Distinguish which headset codec is on the board by codec_dai->name
instead of card->name.

It fixes the crash of being unable to handle kernel paging requests
at virtual address ADDR by initializing the correct audio codec on
the board.

Call stack of the crash:
```
 Unable to handle kernel paging request at virtual address ...
 ...
 Call trace:
  rt5682_set_component_pll+0xcc/0xb78 [snd_soc_rt5682]
  snd_soc_component_set_pll+0x90/0x154
  snd_soc_dai_set_pll+0xf4/0x1ac
  sc7180_snd_startup+0x268/0x3c0 [snd_soc_sc7180]
  snd_soc_link_startup+0xa4/0x180
  soc_pcm_open+0x35c/0x15c8
  snd_pcm_open_substream+0xa90/0x13b0
  snd_pcm_open+0x1a4/0x55c
  snd_pcm_capture_open+0x7c/0xe8
  snd_open+0x2b8/0x2e4
  chrdev_open+0x364/0x3d4
  do_dentry_open+0x66c/0xc58
  vfs_open+0x7c/0x8c
  path_openat+0x108c/0x2bbc
  do_filp_open+0x15c/0x258
  do_sys_open+0x278/0x62c
  __arm64_compat_sys_openat+0x9c/0xb0
  ...
```

Fixes: 425c5fce8a ("ASoC: qcom: Add support for ALC5682I-VS codec")
Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
Link: https://lore.kernel.org/r/20211214022509.1288245-1-judyhsiao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:51 +00:00
Pierre-Louis Bossart
3aa1e96a2b
ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE
A BE connected to more than one FE, e.g. in a mixer case, can go
through the following transitions.

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
stop FE2    -> BE state is STOP (see note [1] below)
release FE1 -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
release FE1 -> BE state is START
stop FE2    -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
play FE2    -> BE state is START (no change)
pause FE1   -> BE state is START (no change)
pause FE2   -> BE state is PAUSED
release FE1 -> BE state is START
release FE2 -> BE state is START (no change)
stop FE1    -> BE state is START (no change)
stop FE2    -> BE state is STOP

The existing code for PAUSE_RELEASE only allows for the case where the
BE is paused, which clearly would not work in the sequences above.

Extend the allowed states to restart the BE when PAUSE_RELEASE is
received, and increase the refcount if the BE is already in START.

[1] the existing logic does not move the BE state back to PAUSED when
the FE2 is stopped. This patch does not change the logic; it would be
painful to keep a history of changes on the FE side, the state machine
is already rather complicated with transitions based on the last BE
state and the trigger type.

Reported-by: Bard Liao <bard.liao@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:48 +00:00
Pierre-Louis Bossart
848aedfdc6
ASoC: soc-pcm: test refcount before triggering
On start/pause_release/resume, when more than one FE is connected to
the same BE, it's possible that the trigger is sent more than
once. This is not desirable, we only want to trigger a BE once, which
is straightforward to implement with a refcount.

For stop/pause/suspend, the problem is more complicated: the check
implemented in snd_soc_dpcm_can_be_free_stop() may fail due to a
conceptual deadlock when we trigger the BE before the FE. In this
case, the FE states have not yet changed, so there are corner cases
where the TRIGGER_STOP is never sent - the dual case of start where
multiple triggers might be sent.

This patch suggests an unconditional trigger in all cases, without
checking the FE states, using a refcount protected by the BE PCM
stream lock.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:47 +00:00
Takashi Iwai
b2ae806630
ASoC: soc-pcm: serialize BE triggers
When more than one FE is connected to a BE, e.g. in a mixing use case,
the BE can be triggered multiple times when the FE are opened/started
concurrently. This race condition is problematic in the case of
SoundWire BE dailinks, and this is not desirable in a general
case.

This patch relies on the existing BE PCM lock, which takes atomicity into
account. The locking model assumes that all interactions start with
the FE, so that there is no deadlock between FE and BE locks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[test, checkpatch fix and clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:46 +00:00
Takashi Iwai
b7898396f4
ASoC: soc-pcm: Fix and cleanup DPCM locking
The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:45 +00:00
Pierre-Louis Bossart
bbf7d3b1c4
ASoC: soc-pcm: align BE 'atomicity' with that of the FE
Since the flow for DPCM is based on taking a lock for the FE first, we
need to make sure during the connection between a BE and an FE that
they both use the same 'atomicity', otherwise we may sleep in atomic
context.

If the FE is nonatomic, this patch forces the BE to be nonatomic as
well. That should have no negative impact since the BE 'inherits' the
FE properties.

However, if the FE is atomic and the BE is not, then the configuration
is flagged as invalid.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[ removed FE stream lock by tiwai ]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:44 +00:00
Pierre-Louis Bossart
d8a9c6e1f6
ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure
We allocate a structure in dpcm_be_connect(), which may be called in
atomic context. Using GFP_KERNEL is not quite right, we have to use
GFP_ATOMIC to prevent the allocator from sleeping.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@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/20211207173745.15850-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:42 +00:00
Martin Blumenstingl
ee907afb0c
ASoC: meson: aiu: Move AIU_I2S_MISC hold setting to aiu-fifo-i2s
The out-of-tree vendor driver uses the following approach to set the
AIU_I2S_MISC register:
1) write AIU_MEM_I2S_START_PTR and AIU_MEM_I2S_RD_PTR
2) configure AIU_I2S_MUTE_SWAP[15:0]
3) write AIU_MEM_I2S_END_PTR
4) set AIU_I2S_MISC[2] to 1 (documented as: "put I2S interface in hold
   mode")
5) set AIU_I2S_MISC[4] to 1 (depending on the driver revision it always
   stays at 1 while for older drivers this bit is unset in step 4)
6) set AIU_I2S_MISC[2] to 0
7) write AIU_MEM_I2S_MASKS
8) toggle AIU_MEM_I2S_CONTROL[0]
9) toggle AIU_MEM_I2S_BUF_CNTL[0]

Move setting the AIU_I2S_MISC[2] bit to aiu_fifo_i2s_hw_params() so it
resembles the flow in the vendor kernel more closely. While here also
configure AIU_I2S_MISC[4] (documented as: "force each audio data to
left or right according to the bit attached with the audio data")
similar to how the vendor driver does this. This fixes the infamous and
long-standing "machine gun noise" issue (a buffer underrun issue).

Fixes: 6ae9ca9ce9 ("ASoC: meson: aiu: add i2s and spdif support")
Reported-by: Christian Hewitt <christianshewitt@gmail.com>
Reported-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
Tested-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
Cc: stable@vger.kernel.org
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20211206210804.2512999-3-martin.blumenstingl@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:32 +00:00
Martin Blumenstingl
1bcd326631
ASoC: meson: aiu: fifo: Add missing dma_coerce_mask_and_coherent()
The FIFO registers which take an DMA-able address are only 32-bit wide
on AIU. Add dma_coerce_mask_and_coherent() to make the DMA core aware of
this limitation.

Fixes: 6ae9ca9ce9 ("ASoC: meson: aiu: add i2s and spdif support")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20211206210804.2512999-2-martin.blumenstingl@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:29 +00:00
Martin Povišer
80d5be1a05
ASoC: tas2770: Fix setting of high sample rates
Although the codec advertises support for 176.4 and 192 ksps, without
this fix setting those sample rates fails with EINVAL at hw_params time.

Signed-off-by: Martin Povišer <povik@protonmail.com>
Link: https://lore.kernel.org/r/20211206224529.74656-1-povik@protonmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 17:15:28 +00:00
Derek Fang
8deb34a90f
ASoC: rt5682: fix the wrong jack type detected
Some powers were changed during the jack insert detection
and clk's enable/disable in CCF.
If in parallel, the influence has a chance to detect
the wrong jack type, so add a lock.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211214105033.471-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 13:37:35 +00:00
Mark Brown
190357e1e0
ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6
Merge series from Stephan Gerhold <stephan@gerhold.net>:

This series makes it possible to route audio through the combined
audio/modem DSP on MSM8916/APQ8016 devices instead of bypassing it using
the LPASS drivers. This is necessary to support certain functionality such
as voice call audio. See PATCH 4/5 for details.

Also, qcom,apq8016-sbc.txt is converted to DT schema by adding it to the
existing qcom,sm8250.yaml. The bindings are similar enough that it is easier
to share a single schema instead of duplicating everything into multiple ones.
2021-12-14 13:23:05 +00:00
Jiaxin Yu
03c2192ab6
ASoC: mediatek: assign correct type to argument
Fix the following sparse warning: (new ones prefixed by >>)
>> sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33:
     sparse: sparse: incorrect type in argument 3 (different base types)
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     expected unsigned int to
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     got restricted snd_pcm_format_t [usertype]

Correct discription of format, use S32_LE and S24_LE to distinguish the
different 32bit.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211209073224.21793-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 13:22:18 +00:00
Rikard Falkeborn
ec247fea73
ASoC: SOF: sof-probes: Constify sof_probe_compr_ops
The only usage of sof_probe_compr_ops is to assign its address to the
cops field in the snd_soc_dai_driver struct (in
sound/soc/sof/intel/hda-dai.c). Make it const to allow the compiler to
put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211204203220.54712-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 13:22:16 +00:00
Allen-KH Cheng
475b17b4a8
ASoC: SOF: Remove pm_runtime_put_autosuspend() for SOF OF device
In SOF OF device, pm_runtime_put_autosuspend() is not
matching any pm_runtime_get_sync().

This is imbalanced for PM runtime.

Also, for consistency we call pm_runtime_mark_last_busy()
before enabling PM runtime.

1. Remove pm_runtime_put_autosuspend() in probe_complete
2. Reorder PM runtime calls int probe_complete

Signed-off-by: Allen-KH Cheng <Allen-KH.Cheng@mediatek.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20211209200830.145005-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 13:22:16 +00:00
Stephan Gerhold
a78a42fb48
ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6
The apq8016-sbc-sndcard is designed to be used with the LPASS drivers
(bypassing the combined audio/modem DSP in MSM8916/APQ8016).
Make it possible to use QDSP6 audio instead for the msm8916-qdsp6-sndcard.

This only requires adding some additional hooks that set up the DPCM
backends correctly. Similar code is already used in drivers for newer
SoCs such as apq8096.c, sdm845.c and sm8250.c.

A slightly different initialization sequence is used for the apq8016-sbc
and msm8916-qdsp6 sound card by defining the apq8016_sbc_add_ops()
function as device match data.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211202145505.58852-6-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 22:44:02 +00:00
Pierre-Louis Bossart
290a7c5509
ASoC: SOF: Intel: add comment on JasperLake support
Explain why JasperLake is exposed in cnl.c instead of icl.c
No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20211207193947.71080-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:54 +00:00
Pierre-Louis Bossart
924631df41
ASoC: SOF: Intel: hda-dai: remove unused fields
The existing code does not use the 'host_dma_id', 'link_dma_id',
'host_bps' fields remove them.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207193947.71080-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:53 +00:00
Pierre-Louis Bossart
288fad2f71
ASoC: SOF: Intel: hda: add quirks for HDAudio DMA position information
The code inherited from the Skylake driver does not seem to follow any
known hardware recommendations.

The only two recommended options are
a) use DPIB registers if VC1 traffic is not allowed
b) use DPIB DDR update if VC1 traffic is used

In all of SOF-based updated, VC1 is not supported so we can 'safely'
move to using DPIB registers only.

This patch keeps the legacy code, in case there was an undocumented
issue lost to history, and adds the DPIB DDR update for additional
debug.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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/20211207193947.71080-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:51 +00:00
Pierre-Louis Bossart
ae81d8fd57
ASoC: SOF: hda-stream: only enable DPIB if needed
The existing code is inconsistent, we should only enable DPIB if the
'use_posbuf' field is true.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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/20211207193947.71080-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:48 +00:00
Pierre-Louis Bossart
12ce213821
ASoC: SOF: Intel: hda-ctrl: apply symmetry for DPIB
we use 'bus->use_posbuf && bus->posbuf.addr' in
hda_dsp_ctrl_init_chip(), use the same for hda_dsp_ctrl_stop_chip()

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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/20211207193947.71080-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:47 +00:00
Pierre-Louis Bossart
a792bfc1c2
ASoC: SOF: Intel: hda-stream: limit PROCEN workaround
The work-around enabled in hda-stream.c is only required on earlier
versions of SOCs/PCH (Skylake, KabyLake, ApolloLake,
GeminiLake). Before setting the format on the host DMA, it is required
to couple the host and link DMA - which as a consequence shall use the
same format.

This patch introduces a quirk field in the platform descriptor and
makes the work-around conditional. Newer platforms have
no limitations on the use of host and link DMA, which can use
different formats.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20211207193947.71080-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:45 +00:00
Ranjani Sridharan
c697ef868f
ASoC: SOF: Intel: ICL: move ICL-specific ops to icl.c
Move the ICL specific ops to icl.c. Also introduce a
macro ICL_DSP_HPRO_CORE_ID to define the core that
should be powered up when HPRO is enabled.

Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211207193947.71080-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:32:44 +00:00
Dmitry Osipenko
db635ba4fa
ASoC: tegra: Restore headphones jack name on Nyan Big
UCM of Acer Chromebook (Nyan) uses a different name for the headphones
jack. The name was changed during unification of the machine drivers and
UCM fails now to load because of that. Restore the old jack name.

Cc: <stable@vger.kernel.org>
Fixes: cc8f70f ("ASoC: tegra: Unify ASoC machine drivers")
Reported-by: Thomas Graichen <thomas.graichen@gmail.com> # T124 Nyan Big
Tested-by: Thomas Graichen <thomas.graichen@gmail.com> # T124 Nyan Big
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20211211231146.6137-2-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:23:33 +00:00
Dmitry Osipenko
d341b427c3
ASoC: tegra: Add DAPM switches for headphones and mic jack
UCM of Acer Chromebook (Nyan) uses DAPM switches of headphones and mic
jack. These switches were lost by accident during unification of the
machine drivers, restore them.

Cc: <stable@vger.kernel.org>
Fixes: cc8f70f ("ASoC: tegra: Unify ASoC machine drivers")
Reported-by: Thomas Graichen <thomas.graichen@gmail.com> # T124 Nyan Big
Tested-by: Thomas Graichen <thomas.graichen@gmail.com> # T124 Nyan Big
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20211211231146.6137-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-13 19:23:31 +00:00
Ameer Hamza
befe304536
ASoC: test-component: fix null pointer dereference.
Dereferncing of_id pointer will result in exception in current
implementation since of_match_device() will assign it to NULL.
Adding NULL check for protection.

Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
Link: https://lore.kernel.org/r/20211207142309.222820-1-amhamza.mgc@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-09 12:31:50 +00:00
Mark Brown
62df22396b
ASoC: amd: Convert to new style DAI format definitions
Convert the AMD machine drivers to use the new style defines for clocking
in DAI formats.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210915180957.39996-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 16:47:31 +00:00
Dan Carpenter
9abc21c966
ASoC: mediatek: mt8195: silence uninitialized variable warning
Smatch complains that we might hit the continue path on every iteration
through the loop.

    sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c:831
      mt8195_mt6359_rt1019_rt5682_card_late_probe()
    error: uninitialized symbol 'sof_comp'.

Initialize "sof_comp" to NULL to silence this warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211208151145.GA29257@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 15:31:29 +00:00
Pierre-Louis Bossart
d9b994cd76
ASoC: AMD: acp-config: fix missing dependency on SND_SOC_ACPI
With a custom .config, the following error is thrown:

ERROR: modpost: "snd_soc_acpi_codec_list"
[sound/soc/amd/snd-acp-config.ko] undefined!

Fix by adding a clear dependency on SND_SOC_ACPI

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211207192309.43883-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 13:59:26 +00:00
Yong Zhi
77659872be
ASoC: Intel: sof_rt5682: Move rt1015 speaker amp to common file
Move rt1015 driver code to common file to be consistent with
rt1011 and rt1015p.

No functional change.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211207192458.44007-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 13:07:59 +00:00
Shuming Fan
7cfa3d0073
ASoC: rt5682s: add delay time to fix pop sound issue
There is a pop noise at the beginning of the capture data.
This patch adds the delay time before stereo1 ADC unmute to fix the pop sound issue.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20211208101718.28945-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 13:07:58 +00:00
Pierre-Louis Bossart
639cd58be7
ASoC: Intel: boards: add 'static' qualifiers for max98390 routes
Sparse warnings:

sound/soc/intel/boards/sof_maxim_common.c:140:33: error: symbol
'max_98390_dapm_routes' was not declared. Should it be static?

sound/soc/intel/boards/sof_maxim_common.c:156:33: error: symbol
'max_98390_tt_dapm_routes' was not declared. Should it be static?

Fixes: f316c9d9ba ('ASoC: Intel: boards: add max98390 2/4 speakers support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211207211700.115319-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 13:07:57 +00:00
Mark Brown
3c732b6481
ASoC: fsl-asoc-card: Add missing Kconfig option for tlv320aic31xx
Merge series from Ariel D'Alessandro <ariel.dalessandro@collabora.com>:

This is a follow up of patchsets:

  [RFC patch 0/5] Support BCLK input clock in tlv320aic31xx
  [PATCH 0/4] fsl-asoc-card: Add optional dt property for setting mclk-id

Patch "ASoC: fsl-asoc-card: Support fsl,imx-audio-tlv320aic31xx codec"
in "[RFC patch 0/5] Support BCLK input clock in tlv320aic31xx" missed a
Kconfig option. Sending incremental patch fix.

Regards,
Ariel

Ariel D'Alessandro (1):
  ASoC: fsl-asoc-card: Add missing Kconfig option for tlv320aic31xx

 sound/soc/fsl/Kconfig | 1 +
 1 file changed, 1 insertion(+)

--
2.30.2
2021-12-06 17:25:01 +00:00
Mark Brown
6e2127dcb7
ASoC: mediatek: support memory-region assignment
Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches adds support for memory-region assignment, so the
access region of DMA engine could be restricted.
Patches are based on broonie tree "for-next" branch.

Trevor Wu (2):
  ASoC: mediatek: mt8195: support reserved memory assignment
  dt-bindings: mediatek: mt8195: add memory-region property

 .../devicetree/bindings/sound/mt8195-afe-pcm.yaml         | 8 ++++++++
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c                | 7 +++++++
 2 files changed, 15 insertions(+)

--
2.18.0
2021-12-06 17:25:00 +00:00
Mark Brown
c736d64daa
ASoC: mediatek: Update MT8195 machine driver
Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches adds support for RT5682s headset codec in mt8195
machine drivers, and SOF support on card mt8195-mt6359-rt1019-rt5682 is
also included.
Patches are based on broonie tree "for-next" branch.

Changes since v1:
  - remove patch3 and patch4 in v1
  - add SOF support on card mt8195-mt6359-rt1012-rt5682
  - add new propertes to dt-bindings for mt8195-mt6359-rt1019-rt5682

Trevor Wu (4):
  ASoC: mediatek: mt8195: add headset codec rt5682s support
  dt-bindings: mediatek: mt8195: add model property
  ASoC: mediatek: mt8195: add sof support on mt8195-mt6359-rt1019-rt5682
  dt-bindings: mediatek: mt8195: add adsp and dai-link property

 .../sound/mt8195-mt6359-rt1011-rt5682.yaml    |   4 +
 .../sound/mt8195-mt6359-rt1019-rt5682.yaml    |  14 +
 sound/soc/mediatek/Kconfig                    |   2 +
 .../mt8195/mt8195-mt6359-rt1011-rt5682.c      |  29 +-
 .../mt8195/mt8195-mt6359-rt1019-rt5682.c      | 347 +++++++++++++++++-
 5 files changed, 370 insertions(+), 26 deletions(-)

--
2.18.0
2021-12-06 17:24:58 +00:00
Takashi Iwai
38ddfb2699 ASoC: Fixes for v5.16
A relatively large collection of updates, the size is increased quite a
 bit by there being some repetitive changes for similar issues that occur
 multiple times with both notifying control value changes and runtime PM.
 
 The Rockchip update looks at first glance like a cleanup but fixes
 instantiation of the hardware on some systems.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmGuLfMACgkQJNaLcl1U
 h9DMbwf/aewIYwfyThs2O5W8Hhn/fxhr8qV6+k08W4dQDjFstUU3meJ9lsWNhb7W
 E2OkuZ7vpvIn3I4Z/1ffNTgvVYafwqg/PVnuUiYtEHr46J6kXZkiUta/e4hZzugb
 J+CGDf5c8Dy7bev26JAKRLxOoU3NlsS3ed5iV2NGZt0zf77og759NJf5fSnsebXw
 ycio8Tnjx15weS0ipl5nXQ74JMQvV5J+6SWQ0favxX2RpGSSekkj7tg5Jsuwx8R0
 nRiBrPHelVJqk5THyyiWe7pImeF2QtTcAWqz8IUR7OfWjBpPlTW6n5VVzKhbuLEr
 Qws4epxVeyeV4mbks9K2R9VryYFT5Q==
 =ufLK
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v5.16

A relatively large collection of updates, the size is increased quite a
bit by there being some repetitive changes for similar issues that occur
multiple times with both notifying control value changes and runtime PM.

The Rockchip update looks at first glance like a cleanup but fixes
instantiation of the hardware on some systems.
2021-12-06 17:25:10 +01:00
Trevor Wu
3d00d2c07f
ASoC: mediatek: mt8195: add sof support on mt8195-mt6359-rt1019-rt5682
In the patch, widgets, routes and dai-link requrird by SOF are included,
and late_probe is introduced for SOF route connection.

Only when adsp phandle could be retrieved from DTS, the SOF related part
of machine driver is executed.

Additionally, supported dai-links could be specified from DTS, so that
we can disable AP side hardware controls when DSP SOF controls the same
audio FE.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20211129141057.12422-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:50:14 +00:00
Rikard Falkeborn
7bef00106b
ASoC: amd: acp6x-pdm-dma: Constify static snd_soc_dai_ops
The only usage of acp6x_pdm_dai_ops is to assign its address to the ops
field in the snd_soc_dai_driver struct, which is a pointer to const
snd_soc_dai_ops. Make it const to allow the compiler to put it in
read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211204110848.21322-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:31 +00:00
Kai Vehmanen
9a83dfcc5a
ASoC: SOF: Intel: fix build issue related to CODEC_PROBE_ENTRIES
Fix following error:
sound/soc/sof/intel/hda-codec.c:132:35: error: use of undeclared identifier 'CODEC_PROBE_RETRIES'

Found with config: i386-randconfig-r033-20211202
(https://download.01.org/0day-ci/archive/20211203/202112031943.Twg19fWT-lkp@intel.com/config)

Fixes: 046aede2f8 ("ASoC: SOF: Intel: Retry codec probing if it fails")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211203154721.923496-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:30 +00:00
Andy Shevchenko
c1a77ba466
ASoC: ti: davinci-mcasp: Remove unnecessary conditional
Instead of double validating of_node, return value of
the boolean property directly.

We can't remove ifdeffery, because in OF_GPIO=n cases
it might bring unwanted surprises.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20211202205612.76216-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:29 +00:00
Andy Shevchenko
4db32072b8
ASoC: ti: davinci-mcasp: Get rid of duplicate of_node assignment
GPIO library does copy the of_node from the parent device of
the GPIO chip, there is no need to repeat this in the individual
drivers. Remove assignment here.

For the details one may look into the of_gpio_dev_init() implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20211202205612.76216-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:28 +00:00
Andy Shevchenko
766cc7f120
ASoC: zl38060: Setup parent device and get rid of unnecessary of_node assignment
Some of the drivers do not set parent device. This may lead to obstacles
during debugging or understanding the device relations from the Linux
point of view. Assign parent device for GPIO chips created by these
drivers.

While at it, let GPIO library to assign of_node from the parent device.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211202204838.75287-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:27 +00:00
Ameer Hamza
c686316ec1
ASoC: test-component: fix null pointer dereference.
Dereferncing of_id pointer will result in exception in current
implementation since of_match_device() will assign it to NULL.
Adding NULL check for protection.

Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
Link: https://lore.kernel.org/r/20211205204200.7852-1-amhamza.mgc@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:26 +00:00
Bernard Zhao
e733ab7e3e
sound/soc: remove useless bool conversion to bool variable
This patch remove useless bool conversion to bool variable

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Link: https://lore.kernel.org/r/20211206021100.321170-1-bernard@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:25 +00:00
Trevor Wu
c9d57a25de
ASoC: mediatek: mt8195: add headset codec rt5682s support
mt8195 machine driver adds rt5682s support in this patch.
Card name can be specified from dts by model property, and driver makes
use of the name to distinguish which headset codec is on the board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211129141057.12422-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:20 +00:00
Ariel D'Alessandro
b6ce5d85b1
ASoC: fsl-asoc-card: Add missing Kconfig option for tlv320aic31xx
The following commit added support for tlv320aic31xx codec to
fsl-asoc-card, but missed the related Kconfig option. Fix this.

  commit 8c9b9cfb77
  Author: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
  Date:   Fri Nov 19 12:32:48 2021 -0300

      ASoC: fsl-asoc-card: Support fsl,imx-audio-tlv320aic31xx codec

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/r/20211203175018.252641-2-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:19 +00:00
Trevor Wu
4d408ea028
ASoC: mediatek: mt8195: support reserved memory assignment
For security purpose, restrict the memory assess region of AFE memif.
The specified memory region should be assigned from DTS.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211130053905.28470-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:16 +00:00
Kai Vehmanen
de7dd9092c
ASoC: SOF: Intel: pci-tgl: add new ADL-P variant
Add a PCI DID for a variant of Intel AlderLake-P.

Signed-off-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/20211203171542.1021399-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:03 +00:00
Kai Vehmanen
cd57eb3c40
ASoC: SOF: Intel: pci-tgl: add ADL-N support
Add PCI DID for Intel AlderLake-N.

Signed-off-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/20211203171542.1021399-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:02 +00:00
Christophe JAILLET
d13a8f6d8e ALSA: Fix some typo
Some comments and include guards are not consistent with the name of the
file where they can be found.

This is likely some typo or cut'n'paste issues.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/7b2bcbda298f02a34d46d8b6593daaaed9a09a45.1638602790.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-12-06 10:04:05 +01:00
Lucas Tanure
0695ad92fe
ASoC: cs35l41: Fix undefined reference to core functions
Auto select core driver if i2c or spi bus drivers are
selected

Fixes: a5e0091d62 ("ASoC: cs35l41: Fix link problem")

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20211201180004.1402156-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-02 13:02:45 +00:00
Lucas Tanure
19a628d8f1
ASoC: amd: Fix dependency for SPI master
Set SPI_MASTER as dependency as is using CS35L41 SPI driver

Fixes: 96792fdd77 ("ASoC: amd: enable vangogh platform machine driver build")

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20211201180004.1402156-1-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-02 13:02:44 +00:00
Oder Chiou
e3dd4424c2
ASoC: rt5640: Fix the wrong state of the JD in the HDA header
The patch fixes the wrong state of the JD with 1M pull up resistor in the
HDA header.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20211201095629.21818-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-02 13:02:43 +00:00
Srinivas Kandagatla
b80155fe61
ASoC: codecs: wcd934x: remove redundant ret variable
return value form snd_soc_dapm_put_enum_double() directly instead
of taking this in another redundant variable.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130160507.22180-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:15:40 +00:00
Sameer Pujar
0d242698fa
ASoC: tegra: Add master volume/mute control support
The MVC module has a per channel control bit, based on which it decides
to apply channel specific volume/mute settings. When per channel control
bit is enabled (which is the default HW configuration), all MVC channel
volume/mute can be independently controlled. If the control is disabled,
channel-0 volume/mute setting is applied by HW to all remaining channels.
Thus add support to leverage this HW feature by exposing master controls
for volume/mute.

With this, now there are per channel and master volume/mute controls.
Users need to just use controls which are suitable for their applications.
The per channel control enable/disable is mananged in driver and hidden
from users, so that they need to just worry about respective volume/mute
controls.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1638278605-28225-1-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:15:39 +00:00
Mark Brown
67140b64b6
Merge branch 'for-5.16' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.17 so we can apply new Tegra work 2021-12-01 14:15:12 +00:00
Srinivas Kandagatla
3fc27e9a1f
ASoC: codecs: wsa881x: fix return values from kcontrol put
wsa881x_set_port() and wsa881x_put_pa_gain() currently returns zero eventhough
it changes the value. Fix this, so that change notifications are sent
correctly.

Fixes: a0aab9e140 ("ASoC: codecs: add wsa881x amplifier support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130160507.22180-5-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:13:53 +00:00
Srinivas Kandagatla
d9be0ff479
ASoC: codecs: wcd934x: return correct value from mixer put
wcd934x_compander_set() currently returns zero eventhough it changes the value.
Fix this, so that change notifications are sent correctly.

Fixes: 1cde8b8223 ("ASoC: wcd934x: add basic controls")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130160507.22180-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:13:50 +00:00
Srinivas Kandagatla
23ba28616d
ASoC: codecs: wcd934x: handle channel mappping list correctly
Currently each channel is added as list to dai channel list, however
there is danger of adding same channel to multiple dai channel list
which endups corrupting the other list where its already added.

This patch ensures that the channel is actually free before adding to
the dai channel list and also ensures that the channel is on the list
before deleting it.

This check was missing previously, and we did not hit this issue as
we were testing very simple usecases with sequence of amixer commands.

Fixes: a70d924575 ("ASoC: wcd934x: add capture dapm widgets")
Fixes: dd9eb19b56 ("ASoC: wcd934x: add playback dapm widgets")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130160507.22180-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:13:49 +00:00
Srinivas Kandagatla
4739d88ad8
ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
msm_routing_put_audio_mixer() can return incorrect value in various scenarios.

scenario 1:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0

return value is 0 instead of 1 eventhough value was changed

scenario 2:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1

return value is 1 instead of 0 eventhough the value was not changed

scenario 3:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
return value is 1 instead of 0 eventhough the value was not changed

Fix this by adding checks, so that change notifications are sent correctly.

Fixes: e3a33673e8 ("ASoC: qdsp6: q6routing: Add q6routing driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130163110.5628-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01 14:13:48 +00:00
Amadeusz Sławiński
322fa43154 ASoC: Intel: Skylake: Use NHLT API to search for blob
With NHLT enriched with new search functions, remove local code in
favour of them. This also fixes broken behaviour: search should be based
on significant bits count rather than container size.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211126140355.1042684-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-30 16:49:34 +01:00
Mac Chiang
f316c9d9ba
ASoC: Intel: boards: add max98390 2/4 speakers support
support 2 hw boards.
1. SSP2 connects max98390, 2 speakers.
2. SSP1 connects max98390, 2/4 speakers.

2 or 4 speakers playback
add echo reference capture
add bt offload support
add DMI_OEM_STRING for board variants
add ALC5682I-VS support

Signed-off-by: Mark Hsieh <mark_hsieh@wistron.corp-partner.google.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Signed-off-by: Kieth Tzeng <keith.tzeng@quantatw.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211125030453.4382-1-mac.chiang@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:14 +00:00
Colin Ian King
91745b034d
ASoC: mediatek: mt8195: make several arrays static const
Don't populate various arrays on the stack but instead make them
static const. Also makes the object code smaller by a few hundred
bytes.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20211129224236.506883-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:13 +00:00
Rikard Falkeborn
10b155fd41
ASoC: intel: boards: bytcht*: Constify static snd_soc_ops
These are only assigned to the ops fields in the snd_soc_dai_link struct
which is a pointer to const struct snd_soc_ops. Make them const to allow
the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211127091954.12075-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:10 +00:00
Chris Down
11918cdcff
ASoC: Intel: hda_dsp_common: don't multiline PCM topology warning
On my T14s Gen2 I saw the following:

    [   16.057258] skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3

    [   16.057261] skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 4

    [   16.057263] skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 5

    [...and so on.]

It looks like the double newline is a mistake, so remove one.

Signed-off-by: Chris Down <chris@chrisdown.name>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/YaOS0sBueAfApwOx@chrisdown.name
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:09 +00:00
Rikard Falkeborn
8752d9a82f
ASoC: mediatek: mt8195: Constify static snd_soc_ops
These are only assigned to the ops field in the snd_soc_dai_link which
is a pointer to const struct snd_soc_ops. Make them const to allow the
compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211127093147.17368-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:08 +00:00
Hui Wang
046aede2f8
ASoC: SOF: Intel: Retry codec probing if it fails
On the latest Lenovo Thinkstation laptops, we often experience the
speaker failure after rebooting, check the dmesg, we could see:
 sof-audio-pci-intel-tgl 0000:00:1f.3: codec #0 probe error, ret: -5

The analogue codec on the machine is ALC287, then we designed a
testcase to reboot and check the codec probing result repeatedly, we
found the analogue codec probing always failed at least once within
several minutes to several hours (roughly 1 reboot per min). This
issue happens on all laptops of this Thinkstation model, but with
legacy HDA driver, we couldn't reproduce this issue on those laptops.
And so far, this issue is not reproduced on machines which don't
belong to this model.

We tried to make the hda_dsp_ctrl_init_chip() same as
hda_intel_init_chip() which is the controller init routine in the
legacy HDA driver, but it didn't help.

We found when issue happens, the resp is -1, and if we let driver
re-run send_cmd() and get_response(), it will get the correct response
10ec0287, then driver continues the rest work, finally boot to the
desktop and all audio function work well.

Here adding codec probing retries to 3 times, it could fix the issue
on this Thinkstation model, and it doesn't bring impact to other
machines.

Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211130090606.529348-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:03 +00:00
Dan Carpenter
d5c137f413
ASoC: amd: fix uninitialized variable in snd_acp6x_probe()
The "index" is potentially used without being initialized on the error
path.

Fixes: fc329c1de4 ("ASoC: amd: add platform devices for acp6x pdm driver and dmic driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211130125633.GA24941@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:02 +00:00
Nicolas Frattaroli
53689f7f91
ASoC: rockchip: i2s_tdm: Dup static DAI template
Previously, the DAI template was used directly, which lead to
fun bugs such as "why is my channels_max changing?" when one
instantiated more than one i2s_tdm IP block in a device tree.

This change makes it so that we instead duplicate the template
struct, and then use that.

Fixes: 081068fd64 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20211125084900.417102-1-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:01 +00:00
Mark Brown
7be10cef0f
ASoC: soc-pcm: tidyup soc_pcm_pointer()'s delay update method
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

	Current soc_pcm_pointer() is checking runtime->delay,
	but it might be updated silently by component's .point callback.
	It is strange and difficult to find/know the issue.  This patch
	adds .delay callback for component, and solve the issue.
2021-11-29 16:43:16 +00:00
Thomas Gleixner
6dd21ad81b ALSA: hda: Make proper use of timecounter
HDA uses a timecounter to read a hardware clock running at 24 MHz. The
conversion factor is set with a mult value of 125 and a shift value of 0,
which is not converting the hardware clock to nanoseconds, it is converting
to 1/3 nanoseconds because the conversion factor from 24Mhz to nanoseconds
is 125/3. The usage sites divide the "nanoseconds" value returned by
timecounter_read() by 3 to get a real nanoseconds value.

There is a lengthy comment in azx_timecounter_init() explaining this
choice. That comment makes blatantly wrong assumptions about how
timecounters work and what can overflow.

The comment says:

     * Applying the 1/3 factor as part of the multiplication
     * requires at least 20 bits for a decent precision, however
     * overflows occur after about 4 hours or less, not a option.

timecounters operate on time deltas between two readouts of a clock and use
the mult/shift pair to calculate a precise nanoseconds value:

    delta_nsec = (delta_clock * mult) >> shift;

The fractional part is also taken into account and preserved to prevent
accumulated rounding errors. For details see cyclecounter_cyc2ns().

The mult/shift pair has to be chosen so that the multiplication of the
maximum expected delta value does not result in a 64bit overflow. As the
counter wraps around on 32bit, the maximum observable delta between two
reads is (1 << 32) - 1 which is about 178.9 seconds.

That in turn means the maximum multiplication factor which fits into an u32
will not cause a 64bit overflow ever because it's guaranteed that:

     ((1 << 32) - 1) ^ 2 < (1 << 64)

The resulting correct multiplication factor is 2796202667 and the shift
value is 26, i.e. 26 bit precision. The overflow of the multiplication
would happen exactly at a clock readout delta of 6597069765 which is way
after the wrap around of the hardware clock at around 274.8 seconds which
is off from the claimed 4 hours by more than an order of magnitude.

If the counter ever wraps around the last read value then the calculation
is off by the number of wrap arounds times 178.9 seconds because the
overflow cannot be observed.

Use clocks_calc_mult_shift(), which calculates the most accurate mult/shift
pair based on the given clock frequency, and remove the bogus comment along
with the divisions at the readout sites.

Fixes: 5d890f591d ("ALSA: hda: support for wallclock timestamps")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/871r35kwji.ffs@tglx
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-29 17:42:31 +01:00
Jernej Skrabec
679de7b64f
ASoC: sunxi: sun4i-spdif: Implement IEC958 control
SPDIF core is capable of sending custom status.

Implement IEC958 control handling.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20211117194458.2249643-1-jernej.skrabec@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:49 +00:00
lvzhaoxiong
425c5fce8a
ASoC: qcom: Add support for ALC5682I-VS codec
Qcom machine driver adds rt5682s support in this patch.
Card name can be specified from dts by model property, and driver makes
use of the name to distinguish which headset codec is on the board.

Signed-off-by: lvzhaoxiong <lvzhaoxiong@huaqin.corp-partner.google.com>
Link: https://lore.kernel.org/r/20211123024329.21998-1-lvzhaoxiong@huaqin.corp-partner.google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:48 +00:00
Samuel Holland
fd03cf7f5b
ASoC: sun8i-codec: Add AIF, ADC, and DAC volume controls
This allows changing the volume of each digital input/output
independently, and provides the only "master volume" for the DAC.
(The ADC also has a gain control on the analog side.)

While the hardware supports digital gain up to +72dB, the controls here
are limited to +24dB maximum, as any gain above that level makes volume
sliders difficult to use, and is extremely likely to cause clipping.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20211118033645.43524-1-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:47 +00:00
Kuninori Morimoto
dd894f4caf
ASoC: soc-pcm: tidyup soc_pcm_pointer()'s delay update method
No driver directly updates runtime->delay in .pointer.
This patch cleanups its method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgq4wnkx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:45 +00:00
Kuninori Morimoto
796b64a72d
ASoC: intel: sst-mfld-platform-pcm: add .delay support
Now ALSA SoC supports .delay for component.
This patch uses it, and not update runtime->delay on .pointer
directly / secretly.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871r3gy25j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:44 +00:00
Kuninori Morimoto
feea640aaf
ASoC: amd: acp-pcm-dma: add .delay support
Now ALSA SoC supports .delay for component.
This patch uses it, and not update runtime->delay on .pointer
directly / secretly.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8735nwy25o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:42 +00:00
Kuninori Morimoto
403f830e7a
ASoC: soc-component: add snd_soc_pcm_component_delay()
Current soc-pcm.c :: soc_pcm_pointer() is assuming that
component driver might update runtime->delay silently in
snd_soc_pcm_component_pointer() (= A).

	static snd_pcm_uframes_t soc_pcm_pointer(...)
	{
		...

		/* clearing the previous total delay */
=>		runtime->delay = 0;

(A)		offset = snd_soc_pcm_component_pointer(substream);

		/* base delay if assigned in pointer callback */
=>		delay = runtime->delay;
		...
	}

1) The behavior that ".pointer callback secretly updates
   runtime->delay" is strange and confusable.

2) Current snd_soc_pcm_component_pointer() uses 1st found component's
   .pointer callback only, thus it is no problem for now.
   But runtime->delay might be overwrote if it adjusted to multiple
   components in the future.

3) Component delay is updated at .pointer callback timing (secretly).
   But some components which doesn't have .pointer callback might want
   to increase runtime->delay for some reasons.

We already have .delay function for DAI, but not have for Component.
This patch adds new snd_soc_pcm_component_delay() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874k8cy25t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:41 +00:00
Kuninori Morimoto
8544f08c81
ASoC: soc-dai: update snd_soc_dai_delay() to snd_soc_pcm_dai_delay()
Current soc_pcm_pointer() is manually calculating
both CPU-DAI's   max delay (= A)
and  Codec-DAI's max delay (= B).

	static snd_pcm_uframes_t soc_pcm_pointer(...)
	{
		...
 ^		for_each_rtd_cpu_dais(rtd, i, cpu_dai)
(A)			cpu_delay = max(cpu_delay, ...);
 v		delay += cpu_delay;

 ^		for_each_rtd_codec_dais(rtd, i, codec_dai)
(B)			codec_delay = max(codec_delay, ...);
 v		delay += codec_delay;

		runtime->delay = delay;
		...
	}

Current soc_pcm_pointer() and the total delay calculating
is not readable / difficult to understand.

This patch update snd_soc_dai_delay() to snd_soc_pcm_dai_delay(),
and calcule both CPU/Codec delay in one function.

Link: https://lore.kernel.org/r/87fszl4yrq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yssy25z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-29 12:19:40 +00:00
Mark Brown
335302dbc2
ASoC: SOF: Fixes for Intel HD-Audio DMA stopping
Merge series from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

	Implement an updated programming sequence to handle DMA stop for Intel
	HD-Audio DMA.

	The new flow is only used if the firmware is sufficiently new to
	support the feature. SOF1.9.2 is the first release with the updated
	flow. The kernel changes are backwards compatible with old firmware
	releases. Likewise new firmware releases will work with old kernel.

	Series reviewed originally at:
	https://github.com/thesofproject/linux/pull/3167
2021-11-27 01:27:27 +00:00
Mark Brown
8a724d5f60
Suspend related fixes on Tegra
Merge series from Sameer Pujar <spujar@nvidia.com>:

	This series addresses following problems:
	 * The runtime PM is not balanced in MVC driver, whenever
	   mute or volume mixer controls are set.
	 * Some of the AHUB devices (SFC, MVC, Mixer, AMX and ADX)
	   use late system sleep. Suspend failure is seen on Jetson
	   TX2 platform.
2021-11-27 01:27:20 +00:00
Geert Uytterhoeven
4dcddadf55
ASoC: SOF: mediatek: Use %pR/%pa to print resources/physical addresses
On 32-bit with CONFIG_ARCH_DMA_ADDR_T_64BIT=n:

    sound/soc/sof/mediatek/mt8195/mt8195.c: In function ‘platform_parse_resource’:
    sound/soc/sof/mediatek/mt8195/mt8195.c:51:15: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=]
       51 |  dev_dbg(dev, "DMA pbase=0x%llx, size=0x%llx\n",
	  |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    sound/soc/sof/mediatek/mt8195/mt8195.c: In function ‘adsp_memory_remap_init’:
    sound/soc/sof/mediatek/mt8195/mt8195.c:167:15: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘phys_addr_t’ {aka ‘unsigned int’} [-Werror=format=]
      167 |  dev_dbg(dev, "adsp->pa_dram %llx, offset %#x\n", adsp->pa_dram, offset);
	  |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    sound/soc/sof/mediatek/mt8195/mt8195.c: In function ‘adsp_shared_base_ioremap’:
    sound/soc/sof/mediatek/mt8195/mt8195.c:196:15: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘phys_addr_t’ {aka ‘unsigned int’} [-Werror=format=]
      196 |  dev_dbg(dev, "shared-dram vbase=%p, phy addr :%llx,  size=%#x\n",
	  |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix the first cases by printing the full resource using %pR.
Fix the other cases by printing the physical addresses using %pa.

Reported-by: noreply@ellerman.id.au
Fixes: 32d7e03d26 ("ASoC: SOF: mediatek: Add mt8195 hardware support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20211123103013.73645-1-geert@linux-m68k.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:32 +00:00
Lucas Tanure
a5e0091d62
ASoC: cs35l41: Fix link problem
Can't link I2C and SPI to the same binary, better
to move CS35L41 to 3 modules approach.
And instead of exposing cs35l41_reg, volatile_reg,
readable_reg and precious_reg arrays, move
cs35l41_regmap_i2c/spi to new module and expose it.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211125143501.7720-1-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:31 +00:00
Paul Cercueil
0b18939594
ASoC: codecs/jz4770: Add missing gain control after DAC/ADC mixer
The capture and playback paths both have a configurable gain after their
respective mixer, which can be set from -31 dB to 0 dB in 32 steps.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20211125232543.117074-1-paul@crapouillou.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:30 +00:00
Ye Guojin
f670b274f7
ASoC: imx-hdmi: add put_device() after of_find_device_by_node()
This was found by coccicheck:
./sound/soc/fsl/imx-hdmi.c,209,1-7,ERROR  missing put_device; call
of_find_device_by_node on line 119, but without a corresponding object
release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Link: https://lore.kernel.org/r/20211110002910.134915-1-ye.guojin@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:28 +00:00
Ranjani Sridharan
69acac5690
ASoC: SOF: Intel: hda: send DAI_CONFIG IPC during pause
For HDA DAI's the DMA must be paused after the RUN bit is cleared by the
host. So, send the DAI_CONFIG IPC with just the SOF_DAI_CONFIG_FLAGS_PAUSE
flag set to indicate this to the firmware.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-11-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:26 +00:00
Ranjani Sridharan
a0f84dfb3f
ASoC: SOF: IPC: dai: Expand DAI_CONFIG IPC flags
Some DAI components, such as HDaudio, need to be stopped in two steps
a) stop the DAI component
b) stop the DAI DMA

This patch enables this two-step stop by expanding the DAI_CONFIG
IPC flags and split them into 2 parts.

The 4 LSB bits indicate when the DAI_CONFIG IPC is sent, ex: hw_params,
hw_free or pause. The 4 MSB bits are used as the quirk flags to be used
along with the command flags. The quirk flag called
SOF_DAI_CONFIG_FLAGS_2_STEP_STOP shall be set along with the HW_PARAMS
command flag, i.e. before the pipeline is started so that the stop/pause
trigger op in the FW can take the appropriate action to either
perform/skip the DMA stop. If set, the DMA stop will be executed when
the DAI_CONFIG IPC is sent during hw_free. In the case of pause, DMA
pause will be handled when the DAI_CONFIG IPC is sent with the PAUSE
command flag.

Along with this, modify the signature for the hda_ctrl_dai_widget_setup/
hda_ctrl_dai_widget_free() functions to take additional flags as an
argument and modify all users to pass the appropriate quirk flags. Only
the HDA DAI's need to pass the SOF_DAI_CONFIG_FLAGS_2_STEP_STOP quirk
flag during hw_params to indicate that it supports two-step stop and
pause.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-10-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:24 +00:00
Ranjani Sridharan
0b639dcd45
ASoC: SOF: align the hw_free sequence with stop
Even though the order of stopping the DMA and freeing the widget list is
not important, align the sequence to match with the stop trigger to
avoid confusion.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-9-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:23 +00:00
Ranjani Sridharan
85d7acd0ef
ASoC: SOF: pcm: move the check for prepared flag
Move the check for the prepared flag inside snd_pcm_dsp_pcm_free() to
avoid having to check it before every invocation of the function.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-8-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:22 +00:00
Ranjani Sridharan
d9a7246534
ASoC: SOF: Add a helper for freeing PCM stream
Add a helper function to free PCM in the FW, stop the DMA and free the
widget list. These actions are performed both during PCM trigger STOP
and when a paused stream is freed during system suspend.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-7-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:21 +00:00
Ranjani Sridharan
47934e0fcb
ASoC: SOF: call platform hw_free for paused streams during suspend
Paused streams must be stopped and platform hw_free should be invoked
during system suspend so they can be restarted properly after system
resume.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:20 +00:00
Ranjani Sridharan
0dd71a3340
ASoC: SOF: pcm: invoke platform hw_free for STOP/SUSPEND triggers
snd_sof_pcm_platform_hw_params() will be called when the stream is
restarted with a prepare ioctl. This happens in two cases i.e. when a
suspended stream is resumed or when a stream is restarted without
intermediate call to sof_pcm_hw_free(). Make sure to call
snd_sof_pcm_platform_hw_free() in both these cases to keep it balanced.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:19 +00:00
Ranjani Sridharan
4794601a52
ASoC: SOF: Intel: hda: reset stream before coupling host and link DMA's
The recommended programming sequence for HD-Audio DMA is to reset the
stream before coupling the link and host DMA's.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:18 +00:00
Ranjani Sridharan
2b1acedccf
ASoC: SOF: Intel: hda: Add a helper function for stream reset
Add a helper function to perform stream reset.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:17 +00:00
Ranjani Sridharan
e14cddc588
ASoC: SOF: Intel: hda: clear stream before freeing the DAI widget
The DAI_CONFIG IPC that is sent during the STOP trigger is used for
stopping the DMA in the FW. This must be done after the DMA RUN bit is
cleared by the host. So move the call to snd_hdac_ext_link_stream_clear()
before hda_link_dai_widget_update() to follow the correct programming
sequence for DMA stop for HDA DAIs.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211125101520.291581-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:16 +00:00
Rob Clark
750dc2f622
ASoC: rt5682s: Fix crash due to out of scope stack vars
Move the declaration of temporary arrays to somewhere that won't go out
of scope before the devm_clk_hw_register() call, lest we be at the whim
of the compiler for whether those stack variables get overwritten.

Fixes a crash seen with gcc version 11.2.1 20210728 (Red Hat 11.2.1-1)

Fixes: bdd229ab26 ("ASoC: rt5682s: Add driver for ALC5682I-VS codec")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20211118010453.843286-2-robdclark@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:10 +00:00
Rob Clark
4999d703c0
ASoC: rt5682: Fix crash due to out of scope stack vars
Move the declaration of temporary arrays to somewhere that won't go out
of scope before the devm_clk_hw_register() call, lest we be at the whim
of the compiler for whether those stack variables get overwritten.

Fixes a crash seen with gcc version 11.2.1 20210728 (Red Hat 11.2.1-1)

Fixes: edbd24ea1e ("ASoC: rt5682: Drop usage of __clk_get_name()")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20211118010453.843286-1-robdclark@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:09 +00:00
Sameer Pujar
cf36de4fc5
ASoC: tegra: Use normal system sleep for ADX
The driver currently subscribes for a late system sleep call.
The initcall_debug log shows that suspend call for ADX device
happens after the parent device (AHUB). This seems to cause
suspend failure on Jetson TX2 platform. Also there is no use
of having late system sleep specifically for ADX device. Fix
the order by using normal system sleep.

Fixes: a99ab6f395 ("ASoC: tegra: Add Tegra210 based ADX driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-7-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:07 +00:00
Sameer Pujar
638c31d542
ASoC: tegra: Use normal system sleep for AMX
The driver currently subscribes for a late system sleep call.
The initcall_debug log shows that suspend call for AMX device
happens after the parent device (AHUB). This seems to cause
suspend failure on Jetson TX2 platform. Also there is no use
of having late system sleep specifically for AMX device. Fix
the order by using normal system sleep.

Fixes: 77f7df346c ("ASoC: tegra: Add Tegra210 based AMX driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-6-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:06 +00:00
Sameer Pujar
b78400e416
ASoC: tegra: Use normal system sleep for Mixer
The driver currently subscribes for a late system sleep call.
The initcall_debug log shows that suspend call for Mixer device
happens after the parent device (AHUB). This seems to cause
suspend failure on Jetson TX2 platform. Also there is no use
of having late system sleep specifically for Mixer device. Fix
the order by using normal system sleep.

Fixes: 05bb3d5ec6 ("ASoC: tegra: Add Tegra210 based Mixer driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-5-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:05 +00:00
Sameer Pujar
c83d263a89
ASoC: tegra: Use normal system sleep for MVC
The driver currently subscribes for a late system sleep call.
The initcall_debug log shows that suspend call for MVC device
happens after the parent device (AHUB). This seems to cause
suspend failure on Jetson TX2 platform. Also there is no use
of having late system sleep specifically for MVC device. Fix
the order by using normal system sleep.

Fixes: e539891f96 ("ASoC: tegra: Add Tegra210 based MVC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-4-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:04 +00:00
Sameer Pujar
af120d07bb
ASoC: tegra: Use normal system sleep for SFC
The driver currently subscribes for a late system sleep call.
The initcall_debug log shows that suspend call for SFC device
happens after the parent device (AHUB). This seems to cause
suspend failure on Jetson TX2 platform. Also there is no use
of having late system sleep specifically for SFC device. Fix
the order by using normal system sleep.

Fixes: b2f74ec53a ("ASoC: tegra: Add Tegra210 based SFC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-3-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:01 +00:00
Sameer Pujar
70408f755f
ASoC: tegra: Balance runtime PM count
After successful application of volume/mute settings via mixer control
put calls, the control returns without balancing the runtime PM count.
This makes device to be always runtime active. Fix this by allowing
control to reach pm_runtime_put() call.

Fixes: e539891f96 ("ASoC: tegra: Add Tegra210 based MVC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1637676459-31191-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-26 13:24:00 +00:00
Takashi Iwai
dcd46eb7a9 ASoC: Fixes for v5.16
There's a large but repetitive set of fixes here for issues with the
 Tegra kcontrols not correctly reporting changes to userspace, a fix for
 some issues with matching on older x86 platforms introduced during the
 merge window together with a set of smaller fixes and one new system
 quirk.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmGfjyoACgkQJNaLcl1U
 h9C4Rgf/fXw9hh2Z/lInp08+RTZ/0NHcluiCk6ku7w0ATF0RsvvDl7kwkg9893ID
 Zm0H+L1kiSMiOXy+uZGyAM2EpXU/m+R4JDi+nKONcJg/PIFeK7t13Tzu/J1NYF3h
 e2r5GXyLpXJC4en8EuA/OJm3w8thdOm0Qrindpw2Sgc13JJCGtlQOw08f6kAidX0
 58kbBMZB5Ofet9L4LMRWNt5fRgMzP25j0GOFQt9ujwddl6Pod0aOz+zfkNF+loCW
 wb1FpqoeJkANfkKEtopYhKu7uK7XsU727jL6tXVnBz7PKkcVrKWCu1Iek3YbT89u
 LAmfbiMtxKI380H9hEHUZ3YgMrRSDg==
 =ngct
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v5.16

There's a large but repetitive set of fixes here for issues with the
Tegra kcontrols not correctly reporting changes to userspace, a fix for
some issues with matching on older x86 platforms introduced during the
merge window together with a set of smaller fixes and one new system
quirk.
2021-11-25 14:35:24 +01:00
Oder Chiou
2b9c8d2b3c
ASoC: rt5640: Add the HDA header support
The patch adds the HDA header support.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20211125055812.8911-2-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-25 11:54:33 +00:00
Lukas Bulwahn
2039cc1da4
ASoC: codecs: wcd938x: add SND_SOC_WCD938_SDW to codec list instead
Commit 0454422288 ("ASoC: codecs: wcd938x: add audio routing and
Kconfig") adds SND_SOC_WCD937X, which does not exist, and
SND_SOC_WCD938X, which seems not really to be the intended config to be
selected, but only a supporting config symbol to the actual config
SND_SOC_WCD938X_SDW for the codec.

Add SND_SOC_WCD938_SDW to the list instead of SND_SOC_WCD93{7,8}X.

The issue was identified with ./scripts/checkkconfigsymbols.py.

Fixes: 0454422288 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Link: https://lore.kernel.org/r/20211125095158.8394-3-lukas.bulwahn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-25 11:54:31 +00:00
Lukas Bulwahn
49f893253a
ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA
Commit f37fe2f998 ("ASoC: uniphier: add support for UniPhier AIO common
driver") adds configs SND_SOC_UNIPHIER_{LD11,PXS2}, which select the
non-existing config SND_SOC_UNIPHIER_AIO_DMA.

Hence, ./scripts/checkkconfigsymbols.py warns:

  SND_SOC_UNIPHIER_AIO_DMA
  Referencing files: sound/soc/uniphier/Kconfig

Probably, there is actually no further config intended to be selected
here. So, just drop selecting the non-existing config.

Fixes: f37fe2f998 ("ASoC: uniphier: add support for UniPhier AIO common driver")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Link: https://lore.kernel.org/r/20211125095158.8394-2-lukas.bulwahn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-25 11:54:30 +00:00
Yang Yingliang
fc6c62cf1c
ASoC: SOF: mediatek: Add missing of_node_put() in platform_parse_resource()
The node pointer is returned by of_parse_phandle() with
refcount incremented in platform_parse_resource(). Calling
of_node_put() to aovid the refcount leak.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211125071608.3056715-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-25 11:54:29 +00:00