History log of /linux-master/sound/soc/codecs/rt715.c
Revision Date Author Comments
# f892e66f 25-Mar-2024 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt-sdw*: add __func__ to all error logs

The drivers for Realtek SoundWire codecs use similar logs, which is
problematic to analyze problems reported by CI tools, e.g. "Failed to
get private value: 752001 => 0000 ret=-5". It's not uncommon to have
several Realtek devices on the same platform, having the same log
thrown makes support difficult.

This patch adds __func__ to all error logs which didn't already
include it.

No functionality change, only error logs are modified.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240325221817.206465-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 078d3a4b 12-Oct-2023 Bard Liao <yung-chuan.liao@linux.intel.com>

ASoC: rt715: reorder the argument in error log

"Failed to set private value: ffffffea <= 6100000 24832" is confusing.
It should be "Failed to set private value: 6100000 <= 24832 -22"

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231012191315.145411-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 340d79a1 06-Oct-2023 Rob Herring <robh@kernel.org>

ASoC: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> # for at91
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-1-13a4f0f7fee6@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 797df2a6 12-Aug-2023 Linus Walleij <linus.walleij@linaro.org>

ASoC: rt715: Drop GPIO includes

This driver include two GPIO legacy headers and one contemporary,
yet doesn't use symbols from any of them. Drop the includes.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org
Link: https://lore.kernel.org/r/20230812-descriptors-asoc-v1-14-eb4dca1f68af@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org


# 927073ee 10-Aug-2023 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: Add software reset in io init

Add software reset before setting preset registers to make sure
all the registers are the default value before preset.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/4f405c7deb9642e1a8599c5f103b5759@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 279be591 02-Aug-2023 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'

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

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

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 49ae74ab 02-Aug-2023 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SoundWire codecs: make regmap cache-only in probe

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

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

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

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

Link: https://lore.kernel.org/alsa-devel/20230503144102.242240-1-krzysztof.kozlowski@linaro.org/
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e506b2bd 23-Mar-2023 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt715: simplify set_stream

Using a dynamic allocation to store a single pointer is not very
efficient/useful.

Worse, the memory is released in the SoundWire stream.c file, but
still accessed in the DAI shutdown, leading to kmemleak reports.

And last the API requires the previous stream information to be
cleared when the argument is NULL.

Simplify the code to address all 3 problems.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230324014408.1677505-12-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8ec35236 30-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rt: use helper function

Current ASoC has many helper function.
This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zg9zea4w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b5d50519 02-Dec-2022 Colin Ian King <colin.i.king@gmail.com>

ASoC: rt715: Make read-only arrays capture_reg_H and capture_reg_L static const

Don't populate the read-only arrays capture_reg_H and capture_reg_L
on the stack but instead make them static const. Also makes the
object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20221202171450.1815346-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 99ae8cf0 23-Nov-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: rt715: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-8-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 011e397f 16-Jun-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: soundwire: call pm_runtime_resume() in component probe

Make sure that the bus and codecs are pm_runtime active when the card
is registered/created. This avoid timeouts when accessing registers.

BugLink: https://github.com/thesofproject/linux/issues/3651
BugLink: https://github.com/thesofproject/linux/issues/3650
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220616210825.132093-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a675012 04-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: rt715: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over a SoundWire DAI and as such
should have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-33-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e8444560 23-Dec-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# fa2f9837 29-Mar-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: remove kcontrols which no longer be used

Using new kcontrols "Capture Switch" and "Capture Volume" instead,
remove kcontrols which no longer be used.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/5c314f5512654aca9fff0195f77264de@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dcca646c 29-Mar-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: add main capture switch and main capture volume

Add main capture switch and main capture volume control.
Main capture control has its own channel value respectivelly.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/dfd43a8db04e4d52a889d6f5c1262173@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a48f928e 29-Mar-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: modification for code simplicity

Modification for code simplicity.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/340ee2df83ce47fcb1b59541b12ba7f4@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f9e56a34 24-Feb-2021 Rikard Falkeborn <rikard.falkeborn@gmail.com>

ASoC: rt*: Constify static struct snd_soc_dai_ops

The only usage of them is to assign their address to the ops field in
the snd_soc_dai_driver struct, which is a pointer to const. 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/20210224211918.39109-3-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4a550007 11-Nov-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt*.c: remove useless pointer cast

Pointer cast is not necessary, remove.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Link: https://lore.kernel.org/r/20201111214318.150529-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 16346a3c 25-Sep-2020 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: Add power-up delay to fix dmic pop sound issue.

Add 400ms power-up delay recommended to fix pop noise on capture.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200925210509.83353-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 07b542fe 15-May-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()

Now that the sdw_stream is allocated in machine driver,
set_sdw_stream() is also called with a NULL argument during the
dailink shutdown.

In this case, the drivers should not allocate any memory, and just
return.

Detected with KASAN/kmemleak.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200515211531.11416-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a62c449f 15-Jan-2020 YueHaibing <yuehaibing@huawei.com>

ASoC: rt715: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200116021142.149000-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# fed4383c 13-Jan-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt715: remove warnings

make W=1 reports defined-but-not-used and kernel-doc formatting issues.

No functionality change.

Fixes: d1ede0641b05e4 ("ASoC: rt715: add RT715 codec driver")
Cc: Jack Yu <jack.yu@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113223625.15995-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d1ede064 09-Jan-2020 Jack Yu <jack.yu@realtek.com>

ASoC: rt715: add RT715 codec driver

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200110021821.17843-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>