Alsa-devel
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
September 2024
- 89 participants
- 145 discussions
Hi Mark
Now, we don't need to use dpcm_playback/capture flags for DPCM since v6.11,
and thus we can use playback/capture_only flags instead too for DPCM,
which is same as non-DPCM.
Let's remove dpcm_playback/capture flags, and use playback/capture_only flags
instead.
[Before] [After]
dpcm_playback = 1; /* no setting is needed */
dpcm_capture = 1;
dpcm_playback = 1; playback_only = 1;
dpcm_capture = 0;
dpcm_playback = 0; capture_only = 1;
dpcm_capture = 1;
And then, because no-one uses dpcm_xxx flags, we don't need to have the code
for both DPCM and non-DPCM. These can be handled by same code.
This patch-set is based on latest linus/master branch.
Kuninori Morimoto (13):
ASoC: amd: remove dpcm_xxx flags
ASoC: fsl: remove dpcm_xxx flags
ASoC: sof: remove dpcm_xxx flags
ASoC: intel: remove dpcm_xxx flags
ASoC: samsung: remove dpcm_xxx flags
ASoC: mediatek: remove dpcm_xxx flags
ASoC: soc-core: remove dpcm_xxx flags
ASoC: soc-compress: remove dpcm_xxx flags
ASoC: soc-topology: remove dpcm_xxx flags
ASoC: intel: boards: remove dpcm_xxx flags
ASoC: soc-pcm: remove dpcm_xxx flags
ASoC: doc: remove dpcm_xxx flags
ASoC: soc-pcm: merge DPCM and non-DPCM validation check
Documentation/sound/soc/dpcm.rst | 11 +--
include/sound/soc.h | 5 -
sound/soc/amd/acp-da7219-max98357a.c | 20 ++--
sound/soc/amd/acp-es8336.c | 2 -
sound/soc/amd/acp/acp-mach-common.c | 24 ++---
sound/soc/amd/acp3x-rt5682-max9836.c | 6 +-
sound/soc/amd/vangogh/acp5x-mach.c | 6 --
sound/soc/fsl/fsl-asoc-card.c | 24 ++---
sound/soc/fsl/imx-audmix.c | 18 ++--
sound/soc/fsl/imx-card.c | 4 +-
sound/soc/intel/avs/boards/da7219.c | 2 -
sound/soc/intel/avs/boards/dmic.c | 4 +-
sound/soc/intel/avs/boards/es8336.c | 2 -
sound/soc/intel/avs/boards/hdaudio.c | 4 -
sound/soc/intel/avs/boards/i2s_test.c | 2 -
sound/soc/intel/avs/boards/max98357a.c | 2 +-
sound/soc/intel/avs/boards/max98373.c | 2 -
sound/soc/intel/avs/boards/max98927.c | 2 -
sound/soc/intel/avs/boards/nau8825.c | 2 -
sound/soc/intel/avs/boards/rt274.c | 2 -
sound/soc/intel/avs/boards/rt286.c | 2 -
sound/soc/intel/avs/boards/rt298.c | 2 -
sound/soc/intel/avs/boards/rt5514.c | 2 +-
sound/soc/intel/avs/boards/rt5663.c | 2 -
sound/soc/intel/avs/boards/rt5682.c | 2 -
sound/soc/intel/avs/boards/ssm4567.c | 2 -
sound/soc/intel/boards/bdw-rt5650.c | 4 -
sound/soc/intel/boards/bdw-rt5677.c | 4 -
sound/soc/intel/boards/bdw_rt286.c | 10 +-
sound/soc/intel/boards/bytcht_cx2072x.c | 6 +-
sound/soc/intel/boards/bytcht_da7213.c | 6 +-
sound/soc/intel/boards/bytcht_es8316.c | 6 +-
sound/soc/intel/boards/bytcht_nocodec.c | 6 +-
sound/soc/intel/boards/bytcr_rt5640.c | 6 +-
sound/soc/intel/boards/bytcr_rt5651.c | 6 +-
sound/soc/intel/boards/bytcr_wm5102.c | 6 +-
sound/soc/intel/boards/cht_bsw_max98090_ti.c | 6 +-
sound/soc/intel/boards/cht_bsw_nau8824.c | 6 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 6 +-
sound/soc/intel/boards/cht_bsw_rt5672.c | 6 +-
sound/soc/intel/boards/ehl_rt5660.c | 14 ++-
sound/soc/intel/boards/hsw_rt5640.c | 10 +-
sound/soc/intel/boards/sof_board_helpers.c | 15 +--
sound/soc/intel/boards/sof_es8336.c | 8 +-
sound/soc/intel/boards/sof_pcm512x.c | 9 +-
sound/soc/intel/boards/sof_wm8804.c | 2 -
sound/soc/mediatek/mt2701/mt2701-cs42448.c | 20 +---
sound/soc/mediatek/mt2701/mt2701-wm8960.c | 6 +-
sound/soc/mediatek/mt6797/mt6797-mt6351.c | 24 ++---
sound/soc/mediatek/mt7986/mt7986-wm8960.c | 6 +-
sound/soc/mediatek/mt8173/mt8173-max98090.c | 6 +-
.../mediatek/mt8173/mt8173-rt5650-rt5514.c | 6 +-
.../mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +-
sound/soc/mediatek/mt8173/mt8173-rt5650.c | 10 +-
.../mediatek/mt8183/mt8183-da7219-max98357.c | 34 +++----
.../mt8183/mt8183-mt6358-ts3a227-max98357.c | 34 +++----
sound/soc/mediatek/mt8186/mt8186-mt6366.c | 86 +++++++----------
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 58 ++++++------
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 78 +++++++---------
sound/soc/mediatek/mt8195/mt8195-mt6359.c | 60 ++++++------
sound/soc/mediatek/mt8365/mt8365-mt6357.c | 14 +--
sound/soc/samsung/odroid.c | 10 +-
sound/soc/soc-compress.c | 15 ++-
sound/soc/soc-core.c | 20 +---
sound/soc/soc-pcm.c | 93 +++++++------------
sound/soc/soc-topology-test.c | 2 -
sound/soc/soc-topology.c | 4 +-
sound/soc/sof/nocodec.c | 4 -
68 files changed, 315 insertions(+), 583 deletions(-)
--
2.43.0
Thank you for your help !!
Best regards
---
Kuninori Morimoto
1
14

Re: [PATCH v2] MAINTAINERS: Update maintainer list for MICROCHIP ASOC, SSC and MCP16502 drivers
by Nicolas Ferre 25 Sep '24
by Nicolas Ferre 25 Sep '24
25 Sep '24
(adding Mark and alsa-devel to the thread)
On 25/09/2024 at 15:07, Andrei Simion wrote:
> To help Claudiu and offload the work, add myself to the maintainer list for
> those drivers.
>
> Acked-by: Claudiu Beznea <claudiu.beznea(a)tuxon.dev>
Acked-by: Nicolas Ferre <nicolas.ferre(a)microchip.com>
Thanks a lot to both of you to continue this work.
Best regards,
Nicolas
> Signed-off-by: Andrei Simion <andrei.simion(a)microchip.com>
> ---
> v1 -> v2:
> - add acked-by tag
> - adjust commit title
> - update maintainer list for MICROCHIP SSC DRIVER
> ---
> MAINTAINERS | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 09d0f09c36cc..12e6777bb6b4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15088,6 +15088,7 @@ F: drivers/spi/spi-at91-usart.c
>
> MICROCHIP AUDIO ASOC DRIVERS
> M: Claudiu Beznea <claudiu.beznea(a)tuxon.dev>
> +M: Andrei Simion <andrei.simion(a)microchip.com>
> L: alsa-devel(a)alsa-project.org (moderated for non-subscribers)
> S: Supported
> F: Documentation/devicetree/bindings/sound/atmel*
> @@ -15196,6 +15197,7 @@ F: include/video/atmel_lcdc.h
>
> MICROCHIP MCP16502 PMIC DRIVER
> M: Claudiu Beznea <claudiu.beznea(a)tuxon.dev>
> +M: Andrei Simion <andrei.simion(a)microchip.com>
> L: linux-arm-kernel(a)lists.infradead.org (moderated for non-subscribers)
> S: Supported
> F: Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml
> @@ -15327,6 +15329,7 @@ F: drivers/spi/spi-atmel.*
>
> MICROCHIP SSC DRIVER
> M: Claudiu Beznea <claudiu.beznea(a)tuxon.dev>
> +M: Andrei Simion <andrei.simion(a)microchip.com>
> L: linux-arm-kernel(a)lists.infradead.org (moderated for non-subscribers)
> S: Supported
> F: Documentation/devicetree/bindings/misc/atmel-ssc.txt
>
> base-commit: 2b7275670032a98cba266bd1b8905f755b3e650f
1
0

[PATCH REVIEW 1/2] ASoC: codecs: lpass-rx-macro: fix RXn(rx,n) macro for DSM_CTL and SEC7 regs
by Alexey Klimov 25 Sep '24
by Alexey Klimov 25 Sep '24
25 Sep '24
Turns out some registers of pre-2.5 version of rxmacro codecs are not
located at the expected offsets but 0xc further away in memory.
So far the detected registers are CDC_RX_RX2_RX_PATH_SEC7 and
CDC_RX_RX2_RX_PATH_DSM_CTL.
CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) macro incorrectly generates the address
0x540 for RX2 but it should be 0x54C and it also overwrites
CDC_RX_RX2_RX_PATH_SEC7 which is located at 0x540.
The same goes for CDC_RX_RXn_RX_PATH_SEC7(rx, n).
Fix this by introducing additional rxn_reg_stride2 offset. For 2.5 version
and above this offset will be equal to 0.
With such change the corresponding RXn() macros will generate the same
values for 2.5 codec version for all RX paths and the same old values
for pre-2.5 version for RX0 and RX1. However for the latter case with RX2 path
it will also add 2 * rxn_reg_stride2 on top.
Signed-off-by: Alexey Klimov <alexey.klimov(a)linaro.org>
---
sound/soc/codecs/lpass-rx-macro.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 71e0d3bffd3f..9288ddb705fe 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -202,12 +202,14 @@
#define CDC_RX_RXn_RX_PATH_SEC3(rx, n) (0x042c + rx->rxn_reg_stride * n)
#define CDC_RX_RX0_RX_PATH_SEC4 (0x0430)
#define CDC_RX_RX0_RX_PATH_SEC7 (0x0434)
-#define CDC_RX_RXn_RX_PATH_SEC7(rx, n) (0x0434 + rx->rxn_reg_stride * n)
+#define CDC_RX_RXn_RX_PATH_SEC7(rx, n) \
+ (0x0434 + rx->rxn_reg_stride * n + n * (n - 1) * rx->rxn_reg_stride2)
#define CDC_RX_DSM_OUT_DELAY_SEL_MASK GENMASK(2, 0)
#define CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE 0x2
#define CDC_RX_RX0_RX_PATH_MIX_SEC0 (0x0438)
#define CDC_RX_RX0_RX_PATH_MIX_SEC1 (0x043C)
-#define CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) (0x0440 + rx->rxn_reg_stride * n)
+#define CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) \
+ (0x0440 + rx->rxn_reg_stride * n + n * (n - 1) * rx->rxn_reg_stride2)
#define CDC_RX_RXn_DSM_CLK_EN_MASK BIT(0)
#define CDC_RX_RX0_RX_PATH_DSM_CTL (0x0440)
#define CDC_RX_RX0_RX_PATH_DSM_DATA1 (0x0444)
@@ -645,6 +647,7 @@ struct rx_macro {
int rx_mclk_cnt;
enum lpass_codec_version codec_version;
int rxn_reg_stride;
+ int rxn_reg_stride2;
bool is_ear_mode_on;
bool hph_pwr_mode;
bool hph_hd2_mode;
@@ -3821,6 +3824,7 @@ static int rx_macro_probe(struct platform_device *pdev)
case LPASS_CODEC_VERSION_2_0:
case LPASS_CODEC_VERSION_2_1:
rx->rxn_reg_stride = 0x80;
+ rx->rxn_reg_stride2 = 0x6;
def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults);
reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
if (!reg_defaults)
@@ -3834,6 +3838,7 @@ static int rx_macro_probe(struct platform_device *pdev)
case LPASS_CODEC_VERSION_2_7:
case LPASS_CODEC_VERSION_2_8:
rx->rxn_reg_stride = 0xc0;
+ rx->rxn_reg_stride2 = 0x0;
def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults);
reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
if (!reg_defaults)
--
2.45.2
3
5

[PATCH AUTOSEL 6.6 063/139] ASoC: codecs: wsa883x: Handle reading version failure
by Sasha Levin 25 Sep '24
by Sasha Levin 25 Sep '24
25 Sep '24
From: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
[ Upstream commit 2fbf16992e5aa14acf0441320033a01a32309ded ]
If reading version and variant from registers fails (which is unlikely
but possible, because it is a read over bus), the driver will proceed
and perform device configuration based on uninitialized stack variables.
Handle it a bit better - bail out without doing any init and failing the
update status Soundwire callback.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
Link: https://patch.msgid.link/20240710-asoc-wsa88xx-version-v1-2-f1c54966ccde@li…
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/codecs/wsa883x.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 2169d93989841..1831d4487ba9d 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -998,15 +998,19 @@ static const struct reg_sequence reg_init[] = {
{WSA883X_GMAMP_SUP1, 0xE2},
};
-static void wsa883x_init(struct wsa883x_priv *wsa883x)
+static int wsa883x_init(struct wsa883x_priv *wsa883x)
{
struct regmap *regmap = wsa883x->regmap;
- int variant, version;
+ int variant, version, ret;
- regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ ret = regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ if (ret)
+ return ret;
wsa883x->variant = variant & WSA883X_ID_MASK;
- regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ ret = regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ if (ret)
+ return ret;
wsa883x->version = version;
switch (wsa883x->variant) {
@@ -1041,6 +1045,8 @@ static void wsa883x_init(struct wsa883x_priv *wsa883x)
WSA883X_DRE_OFFSET_MASK,
wsa883x->comp_offset);
}
+
+ return 0;
}
static int wsa883x_update_status(struct sdw_slave *slave,
@@ -1049,7 +1055,7 @@ static int wsa883x_update_status(struct sdw_slave *slave,
struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)
- wsa883x_init(wsa883x);
+ return wsa883x_init(wsa883x);
return 0;
}
--
2.43.0
1
0
alsa-project/alsa-lib issue #410 was opened from suddenfall:
When using amixer and alsamixer, I noticed that the volume controls for certain channels are reversed. I have verified the problem with two sound cards:
Terratec Aureon XFire8.0HD
hifidom DSC8-MAIN
Both are USB sound cards (UAC2).
Both sound cards have the channel map: FL FR FC LFE RL RR SL SR (cat stream0)
The channels FC/LFE are swapped with RL/RR.
I am using Ubuntu 24.04. The version of libasound2t64 is 1.2.11-1build2.
I am happy to help with troubleshooting.
Issue URL : https://github.com/alsa-project/alsa-lib/issues/410
Repository URL: https://github.com/alsa-project/alsa-lib
1
0

[PATCH AUTOSEL 6.10 095/197] ASoC: Intel: boards: always check the result of acpi_dev_get_first_match_dev()
by Sasha Levin 25 Sep '24
by Sasha Levin 25 Sep '24
25 Sep '24
From: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
[ Upstream commit 14e91ddd5c02d8c3e5a682ebfa0546352b459911 ]
The code seems mostly copy-pasted, with some machine drivers
forgetting to test if the 'adev' result is NULL.
Add this check when missing, and use -ENOENT consistently as an error
code.
Reported-by: Dan Carpenter <dan.carpenter(a)linaro.org>
Closes: https://lore.kernel.org/alsa-devel/918944d2-3d00-465e-a9d1-5d57fc966113@sta…
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi(a)linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao(a)linux.intel.com>
Link: https://patch.msgid.link/20240827123215.258859-4-yung-chuan.liao@linux.inte…
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/intel/boards/bytcht_cx2072x.c | 4 ++++
sound/soc/intel/boards/bytcht_da7213.c | 4 ++++
sound/soc/intel/boards/bytcht_es8316.c | 2 +-
sound/soc/intel/boards/bytcr_rt5640.c | 2 +-
sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 4 ++++
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 ++++
sound/soc/intel/boards/sof_es8336.c | 2 +-
sound/soc/intel/boards/sof_wm8804.c | 4 ++++
9 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/boards/bytcht_cx2072x.c b/sound/soc/intel/boards/bytcht_cx2072x.c
index df3c2a7b64d23..8c2b4ab764bba 100644
--- a/sound/soc/intel/boards/bytcht_cx2072x.c
+++ b/sound/soc/intel/boards/bytcht_cx2072x.c
@@ -255,7 +255,11 @@ static int snd_byt_cht_cx2072x_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name), "i2c-%s",
acpi_dev_name(adev));
byt_cht_cx2072x_dais[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* override platform name, if required */
diff --git a/sound/soc/intel/boards/bytcht_da7213.c b/sound/soc/intel/boards/bytcht_da7213.c
index 08c598b7e1eee..9178bbe8d9950 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -258,7 +258,11 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name),
"i2c-%s", acpi_dev_name(adev));
dailink[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* override platform name, if required */
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 77b91ea4dc32c..3539c9ff0fd2c 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -562,7 +562,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index db4a33680d948..4479825c08b5e 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1693,7 +1693,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 8514b79f389bb..1f54da98aacf4 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -926,7 +926,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 1da9ceee4d593..ac23a8b7cafca 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -582,7 +582,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
"i2c-%s", acpi_dev_name(adev));
cht_dailink[dai_index].codecs->name = cht_rt5645_codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
/* acpi_get_first_physical_node() returns a borrowed ref, no need to deref */
codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index d68e5bc755dee..c6c469d51243e 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -479,7 +479,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
snprintf(drv->codec_name, sizeof(drv->codec_name),
"i2c-%s", acpi_dev_name(adev));
cht_dailink[dai_index].codecs->name = drv->codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* Use SSP0 on Bay Trail CR devices */
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index c1fcc156a5752..809532238c44f 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -681,7 +681,7 @@ static int sof_es8336_probe(struct platform_device *pdev)
dai_links[0].codecs->dai_name = "ES8326 HiFi";
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/sof_wm8804.c b/sound/soc/intel/boards/sof_wm8804.c
index 4cb0d463bf404..9c5b3f8f09f36 100644
--- a/sound/soc/intel/boards/sof_wm8804.c
+++ b/sound/soc/intel/boards/sof_wm8804.c
@@ -270,7 +270,11 @@ static int sof_wm8804_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name),
"%s%s", "i2c-", acpi_dev_name(adev));
dailink[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
snd_soc_card_set_drvdata(card, ctx);
--
2.43.0
1
0

[PATCH AUTOSEL 6.10 082/197] ASoC: codecs: wsa883x: Handle reading version failure
by Sasha Levin 25 Sep '24
by Sasha Levin 25 Sep '24
25 Sep '24
From: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
[ Upstream commit 2fbf16992e5aa14acf0441320033a01a32309ded ]
If reading version and variant from registers fails (which is unlikely
but possible, because it is a read over bus), the driver will proceed
and perform device configuration based on uninitialized stack variables.
Handle it a bit better - bail out without doing any init and failing the
update status Soundwire callback.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
Link: https://patch.msgid.link/20240710-asoc-wsa88xx-version-v1-2-f1c54966ccde@li…
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/codecs/wsa883x.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 2169d93989841..1831d4487ba9d 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -998,15 +998,19 @@ static const struct reg_sequence reg_init[] = {
{WSA883X_GMAMP_SUP1, 0xE2},
};
-static void wsa883x_init(struct wsa883x_priv *wsa883x)
+static int wsa883x_init(struct wsa883x_priv *wsa883x)
{
struct regmap *regmap = wsa883x->regmap;
- int variant, version;
+ int variant, version, ret;
- regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ ret = regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ if (ret)
+ return ret;
wsa883x->variant = variant & WSA883X_ID_MASK;
- regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ ret = regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ if (ret)
+ return ret;
wsa883x->version = version;
switch (wsa883x->variant) {
@@ -1041,6 +1045,8 @@ static void wsa883x_init(struct wsa883x_priv *wsa883x)
WSA883X_DRE_OFFSET_MASK,
wsa883x->comp_offset);
}
+
+ return 0;
}
static int wsa883x_update_status(struct sdw_slave *slave,
@@ -1049,7 +1055,7 @@ static int wsa883x_update_status(struct sdw_slave *slave,
struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)
- wsa883x_init(wsa883x);
+ return wsa883x_init(wsa883x);
return 0;
}
--
2.43.0
1
0

[PATCH AUTOSEL 6.11 111/244] ASoC: Intel: boards: always check the result of acpi_dev_get_first_match_dev()
by Sasha Levin 25 Sep '24
by Sasha Levin 25 Sep '24
25 Sep '24
From: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
[ Upstream commit 14e91ddd5c02d8c3e5a682ebfa0546352b459911 ]
The code seems mostly copy-pasted, with some machine drivers
forgetting to test if the 'adev' result is NULL.
Add this check when missing, and use -ENOENT consistently as an error
code.
Reported-by: Dan Carpenter <dan.carpenter(a)linaro.org>
Closes: https://lore.kernel.org/alsa-devel/918944d2-3d00-465e-a9d1-5d57fc966113@sta…
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi(a)linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao(a)linux.intel.com>
Link: https://patch.msgid.link/20240827123215.258859-4-yung-chuan.liao@linux.inte…
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/intel/boards/bytcht_cx2072x.c | 4 ++++
sound/soc/intel/boards/bytcht_da7213.c | 4 ++++
sound/soc/intel/boards/bytcht_es8316.c | 2 +-
sound/soc/intel/boards/bytcr_rt5640.c | 2 +-
sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 4 ++++
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 ++++
sound/soc/intel/boards/sof_es8336.c | 2 +-
sound/soc/intel/boards/sof_wm8804.c | 4 ++++
9 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/boards/bytcht_cx2072x.c b/sound/soc/intel/boards/bytcht_cx2072x.c
index df3c2a7b64d23..8c2b4ab764bba 100644
--- a/sound/soc/intel/boards/bytcht_cx2072x.c
+++ b/sound/soc/intel/boards/bytcht_cx2072x.c
@@ -255,7 +255,11 @@ static int snd_byt_cht_cx2072x_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name), "i2c-%s",
acpi_dev_name(adev));
byt_cht_cx2072x_dais[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* override platform name, if required */
diff --git a/sound/soc/intel/boards/bytcht_da7213.c b/sound/soc/intel/boards/bytcht_da7213.c
index 08c598b7e1eee..9178bbe8d9950 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -258,7 +258,11 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name),
"i2c-%s", acpi_dev_name(adev));
dailink[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* override platform name, if required */
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 77b91ea4dc32c..3539c9ff0fd2c 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -562,7 +562,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index db4a33680d948..4479825c08b5e 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1693,7 +1693,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 8514b79f389bb..1f54da98aacf4 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -926,7 +926,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name;
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 1da9ceee4d593..ac23a8b7cafca 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -582,7 +582,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
"i2c-%s", acpi_dev_name(adev));
cht_dailink[dai_index].codecs->name = cht_rt5645_codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
/* acpi_get_first_physical_node() returns a borrowed ref, no need to deref */
codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index d68e5bc755dee..c6c469d51243e 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -479,7 +479,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
snprintf(drv->codec_name, sizeof(drv->codec_name),
"i2c-%s", acpi_dev_name(adev));
cht_dailink[dai_index].codecs->name = drv->codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
/* Use SSP0 on Bay Trail CR devices */
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index 2a88efaa6d26b..b45d0501f1090 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -681,7 +681,7 @@ static int sof_es8336_probe(struct platform_device *pdev)
dai_links[0].codecs->dai_name = "ES8326 HiFi";
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
- return -ENXIO;
+ return -ENOENT;
}
codec_dev = acpi_get_first_physical_node(adev);
diff --git a/sound/soc/intel/boards/sof_wm8804.c b/sound/soc/intel/boards/sof_wm8804.c
index b2d02cc92a6a8..0a5ce34d7f7bb 100644
--- a/sound/soc/intel/boards/sof_wm8804.c
+++ b/sound/soc/intel/boards/sof_wm8804.c
@@ -270,7 +270,11 @@ static int sof_wm8804_probe(struct platform_device *pdev)
snprintf(codec_name, sizeof(codec_name),
"%s%s", "i2c-", acpi_dev_name(adev));
dailink[dai_index].codecs->name = codec_name;
+ } else {
+ dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ return -ENOENT;
}
+
acpi_dev_put(adev);
snd_soc_card_set_drvdata(card, ctx);
--
2.43.0
1
0

[PATCH AUTOSEL 6.11 098/244] ASoC: codecs: wsa883x: Handle reading version failure
by Sasha Levin 25 Sep '24
by Sasha Levin 25 Sep '24
25 Sep '24
From: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
[ Upstream commit 2fbf16992e5aa14acf0441320033a01a32309ded ]
If reading version and variant from registers fails (which is unlikely
but possible, because it is a read over bus), the driver will proceed
and perform device configuration based on uninitialized stack variables.
Handle it a bit better - bail out without doing any init and failing the
update status Soundwire callback.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
Link: https://patch.msgid.link/20240710-asoc-wsa88xx-version-v1-2-f1c54966ccde@li…
Signed-off-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
sound/soc/codecs/wsa883x.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 3e4fdaa3f44fb..53f6de4340548 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -997,15 +997,19 @@ static const struct reg_sequence reg_init[] = {
{WSA883X_GMAMP_SUP1, 0xE2},
};
-static void wsa883x_init(struct wsa883x_priv *wsa883x)
+static int wsa883x_init(struct wsa883x_priv *wsa883x)
{
struct regmap *regmap = wsa883x->regmap;
- int variant, version;
+ int variant, version, ret;
- regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ ret = regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
+ if (ret)
+ return ret;
wsa883x->variant = variant & WSA883X_ID_MASK;
- regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ ret = regmap_read(regmap, WSA883X_CHIP_ID0, &version);
+ if (ret)
+ return ret;
wsa883x->version = version;
switch (wsa883x->variant) {
@@ -1040,6 +1044,8 @@ static void wsa883x_init(struct wsa883x_priv *wsa883x)
WSA883X_DRE_OFFSET_MASK,
wsa883x->comp_offset);
}
+
+ return 0;
}
static int wsa883x_update_status(struct sdw_slave *slave,
@@ -1048,7 +1054,7 @@ static int wsa883x_update_status(struct sdw_slave *slave,
struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)
- wsa883x_init(wsa883x);
+ return wsa883x_init(wsa883x);
return 0;
}
--
2.43.0
1
0
alsa-project/alsa-ucm-conf pull request #443 was opened from shumingfan:
rt722: add mic led support
Request URL : https://github.com/alsa-project/alsa-ucm-conf/pull/443
Patch URL : https://github.com/alsa-project/alsa-ucm-conf/pull/443.patch
Repository URL: https://github.com/alsa-project/alsa-ucm-conf
1
0
This is the initial codec driver for rt721-sdca.
Signed-off-by: Jack Yu <jack.yu(a)realtek.com>
---
sound/soc/codecs/Kconfig | 7 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/rt721-sdca-sdw.c | 550 +++++++++
sound/soc/codecs/rt721-sdca-sdw.h | 150 +++
sound/soc/codecs/rt721-sdca.c | 1790 +++++++++++++++++++++++++++++
sound/soc/codecs/rt721-sdca.h | 277 +++++
6 files changed, 2776 insertions(+)
create mode 100644 sound/soc/codecs/rt721-sdca-sdw.c
create mode 100644 sound/soc/codecs/rt721-sdca-sdw.h
create mode 100644 sound/soc/codecs/rt721-sdca.c
create mode 100644 sound/soc/codecs/rt721-sdca.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 7092842480ef..74c14da4ae09 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -222,6 +222,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_RT712_SDCA_DMIC_SDW
imply SND_SOC_RT715_SDW
imply SND_SOC_RT715_SDCA_SDW
+ imply SND_SOC_RT721_SDCA_SDW
imply SND_SOC_RT722_SDCA_SDW
imply SND_SOC_RT1308_SDW
imply SND_SOC_RT1316_SDW
@@ -1743,6 +1744,12 @@ config SND_SOC_RT712_SDCA_DMIC_SDW
select REGMAP_SOUNDWIRE
select REGMAP_SOUNDWIRE_MBQ
+config SND_SOC_RT721_SDCA_SDW
+ tristate "Realtek RT721 SDCA Codec - SDW"
+ depends on SOUNDWIRE
+ select REGMAP_SOUNDWIRE
+ select REGMAP_SOUNDWIRE_MBQ
+
config SND_SOC_RT722_SDCA_SDW
tristate "Realtek RT722 SDCA Codec - SDW"
depends on SOUNDWIRE
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 54cbc3feae32..3477c6352acc 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -259,6 +259,7 @@ snd-soc-rt712-sdca-y := rt712-sdca.o rt712-sdca-sdw.o
snd-soc-rt712-sdca-dmic-y := rt712-sdca-dmic.o
snd-soc-rt715-y := rt715.o rt715-sdw.o
snd-soc-rt715-sdca-y := rt715-sdca.o rt715-sdca-sdw.o
+snd-soc-rt721-sdca-y := rt721-sdca.o rt721-sdca-sdw.o
snd-soc-rt722-sdca-y := rt722-sdca.o rt722-sdca-sdw.o
snd-soc-rt9120-y := rt9120.o
snd-soc-rtq9128-y := rtq9128.o
@@ -662,6 +663,7 @@ obj-$(CONFIG_SND_SOC_RT712_SDCA_SDW) += snd-soc-rt712-sdca.o
obj-$(CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW) += snd-soc-rt712-sdca-dmic.o
obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o
obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o
+obj-$(CONFIG_SND_SOC_RT721_SDCA_SDW) += snd-soc-rt721-sdca.o
obj-$(CONFIG_SND_SOC_RT722_SDCA_SDW) += snd-soc-rt722-sdca.o
obj-$(CONFIG_SND_SOC_RT9120) += snd-soc-rt9120.o
obj-$(CONFIG_SND_SOC_RTQ9128) += snd-soc-rtq9128.o
diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c
new file mode 100644
index 000000000000..3a8dbbc01152
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca-sdw.c
@@ -0,0 +1,550 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// rt721-sdca-sdw.c -- rt721 SDCA ALSA SoC audio driver
+//
+// Copyright(c) 2024 Realtek Semiconductor Corp.
+//
+//
+
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm_runtime.h>
+#include <linux/soundwire/sdw_registers.h>
+
+#include "rt721-sdca.h"
+#include "rt721-sdca-sdw.h"
+
+static bool rt721_sdca_readable_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x2f01 ... 0x2f0a:
+ case 0x2f35:
+ case 0x2f50:
+ case 0x2f51:
+ case 0x2f58 ... 0x2f5d:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
+ RT721_SDCA_CTL_XUV, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_SELECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
+ RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
+ case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_volatile_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x2f01:
+ case 0x2f51:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
+ RT721_SDCA_CTL_XUV, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
+ RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
+ case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_mbq_readable_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x0900007:
+ case 0x0a00005:
+ case 0x0c00005:
+ case 0x0d00014:
+ case 0x0310100:
+ case 0x2000001:
+ case 0x2000002:
+ case 0x2000003:
+ case 0x2000013:
+ case 0x200003c:
+ case 0x2000046:
+ case 0x5810000:
+ case 0x5810036:
+ case 0x5810037:
+ case 0x5810038:
+ case 0x5810039:
+ case 0x5b10018:
+ case 0x5b10019:
+ case 0x5f00045:
+ case 0x5f00048:
+ case 0x6100000:
+ case 0x6100005:
+ case 0x6100006:
+ case 0x610000d:
+ case 0x6100010:
+ case 0x6100011:
+ case 0x6100013:
+ case 0x6100015:
+ case 0x6100017:
+ case 0x6100025:
+ case 0x6100029:
+ case 0x610002c ... 0x610002f:
+ case 0x6100053 ... 0x6100055:
+ case 0x6100057:
+ case 0x610005a:
+ case 0x610005b:
+ case 0x610006a:
+ case 0x610006d:
+ case 0x6100092:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_01):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_02):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_03):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_04):
+ case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_R):
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x0310100:
+ case 0x0a00005:
+ case 0x0c00005:
+ case 0x0d00014:
+ case 0x2000000:
+ case 0x200000d:
+ case 0x2000019:
+ case 0x2000020:
+ case 0x2000030:
+ case 0x2000046:
+ case 0x2000067:
+ case 0x2000084:
+ case 0x2000086:
+ case 0x5810000:
+ case 0x5810036:
+ case 0x5810037:
+ case 0x5810038:
+ case 0x5810039:
+ case 0x5b10018:
+ case 0x5b10019:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static const struct regmap_config rt721_sdca_regmap = {
+ .reg_bits = 32,
+ .val_bits = 8,
+ .readable_reg = rt721_sdca_readable_register,
+ .volatile_reg = rt721_sdca_volatile_register,
+ .max_register = 0x44ffffff,
+ .reg_defaults = rt721_sdca_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rt721_sdca_reg_defaults),
+ .cache_type = REGCACHE_MAPLE,
+ .use_single_read = true,
+ .use_single_write = true,
+};
+
+static const struct regmap_config rt721_sdca_mbq_regmap = {
+ .name = "sdw-mbq",
+ .reg_bits = 32,
+ .val_bits = 16,
+ .readable_reg = rt721_sdca_mbq_readable_register,
+ .volatile_reg = rt721_sdca_mbq_volatile_register,
+ .max_register = 0x41000312,
+ .reg_defaults = rt721_sdca_mbq_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rt721_sdca_mbq_defaults),
+ .cache_type = REGCACHE_MAPLE,
+ .use_single_read = true,
+ .use_single_write = true,
+};
+
+static int rt721_sdca_update_status(struct sdw_slave *slave,
+ enum sdw_slave_status status)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+
+ if (status == SDW_SLAVE_UNATTACHED)
+ rt721->hw_init = false;
+
+ if (status == SDW_SLAVE_ATTACHED) {
+ if (rt721->hs_jack) {
+ /*
+ * Due to the SCP_SDCA_INTMASK will be cleared by any reset, and then
+ * if the device attached again, we will need to set the setting back.
+ * It could avoid losing the jack detection interrupt.
+ * This also could sync with the cache value as the rt721_sdca_jack_init set.
+ */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_6);
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ }
+ }
+
+ /*
+ * Perform initialization only if slave status is present and
+ * hw_init flag is false
+ */
+ if (rt721->hw_init || status != SDW_SLAVE_ATTACHED)
+ return 0;
+
+ /* perform I/O transfers required for Slave initialization */
+ return rt721_sdca_io_init(&slave->dev, slave);
+}
+
+static int rt721_sdca_read_prop(struct sdw_slave *slave)
+{
+ struct sdw_slave_prop *prop = &slave->prop;
+ int nval;
+ int i, j;
+ u32 bit;
+ unsigned long addr;
+ struct sdw_dpn_prop *dpn;
+
+ sdw_slave_read_prop(slave);
+ prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
+ prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
+
+ prop->paging_support = true;
+
+ /*
+ * port = 1 for headphone playback
+ * port = 2 for headset-mic capture
+ * port = 3 for speaker playback
+ * port = 6 for digital-mic capture
+ */
+ prop->source_ports = BIT(6) | BIT(2); /* BITMAP: 01000100 */
+ prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */
+
+ nval = hweight32(prop->source_ports);
+ prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->src_dpn_prop), GFP_KERNEL);
+ if (!prop->src_dpn_prop)
+ return -ENOMEM;
+
+ i = 0;
+ dpn = prop->src_dpn_prop;
+ addr = prop->source_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[i].num = bit;
+ dpn[i].type = SDW_DPN_FULL;
+ dpn[i].simple_ch_prep_sm = true;
+ dpn[i].ch_prep_timeout = 10;
+ i++;
+ }
+
+ /* do this again for sink now */
+ nval = hweight32(prop->sink_ports);
+ prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
+ if (!prop->sink_dpn_prop)
+ return -ENOMEM;
+
+ j = 0;
+ dpn = prop->sink_dpn_prop;
+ addr = prop->sink_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[j].num = bit;
+ dpn[j].type = SDW_DPN_FULL;
+ dpn[j].simple_ch_prep_sm = true;
+ dpn[j].ch_prep_timeout = 10;
+ j++;
+ }
+
+ /* set the timeout values */
+ prop->clk_stop_timeout = 200;
+
+ /* wake-up event */
+ prop->wake_capable = 1;
+
+ /* Three data lanes are supported by rt721-sdca codec */
+ prop->lane_control_support = true;
+
+ return 0;
+}
+
+static int rt721_sdca_interrupt_callback(struct sdw_slave *slave,
+ struct sdw_slave_intr_status *status)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+ int ret, stat;
+ int count = 0, retry = 3;
+ unsigned int sdca_cascade, scp_sdca_stat1, scp_sdca_stat2 = 0;
+
+ if (cancel_delayed_work_sync(&rt721->jack_detect_work)) {
+ dev_warn(&slave->dev, "%s the pending delayed_work was cancelled", __func__);
+ /* avoid the HID owner doesn't change to device */
+ if (rt721->scp_sdca_stat2)
+ scp_sdca_stat2 = rt721->scp_sdca_stat2;
+ }
+
+ /*
+ * The critical section below intentionally protects a rather large piece of code.
+ * We don't want to allow the system suspend to disable an interrupt while we are
+ * processing it, which could be problematic given the quirky SoundWire interrupt
+ * scheme. We do want however to prevent new workqueues from being scheduled if
+ * the disable_irq flag was set during system suspend.
+ */
+ mutex_lock(&rt721->disable_irq_lock);
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+
+ rt721->scp_sdca_stat1 = ret;
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+
+ rt721->scp_sdca_stat2 = ret;
+ if (scp_sdca_stat2)
+ rt721->scp_sdca_stat2 |= scp_sdca_stat2;
+ do {
+ /* clear flag */
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+ if (ret & SDW_SCP_SDCA_INTMASK_SDCA_0) {
+ ret = sdw_update_no_pm(rt721->slave, SDW_SCP_SDCA_INT1,
+ SDW_SCP_SDCA_INT_SDCA_0, SDW_SCP_SDCA_INT_SDCA_0);
+ if (ret < 0)
+ goto io_error;
+ } else if (ret & SDW_SCP_SDCA_INTMASK_SDCA_6) {
+ ret = sdw_update_no_pm(rt721->slave, SDW_SCP_SDCA_INT1,
+ SDW_SCP_SDCA_INT_SDCA_6, SDW_SCP_SDCA_INT_SDCA_6);
+ if (ret < 0)
+ goto io_error;
+ }
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+ if (ret & SDW_SCP_SDCA_INTMASK_SDCA_8) {
+ ret = sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INT2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ if (ret < 0)
+ goto io_error;
+ }
+
+ /* check if flag clear or not */
+ ret = sdw_read_no_pm(rt721->slave, SDW_DP0_INT);
+ if (ret < 0)
+ goto io_error;
+ sdca_cascade = ret & SDW_DP0_SDCA_CASCADE;
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+ scp_sdca_stat1 = ret & SDW_SCP_SDCA_INTMASK_SDCA_0;
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+ scp_sdca_stat2 = ret & SDW_SCP_SDCA_INTMASK_SDCA_8;
+
+ stat = scp_sdca_stat1 || scp_sdca_stat2 || sdca_cascade;
+
+ count++;
+ } while (stat != 0 && count < retry);
+
+ if (stat)
+ dev_warn(&slave->dev,
+ "%s scp_sdca_stat1=0x%x, scp_sdca_stat2=0x%x\n", __func__,
+ rt721->scp_sdca_stat1, rt721->scp_sdca_stat2);
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+
+ if (status->sdca_cascade && !rt721->disable_irq)
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_detect_work, msecs_to_jiffies(280));
+
+ mutex_unlock(&rt721->disable_irq_lock);
+
+ return 0;
+
+io_error:
+ mutex_unlock(&rt721->disable_irq_lock);
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+ return ret;
+}
+
+static const struct sdw_slave_ops rt721_sdca_slave_ops = {
+ .read_prop = rt721_sdca_read_prop,
+ .interrupt_callback = rt721_sdca_interrupt_callback,
+ .update_status = rt721_sdca_update_status,
+};
+
+static int rt721_sdca_sdw_probe(struct sdw_slave *slave,
+ const struct sdw_device_id *id)
+{
+ struct regmap *regmap, *mbq_regmap;
+
+ /* Regmap Initialization */
+ mbq_regmap = devm_regmap_init_sdw_mbq(slave, &rt721_sdca_mbq_regmap);
+ if (IS_ERR(mbq_regmap))
+ return PTR_ERR(mbq_regmap);
+
+ regmap = devm_regmap_init_sdw(slave, &rt721_sdca_regmap);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return rt721_sdca_init(&slave->dev, regmap, mbq_regmap, slave);
+}
+
+static int rt721_sdca_sdw_remove(struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+
+ if (rt721->hw_init) {
+ cancel_delayed_work_sync(&rt721->jack_detect_work);
+ cancel_delayed_work_sync(&rt721->jack_btn_check_work);
+ }
+
+ if (rt721->first_hw_init)
+ pm_runtime_disable(&slave->dev);
+
+ mutex_destroy(&rt721->calibrate_mutex);
+ mutex_destroy(&rt721->disable_irq_lock);
+
+ return 0;
+}
+
+static const struct sdw_device_id rt721_sdca_id[] = {
+ SDW_SLAVE_ENTRY_EXT(0x025d, 0x721, 0x3, 0x1, 0),
+ {},
+};
+MODULE_DEVICE_TABLE(sdw, rt721_sdca_id);
+
+static int __maybe_unused rt721_sdca_dev_suspend(struct device *dev)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+
+ if (!rt721->hw_init)
+ return 0;
+
+ cancel_delayed_work_sync(&rt721->jack_detect_work);
+ cancel_delayed_work_sync(&rt721->jack_btn_check_work);
+
+ regcache_cache_only(rt721->regmap, true);
+ regcache_cache_only(rt721->mbq_regmap, true);
+
+ return 0;
+}
+
+static int __maybe_unused rt721_sdca_dev_system_suspend(struct device *dev)
+{
+ struct rt721_sdca_priv *rt721_sdca = dev_get_drvdata(dev);
+ struct sdw_slave *slave = dev_to_sdw_dev(dev);
+ int ret1, ret2;
+
+ if (!rt721_sdca->hw_init)
+ return 0;
+
+ /*
+ * prevent new interrupts from being handled after the
+ * deferred work completes and before the parent disables
+ * interrupts on the link
+ */
+ mutex_lock(&rt721_sdca->disable_irq_lock);
+ rt721_sdca->disable_irq = true;
+ ret1 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6, 0);
+ ret2 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8, 0);
+ mutex_unlock(&rt721_sdca->disable_irq_lock);
+
+ if (ret1 < 0 || ret2 < 0) {
+ /* log but don't prevent suspend from happening */
+ dev_dbg(&slave->dev, "%s: could not disable SDCA interrupts\n:", __func__);
+ }
+
+ return rt721_sdca_dev_suspend(dev);
+}
+
+#define RT721_PROBE_TIMEOUT 5000
+
+static int __maybe_unused rt721_sdca_dev_resume(struct device *dev)
+{
+ struct sdw_slave *slave = dev_to_sdw_dev(dev);
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+ unsigned long time;
+
+ if (!rt721->first_hw_init)
+ return 0;
+
+ if (!slave->unattach_request) {
+ mutex_lock(&rt721->disable_irq_lock);
+ if (rt721->disable_irq == true) {
+ sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_6);
+ sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
+ rt721->disable_irq = false;
+ }
+ mutex_unlock(&rt721->disable_irq_lock);
+ goto regmap_sync;
+ }
+
+ time = wait_for_completion_timeout(&slave->initialization_complete,
+ msecs_to_jiffies(RT721_PROBE_TIMEOUT));
+ if (!time) {
+ dev_err(&slave->dev, "Initialization not complete, timed out\n");
+ sdw_show_ping_status(slave->bus, true);
+
+ return -ETIMEDOUT;
+ }
+
+regmap_sync:
+ slave->unattach_request = 0;
+ regcache_cache_only(rt721->regmap, false);
+ regcache_sync(rt721->regmap);
+ regcache_cache_only(rt721->mbq_regmap, false);
+ regcache_sync(rt721->mbq_regmap);
+ return 0;
+}
+
+static const struct dev_pm_ops rt721_sdca_pm = {
+ SET_SYSTEM_SLEEP_PM_OPS(rt721_sdca_dev_system_suspend, rt721_sdca_dev_resume)
+ SET_RUNTIME_PM_OPS(rt721_sdca_dev_suspend, rt721_sdca_dev_resume, NULL)
+};
+
+static struct sdw_driver rt721_sdca_sdw_driver = {
+ .driver = {
+ .name = "rt721-sdca",
+ .owner = THIS_MODULE,
+ .pm = &rt721_sdca_pm,
+ },
+ .probe = rt721_sdca_sdw_probe,
+ .remove = rt721_sdca_sdw_remove,
+ .ops = &rt721_sdca_slave_ops,
+ .id_table = rt721_sdca_id,
+};
+module_sdw_driver(rt721_sdca_sdw_driver);
+
+MODULE_DESCRIPTION("ASoC RT721 SDCA SDW driver");
+MODULE_AUTHOR("Jack Yu <jack.yu(a)realtek.com>");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt721-sdca-sdw.h b/sound/soc/codecs/rt721-sdca-sdw.h
new file mode 100644
index 000000000000..214b31b82583
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca-sdw.h
@@ -0,0 +1,150 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * rt721-sdca-sdw.h -- RT721 SDCA ALSA SoC audio driver header
+ *
+ * Copyright(c) 2024 Realtek Semiconductor Corp.
+ */
+
+#ifndef __RT721_SDW_H__
+#define __RT721_SDW_H__
+
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw_registers.h>
+
+static const struct reg_default rt721_sdca_reg_defaults[] = {
+ { 0x202d, 0x00 },
+ { 0x2f01, 0x00 },
+ { 0x2f02, 0x09 },
+ { 0x2f03, 0x08 },
+ { 0x2f04, 0x00 },
+ { 0x2f05, 0x0e },
+ { 0x2f06, 0x01 },
+ { 0x2f09, 0x00 },
+ { 0x2f0a, 0x00 },
+ { 0x2f35, 0x00 },
+ { 0x2f50, 0xf0 },
+ { 0x2f58, 0x07 },
+ { 0x2f59, 0x07 },
+ { 0x2f5a, 0x00 },
+ { 0x2f5b, 0x07 },
+ { 0x2f5c, 0x27 },
+ { 0x2f5d, 0x07 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS01,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS11,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_03), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_04), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_CS1F,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_IT26,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_CS31,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_OT23,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+};
+
+static const struct reg_default rt721_sdca_mbq_defaults[] = {
+ { 0x0900007, 0xc004 },
+ { 0x2000001, 0x0000 },
+ { 0x2000002, 0x0000 },
+ { 0x2000003, 0x0000 },
+ { 0x2000013, 0x8001 },
+ { 0x200003c, 0x0000 },
+ { 0x2000046, 0x3400 },
+ { 0x5f00044, 0x6040 },
+ { 0x5f00045, 0x3333 },
+ { 0x5f00048, 0x0000 },
+ { 0x6100005, 0x0005 },
+ { 0x6100006, 0x0000 },
+ { 0x610000d, 0x0051 },
+ { 0x6100010, 0x0180 },
+ { 0x6100011, 0x0000 },
+ { 0x6100013, 0x0000 },
+ { 0x6100015, 0x0000 },
+ { 0x6100017, 0x8049 },
+ { 0x6100025, 0x1000 },
+ { 0x6100029, 0x0809 },
+ { 0x610002c, 0x2828 },
+ { 0x610002d, 0x2929 },
+ { 0x610002e, 0x3529 },
+ { 0x610002f, 0x2901 },
+ { 0x6100053, 0x2630 },
+ { 0x6100054, 0x2a2a },
+ { 0x6100055, 0x152f },
+ { 0x6100057, 0x2200 },
+ { 0x610005a, 0x2a4b },
+ { 0x610005b, 0x2a00 },
+ { 0x610006a, 0x0102 },
+ { 0x610006d, 0x0102 },
+ { 0x6100092, 0x4f61 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44, RT721_SDCA_CTL_FU_CH_GAIN,
+ CH_L), 0xfe00 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44, RT721_SDCA_CTL_FU_CH_GAIN,
+ CH_R), 0xfe00 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_01),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_02),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_03),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_04),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_01), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_02), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_03), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_04), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_R),
+ 0x0000 },
+};
+
+#endif /* __RT721_SDW_H__ */
diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
new file mode 100644
index 000000000000..cca749ebbd31
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -0,0 +1,1790 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// rt721-sdca.c -- rt721 SDCA ALSA SoC audio driver
+//
+// Copyright(c) 2024 Realtek Semiconductor Corp.
+//
+//
+
+#include <linux/bitops.h>
+#include <sound/core.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <sound/initval.h>
+#include <sound/jack.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <sound/pcm.h>
+#include <linux/pm_runtime.h>
+#include <sound/pcm_params.h>
+#include <linux/soundwire/sdw_registers.h>
+#include <linux/slab.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>
+
+#include "rt721-sdca.h"
+
+static void rt721_sdca_dmic_preset(struct rt721_sdca_priv *rt721)
+{
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* Set AD07/08 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL9, 0x2a2a);
+ /* Set AD10 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL10, 0x2a00);
+ /* Set DMIC1/DMIC2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL6, 0x2a2a);
+ /* Set DMIC1/DMIC2 IT entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL5, 0x2626);
+ /* Set AD10 FU entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL8, 0x1e00);
+ /* Set DMIC1/DMIC2 FU input gain floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL7, 0x1515);
+ /* Set DMIC2 FU input gain channel floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL3, 0x0304);
+ /* Set AD10 FU channel floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL4, 0x0304);
+ /* vf71f_r12_07_06 and vf71f_r13_07_06 = 2’b00 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_CTL1, 0x0000);
+ /* Enable vf707_r12_05/vf707_r13_05 */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_IT26,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x01);
+ /* Set usd_flag_sel, usd_in_sel */
+ regmap_write(rt721->mbq_regmap, 0x5910009, 0x2e01);
+ /* Set RC calibration */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b00);
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b40);
+ /* Fine tune PDE2A latency */
+ regmap_write(rt721->regmap, 0x2f5c, 0x25);
+}
+
+static void rt721_sdca_amp_preset(struct rt721_sdca_priv *rt721)
+{;
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* Reset dc_cal_top */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x6420);
+ /* Turn back to normal dc_cal_top */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x6421);
+ /* W1C Trigger Calibration */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0xe421);
+ /* DAC04 FU entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL6, 0x5561);
+ /* Set EAPD high */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_REG,
+ RT721_GPIO_PAD_CTRL5, 0x8003);
+ /* Enable vf707_r14 */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_OT23,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x04);
+ /* FU 23 SPK mute control - L */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x00);
+ /* FU 23 SPK mute control - R */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x00);
+ /* FU 55 DAC04 mute control - L */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x00);
+ /* FU 55 DAC04 mute control - R */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x00);
+}
+
+static void rt721_sdca_jack_preset(struct rt721_sdca_priv *rt721)
+{
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* GE0 mode related control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_GE_REL_CTRL1, 0x8011);
+ /* Button A, B, C, D bypass mode */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL3, 0xcf00);
+ /* HID1 slot enable */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL4, 0x000f);
+ /* Report ID for HID1 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL1, 0x1100);
+ /* OSC/OOC for slot 2, 3 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL5, 0x0c12);
+ /* Set JD de-bounce clock control */
+ rt721_sdca_index_write(rt721, RT721_JD_CTRL,
+ RT721_JD_1PIN_GAT_CTRL2, 0xc002);
+ /* RC calibration -1 */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b00);
+ /* RC calibration -2 */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b40);
+ /* pow_clk_12p288mhz_dre03 change to register mode */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3333);
+ /* Tune calibration timing control */
+ regmap_write(rt721->mbq_regmap, 0x5810035, 0x0036);
+ /* calibration HP amp output select control from Efuse */
+ regmap_write(rt721->mbq_regmap, 0x5810030, 0xee00);
+ /* FSM related control */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL1, 0x0140);
+ /* HP calibration related control */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x0021);
+ /* W1C HP calibration*/
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x8021);
+ /* reg_sel_cin_hp_0010/0011 */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL18, 0x5522);
+ regmap_write(rt721->mbq_regmap, 0x5b10007, 0x2000);
+ /* sel_sensing_lr_hp */
+ regmap_write(rt721->mbq_regmap, 0x5B10017, 0x1b0f);
+ /* Release HP-JD */
+ rt721_sdca_index_write(rt721, RT721_CBJ_CTRL,
+ RT721_CBJ_A0_GAT_CTRL1, 0x2a02);
+ /* en_osw gating auto done bit */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL4, 0xa105);
+ /* pow_clk_en_sw_amp_detect_sel to register mode */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3b33);
+ /* cp_sw_hp to auto mode */
+ regmap_write(rt721->mbq_regmap, 0x310400, 0x3023);
+ /* pow_clk_en_sw_amp_detect power up */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3f33);
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON13, 0x6048);
+ /* switch size detect threshold */
+ regmap_write(rt721->mbq_regmap, 0x310401, 0x3000);
+ regmap_write(rt721->mbq_regmap, 0x310402, 0x1b00);
+ /* en_hp_amp_detect auto mode */
+ regmap_write(rt721->mbq_regmap, 0x310300, 0x000f);
+ /* amp detect threshold */
+ regmap_write(rt721->mbq_regmap, 0x310301, 0x3000);
+ regmap_write(rt721->mbq_regmap, 0x310302, 0x1b00);
+ /* gating_sdw_link_rst_n_1_cbj_reg */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON17, 0x0008);
+ /* CKXEN_SDAC chopper function */
+ rt721_sdca_index_write(rt721, RT721_DAC_CTRL,
+ RT721_DAC_2CH_CTRL3, 0x55ff);
+ /* CKXSEL_SDAC chopper frequency */
+ rt721_sdca_index_write(rt721, RT721_DAC_CTRL,
+ RT721_DAC_2CH_CTRL4, 0xcc00);
+ /* Bias current for SDAC */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_MBIAS_LV_CTRL2, 0x6677);
+ /* VREF2 level selection */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF2_LV_CTRL1, 0x7600);
+ /* ADC09/MIC2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL2, 0x1234);
+ /* LINE2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL3, 0x3512);
+ /* DAC03/HP power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL1, 0x4040);
+ /* ADC27 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL4, 0x1201);
+ /* Fine tune PDE40 latency */
+ regmap_write(rt721->regmap, 0x2f58, 0x07);
+}
+
+int rt721_sdca_index_write(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int value)
+{
+ struct regmap *regmap = rt721->mbq_regmap;
+ unsigned int addr = (nid << 20) | reg;
+ int ret;
+
+ ret = regmap_write(regmap, addr, value);
+ if (ret < 0)
+ dev_err(&rt721->slave->dev,
+ "Failed to set private value: %06x <= %04x ret=%d\n",
+ addr, value, ret);
+
+ return ret;
+}
+
+int rt721_sdca_index_read(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int *value)
+{
+ int ret;
+ struct regmap *regmap = rt721->mbq_regmap;
+ unsigned int addr = (nid << 20) | reg;
+
+ ret = regmap_read(regmap, addr, value);
+ if (ret < 0)
+ dev_err(&rt721->slave->dev,
+ "Failed to get private value: %06x => %04x ret=%d\n",
+ addr, *value, ret);
+
+ return ret;
+}
+
+static int rt721_sdca_index_update_bits(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int mask, unsigned int val)
+{
+ unsigned int tmp;
+ int ret;
+
+ ret = rt721_sdca_index_read(rt721, nid, reg, &tmp);
+ if (ret < 0)
+ return ret;
+
+ set_mask_bits(&tmp, mask, val);
+ return rt721_sdca_index_write(rt721, nid, reg, tmp);
+}
+
+static int rt721_sdca_btn_type(unsigned char *buffer)
+{
+ if ((*buffer & 0xf0) == 0x10 || (*buffer & 0x0f) == 0x01 ||
+ (*(buffer + 1) == 0x01) || (*(buffer + 1) == 0x10))
+ return SND_JACK_BTN_2;
+ else if ((*buffer & 0xf0) == 0x20 || (*buffer & 0x0f) == 0x02 ||
+ (*(buffer + 1) == 0x02) || (*(buffer + 1) == 0x20))
+ return SND_JACK_BTN_3;
+ else if ((*buffer & 0xf0) == 0x40 || (*buffer & 0x0f) == 0x04 ||
+ (*(buffer + 1) == 0x04) || (*(buffer + 1) == 0x40))
+ return SND_JACK_BTN_0;
+ else if ((*buffer & 0xf0) == 0x80 || (*buffer & 0x0f) == 0x08 ||
+ (*(buffer + 1) == 0x08) || (*(buffer + 1) == 0x80))
+ return SND_JACK_BTN_1;
+
+ return 0;
+}
+
+static unsigned int rt721_sdca_button_detect(struct rt721_sdca_priv *rt721)
+{
+ unsigned int btn_type = 0, offset, idx, val, owner;
+ int ret;
+ unsigned char buf[3];
+
+ /* get current UMP message owner */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), &owner);
+ if (ret < 0)
+ return 0;
+
+ /* if owner is device then there is no button event from device */
+ if (owner == 1)
+ return 0;
+
+ /* read UMP message offset */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET, 0), &offset);
+ if (ret < 0)
+ goto _end_btn_det_;
+
+ for (idx = 0; idx < sizeof(buf); idx++) {
+ ret = regmap_read(rt721->regmap,
+ RT721_BUF_ADDR_HID1 + offset + idx, &val);
+ if (ret < 0)
+ goto _end_btn_det_;
+ buf[idx] = val & 0xff;
+ }
+
+ if (buf[0] == 0x11)
+ btn_type = rt721_sdca_btn_type(&buf[1]);
+
+_end_btn_det_:
+ /* Host is owner, so set back to device */
+ if (owner == 0)
+ /* set owner to device */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), 0x01);
+
+ return btn_type;
+}
+
+static int rt721_sdca_headset_detect(struct rt721_sdca_priv *rt721)
+{
+ unsigned int det_mode;
+ int ret;
+
+ /* get detected_mode */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0), &det_mode);
+
+ if (ret < 0)
+ goto io_error;
+
+ switch (det_mode) {
+ case 0x00:
+ rt721->jack_type = 0;
+ break;
+ case 0x03:
+ rt721->jack_type = SND_JACK_HEADPHONE;
+ break;
+ case 0x05:
+ rt721->jack_type = SND_JACK_HEADSET;
+ break;
+ }
+
+ /* write selected_mode */
+ if (det_mode) {
+ ret = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), det_mode);
+ if (ret < 0)
+ goto io_error;
+ }
+
+ dev_dbg(&rt721->slave->dev,
+ "%s, detected_mode=0x%x\n", __func__, det_mode);
+
+ return 0;
+
+io_error:
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+ return ret;
+}
+
+static void rt721_sdca_jack_detect_handler(struct work_struct *work)
+{
+ struct rt721_sdca_priv *rt721 =
+ container_of(work, struct rt721_sdca_priv, jack_detect_work.work);
+ int btn_type = 0, ret;
+
+ if (!rt721->hs_jack)
+ return;
+
+ if (!rt721->component->card || !rt721->component->card->instantiated)
+ return;
+
+ /* SDW_SCP_SDCA_INT_SDCA_6 is used for jack detection */
+ if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) {
+ ret = rt721_sdca_headset_detect(rt721);
+ if (ret < 0)
+ return;
+ }
+
+ /* SDW_SCP_SDCA_INT_SDCA_8 is used for button detection */
+ if (rt721->scp_sdca_stat2 & SDW_SCP_SDCA_INT_SDCA_8)
+ btn_type = rt721_sdca_button_detect(rt721);
+
+ if (rt721->jack_type == 0)
+ btn_type = 0;
+
+ dev_dbg(&rt721->slave->dev,
+ "in %s, jack_type=%d\n", __func__, rt721->jack_type);
+ dev_dbg(&rt721->slave->dev,
+ "in %s, btn_type=0x%x\n", __func__, btn_type);
+ pr_info("rtk debug, jack_type=%d\n", rt721->jack_type);
+ pr_info("rtk debug, btn_type=0x%x\n", btn_type);
+ dev_dbg(&rt721->slave->dev,
+ "in %s, scp_sdca_stat1=0x%x, scp_sdca_stat2=0x%x\n", __func__,
+ rt721->scp_sdca_stat1, rt721->scp_sdca_stat2);
+
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type | btn_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ if (btn_type) {
+ /* button released */
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_btn_check_work, msecs_to_jiffies(200));
+ }
+}
+
+static void rt721_sdca_btn_check_handler(struct work_struct *work)
+{
+ struct rt721_sdca_priv *rt721 =
+ container_of(work, struct rt721_sdca_priv, jack_btn_check_work.work);
+ int btn_type = 0, ret, idx;
+ unsigned int det_mode, offset, val;
+ unsigned char buf[3];
+
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0), &det_mode);
+ if (ret < 0)
+ goto io_error;
+
+ /* pin attached */
+ if (det_mode) {
+ /* read UMP message offset */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET, 0), &offset);
+ if (ret < 0)
+ goto io_error;
+
+ for (idx = 0; idx < sizeof(buf); idx++) {
+ ret = regmap_read(rt721->regmap,
+ RT721_BUF_ADDR_HID1 + offset + idx, &val);
+ if (ret < 0)
+ goto io_error;
+ buf[idx] = val & 0xff;
+ }
+
+ if (buf[0] == 0x11)
+ btn_type = rt721_sdca_btn_type(&buf[1]);
+ } else
+ rt721->jack_type = 0;
+
+ dev_dbg(&rt721->slave->dev, "%s, btn_type=0x%x\n", __func__, btn_type);
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type | btn_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ if (btn_type) {
+ /* button released */
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_btn_check_work, msecs_to_jiffies(200));
+ }
+
+ return;
+
+io_error:
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+}
+
+static void rt721_sdca_jack_init(struct rt721_sdca_priv *rt721)
+{
+ mutex_lock(&rt721->calibrate_mutex);
+ if (rt721->hs_jack) {
+ /* set SCP_SDCA_IntMask1[0]=1 */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6);
+ /* set SCP_SDCA_IntMask2[0]=1 */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ dev_dbg(&rt721->slave->dev, "in %s enable\n", __func__);
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_UAJ_CTL, 0x036E);
+ /* set XU(et03h) & XU(et0Dh) to Not bypassed */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XU03,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), 0);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XU0D,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), 0);
+ /* trigger GE interrupt */
+ rt721_sdca_index_update_bits(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_GE_REL_CTRL1, 0x4000, 0x4000);
+ }
+ mutex_unlock(&rt721->calibrate_mutex);
+}
+
+static int rt721_sdca_set_jack_detect(struct snd_soc_component *component,
+ struct snd_soc_jack *hs_jack, void *data)
+{
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ rt721->hs_jack = hs_jack;
+
+ ret = pm_runtime_resume_and_get(component->dev);
+ if (ret < 0) {
+ if (ret != -EACCES) {
+ dev_err(component->dev, "%s: failed to resume %d\n", __func__, ret);
+ return ret;
+ }
+ /* pm_runtime not enabled yet */
+ dev_dbg(component->dev, "%s: skipping jack init for now\n", __func__);
+ return 0;
+ }
+
+ rt721_sdca_jack_init(rt721);
+
+ pm_runtime_mark_last_busy(component->dev);
+ pm_runtime_put_autosuspend(component->dev);
+
+ return 0;
+}
+
+/* For SDCA control DAC/ADC Gain */
+static int rt721_sdca_set_gain_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int read_l, read_r, gain_l_val, gain_r_val;
+ unsigned int adc_vol_flag = 0, changed = 0;
+ unsigned int lvalue, rvalue;
+ const unsigned int interval_offset = 0xc0;
+ const unsigned int tendA = 0x200;
+ const unsigned int tendB = 0xa00;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume") ||
+ strstr(ucontrol->id.name, "FU0F Capture Volume"))
+ adc_vol_flag = 1;
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &lvalue);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &rvalue);
+
+ /* L Channel */
+ gain_l_val = ucontrol->value.integer.value[0];
+ if (gain_l_val > mc->max)
+ gain_l_val = mc->max;
+
+ if (mc->shift == 8) {
+ /* boost gain */
+ gain_l_val = gain_l_val * tendB;
+ } else if (mc->shift == 1) {
+ /* FU33 boost gain */
+ if (gain_l_val == 0)
+ gain_l_val = 0x8000;
+ else
+ gain_l_val = (gain_l_val - 1) * tendA;
+ } else {
+ /* ADC/DAC gain */
+ if (adc_vol_flag)
+ gain_l_val = 0x1e00 - ((mc->max - gain_l_val) * interval_offset);
+ else
+ gain_l_val = 0 - ((mc->max - gain_l_val) * interval_offset);
+ gain_l_val &= 0xffff;
+ }
+
+ /* R Channel */
+ gain_r_val = ucontrol->value.integer.value[1];
+ if (gain_r_val > mc->max)
+ gain_r_val = mc->max;
+
+ if (mc->shift == 8) {
+ /* boost gain */
+ gain_r_val = gain_r_val * tendB;
+ } else if (mc->shift == 1) {
+ /* FU33 boost gain */
+ if (gain_r_val == 0)
+ gain_r_val = 0x8000;
+ else
+ gain_r_val = (gain_r_val - 1) * tendA;
+ } else {
+ /* ADC/DAC gain */
+ if (adc_vol_flag)
+ gain_r_val = 0x1e00 - ((mc->max - gain_r_val) * interval_offset);
+ else
+ gain_r_val = 0 - ((mc->max - gain_r_val) * interval_offset);
+ gain_r_val &= 0xffff;
+ }
+
+ if (lvalue != gain_l_val || rvalue != gain_r_val)
+ changed = 1;
+ else
+ return 0;
+
+ /* Lch*/
+ regmap_write(rt721->mbq_regmap, mc->reg, gain_l_val);
+
+ /* Rch */
+ regmap_write(rt721->mbq_regmap, mc->rreg, gain_r_val);
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &read_l);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &read_r);
+ if (read_r == gain_r_val && read_l == gain_l_val)
+ return changed;
+
+ return -EIO;
+}
+
+static int rt721_sdca_set_gain_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ unsigned int read_l, read_r, ctl_l = 0, ctl_r = 0;
+ unsigned int adc_vol_flag = 0;
+ const unsigned int interval_offset = 0xc0;
+ const unsigned int tendB = 0xa00;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume") ||
+ strstr(ucontrol->id.name, "FU0F Capture Volume"))
+ adc_vol_flag = 1;
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &read_l);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &read_r);
+
+ if (mc->shift == 8) /* boost gain */
+ ctl_l = read_l / tendB;
+ else {
+ if (adc_vol_flag)
+ ctl_l = mc->max - (((0x1e00 - read_l) & 0xffff) / interval_offset);
+ else
+ ctl_l = mc->max - (((0 - read_l) & 0xffff) / interval_offset);
+ }
+
+ if (read_l != read_r) {
+ if (mc->shift == 8) /* boost gain */
+ ctl_r = read_r / tendB;
+ else { /* ADC/DAC gain */
+ if (adc_vol_flag)
+ ctl_r = mc->max - (((0x1e00 - read_r) & 0xffff) / interval_offset);
+ else
+ ctl_r = mc->max - (((0 - read_r) & 0xffff) / interval_offset);
+ }
+ } else {
+ ctl_r = ctl_l;
+ }
+
+ ucontrol->value.integer.value[0] = ctl_l;
+ ucontrol->value.integer.value[1] = ctl_r;
+
+ return 0;
+}
+
+static int rt721_sdca_set_fu1e_capture_ctl(struct rt721_sdca_priv *rt721)
+{
+ int err, i;
+ unsigned int ch_mute;
+
+ for (i = 0; i < ARRAY_SIZE(rt721->fu1e_mixer_mute); i++) {
+ ch_mute = rt721->fu1e_dapm_mute || rt721->fu1e_mixer_mute[i];
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01) + i, ch_mute);
+ if (err < 0)
+ return err;
+ }
+
+ return 0;
+}
+
+static int rt721_sdca_fu1e_capture_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ unsigned int i;
+
+ for (i = 0; i < p->count; i++)
+ ucontrol->value.integer.value[i] = !rt721->fu1e_mixer_mute[i];
+
+ return 0;
+}
+
+static int rt721_sdca_fu1e_capture_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ int err, changed = 0, i;
+
+ for (i = 0; i < p->count; i++) {
+ if (rt721->fu1e_mixer_mute[i] != !ucontrol->value.integer.value[i])
+ changed = 1;
+ rt721->fu1e_mixer_mute[i] = !ucontrol->value.integer.value[i];
+ }
+
+ err = rt721_sdca_set_fu1e_capture_ctl(rt721);
+ if (err < 0)
+ return err;
+
+ return changed;
+}
+
+static int rt721_sdca_set_fu0f_capture_ctl(struct rt721_sdca_priv *rt721)
+{
+ int err;
+ unsigned int ch_l, ch_r;
+
+ ch_l = (rt721->fu0f_dapm_mute || rt721->fu0f_mixer_l_mute) ? 0x01 : 0x00;
+ ch_r = (rt721->fu0f_dapm_mute || rt721->fu0f_mixer_r_mute) ? 0x01 : 0x00;
+
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), ch_l);
+ if (err < 0)
+ return err;
+
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), ch_r);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static int rt721_sdca_fu0f_capture_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ ucontrol->value.integer.value[0] = !rt721->fu0f_mixer_l_mute;
+ ucontrol->value.integer.value[1] = !rt721->fu0f_mixer_r_mute;
+ return 0;
+}
+
+static int rt721_sdca_fu0f_capture_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int err, changed = 0;
+
+ if (rt721->fu0f_mixer_l_mute != !ucontrol->value.integer.value[0] ||
+ rt721->fu0f_mixer_r_mute != !ucontrol->value.integer.value[1])
+ changed = 1;
+
+ rt721->fu0f_mixer_l_mute = !ucontrol->value.integer.value[0];
+ rt721->fu0f_mixer_r_mute = !ucontrol->value.integer.value[1];
+ err = rt721_sdca_set_fu0f_capture_ctl(rt721);
+ if (err < 0)
+ return err;
+
+ return changed;
+}
+
+static int rt721_sdca_fu_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+
+ if (p->max == 1)
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ else
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ uinfo->count = p->count;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = p->max;
+ return 0;
+}
+
+static int rt721_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ unsigned int boost_step = 0x0a00;
+ unsigned int vol_max = 0x1e00;
+ unsigned int regvalue, ctl, i;
+ unsigned int adc_vol_flag = 0;
+ const unsigned int interval_offset = 0xc0;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume"))
+ adc_vol_flag = 1;
+
+ /* check all channels */
+ for (i = 0; i < p->count; i++) {
+ regmap_read(rt721->mbq_regmap, p->reg_base + i, ®value);
+
+ if (!adc_vol_flag) /* boost gain */
+ ctl = regvalue / boost_step;
+ else { /* ADC gain */
+ if (adc_vol_flag)
+ ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
+ else
+ ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
+ }
+
+ ucontrol->value.integer.value[i] = ctl;
+ }
+
+ return 0;
+}
+
+static int rt721_sdca_dmic_set_gain_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int boost_step = 0x0a00;
+ unsigned int vol_max = 0x1e00;
+ unsigned int gain_val[4];
+ unsigned int i, adc_vol_flag = 0, changed = 0;
+ unsigned int regvalue[4];
+ const unsigned int interval_offset = 0xc0;
+ int err;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume"))
+ adc_vol_flag = 1;
+
+ /* check all channels */
+ for (i = 0; i < p->count; i++) {
+ regmap_read(rt721->mbq_regmap, p->reg_base + i, ®value[i]);
+
+ gain_val[i] = ucontrol->value.integer.value[i];
+ if (gain_val[i] > p->max)
+ gain_val[i] = p->max;
+
+ if (!adc_vol_flag) /* boost gain */
+ gain_val[i] = gain_val[i] * boost_step;
+ else { /* ADC gain */
+ gain_val[i] = vol_max - ((p->max - gain_val[i]) * interval_offset);
+ gain_val[i] &= 0xffff;
+ }
+
+ if (regvalue[i] != gain_val[i])
+ changed = 1;
+ }
+
+ if (!changed)
+ return 0;
+
+ for (i = 0; i < p->count; i++) {
+ err = regmap_write(rt721->mbq_regmap, p->reg_base + i, gain_val[i]);
+ if (err < 0)
+ dev_err(&rt721->slave->dev, "%#08x can't be set\n", p->reg_base + i);
+ }
+
+ return changed;
+}
+
+#define RT721_SDCA_PR_VALUE(xreg_base, xcount, xmax, xinvert) \
+ ((unsigned long)&(struct rt721_sdca_dmic_kctrl_priv) \
+ {.reg_base = xreg_base, .count = xcount, .max = xmax, \
+ .invert = xinvert})
+
+#define RT721_SDCA_FU_CTRL(xname, reg_base, xmax, xinvert, xcount) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .info = rt721_sdca_fu_info, \
+ .get = rt721_sdca_fu1e_capture_get, \
+ .put = rt721_sdca_fu1e_capture_put, \
+ .private_value = RT721_SDCA_PR_VALUE(reg_base, xcount, xmax, xinvert)}
+
+#define RT721_SDCA_EXT_TLV(xname, reg_base, xhandler_get,\
+ xhandler_put, xcount, xmax, tlv_array) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
+ SNDRV_CTL_ELEM_ACCESS_READWRITE, \
+ .tlv.p = (tlv_array), \
+ .info = rt721_sdca_fu_info, \
+ .get = xhandler_get, .put = xhandler_put, \
+ .private_value = RT721_SDCA_PR_VALUE(reg_base, xcount, xmax, 0) }
+
+static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);
+static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -1725, 75, 0);
+static const DECLARE_TLV_DB_SCALE(boost_vol_tlv, 0, 1000, 0);
+static const DECLARE_TLV_DB_SCALE(mic2_boost_vol_tlv, -200, 200, 0);
+
+static const struct snd_kcontrol_new rt721_sdca_controls[] = {
+ /* Headphone playback settings */
+ SOC_DOUBLE_R_EXT_TLV("FU05 Playback Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x57, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, out_vol_tlv),
+ /* Headset mic capture settings */
+ SOC_DOUBLE_EXT("FU0F Capture Switch", SND_SOC_NOPM, 0, 1, 1, 0,
+ rt721_sdca_fu0f_capture_get, rt721_sdca_fu0f_capture_put),
+ SOC_DOUBLE_R_EXT_TLV("FU0F Capture Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x3f, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, mic_vol_tlv),
+ SOC_DOUBLE_R_EXT_TLV("FU33 Boost Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_R), 1, 0x15, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, mic2_boost_vol_tlv),
+ /* AMP playback settings */
+ SOC_DOUBLE_R_EXT_TLV("FU06 Playback Volume",
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x57, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, out_vol_tlv),
+ /* DMIC capture settings */
+ RT721_SDCA_FU_CTRL("FU1E Capture Switch",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 1, 1, 4),
+ RT721_SDCA_EXT_TLV("FU1E Capture Volume",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_VOLUME, CH_01),
+ rt721_sdca_dmic_set_gain_get, rt721_sdca_dmic_set_gain_put,
+ 4, 0x3f, mic_vol_tlv),
+ RT721_SDCA_EXT_TLV("FU15 Boost Volume",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_01),
+ rt721_sdca_dmic_set_gain_get, rt721_sdca_dmic_set_gain_put,
+ 4, 3, boost_vol_tlv),
+};
+
+static int rt721_sdca_adc_mux_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_kcontrol_component(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int val = 0, mask_sft, mask;
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux")) {
+ mask_sft = 12;
+ mask = 0x7;
+ } else if (strstr(ucontrol->id.name, "ADC 08 R Mux")) {
+ mask_sft = 10;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 08 L Mux")) {
+ mask_sft = 8;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 R Mux")) {
+ mask_sft = 6;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 L Mux")) {
+ mask_sft = 4;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 R Mux")) {
+ mask_sft = 2;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 L Mux")) {
+ mask_sft = 0;
+ mask = 0x3;
+ } else
+ return -EINVAL;
+
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &val);
+
+ ucontrol->value.enumerated.item[0] = (val >> mask_sft) & mask;
+
+ return 0;
+}
+
+static int rt721_sdca_adc_mux_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_kcontrol_component(kcontrol);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_dapm_kcontrol_dapm(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+ unsigned int *item = ucontrol->value.enumerated.item;
+ unsigned int val, val2 = 0, change, mask_sft, mask;
+ unsigned int check;
+
+ if (item[0] >= e->items)
+ return -EINVAL;
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux")) {
+ mask_sft = 12;
+ mask = 0x7;
+ } else if (strstr(ucontrol->id.name, "ADC 08 R Mux")) {
+ mask_sft = 10;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 08 L Mux")) {
+ mask_sft = 8;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 R Mux")) {
+ mask_sft = 6;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 L Mux")) {
+ mask_sft = 4;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 R Mux")) {
+ mask_sft = 2;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 L Mux")) {
+ mask_sft = 0;
+ mask = 0x3;
+ } else
+ return -EINVAL;
+
+ val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l;
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &val2);
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux"))
+ val2 = (val2 >> mask_sft) & 0x7;
+ else
+ val2 = (val2 >> mask_sft) & 0x3;
+
+ if (val == val2)
+ change = 0;
+ else
+ change = 1;
+
+ if (change) {
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &check);
+ rt721_sdca_index_update_bits(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, mask << mask_sft,
+ val << mask_sft);
+ }
+
+ snd_soc_dapm_mux_update_power(dapm, kcontrol,
+ item[0], e, NULL);
+
+ return change;
+}
+
+static const char * const adc09_mux_text[] = {
+ "MIC2",
+ "LINE1",
+ "LINE2",
+};
+static const char * const adc07_10_mux_text[] = {
+ "DMIC1 RE",
+ "DMIC1 FE",
+ "DMIC2 RE",
+ "DMIC2 FE",
+};
+
+static SOC_ENUM_SINGLE_DECL(
+ rt721_adc09_enum, SND_SOC_NOPM, 0, adc09_mux_text);
+static SOC_ENUM_SINGLE_DECL(
+ rt721_dmic_enum, SND_SOC_NOPM, 0, adc07_10_mux_text);
+
+static const struct snd_kcontrol_new rt721_sdca_adc09_mux =
+ SOC_DAPM_ENUM_EXT("ADC 09 Mux", rt721_adc09_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc08_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 08 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc08_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 08 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc10_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 10 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc10_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 10 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc07_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 07 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc07_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 07 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+
+
+static int rt721_sdca_fu42_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ msleep(100);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu21_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu23_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu113_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ rt721->fu1e_dapm_mute = false;
+ rt721_sdca_set_fu1e_capture_ctl(rt721);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ rt721->fu1e_dapm_mute = true;
+ rt721_sdca_set_fu1e_capture_ctl(rt721);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu36_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ rt721->fu0f_dapm_mute = false;
+ rt721_sdca_set_fu0f_capture_ctl(rt721);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ rt721->fu0f_dapm_mute = true;
+ rt721_sdca_set_fu0f_capture_ctl(rt721);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde47_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde41_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE41,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE41,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde11_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde34_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static const struct snd_soc_dapm_widget rt721_sdca_dapm_widgets[] = {
+ SND_SOC_DAPM_OUTPUT("HP"),
+ SND_SOC_DAPM_OUTPUT("SPK"),
+ SND_SOC_DAPM_INPUT("MIC2"),
+ SND_SOC_DAPM_INPUT("LINE1"),
+ SND_SOC_DAPM_INPUT("LINE2"),
+ SND_SOC_DAPM_INPUT("DMIC1_2"),
+ SND_SOC_DAPM_INPUT("DMIC3_4"),
+
+ SND_SOC_DAPM_SUPPLY("PDE 41", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde41_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 47", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde47_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 11", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde11_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 34", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde34_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+
+ SND_SOC_DAPM_DAC_E("FU 21", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu21_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_DAC_E("FU 23", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu23_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_DAC_E("FU 42", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu42_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_ADC_E("FU 36", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu36_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_ADC_E("FU 113", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu113_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_MUX("ADC 09 Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc09_mux),
+ SND_SOC_DAPM_MUX("ADC 08 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc08_r_mux),
+ SND_SOC_DAPM_MUX("ADC 08 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc08_l_mux),
+ SND_SOC_DAPM_MUX("ADC 10 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc10_r_mux),
+ SND_SOC_DAPM_MUX("ADC 10 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc10_l_mux),
+ SND_SOC_DAPM_MUX("ADC 07 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc07_r_mux),
+ SND_SOC_DAPM_MUX("ADC 07 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc07_l_mux),
+
+ SND_SOC_DAPM_AIF_IN("DP1RX", "DP1 Headphone Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("DP2TX", "DP2 Headset Capture", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_IN("DP3RX", "DP3 Speaker Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("DP6TX", "DP6 DMic Capture", 0, SND_SOC_NOPM, 0, 0),
+};
+
+static const struct snd_soc_dapm_route rt721_sdca_audio_map[] = {
+ {"FU 42", NULL, "DP1RX"},
+ {"FU 21", NULL, "DP3RX"},
+ {"FU 23", NULL, "DP3RX"},
+
+ {"ADC 09 Mux", "MIC2", "MIC2"},
+ {"ADC 09 Mux", "LINE1", "LINE1"},
+ {"ADC 09 Mux", "LINE2", "LINE2"},
+ {"ADC 07 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 07 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 07 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 07 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 07 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 07 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 07 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 07 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 08 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 08 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 08 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 08 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 08 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 08 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 08 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 08 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 10 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 10 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 10 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 10 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 10 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 10 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 10 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 10 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"FU 36", NULL, "PDE 34"},
+ {"FU 36", NULL, "ADC 09 Mux"},
+ {"FU 113", NULL, "PDE 11"},
+ {"FU 113", NULL, "ADC 07 R Mux"},
+ {"FU 113", NULL, "ADC 07 L Mux"},
+ {"FU 113", NULL, "ADC 10 R Mux"},
+ {"FU 113", NULL, "ADC 10 L Mux"},
+ {"DP2TX", NULL, "FU 36"},
+ {"DP6TX", NULL, "FU 113"},
+
+ {"HP", NULL, "PDE 47"},
+ {"HP", NULL, "FU 42"},
+ {"SPK", NULL, "PDE 41"},
+ {"SPK", NULL, "FU 21"},
+ {"SPK", NULL, "FU 23"},
+};
+
+static int rt721_sdca_parse_dt(struct rt721_sdca_priv *rt721, struct device *dev)
+{
+ device_property_read_u32(dev, "realtek,jd-src", &rt721->jd_src);
+
+ return 0;
+}
+
+static int rt721_sdca_probe(struct snd_soc_component *component)
+{
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ rt721_sdca_parse_dt(rt721, &rt721->slave->dev);
+ rt721->component = component;
+
+ ret = pm_runtime_resume(component->dev);
+ if (ret < 0 && ret != -EACCES)
+ return ret;
+
+ return 0;
+}
+
+static const struct snd_soc_component_driver soc_sdca_dev_rt721 = {
+ .probe = rt721_sdca_probe,
+ .controls = rt721_sdca_controls,
+ .num_controls = ARRAY_SIZE(rt721_sdca_controls),
+ .dapm_widgets = rt721_sdca_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(rt721_sdca_dapm_widgets),
+ .dapm_routes = rt721_sdca_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(rt721_sdca_audio_map),
+ .set_jack = rt721_sdca_set_jack_detect,
+ .endianness = 1,
+};
+
+static int rt721_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
+ int direction)
+{
+ snd_soc_dai_dma_data_set(dai, direction, sdw_stream);
+
+ return 0;
+}
+
+static void rt721_sdca_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ snd_soc_dai_set_dma_data(dai, substream, NULL);
+}
+
+static int rt721_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct sdw_stream_config stream_config;
+ struct sdw_port_config port_config;
+ enum sdw_data_direction direction;
+ struct sdw_stream_runtime *sdw_stream;
+ int retval, port, num_channels;
+ unsigned int sampling_rate;
+
+ dev_dbg(dai->dev, "%s %s", __func__, dai->name);
+ sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!sdw_stream)
+ return -EINVAL;
+
+ if (!rt721->slave)
+ return -EINVAL;
+
+ /*
+ * RT721_AIF1 with port = 1 for headphone playback
+ * RT721_AIF1 with port = 2 for headset-mic capture
+ * RT721_AIF2 with port = 3 for speaker playback
+ * RT721_AIF3 with port = 6 for digital-mic capture
+ */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ direction = SDW_DATA_DIR_RX;
+ if (dai->id == RT721_AIF1)
+ port = 1;
+ else if (dai->id == RT721_AIF2)
+ port = 3;
+ else
+ return -EINVAL;
+ } else {
+ direction = SDW_DATA_DIR_TX;
+ if (dai->id == RT721_AIF1)
+ port = 2;
+ else if (dai->id == RT721_AIF3)
+ port = 6;
+ else
+ return -EINVAL;
+ }
+ stream_config.frame_rate = params_rate(params);
+ stream_config.ch_count = params_channels(params);
+ stream_config.bps = snd_pcm_format_width(params_format(params));
+ stream_config.direction = direction;
+
+ num_channels = params_channels(params);
+ port_config.ch_mask = GENMASK(num_channels - 1, 0);
+ port_config.num = port;
+
+ retval = sdw_stream_add_slave(rt721->slave, &stream_config,
+ &port_config, 1, sdw_stream);
+ if (retval) {
+ dev_err(dai->dev, "Unable to configure port\n");
+ return retval;
+ }
+
+ if (params_channels(params) > 16) {
+ dev_err(component->dev, "Unsupported channels %d\n",
+ params_channels(params));
+ return -EINVAL;
+ }
+
+ /* sampling rate configuration */
+ switch (params_rate(params)) {
+ case 8000:
+ sampling_rate = RT721_SDCA_RATE_8000HZ;
+ break;
+ case 16000:
+ sampling_rate = RT721_SDCA_RATE_16000HZ;
+ break;
+ case 24000:
+ sampling_rate = RT721_SDCA_RATE_24000HZ;
+ break;
+ case 32000:
+ sampling_rate = RT721_SDCA_RATE_32000HZ;
+ break;
+ case 44100:
+ sampling_rate = RT721_SDCA_RATE_44100HZ;
+ break;
+ case 48000:
+ sampling_rate = RT721_SDCA_RATE_48000HZ;
+ break;
+ case 96000:
+ sampling_rate = RT721_SDCA_RATE_96000HZ;
+ break;
+ case 192000:
+ sampling_rate = RT721_SDCA_RATE_192000HZ;
+ break;
+ case 384000:
+ sampling_rate = RT721_SDCA_RATE_384000HZ;
+ break;
+ case 768000:
+ sampling_rate = RT721_SDCA_RATE_768000HZ;
+ break;
+ default:
+ dev_err(component->dev, "Rate %d is not supported\n",
+ params_rate(params));
+ return -EINVAL;
+ }
+
+ /* set sampling frequency */
+ if (dai->id == RT721_AIF1) {
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS01,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS11,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+ }
+
+ if (dai->id == RT721_AIF2)
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_CS31,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+
+ if (dai->id == RT721_AIF3)
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_CS1F,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+
+ return 0;
+}
+
+static int rt721_sdca_pcm_hw_free(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct sdw_stream_runtime *sdw_stream =
+ snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!rt721->slave)
+ return -EINVAL;
+
+ sdw_stream_remove_slave(rt721->slave, sdw_stream);
+ return 0;
+}
+
+#define RT721_STEREO_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \
+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000)
+#define RT721_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE)
+
+static const struct snd_soc_dai_ops rt721_sdca_ops = {
+ .hw_params = rt721_sdca_pcm_hw_params,
+ .hw_free = rt721_sdca_pcm_hw_free,
+ .set_stream = rt721_sdca_set_sdw_stream,
+ .shutdown = rt721_sdca_shutdown,
+};
+
+static struct snd_soc_dai_driver rt721_sdca_dai[] = {
+ {
+ .name = "rt721-sdca-aif1",
+ .id = RT721_AIF1,
+ .playback = {
+ .stream_name = "DP1 Headphone Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .capture = {
+ .stream_name = "DP2 Headset Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ },
+ {
+ .name = "rt721-sdca-aif2",
+ .id = RT721_AIF2,
+ .playback = {
+ .stream_name = "DP3 Speaker Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ },
+ {
+ .name = "rt721-sdca-aif3",
+ .id = RT721_AIF3,
+ .capture = {
+ .stream_name = "DP6 DMic Capture",
+ .channels_min = 1,
+ .channels_max = 4,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ }
+};
+
+int rt721_sdca_init(struct device *dev, struct regmap *regmap,
+ struct regmap *mbq_regmap, struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721;
+
+ rt721 = devm_kzalloc(dev, sizeof(*rt721), GFP_KERNEL);
+ if (!rt721)
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, rt721);
+ rt721->slave = slave;
+ rt721->regmap = regmap;
+ rt721->mbq_regmap = mbq_regmap;
+
+ regcache_cache_only(rt721->regmap, true);
+ regcache_cache_only(rt721->mbq_regmap, true);
+
+ mutex_init(&rt721->calibrate_mutex);
+ mutex_init(&rt721->disable_irq_lock);
+
+ INIT_DELAYED_WORK(&rt721->jack_detect_work, rt721_sdca_jack_detect_handler);
+ INIT_DELAYED_WORK(&rt721->jack_btn_check_work, rt721_sdca_btn_check_handler);
+
+ /*
+ * Mark hw_init to false
+ * HW init will be performed when device reports present
+ */
+ rt721->hw_init = false;
+ rt721->first_hw_init = false;
+ rt721->fu1e_dapm_mute = true;
+ rt721->fu0f_dapm_mute = true;
+ rt721->fu0f_mixer_l_mute = rt721->fu0f_mixer_r_mute = true;
+ rt721->fu1e_mixer_mute[0] = rt721->fu1e_mixer_mute[1] =
+ rt721->fu1e_mixer_mute[2] = rt721->fu1e_mixer_mute[3] = true;
+
+ return devm_snd_soc_register_component(dev,
+ &soc_sdca_dev_rt721, rt721_sdca_dai, ARRAY_SIZE(rt721_sdca_dai));
+}
+
+int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+
+ rt721->disable_irq = false;
+
+ if (rt721->hw_init)
+ return 0;
+
+ regcache_cache_only(rt721->regmap, false);
+ regcache_cache_only(rt721->mbq_regmap, false);
+ if (rt721->first_hw_init) {
+ regcache_cache_bypass(rt721->regmap, true);
+ regcache_cache_bypass(rt721->mbq_regmap, true);
+ } else {
+ /*
+ * PM runtime is only enabled when a Slave reports as Attached
+ */
+
+ /* set autosuspend parameters */
+ pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
+ pm_runtime_use_autosuspend(&slave->dev);
+
+ /* update count of parent 'active' children */
+ pm_runtime_set_active(&slave->dev);
+
+ /* make sure the device does not suspend immediately */
+ pm_runtime_mark_last_busy(&slave->dev);
+
+ pm_runtime_enable(&slave->dev);
+ }
+
+ pm_runtime_get_noresume(&slave->dev);
+ rt721_sdca_dmic_preset(rt721);
+ rt721_sdca_amp_preset(rt721);
+ rt721_sdca_jack_preset(rt721);
+ if (rt721->first_hw_init) {
+ regcache_cache_bypass(rt721->regmap, false);
+ regcache_mark_dirty(rt721->regmap);
+ regcache_cache_bypass(rt721->mbq_regmap, false);
+ regcache_mark_dirty(rt721->mbq_regmap);
+ } else
+ rt721->first_hw_init = true;
+
+ /* Mark Slave initialization complete */
+ rt721->hw_init = true;
+
+ pm_runtime_mark_last_busy(&slave->dev);
+ pm_runtime_put_autosuspend(&slave->dev);
+
+ dev_dbg(&slave->dev, "%s hw_init complete\n", __func__);
+ return 0;
+}
+
+MODULE_DESCRIPTION("ASoC RT721 SDCA SDW driver");
+MODULE_AUTHOR("Jack Yu <jack.yu(a)realtek.com>");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt721-sdca.h b/sound/soc/codecs/rt721-sdca.h
new file mode 100644
index 000000000000..372a788d384d
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca.h
@@ -0,0 +1,277 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * rt721-sdca.h -- RT721 SDCA ALSA SoC audio driver header
+ *
+ * Copyright(c) 2024 Realtek Semiconductor Corp.
+ */
+
+#ifndef __RT721_H__
+#define __RT721_H__
+
+#include <linux/pm.h>
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_type.h>
+#include <sound/soc.h>
+#include <linux/workqueue.h>
+
+struct rt721_sdca_priv {
+ struct regmap *regmap;
+ struct regmap *mbq_regmap;
+ struct snd_soc_component *component;
+ struct sdw_slave *slave;
+ struct sdw_bus_params params;
+ bool hw_init;
+ bool first_hw_init;
+ struct mutex calibrate_mutex;
+ struct mutex disable_irq_lock;
+ bool disable_irq;
+ /* For Headset jack & Headphone */
+ unsigned int scp_sdca_stat1;
+ unsigned int scp_sdca_stat2;
+ struct snd_soc_jack *hs_jack;
+ struct delayed_work jack_detect_work;
+ struct delayed_work jack_btn_check_work;
+ int jack_type;
+ int jd_src;
+ bool fu0f_dapm_mute;
+ bool fu0f_mixer_l_mute;
+ bool fu0f_mixer_r_mute;
+ /* For DMIC */
+ bool fu1e_dapm_mute;
+ bool fu1e_mixer_mute[4];
+};
+
+struct rt721_sdca_dmic_kctrl_priv {
+ unsigned int reg_base;
+ unsigned int count;
+ unsigned int max;
+ unsigned int invert;
+};
+
+/* NID */
+#define RT721_ANA_POW_PART 0x01
+#define RT721_DAC_CTRL 0x04
+#define RT721_JD_CTRL 0x09
+#define RT721_CBJ_CTRL 0x0a
+#define RT721_CAP_PORT_CTRL 0x0c
+#define RT721_CLASD_AMP_CTRL 0x0d
+#define RT721_VENDOR_REG 0x20
+#define RT721_RC_CALIB_CTRL 0x40
+#define RT721_VENDOR_EQ_L 0x53
+#define RT721_VENDOR_EQ_R 0x54
+#define RT721_VENDOR_HP_CALI 0x56
+#define RT721_VENDOR_CHARGE_PUMP 0x57
+#define RT721_VENDOR_CLASD_CALI 0x58
+#define RT721_VENDOR_IMS_DRE 0x5b
+#define RT721_VENDOR_SPK_EFUSE 0x5c
+#define RT721_VENDOR_LEVEL_CTRL 0x5d
+#define RT721_VENDOR_ANA_CTL 0x5f
+#define RT721_HDA_SDCA_FLOAT 0x61
+
+/* Index (NID:01h) */
+#define RT721_MBIAS_LV_CTRL2 0x07
+#define RT721_VREF1_HV_CTRL1 0x0a
+#define RT721_VREF2_LV_CTRL1 0x0b
+
+/* Index (NID:04h) */
+#define RT721_DAC_2CH_CTRL3 0x02
+#define RT721_DAC_2CH_CTRL4 0x03
+
+/* Index (NID:09h) */
+#define RT721_JD_1PIN_GAT_CTRL2 0x07
+
+/* Index (NID:0ah) */
+#define RT721_CBJ_A0_GAT_CTRL1 0x04
+#define RT721_CBJ_A0_GAT_CTRL2 0x05
+
+/* Index (NID:0Ch) */
+#define RT721_HP_AMP_2CH_CAL1 0x05
+#define RT721_HP_AMP_2CH_CAL4 0x08
+#define RT721_HP_AMP_2CH_CAL18 0x1b
+
+/* Index (NID:0dh) */
+#define RT721_CLASD_AMP_2CH_CAL 0x14
+
+/* Index (NID:20h) */
+#define RT721_JD_PRODUCT_NUM 0x00
+#define RT721_ANALOG_BIAS_CTL3 0x04
+#define RT721_JD_CTRL1 0x09
+#define RT721_LDO2_3_CTL1 0x0e
+#define RT721_GPIO_PAD_CTRL5 0x13
+#define RT721_LDO1_CTL 0x1a
+#define RT721_HP_JD_CTRL 0x24
+#define RT721_VD_HIDDEN_CTRL 0x26
+#define RT721_CLSD_CTRL6 0x3c
+#define RT721_COMBO_JACK_AUTO_CTL1 0x45
+#define RT721_COMBO_JACK_AUTO_CTL2 0x46
+#define RT721_COMBO_JACK_AUTO_CTL3 0x47
+#define RT721_DIGITAL_MISC_CTRL4 0x4a
+#define RT721_VREFO_GAT 0x63
+#define RT721_FSM_CTL 0x67
+#define RT721_SDCA_INTR_REC 0x82
+#define RT721_SW_CONFIG1 0x8a
+#define RT721_SW_CONFIG2 0x8b
+
+/* Index (NID:40h) */
+#define RT721_RC_CALIB_CTRL0 0x00
+
+/* Index (NID:58h) */
+#define RT721_DAC_DC_CALI_CTL1 0x01
+#define RT721_DAC_DC_CALI_CTL2 0x02
+#define RT721_DAC_DC_CALI_CTL3 0x03
+
+/* Index (NID:5fh) */
+#define RT721_MISC_POWER_CTL0 0x00
+#define RT721_MISC_POWER_CTL31 0x31
+#define RT721_UAJ_TOP_TCON13 0x44
+#define RT721_UAJ_TOP_TCON14 0x45
+#define RT721_UAJ_TOP_TCON17 0x48
+
+/* Index (NID:61h) */
+#define RT721_HDA_LEGACY_MUX_CTL0 0x00
+#define RT721_HDA_LEGACY_UAJ_CTL 0x02
+#define RT721_HDA_LEGACY_CTL1 0x05
+#define RT721_HDA_LEGACY_RESET_CTL 0x06
+#define RT721_GE_REL_CTRL1 0x0d
+#define RT721_HDA_LEGACY_GPIO_WAKE_EN_CTL 0x0e
+#define RT721_GE_SDCA_RST_CTRL 0x10
+#define RT721_INT_RST_EN_CTRL 0x11
+#define RT721_XU_EVENT_EN 0x13
+#define RT721_INLINE_CTL2 0x17
+#define RT721_UMP_HID_CTRL1 0x18
+#define RT721_UMP_HID_CTRL2 0x19
+#define RT721_UMP_HID_CTRL3 0x1a
+#define RT721_UMP_HID_CTRL4 0x1b
+#define RT721_UMP_HID_CTRL5 0x1c
+#define RT721_FUNC_FLOAT_CTL0 0x22
+#define RT721_FUNC_FLOAT_CTL1 0x23
+#define RT721_FUNC_FLOAT_CTL2 0x24
+#define RT721_FUNC_FLOAT_CTL3 0x25
+#define RT721_ENT_FLOAT_CTL0 0x29
+#define RT721_ENT_FLOAT_CTL1 0x2c
+#define RT721_ENT_FLOAT_CTL2 0x2d
+#define RT721_ENT_FLOAT_CTL3 0x2e
+#define RT721_ENT_FLOAT_CTL4 0x2f
+#define RT721_CH_FLOAT_CTL1 0x45
+#define RT721_CH_FLOAT_CTL2 0x46
+#define RT721_ENT_FLOAT_CTL5 0x53
+#define RT721_ENT_FLOAT_CTL6 0x54
+#define RT721_ENT_FLOAT_CTL7 0x55
+#define RT721_ENT_FLOAT_CTL8 0x57
+#define RT721_ENT_FLOAT_CTL9 0x5a
+#define RT721_ENT_FLOAT_CTL10 0x5b
+#define RT721_CH_FLOAT_CTL3 0x6a
+#define RT721_CH_FLOAT_CTL4 0x6d
+#define RT721_CH_FLOAT_CTL5 0x70
+#define RT721_CH_FLOAT_CTL6 0x92
+
+/* Parameter & Verb control 01 (0x26)(NID:20h) */
+#define RT721_HIDDEN_REG_SW_RESET (0x1 << 14)
+
+/* Buffer address for HID */
+#define RT721_BUF_ADDR_HID1 0x44030000
+#define RT721_BUF_ADDR_HID2 0x44030020
+
+/* RT721 SDCA Control - function number */
+#define FUNC_NUM_JACK_CODEC 0x01
+#define FUNC_NUM_MIC_ARRAY 0x02
+#define FUNC_NUM_HID 0x03
+#define FUNC_NUM_AMP 0x04
+
+/* RT721 SDCA entity */
+#define RT721_SDCA_ENT_HID01 0x01
+#define RT721_SDCA_ENT_XUV 0x03
+#define RT721_SDCA_ENT_GE49 0x49
+#define RT721_SDCA_ENT_USER_FU05 0x05
+#define RT721_SDCA_ENT_USER_FU06 0x06
+#define RT721_SDCA_ENT_USER_FU0F 0x0f
+#define RT721_SDCA_ENT_USER_FU10 0x19
+#define RT721_SDCA_ENT_USER_FU1E 0x1e
+#define RT721_SDCA_ENT_FU15 0x15
+#define RT721_SDCA_ENT_PDE23 0x23
+#define RT721_SDCA_ENT_PDE40 0x40
+#define RT721_SDCA_ENT_PDE41 0x41
+#define RT721_SDCA_ENT_PDE11 0x11
+#define RT721_SDCA_ENT_PDE12 0x12
+#define RT721_SDCA_ENT_PDE2A 0x2a
+#define RT721_SDCA_ENT_CS01 0x01
+#define RT721_SDCA_ENT_CS11 0x11
+#define RT721_SDCA_ENT_CS1F 0x1f
+#define RT721_SDCA_ENT_CS1C 0x1c
+#define RT721_SDCA_ENT_CS31 0x31
+#define RT721_SDCA_ENT_OT23 0x42
+#define RT721_SDCA_ENT_IT26 0x26
+#define RT721_SDCA_ENT_IT09 0x09
+#define RT721_SDCA_ENT_PLATFORM_FU15 0x15
+#define RT721_SDCA_ENT_PLATFORM_FU44 0x44
+#define RT721_SDCA_ENT_XU03 0x03
+#define RT721_SDCA_ENT_XU0D 0x0d
+#define RT721_SDCA_ENT_FU55 0x55
+
+/* RT721 SDCA control */
+#define RT721_SDCA_CTL_SAMPLE_FREQ_INDEX 0x10
+#define RT721_SDCA_CTL_FU_MUTE 0x01
+#define RT721_SDCA_CTL_FU_VOLUME 0x02
+#define RT721_SDCA_CTL_HIDTX_CURRENT_OWNER 0x10
+#define RT721_SDCA_CTL_HIDTX_SET_OWNER_TO_DEVICE 0x11
+#define RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET 0x12
+#define RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH 0x13
+#define RT721_SDCA_CTL_SELECTED_MODE 0x01
+#define RT721_SDCA_CTL_DETECTED_MODE 0x02
+#define RT721_SDCA_CTL_REQ_POWER_STATE 0x01
+#define RT721_SDCA_CTL_VENDOR_DEF 0x30
+#define RT721_SDCA_CTL_XUV 0x34
+#define RT721_SDCA_CTL_FU_CH_GAIN 0x0b
+
+/* RT721 SDCA channel */
+#define CH_L 0x01
+#define CH_R 0x02
+#define CH_01 0x01
+#define CH_02 0x02
+#define CH_03 0x03
+#define CH_04 0x04
+#define CH_08 0x08
+#define CH_09 0x09
+#define CH_0A 0x0a
+
+/* sample frequency index */
+#define RT721_SDCA_RATE_8000HZ 0x01
+#define RT721_SDCA_RATE_11025HZ 0x02
+#define RT721_SDCA_RATE_12000HZ 0x03
+#define RT721_SDCA_RATE_16000HZ 0x04
+#define RT721_SDCA_RATE_22050HZ 0x05
+#define RT721_SDCA_RATE_24000HZ 0x06
+#define RT721_SDCA_RATE_32000HZ 0x07
+#define RT721_SDCA_RATE_44100HZ 0x08
+#define RT721_SDCA_RATE_48000HZ 0x09
+#define RT721_SDCA_RATE_88200HZ 0x0a
+#define RT721_SDCA_RATE_96000HZ 0x0b
+#define RT721_SDCA_RATE_176400HZ 0x0c
+#define RT721_SDCA_RATE_192000HZ 0x0d
+#define RT721_SDCA_RATE_384000HZ 0x0e
+#define RT721_SDCA_RATE_768000HZ 0x0f
+
+enum {
+ RT721_AIF1, /* For headset mic and headphone */
+ RT721_AIF2, /* For speaker */
+ RT721_AIF3, /* For dmic */
+ RT721_AIFS,
+};
+
+enum rt721_sdca_jd_src {
+ RT721_JD_NULL,
+ RT721_JD1,
+ RT721_JD2,
+};
+
+int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave);
+int rt721_sdca_init(struct device *dev, struct regmap *regmap,
+ struct regmap *mbq_regmap, struct sdw_slave *slave);
+int rt721_sdca_index_write(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int value);
+int rt721_sdca_index_read(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int *value);
+
+int rt721_sdca_jack_detect(struct rt721_sdca_priv *rt721, bool *hp, bool *mic);
+#endif /* __RT721_H__ */
--
2.34.1
4
7

25 Sep '24
Add hw monitor volume control for POD HD500X. This is done adding
LINE6_CAP_HWMON_CTL to the capabilities
Signed-off-by: Hans P. Moller <hmoller(a)uc.cl>
---
sound/usb/line6/podhd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index ffd8c157a281..70de08635f54 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -507,7 +507,7 @@ static const struct line6_properties podhd_properties_table[] = {
[LINE6_PODHD500X] = {
.id = "PODHD500X",
.name = "POD HD500X",
- .capabilities = LINE6_CAP_CONTROL
+ .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_HWMON_CTL
| LINE6_CAP_PCM | LINE6_CAP_HWMON,
.altsetting = 1,
.ep_ctrl_r = 0x81,
--
2.43.0
1
0
This patch attempted to work around a DMA issue involving Xen, but
causes subtle kernel memory corruption.
When I brought up this patch in the XenDevel matrix channel, I was
told that it had been requested by the Qubes OS developers because
they were trying to fix an issue where the sound stack would fail
after a few hours of uptime. They wound up disabling SG buffering
entirely instead as a workaround.
Accordingly, I propose that we should revert this workaround patch,
since it causes kernel memory corruption and that the ALSA and Xen
communities should collaborate on fixing the underlying problem in
such a way that SG buffering works correctly under Xen.
This reverts commit 53466ebdec614f915c691809b0861acecb941e30.
Signed-off-by: Ariadne Conill <ariadne(a)ariadne.space>
Cc: stable(a)vger.kernel.org
Cc: xen-devel(a)lists.xenproject.org
Cc: alsa-devel(a)alsa-project.org
Cc: Takashi Iwai <tiwai(a)suse.de>
---
sound/core/memalloc.c | 87 +++++++++----------------------------------
1 file changed, 18 insertions(+), 69 deletions(-)
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index f901504b5afc..81025f50a542 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -541,15 +541,16 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
struct sg_table *sgt;
void *p;
-#ifdef CONFIG_SND_DMA_SGBUF
- if (cpu_feature_enabled(X86_FEATURE_XENPV))
- return snd_dma_sg_fallback_alloc(dmab, size);
-#endif
sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
DEFAULT_GFP, 0);
#ifdef CONFIG_SND_DMA_SGBUF
- if (!sgt && !get_dma_ops(dmab->dev.dev))
+ if (!sgt && !get_dma_ops(dmab->dev.dev)) {
+ if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
+ dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
+ else
+ dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
return snd_dma_sg_fallback_alloc(dmab, size);
+ }
#endif
if (!sgt)
return NULL;
@@ -716,38 +717,19 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {
/* Fallback SG-buffer allocations for x86 */
struct snd_dma_sg_fallback {
- bool use_dma_alloc_coherent;
size_t count;
struct page **pages;
- /* DMA address array; the first page contains #pages in ~PAGE_MASK */
- dma_addr_t *addrs;
};
static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab,
struct snd_dma_sg_fallback *sgbuf)
{
- size_t i, size;
-
- if (sgbuf->pages && sgbuf->addrs) {
- i = 0;
- while (i < sgbuf->count) {
- if (!sgbuf->pages[i] || !sgbuf->addrs[i])
- break;
- size = sgbuf->addrs[i] & ~PAGE_MASK;
- if (WARN_ON(!size))
- break;
- if (sgbuf->use_dma_alloc_coherent)
- dma_free_coherent(dmab->dev.dev, size << PAGE_SHIFT,
- page_address(sgbuf->pages[i]),
- sgbuf->addrs[i] & PAGE_MASK);
- else
- do_free_pages(page_address(sgbuf->pages[i]),
- size << PAGE_SHIFT, false);
- i += size;
- }
- }
+ bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
+ size_t i;
+
+ for (i = 0; i < sgbuf->count && sgbuf->pages[i]; i++)
+ do_free_pages(page_address(sgbuf->pages[i]), PAGE_SIZE, wc);
kvfree(sgbuf->pages);
- kvfree(sgbuf->addrs);
kfree(sgbuf);
}
@@ -756,36 +738,24 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
struct snd_dma_sg_fallback *sgbuf;
struct page **pagep, *curp;
size_t chunk, npages;
- dma_addr_t *addrp;
dma_addr_t addr;
void *p;
-
- /* correct the type */
- if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG)
- dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
- else if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
- dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
+ bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
if (!sgbuf)
return NULL;
- sgbuf->use_dma_alloc_coherent = cpu_feature_enabled(X86_FEATURE_XENPV);
size = PAGE_ALIGN(size);
sgbuf->count = size >> PAGE_SHIFT;
sgbuf->pages = kvcalloc(sgbuf->count, sizeof(*sgbuf->pages), GFP_KERNEL);
- sgbuf->addrs = kvcalloc(sgbuf->count, sizeof(*sgbuf->addrs), GFP_KERNEL);
- if (!sgbuf->pages || !sgbuf->addrs)
+ if (!sgbuf->pages)
goto error;
pagep = sgbuf->pages;
- addrp = sgbuf->addrs;
- chunk = (PAGE_SIZE - 1) << PAGE_SHIFT; /* to fit in low bits in addrs */
+ chunk = size;
while (size > 0) {
chunk = min(size, chunk);
- if (sgbuf->use_dma_alloc_coherent)
- p = dma_alloc_coherent(dmab->dev.dev, chunk, &addr, DEFAULT_GFP);
- else
- p = do_alloc_pages(dmab->dev.dev, chunk, &addr, false);
+ p = do_alloc_pages(dmab->dev.dev, chunk, &addr, wc);
if (!p) {
if (chunk <= PAGE_SIZE)
goto error;
@@ -797,25 +767,17 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
size -= chunk;
/* fill pages */
npages = chunk >> PAGE_SHIFT;
- *addrp = npages; /* store in lower bits */
curp = virt_to_page(p);
- while (npages--) {
+ while (npages--)
*pagep++ = curp++;
- *addrp++ |= addr;
- addr += PAGE_SIZE;
- }
}
p = vmap(sgbuf->pages, sgbuf->count, VM_MAP, PAGE_KERNEL);
if (!p)
goto error;
-
- if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
- set_pages_array_wc(sgbuf->pages, sgbuf->count);
-
dmab->private_data = sgbuf;
/* store the first page address for convenience */
- dmab->addr = sgbuf->addrs[0] & PAGE_MASK;
+ dmab->addr = snd_sgbuf_get_addr(dmab, 0);
return p;
error:
@@ -825,23 +787,10 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
static void snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab)
{
- struct snd_dma_sg_fallback *sgbuf = dmab->private_data;
-
- if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
- set_pages_array_wb(sgbuf->pages, sgbuf->count);
vunmap(dmab->area);
__snd_dma_sg_fallback_free(dmab, dmab->private_data);
}
-static dma_addr_t snd_dma_sg_fallback_get_addr(struct snd_dma_buffer *dmab,
- size_t offset)
-{
- struct snd_dma_sg_fallback *sgbuf = dmab->private_data;
- size_t index = offset >> PAGE_SHIFT;
-
- return (sgbuf->addrs[index] & PAGE_MASK) | (offset & ~PAGE_MASK);
-}
-
static int snd_dma_sg_fallback_mmap(struct snd_dma_buffer *dmab,
struct vm_area_struct *area)
{
@@ -856,8 +805,8 @@ static const struct snd_malloc_ops snd_dma_sg_fallback_ops = {
.alloc = snd_dma_sg_fallback_alloc,
.free = snd_dma_sg_fallback_free,
.mmap = snd_dma_sg_fallback_mmap,
- .get_addr = snd_dma_sg_fallback_get_addr,
/* reuse vmalloc helpers */
+ .get_addr = snd_dma_vmalloc_get_addr,
.get_page = snd_dma_vmalloc_get_page,
.get_chunk_size = snd_dma_vmalloc_get_chunk_size,
};
--
2.39.2
5
12

25 Sep '24
Requesting to see if we can get some Acked-By tags, and merge on usb-next.
Several Qualcomm based chipsets can support USB audio offloading to a
dedicated audio DSP, which can take over issuing transfers to the USB
host controller. The intention is to reduce the load on the main
processors in the SoC, and allow them to be placed into lower power modes.
There are several parts to this design:
1. Adding ASoC binding layer
2. Create a USB backend for Q6DSP
3. Introduce XHCI interrupter support
4. Create vendor ops for the USB SND driver
USB | ASoC
--------------------------------------------------------------------
| _________________________
| |sm8250 platform card |
| |_________________________|
| | |
| ___V____ ____V____
| |Q6USB | |Q6AFE |
| |"codec" | |"cpu" |
| |________| |_________|
| ^ ^ ^
| | |________|
| ___V____ |
| |SOC-USB | |
________ ________ | | |
|USB SND |<--->|QC offld|<------------>|________| |
|(card.c)| | |<---------- |
|________| |________|___ | | |
^ ^ | | | ____________V_________
| | | | | |APR/GLINK |
__ V_______________V_____ | | | |______________________|
|USB SND (endpoint.c) | | | | ^
|_________________________| | | | |
^ | | | ___________V___________
| | | |->|audio DSP |
___________V_____________ | | |_______________________|
|XHCI HCD |<- |
|_________________________| |
Adding ASoC binding layer
=========================
soc-usb: Intention is to treat a USB port similar to a headphone jack.
The port is always present on the device, but cable/pin status can be
enabled/disabled. Expose mechanisms for USB backend ASoC drivers to
communicate with USB SND.
Create a USB backend for Q6DSP
==============================
q6usb: Basic backend driver that will be responsible for maintaining the
resources needed to initiate a playback stream using the Q6DSP. Will
be the entity that checks to make sure the connected USB audio device
supports the requested PCM format. If it does not, the PCM open call will
fail, and userspace ALSA can take action accordingly.
Introduce XHCI interrupter support
==================================
XHCI HCD supports multiple interrupters, which allows for events to be routed
to different event rings. This is determined by "Interrupter Target" field
specified in Section "6.4.1.1 Normal TRB" of the XHCI specification.
Events in the offloading case will be routed to an event ring that is assigned
to the audio DSP.
Create vendor ops for the USB SND driver
========================================
qc_audio_offload: This particular driver has several components associated
with it:
- QMI stream request handler
- XHCI interrupter and resource management
- audio DSP memory management
When the audio DSP wants to enable a playback stream, the request is first
received by the ASoC platform sound card. Depending on the selected route,
ASoC will bring up the individual DAIs in the path. The Q6USB backend DAI
will send an AFE port start command (with enabling the USB playback path), and
the audio DSP will handle the request accordingly.
Part of the AFE USB port start handling will have an exchange of control
messages using the QMI protocol. The qc_audio_offload driver will populate the
buffer information:
- Event ring base address
- EP transfer ring base address
and pass it along to the audio DSP. All endpoint management will now be handed
over to the DSP, and the main processor is not involved in transfers.
Overall, implementing this feature will still expose separate sound card and PCM
devices for both the platform card and USB audio device:
0 [SM8250MTPWCD938]: sm8250 - SM8250-MTP-WCD9380-WSA8810-VA-D
SM8250-MTP-WCD9380-WSA8810-VA-DMIC
1 [Audio ]: USB-Audio - USB Audio
Generic USB Audio at usb-xhci-hcd.1.auto-1.4, high speed
This is to ensure that userspace ALSA entities can decide which route to take
when executing the audio playback. In the above, if card#1 is selected, then
USB audio data will take the legacy path over the USB PCM drivers, etc...
The current limitation is that the latest USB audio device that is identified
will be automatically selected by the Q6USB BE DAI for offloading. Future
patches can be added to possibly add for more flexibility, but until the userpace
applications can be better defined, having these mechanisms will complicate the
overall implementation.
USB offload Kcontrols
=====================
Part of the vendor offload package will have a mixer driver associated with it
(mixer_usb_offload.c). This entity will be responsible for coordinating with
SOC USB and the Q6USB backend DAI to fetch information about the sound card
and PCM device indices associated with the offload path. The logic is done
based on the current implementation of how paths are controlled within the QC
ASoC implementation.
QC ASoC Q6Routing
-----------------
Within the Q6 ASOC design, the registered ASoC platform card will expose a set
of kcontrols for enabling the BE DAI links to the FE DAI link. For example:
tinymix -D 0 contents
Number of controls: 1033
ctl type num name value
...
1025 BOOL 1 USB Mixer MultiMedia1 Off
1026 BOOL 1 USB Mixer MultiMedia2 Off
1027 BOOL 1 USB Mixer MultiMedia3 Off
1028 BOOL 1 USB Mixer MultiMedia4 Off
1029 BOOL 1 USB Mixer MultiMedia5 Off
1030 BOOL 1 USB Mixer MultiMedia6 Off
1031 BOOL 1 USB Mixer MultiMedia7 Off
1032 BOOL 1 USB Mixer MultiMedia8 Off
Each of these kcontrols will enable the USB BE DAI link (q6usb) to be connected
to a FE DAI link (q6asm). Since each of these controls are DAPM widgets, when
it is enabled, the DAPM widget's "connect" flag is updated accordingly.
USB Offload Mapping
-------------------
Based on the Q6routing, the USB BE DAI link can determine which sound card and
PCM device is enabled for offloading. Fetching the ASoC platform sound card's
information is fairly straightforward, and the bulk of the work goes to finding
the corresponding PCM device index. As mentioned above, the USB BE DAI can
traverse the DAPM widgets to find the DAPM path that is related to the control
for the "USB Mixer." Based on which "USB Mixer" is enabled, it can find the
corresponding DAPM widget associated w/ the FE DAI link (Multimedia*). From there
it can find the PCM device created for the Multimedia* stream.
Only one BE DAI link can be enabled per FE DAI. For example, if the HDMI path is
enabled for Multimedia1, the USB Mixer will be disabled and switched over.
Examples of kcontrol
--------------------
tinymix -D 0 contents
Number of controls: 1033
ctl type num name
...
1025 BOOL 1 USB Mixer MultiMedia1 Off
1026 BOOL 1 USB Mixer MultiMedia2 On
1027 BOOL 1 USB Mixer MultiMedia3 Off
1028 BOOL 1 USB Mixer MultiMedia4 Off
1029 BOOL 1 USB Mixer MultiMedia5 Off
1030 BOOL 1 USB Mixer MultiMedia6 Off
1031 BOOL 1 USB Mixer MultiMedia7 Off
1032 BOOL 1 USB Mixer MultiMedia8 Off
tinymix -D 2 contents
Number of controls: 7
ctl type num name value
0 INT 2 Playback Channel Map 0, 0 (range 0->36)
1 BOOL 2 MDR-1ADAC Playback Switch On, On
2 BOOL 1 MDR-1ADAC Playback Switch On
3 INT 2 MDR-1ADAC Playback Volume 127, 127 (range 0->127)
4 INT 1 MDR-1ADAC Playback Volume 127 (range 0->127)
5 BOOL 1 Sony Internal Clock Validity On
6 INT 2 USB Offload Playback Route PCM#0 0, 1 (range -1->255)
The example highlights that the userspace/application can utilize the offload path
for the USB device on card#0 PCM device#1.
When dealing with multiple USB audio devices, only the latest USB device identified
is going to be selected for offload capable.
tinymix -D 1 contents
Number of controls: 9
ctl type num name value
0 INT 2 Capture Channel Map 0, 0 (range 0->36)
1 INT 2 Playback Channel Map 0, 0 (range 0->36)
2 BOOL 1 Headset Capture Switch On
3 INT 1 Headset Capture Volume 1 (range 0->4)
4 BOOL 1 Sidetone Playback Switch On
5 INT 1 Sidetone Playback Volume 4096 (range 0->8192)
6 BOOL 1 Headset Playback Switch On
7 INT 2 Headset Playback Volume 20, 20 (range 0->24)
8 INT 2 USB Offload Playback Route PCM#0 -1, -1 (range -1->255)
"-1, -1" shows that this device has no route to the offload path.
This feature was validated using:
- tinymix: set/enable the multimedia path to route to USB backend
- tinyplay: issue playback on platform card
Changelog
--------------------------------------------
Changes in v27:
- Added some comments and notes about the offload design. Enforcing the q6routing
to only allow one USB mixer (PCM device) to be enabled at a time.
- Modified SND_JACK_USB notifications for all USB audio offloadable devices plugged
in
- Rebased on latest XHCI secondary interrupter IMOD changes upstream. Modified the
change in this series to allow for XHCI sideband to set the IMOD for sideband
clients.
- Updated documentation on how USB SND kcontrols are involved in the overall design.
- Remove mutex locking from suspend/resume platform ops, as USB core ensures that the
interface and device are in the RPM_ACTIVE state while disconnect is handled.
Changes in v26:
- Cleaned up drivers based on errors from checkpatch
- Fixed several typos using codespell
- Removed any vendor specific notation from USB SND offload mixer patch
Changes in v25:
- Cleanups on typos mentioned within the xHCI layers
- Modified the xHCI interrupter search if clients specify interrupter index
- Moved mixer_usb_offload into its own module, so that other vendor offload USB
modules can utilize it also.
- Added support for USB audio devices that may have multiple PCM streams, as
previous implementation only assumed a single PCM device. SOC USB will be
able to handle an array of PCM indexes supported by the USB audio device.
- Added some additional checks in the QC USB offload driver to check that device
has at least one playback stream before allowing to bind
- Reordered DT bindings to fix the error found by Rob's bot. The patch that
added USB_RX was after the example was updated.
- Updated comments within SOC USB to clarify terminology and to keep it consistent
- Added SND_USB_JACK type for notifying of USB device audio connections
Changes in v24:
- Simplified the kcontrols involved in determining how to utilize the offload
path.
- There is one kcontrol registered to each USB audio device that will
output which card/pcm device it is mapped to for the offload route.
- Removed kcontrols to track offload status and device selection.
- Default to last USB audio device plugged in as offload capable.
- kcontrol will reside on USB SND device.
- Reworked the tracking of connected USB devices from the Q6USB BE DAI link.
Previously, it was convoluted by doing it over an array, but moved to using
a list made it much simpler. Logic is still unchanged in that the last USB
headset plugged in will be selected for offloading.
- Updated the USB SOC RST documentation accordingly with new kcontrol updates.
- Added logic to fetch mapped ASoC card and pcm device index that the offload
path is mapped to for the USB SND kcontrol (for offload route).
- Re-ordered series to hopefully make reviews more readable by combining
patches based on the layer modified (ie QC ASoC, ASoC, USB sound, and USB XHCI).
Changes in v23:
- Added MODULE_DESCRIPTION() fields to drivers that needed it.
Changes in v22:
- Removed components tag for the ASoC platform card, as the USB SND kcontrol for
notifying userspace of offload capable card achieves similar results.
- Due to the above, had to remove the review-by tag for the RST documentation,
as changes were made to remove the components tag section.
- Took in feedback to make the SOC USB add/remove ports void.
- Fixed an issue w/ the USB SND kcontrol management for devices that have multi
UAC interfaces. (would attempt to create the kcontrol more than once)
- Modified SOC USB card and PCM index select to be based off the num_supported
streams that is specified by the USB BE DAI.
- Modified comments on selecting the latest USB headset for offloading.
Changes in v21:
- Added an offload jack disable path from the ASoC platform driver and SOC USB.
- Refactored some of the existing SOC USB context look up APIs and created some
new helpers to search for the USB context.
- Renamed snd_soc_usb_find_format to snd_soc_usb_find_supported_format
- Removed some XHCI sideband calls that would allow clients to actually enable
the IRQ line associated w/ the secondary interrupter. This is removed because
there are other dependencies that are required for that to happen, which are not
covered as part of this series, and to avoid confusion.
- Due to the above, removed the need to export IMOD setting, and enable/disable
interrupter APIs.
Changes in v20:
- Fixed up some formatting changes pointed out in the usb.rst
- Added SB null check during XHCI sideband unregister in case caller passes
improper argument (xhci_sideband_unregister())
Changes in v19:
- Rebased to usb-next to account for some new changes in dependent drivers.
Changes in v18:
- Rebased to usb-next, which merged in part of the series. Removed these patches.
- Reworked Kconfigs for the ASoC USB related components from QCOM Q6DSP drivers
to keep dependencies in place for SoC USB and USB SND.
- Removed the repurposing of the stop ep sync API into existing XHCI operations.
This will be solely used by the XHCI sideband for now.
Changes in v17:
- Fixed an issue where one patch was squashed into another.
- Re-added some kconfig checks for helpers exposed in USB SND for the soc usb
driver, after running different kconfigs.
Changes in v16:
- Modified some code layer dependencies so that soc usb can be split as a separate
module.
- Split the kcontrols from ASoC QCOM common layer into a separate driver
- Reworked SOC USB kcontrols for controlling card + pcm offload routing and status
so that there are individual controls for card and pcm devices.
- Added a kcontrol remove API in SOC USB to remove the controls on the fly. This
required to add some kcontrol management to SOC USB.
- Removed the disconnect work and workqueue for the QC USB offload as it is not
required, since QMI interface driver ensures events are handled in its own WQ.
Changes in v15:
- Removed some already merged XHCI changes
- Separated SOC USB driver from being always compiled into SOC core. Now
configurable from kconfig.
- Fixed up ASoC kcontrol naming to fit guidelines.
- Removed some unnecessary dummy ifdefs.
- Moved usb snd offload capable kcontrol to be initialized by the platform offloading
driver.
Changes in v14:
- Cleaned up some USB SND related feedback:
- Renamed SNDUSB OFFLD playback available --> USB offload capable card
- Fixed locking while checking if stream is in use
- Replaced some mutex pairs with guard(mutex)
Changes in v13:
- Pulled in secondary/primary interrupter rework from Mathias from:
https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/drivers…
- Did some cleanup and commit message updates, and tested on current code base.
- Added mutex locking to xhci sideband to help prevent any race conditions, esp. for when accessing shared
references.
- Addressed concerns from Hillf about gfp_flags and locking used in qc_usb_audio_offload.
- Rebased onto usb-next
Changes in v12:
- Updated copyright year to 2024. Happy new years!
- Fixed newline format on mixer offload driver.
Changes in v11:
- Modified QMI format structures to be const
Changes in v10:
- Added new mixer for exposing kcontrol for sound card created by USB SND. This
allows for applications to know which platform sound card has offload support.
Will return the card number.
- Broke down and cleaned up some functions/APIs within qc_audio_offload driver.
- Exported xhci_initialize_ring_info(), and modified XHCI makefile to allow for
the XHCI sideband to exist as a module.
- Reworked the jack registration and moved it to the QCOM platform card driver,
ie sm8250.
- Added an SOC USB API to fetch a standard component tag that can be appended to
the platform sound card. Added this tag to sm8250 if any USB path exists within
the DT node.
- Moved kcontrols that existed in the Q6USB driver, and made it a bit more generic,
so that naming can be standardized across solutions. SOC USB is now responsible
for creation of these kcontrols.
- Added a SOC USB RST document explaining some code flows and implementation details
so that other vendors can utilize the framework.
- Addressed a case where USB device connection events are lost if usb offload driver
(qc_audio_offload) is not probed when everything else has been initialized, ie
USB SND, SOC USB and ASoC sound card. Add a rediscover device call during module
init, to ensure that connection events will be propagated.
- Rebased to usb-next.
Changes in v9:
- Fixed the dt binding check issue with regards to num-hc-interrupters.
Changes in v8:
- Cleaned up snd_soc_usb_find_priv_data() based on Mark's feedback. Removed some of
the duplicate looping code that was present on previous patches. Also renamed the API.
- Integrated Mathias' suggestions on his new sideband changes:
https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=feat…
- Addressed some of Mathias' fixme tags, such as:
- Resetting transfer ring dequeue/enqueue pointers
- Issuing stop endpoint command during ep removal
- Reset ERDP properly to first segment ring during interrupter removal. (this is currently
just being cleared to 0, but should be pointing to a valid segment if controller is still
running.
Changes in v7:
- Fixed dt check error for q6usb bindings
- Updated q6usb property from qcom,usb-audio-intr-num --> qcom,usb-audio-intr-idx
- Removed separate DWC3 HC interrupters num property, and place limits to XHCI one.
- Modified xhci_ring_to_sgtable() to use assigned IOVA/DMA address to fetch pages, as
it is not ensured event ring allocated is always done in the vmalloc range.
Changes in v6:
- Fixed limits and description on several DT bindings (XHCI and Q6USB)
- Fixed patch subjects to follow other ALSA/ASoC notations.
USB SND
- Addressed devices which expose multiple audio (UAC) interfaces. These devices will
create a single USB sound card with multiple audio streams, and receive multiple
interface probe routines. QC offload was not properly considering cases with multiple
probe calls.
- Renamed offload module name and kconfig to fit within the SND domain.
- Renamed attach/detach endpoint API to keep the hw_params notation.
Changes in v5:
- Removed some unnecessary files that were included
- Fixed some typos mentioned
- Addressed dt-binding issues and added hc-interrupters definition to usb-xhci.yaml
XHCI:
- Moved secondary skip events API to xhci-ring and updated implementation
- Utilized existing XHCI APIs, such as inc_deq and xhci_update_erst_dequeue()
USB SND
- Renamed and reworked the APIs in "sound: usb: Export USB SND APIs for modules" patch to
include suggestions to utilize snd_usb_hw_params/free and to avoid generic naming.
- Added a resume_cb() op for completion sake.
- Addressed some locking concerns with regards to when registering for platform hooks.
- Added routine to disconnect all offloaded devices during module unbind.
ASoC
- Replaced individual PCM parameter arguments in snd_soc_usb_connect() with new
snd_soc_usb_device structure to pass along PCM info.
- Modified snd_jack set report to notify HEADPHONE event, as we do not support record path.
Changes in v4:
- Rebased to xhci/for-usb-next
- Addressed some dt-bindings comments
XHCI:
- Pulled in latest changes from Mathias' feature_interrupters branch:
https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=feat…
- Fixed commit text and signage for the XHCI sideband/interrupter related changes
- Added some logic to address the FIXME tags mentioned throughout the commits, such
as handling multi segment rings and building the SGT, locking concerns, and ep
cleanup operations.
- Removed some fixme tags for conditions that may not be needed/addressed.
- Repurposed the new endpoint stop sync API to be utilized in other places.
- Fixed potential compile issue if XHCI sideband config is not defined.
ASoC:
- Added sound jack control into the Q6USB driver. Allows for userspsace to know when
an offload capable device is connected.
USB SND:
- Avoided exporting _snd_pcm_hw_param_set based on Takashi's recommendation.
- Split USB QMI packet header definitions into a separate commit. This is used to
properly allow the QMI interface driver to parse and route QMI packets accordingly
- Added a "depends on" entry when enabling QC audio offload to avoid compile time
issues.
Changes in v3:
- Changed prefix from RFC to PATCH
- Rebased entire series to usb-next
- Updated copyright years
XHCI:
- Rebased changes on top of XHCI changes merged into usb-next, and only added
changes that were still under discussion.
- Added change to read in the "num-hc-interrupters" device property.
ASoC:
- qusb6 USB backend
- Incorporated suggestions to fetch iommu information with existing APIs
- Added two new sound kcontrols to fetch offload status and offload device
selection.
- offload status - will return the card and pcm device in use
tinymix -D 0 get 1 --> 1, 0 (offload in progress on card#1 pcm#0)
- device selection - set the card and pcm device to enable offload on. Ex.:
tinymix -D 0 set 1 2 0 --> sets offload on card#2 pcm#0
(this should be the USB card)
USB SND:
- Fixed up some locking related concerns for registering platform ops.
- Moved callbacks under the register_mutex, so that
- Modified APIs to properly pass more information about the USB SND device, so
that the Q6USB backend can build a device list/map, in order to monitor offload
status and device selection.
Changes in v2:
XHCI:
- Replaced XHCI and HCD changes with Mathias' XHCI interrupter changes
in his tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=feat…
Adjustments made to Mathias' changes:
- Created xhci-intr.h to export/expose interrupter APIs versus exposing xhci.h.
Moved dependent structures to this file as well. (so clients can parse out
information from "struct xhci_interrupter")
- Added some basic locking when requesting interrupters.
- Fixed up some sanity checks.
- Removed clearing of the ERSTBA during freeing of the interrupter. (pending
issue where SMMU fault occurs if DMA addr returned is 64b - TODO)
- Clean up pending events in the XHCI secondary interrupter. While testing USB
bus suspend, it was seen that on bus resume, the xHCI HC would run into a command
timeout.
- Added offloading APIs to xHCI to fetch transfer and event ring information.
ASoC:
- Modified soc-usb to allow for multiple USB port additions. For this to work,
the USB offload driver has to have a reference to the USB backend by adding
a "usb-soc-be" DT entry to the device saved into XHCI sysdev.
- Created separate dt-bindings for defining USB_RX port.
- Increased APR timeout to accommodate the situation where the AFE port start
command could be delayed due to having to issue a USB bus resume while
handling the QMI stream start command.
Mathias Nyman (2):
xhci: add helper to stop endpoint and wait for completion
xhci: sideband: add initial api to register a sideband entity
Wesley Cheng (30):
usb: host: xhci: Repurpose event handler for skipping interrupter
events
usb: xhci: xhci-sideband: Set IMOD for xHCI sideband clients
usb: host: xhci-mem: Cleanup pending secondary event ring events
usb: host: xhci-mem: Allow for interrupter clients to choose specific
index
usb: host: xhci-plat: Set XHCI max interrupters if property is present
usb: dwc3: Specify maximum number of XHCI interrupters
ALSA: Add USB audio device jack type
ALSA: usb-audio: Export USB SND APIs for modules
ALSA: usb-audio: Check for support for requested audio format
ALSA: usb-audio: Save UAC sample size information
ALSA: usb-audio: Prevent starting of audio stream if in use
ASoC: Add SOC USB APIs for adding an USB backend
ASoC: usb: Add PCM format check API for USB backend
ASoC: usb: Create SOC USB SND jack kcontrol
ASoC: usb: Fetch ASoC card and pcm device information
ASoC: doc: Add documentation for SOC USB
ASoC: dt-bindings: qcom,q6dsp-lpass-ports: Add USB_RX port
ASoC: dt-bindings: Update example for enabling USB offload on SM8250
ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp
ASoC: qcom: qdsp6: q6afe: Increase APR timeout
ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6
ASoC: qcom: qdsp6: Add headphone jack for offload connection status
ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device
ALSA: usb-audio: Introduce USB SND platform op callbacks
ALSA: usb-audio: qcom: Add USB QMI definitions
ALSA: usb-audio: qcom: Introduce QC USB SND offloading support
ALSA: usb-audio: qcom: Don't allow USB offload path if PCM device is
in use
ALSA: usb-audio: Add USB offload route kcontrol
ALSA: usb-audio: Allow for rediscovery of connected USB SND devices
ASoC: usb: Rediscover USB SND devices on USB port add
.../bindings/sound/qcom,sm8250.yaml | 15 +
Documentation/sound/soc/index.rst | 1 +
Documentation/sound/soc/usb.rst | 456 ++++
drivers/usb/dwc3/core.c | 12 +
drivers/usb/dwc3/core.h | 2 +
drivers/usb/dwc3/host.c | 3 +
drivers/usb/host/Kconfig | 9 +
drivers/usb/host/Makefile | 2 +
drivers/usb/host/xhci-mem.c | 31 +-
drivers/usb/host/xhci-plat.c | 2 +
drivers/usb/host/xhci-ring.c | 54 +-
drivers/usb/host/xhci-sideband.c | 425 ++++
drivers/usb/host/xhci.c | 41 +-
drivers/usb/host/xhci.h | 16 +-
.../sound/qcom,q6dsp-lpass-ports.h | 1 +
include/linux/mod_devicetable.h | 2 +-
include/linux/usb/xhci-sideband.h | 70 +
include/sound/jack.h | 4 +-
include/sound/q6usboffload.h | 20 +
include/sound/soc-usb.h | 139 ++
include/uapi/linux/input-event-codes.h | 3 +-
sound/core/jack.c | 6 +-
sound/soc/Kconfig | 10 +
sound/soc/Makefile | 2 +
sound/soc/qcom/Kconfig | 15 +
sound/soc/qcom/Makefile | 2 +
sound/soc/qcom/qdsp6/Makefile | 1 +
sound/soc/qcom/qdsp6/q6afe-dai.c | 60 +
sound/soc/qcom/qdsp6/q6afe.c | 194 +-
sound/soc/qcom/qdsp6/q6afe.h | 36 +-
sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c | 23 +
sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h | 1 +
sound/soc/qcom/qdsp6/q6routing.c | 32 +-
sound/soc/qcom/qdsp6/q6usb.c | 391 ++++
sound/soc/qcom/sm8250.c | 24 +-
sound/soc/qcom/usb_offload_utils.c | 56 +
sound/soc/qcom/usb_offload_utils.h | 30 +
sound/soc/soc-usb.c | 342 +++
sound/usb/Kconfig | 25 +
sound/usb/Makefile | 4 +-
sound/usb/card.c | 106 +
sound/usb/card.h | 17 +
sound/usb/endpoint.c | 1 +
sound/usb/format.c | 1 +
sound/usb/helper.c | 1 +
sound/usb/mixer_usb_offload.c | 102 +
sound/usb/mixer_usb_offload.h | 17 +
sound/usb/pcm.c | 104 +-
sound/usb/pcm.h | 11 +
sound/usb/qcom/Makefile | 2 +
sound/usb/qcom/qc_audio_offload.c | 1968 +++++++++++++++++
sound/usb/qcom/usb_audio_qmi_v01.c | 863 ++++++++
sound/usb/qcom/usb_audio_qmi_v01.h | 164 ++
53 files changed, 5864 insertions(+), 55 deletions(-)
create mode 100644 Documentation/sound/soc/usb.rst
create mode 100644 drivers/usb/host/xhci-sideband.c
create mode 100644 include/linux/usb/xhci-sideband.h
create mode 100644 include/sound/q6usboffload.h
create mode 100644 include/sound/soc-usb.h
create mode 100644 sound/soc/qcom/qdsp6/q6usb.c
create mode 100644 sound/soc/qcom/usb_offload_utils.c
create mode 100644 sound/soc/qcom/usb_offload_utils.h
create mode 100644 sound/soc/soc-usb.c
create mode 100644 sound/usb/mixer_usb_offload.c
create mode 100644 sound/usb/mixer_usb_offload.h
create mode 100644 sound/usb/qcom/Makefile
create mode 100644 sound/usb/qcom/qc_audio_offload.c
create mode 100644 sound/usb/qcom/usb_audio_qmi_v01.c
create mode 100644 sound/usb/qcom/usb_audio_qmi_v01.h
2
38

[PATCH] ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is uninitialized
by Andrei Simion 24 Sep '24
by Andrei Simion 24 Sep '24
24 Sep '24
Update the driver to prevent alsa-restore.service from failing when
reading data from /var/lib/alsa/asound.state at boot. Ensure that the
restoration of ALSA mixer configurations is skipped if substream->runtime
is NULL.
Fixes: 50291652af52 ("ASoC: atmel: mchp-pdmc: add PDMC driver")
Signed-off-by: Andrei Simion <andrei.simion(a)microchip.com>
---
sound/soc/atmel/mchp-pdmc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c
index 939cd44ebc8a..06dc3c48e7e8 100644
--- a/sound/soc/atmel/mchp-pdmc.c
+++ b/sound/soc/atmel/mchp-pdmc.c
@@ -302,6 +302,9 @@ static int mchp_pdmc_chmap_ctl_put(struct snd_kcontrol *kcontrol,
if (!substream)
return -ENODEV;
+ if (!substream->runtime)
+ return 0; /* just for avoiding error from alsactl restore */
+
map = mchp_pdmc_chmap_get(substream, info);
if (!map)
return -EINVAL;
base-commit: 4d0326b60bb753627437fff0f76bf1525bcda422
--
2.34.1
2
4
This is the initial codec driver for rt721-sdca.
Signed-off-by: Jack Yu <jack.yu(a)realtek.com>
---
sound/soc/codecs/Kconfig | 7 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/rt721-sdca-sdw.c | 550 +++++++++
sound/soc/codecs/rt721-sdca-sdw.h | 151 +++
sound/soc/codecs/rt721-sdca.c | 1790 +++++++++++++++++++++++++++++
sound/soc/codecs/rt721-sdca.h | 277 +++++
6 files changed, 2777 insertions(+)
create mode 100644 sound/soc/codecs/rt721-sdca-sdw.c
create mode 100644 sound/soc/codecs/rt721-sdca-sdw.h
create mode 100644 sound/soc/codecs/rt721-sdca.c
create mode 100644 sound/soc/codecs/rt721-sdca.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 7092842480ef..74c14da4ae09 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -222,6 +222,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_RT712_SDCA_DMIC_SDW
imply SND_SOC_RT715_SDW
imply SND_SOC_RT715_SDCA_SDW
+ imply SND_SOC_RT721_SDCA_SDW
imply SND_SOC_RT722_SDCA_SDW
imply SND_SOC_RT1308_SDW
imply SND_SOC_RT1316_SDW
@@ -1743,6 +1744,12 @@ config SND_SOC_RT712_SDCA_DMIC_SDW
select REGMAP_SOUNDWIRE
select REGMAP_SOUNDWIRE_MBQ
+config SND_SOC_RT721_SDCA_SDW
+ tristate "Realtek RT721 SDCA Codec - SDW"
+ depends on SOUNDWIRE
+ select REGMAP_SOUNDWIRE
+ select REGMAP_SOUNDWIRE_MBQ
+
config SND_SOC_RT722_SDCA_SDW
tristate "Realtek RT722 SDCA Codec - SDW"
depends on SOUNDWIRE
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 54cbc3feae32..3477c6352acc 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -259,6 +259,7 @@ snd-soc-rt712-sdca-y := rt712-sdca.o rt712-sdca-sdw.o
snd-soc-rt712-sdca-dmic-y := rt712-sdca-dmic.o
snd-soc-rt715-y := rt715.o rt715-sdw.o
snd-soc-rt715-sdca-y := rt715-sdca.o rt715-sdca-sdw.o
+snd-soc-rt721-sdca-y := rt721-sdca.o rt721-sdca-sdw.o
snd-soc-rt722-sdca-y := rt722-sdca.o rt722-sdca-sdw.o
snd-soc-rt9120-y := rt9120.o
snd-soc-rtq9128-y := rtq9128.o
@@ -662,6 +663,7 @@ obj-$(CONFIG_SND_SOC_RT712_SDCA_SDW) += snd-soc-rt712-sdca.o
obj-$(CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW) += snd-soc-rt712-sdca-dmic.o
obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o
obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o
+obj-$(CONFIG_SND_SOC_RT721_SDCA_SDW) += snd-soc-rt721-sdca.o
obj-$(CONFIG_SND_SOC_RT722_SDCA_SDW) += snd-soc-rt722-sdca.o
obj-$(CONFIG_SND_SOC_RT9120) += snd-soc-rt9120.o
obj-$(CONFIG_SND_SOC_RTQ9128) += snd-soc-rtq9128.o
diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c
new file mode 100644
index 000000000000..3a8dbbc01152
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca-sdw.c
@@ -0,0 +1,550 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// rt721-sdca-sdw.c -- rt721 SDCA ALSA SoC audio driver
+//
+// Copyright(c) 2024 Realtek Semiconductor Corp.
+//
+//
+
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm_runtime.h>
+#include <linux/soundwire/sdw_registers.h>
+
+#include "rt721-sdca.h"
+#include "rt721-sdca-sdw.h"
+
+static bool rt721_sdca_readable_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x2f01 ... 0x2f0a:
+ case 0x2f35:
+ case 0x2f50:
+ case 0x2f51:
+ case 0x2f58 ... 0x2f5d:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
+ RT721_SDCA_CTL_XUV, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_SELECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
+ RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
+ case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_volatile_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x2f01:
+ case 0x2f51:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
+ RT721_SDCA_CTL_XUV, 0):
+ case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
+ RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
+ case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_mbq_readable_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x0900007:
+ case 0x0a00005:
+ case 0x0c00005:
+ case 0x0d00014:
+ case 0x0310100:
+ case 0x2000001:
+ case 0x2000002:
+ case 0x2000003:
+ case 0x2000013:
+ case 0x200003c:
+ case 0x2000046:
+ case 0x5810000:
+ case 0x5810036:
+ case 0x5810037:
+ case 0x5810038:
+ case 0x5810039:
+ case 0x5b10018:
+ case 0x5b10019:
+ case 0x5f00045:
+ case 0x5f00048:
+ case 0x6100000:
+ case 0x6100005:
+ case 0x6100006:
+ case 0x610000d:
+ case 0x6100010:
+ case 0x6100011:
+ case 0x6100013:
+ case 0x6100015:
+ case 0x6100017:
+ case 0x6100025:
+ case 0x6100029:
+ case 0x610002c ... 0x610002f:
+ case 0x6100053 ... 0x6100055:
+ case 0x6100057:
+ case 0x610005a:
+ case 0x610005b:
+ case 0x610006a:
+ case 0x610006d:
+ case 0x6100092:
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_R):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_01):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_02):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_03):
+ case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_04):
+ case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_L):
+ case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_R):
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case 0x0310100:
+ case 0x0a00005:
+ case 0x0c00005:
+ case 0x0d00014:
+ case 0x2000000:
+ case 0x200000d:
+ case 0x2000019:
+ case 0x2000020:
+ case 0x2000030:
+ case 0x2000046:
+ case 0x2000067:
+ case 0x2000084:
+ case 0x2000086:
+ case 0x5810000:
+ case 0x5810036:
+ case 0x5810037:
+ case 0x5810038:
+ case 0x5810039:
+ case 0x5b10018:
+ case 0x5b10019:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static const struct regmap_config rt721_sdca_regmap = {
+ .reg_bits = 32,
+ .val_bits = 8,
+ .readable_reg = rt721_sdca_readable_register,
+ .volatile_reg = rt721_sdca_volatile_register,
+ .max_register = 0x44ffffff,
+ .reg_defaults = rt721_sdca_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rt721_sdca_reg_defaults),
+ .cache_type = REGCACHE_MAPLE,
+ .use_single_read = true,
+ .use_single_write = true,
+};
+
+static const struct regmap_config rt721_sdca_mbq_regmap = {
+ .name = "sdw-mbq",
+ .reg_bits = 32,
+ .val_bits = 16,
+ .readable_reg = rt721_sdca_mbq_readable_register,
+ .volatile_reg = rt721_sdca_mbq_volatile_register,
+ .max_register = 0x41000312,
+ .reg_defaults = rt721_sdca_mbq_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rt721_sdca_mbq_defaults),
+ .cache_type = REGCACHE_MAPLE,
+ .use_single_read = true,
+ .use_single_write = true,
+};
+
+static int rt721_sdca_update_status(struct sdw_slave *slave,
+ enum sdw_slave_status status)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+
+ if (status == SDW_SLAVE_UNATTACHED)
+ rt721->hw_init = false;
+
+ if (status == SDW_SLAVE_ATTACHED) {
+ if (rt721->hs_jack) {
+ /*
+ * Due to the SCP_SDCA_INTMASK will be cleared by any reset, and then
+ * if the device attached again, we will need to set the setting back.
+ * It could avoid losing the jack detection interrupt.
+ * This also could sync with the cache value as the rt721_sdca_jack_init set.
+ */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_6);
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ }
+ }
+
+ /*
+ * Perform initialization only if slave status is present and
+ * hw_init flag is false
+ */
+ if (rt721->hw_init || status != SDW_SLAVE_ATTACHED)
+ return 0;
+
+ /* perform I/O transfers required for Slave initialization */
+ return rt721_sdca_io_init(&slave->dev, slave);
+}
+
+static int rt721_sdca_read_prop(struct sdw_slave *slave)
+{
+ struct sdw_slave_prop *prop = &slave->prop;
+ int nval;
+ int i, j;
+ u32 bit;
+ unsigned long addr;
+ struct sdw_dpn_prop *dpn;
+
+ sdw_slave_read_prop(slave);
+ prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
+ prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
+
+ prop->paging_support = true;
+
+ /*
+ * port = 1 for headphone playback
+ * port = 2 for headset-mic capture
+ * port = 3 for speaker playback
+ * port = 6 for digital-mic capture
+ */
+ prop->source_ports = BIT(6) | BIT(2); /* BITMAP: 01000100 */
+ prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */
+
+ nval = hweight32(prop->source_ports);
+ prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->src_dpn_prop), GFP_KERNEL);
+ if (!prop->src_dpn_prop)
+ return -ENOMEM;
+
+ i = 0;
+ dpn = prop->src_dpn_prop;
+ addr = prop->source_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[i].num = bit;
+ dpn[i].type = SDW_DPN_FULL;
+ dpn[i].simple_ch_prep_sm = true;
+ dpn[i].ch_prep_timeout = 10;
+ i++;
+ }
+
+ /* do this again for sink now */
+ nval = hweight32(prop->sink_ports);
+ prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval,
+ sizeof(*prop->sink_dpn_prop), GFP_KERNEL);
+ if (!prop->sink_dpn_prop)
+ return -ENOMEM;
+
+ j = 0;
+ dpn = prop->sink_dpn_prop;
+ addr = prop->sink_ports;
+ for_each_set_bit(bit, &addr, 32) {
+ dpn[j].num = bit;
+ dpn[j].type = SDW_DPN_FULL;
+ dpn[j].simple_ch_prep_sm = true;
+ dpn[j].ch_prep_timeout = 10;
+ j++;
+ }
+
+ /* set the timeout values */
+ prop->clk_stop_timeout = 200;
+
+ /* wake-up event */
+ prop->wake_capable = 1;
+
+ /* Three data lanes are supported by rt721-sdca codec */
+ prop->lane_control_support = true;
+
+ return 0;
+}
+
+static int rt721_sdca_interrupt_callback(struct sdw_slave *slave,
+ struct sdw_slave_intr_status *status)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+ int ret, stat;
+ int count = 0, retry = 3;
+ unsigned int sdca_cascade, scp_sdca_stat1, scp_sdca_stat2 = 0;
+
+ if (cancel_delayed_work_sync(&rt721->jack_detect_work)) {
+ dev_warn(&slave->dev, "%s the pending delayed_work was cancelled", __func__);
+ /* avoid the HID owner doesn't change to device */
+ if (rt721->scp_sdca_stat2)
+ scp_sdca_stat2 = rt721->scp_sdca_stat2;
+ }
+
+ /*
+ * The critical section below intentionally protects a rather large piece of code.
+ * We don't want to allow the system suspend to disable an interrupt while we are
+ * processing it, which could be problematic given the quirky SoundWire interrupt
+ * scheme. We do want however to prevent new workqueues from being scheduled if
+ * the disable_irq flag was set during system suspend.
+ */
+ mutex_lock(&rt721->disable_irq_lock);
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+
+ rt721->scp_sdca_stat1 = ret;
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+
+ rt721->scp_sdca_stat2 = ret;
+ if (scp_sdca_stat2)
+ rt721->scp_sdca_stat2 |= scp_sdca_stat2;
+ do {
+ /* clear flag */
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+ if (ret & SDW_SCP_SDCA_INTMASK_SDCA_0) {
+ ret = sdw_update_no_pm(rt721->slave, SDW_SCP_SDCA_INT1,
+ SDW_SCP_SDCA_INT_SDCA_0, SDW_SCP_SDCA_INT_SDCA_0);
+ if (ret < 0)
+ goto io_error;
+ } else if (ret & SDW_SCP_SDCA_INTMASK_SDCA_6) {
+ ret = sdw_update_no_pm(rt721->slave, SDW_SCP_SDCA_INT1,
+ SDW_SCP_SDCA_INT_SDCA_6, SDW_SCP_SDCA_INT_SDCA_6);
+ if (ret < 0)
+ goto io_error;
+ }
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+ if (ret & SDW_SCP_SDCA_INTMASK_SDCA_8) {
+ ret = sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INT2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ if (ret < 0)
+ goto io_error;
+ }
+
+ /* check if flag clear or not */
+ ret = sdw_read_no_pm(rt721->slave, SDW_DP0_INT);
+ if (ret < 0)
+ goto io_error;
+ sdca_cascade = ret & SDW_DP0_SDCA_CASCADE;
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ if (ret < 0)
+ goto io_error;
+ scp_sdca_stat1 = ret & SDW_SCP_SDCA_INTMASK_SDCA_0;
+
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+ if (ret < 0)
+ goto io_error;
+ scp_sdca_stat2 = ret & SDW_SCP_SDCA_INTMASK_SDCA_8;
+
+ stat = scp_sdca_stat1 || scp_sdca_stat2 || sdca_cascade;
+
+ count++;
+ } while (stat != 0 && count < retry);
+
+ if (stat)
+ dev_warn(&slave->dev,
+ "%s scp_sdca_stat1=0x%x, scp_sdca_stat2=0x%x\n", __func__,
+ rt721->scp_sdca_stat1, rt721->scp_sdca_stat2);
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT1);
+ ret = sdw_read_no_pm(rt721->slave, SDW_SCP_SDCA_INT2);
+
+ if (status->sdca_cascade && !rt721->disable_irq)
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_detect_work, msecs_to_jiffies(280));
+
+ mutex_unlock(&rt721->disable_irq_lock);
+
+ return 0;
+
+io_error:
+ mutex_unlock(&rt721->disable_irq_lock);
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+ return ret;
+}
+
+static const struct sdw_slave_ops rt721_sdca_slave_ops = {
+ .read_prop = rt721_sdca_read_prop,
+ .interrupt_callback = rt721_sdca_interrupt_callback,
+ .update_status = rt721_sdca_update_status,
+};
+
+static int rt721_sdca_sdw_probe(struct sdw_slave *slave,
+ const struct sdw_device_id *id)
+{
+ struct regmap *regmap, *mbq_regmap;
+
+ /* Regmap Initialization */
+ mbq_regmap = devm_regmap_init_sdw_mbq(slave, &rt721_sdca_mbq_regmap);
+ if (IS_ERR(mbq_regmap))
+ return PTR_ERR(mbq_regmap);
+
+ regmap = devm_regmap_init_sdw(slave, &rt721_sdca_regmap);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return rt721_sdca_init(&slave->dev, regmap, mbq_regmap, slave);
+}
+
+static int rt721_sdca_sdw_remove(struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
+
+ if (rt721->hw_init) {
+ cancel_delayed_work_sync(&rt721->jack_detect_work);
+ cancel_delayed_work_sync(&rt721->jack_btn_check_work);
+ }
+
+ if (rt721->first_hw_init)
+ pm_runtime_disable(&slave->dev);
+
+ mutex_destroy(&rt721->calibrate_mutex);
+ mutex_destroy(&rt721->disable_irq_lock);
+
+ return 0;
+}
+
+static const struct sdw_device_id rt721_sdca_id[] = {
+ SDW_SLAVE_ENTRY_EXT(0x025d, 0x721, 0x3, 0x1, 0),
+ {},
+};
+MODULE_DEVICE_TABLE(sdw, rt721_sdca_id);
+
+static int __maybe_unused rt721_sdca_dev_suspend(struct device *dev)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+
+ if (!rt721->hw_init)
+ return 0;
+
+ cancel_delayed_work_sync(&rt721->jack_detect_work);
+ cancel_delayed_work_sync(&rt721->jack_btn_check_work);
+
+ regcache_cache_only(rt721->regmap, true);
+ regcache_cache_only(rt721->mbq_regmap, true);
+
+ return 0;
+}
+
+static int __maybe_unused rt721_sdca_dev_system_suspend(struct device *dev)
+{
+ struct rt721_sdca_priv *rt721_sdca = dev_get_drvdata(dev);
+ struct sdw_slave *slave = dev_to_sdw_dev(dev);
+ int ret1, ret2;
+
+ if (!rt721_sdca->hw_init)
+ return 0;
+
+ /*
+ * prevent new interrupts from being handled after the
+ * deferred work completes and before the parent disables
+ * interrupts on the link
+ */
+ mutex_lock(&rt721_sdca->disable_irq_lock);
+ rt721_sdca->disable_irq = true;
+ ret1 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6, 0);
+ ret2 = sdw_update_no_pm(slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8, 0);
+ mutex_unlock(&rt721_sdca->disable_irq_lock);
+
+ if (ret1 < 0 || ret2 < 0) {
+ /* log but don't prevent suspend from happening */
+ dev_dbg(&slave->dev, "%s: could not disable SDCA interrupts\n:", __func__);
+ }
+
+ return rt721_sdca_dev_suspend(dev);
+}
+
+#define RT721_PROBE_TIMEOUT 5000
+
+static int __maybe_unused rt721_sdca_dev_resume(struct device *dev)
+{
+ struct sdw_slave *slave = dev_to_sdw_dev(dev);
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+ unsigned long time;
+
+ if (!rt721->first_hw_init)
+ return 0;
+
+ if (!slave->unattach_request) {
+ mutex_lock(&rt721->disable_irq_lock);
+ if (rt721->disable_irq == true) {
+ sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_6);
+ sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
+ rt721->disable_irq = false;
+ }
+ mutex_unlock(&rt721->disable_irq_lock);
+ goto regmap_sync;
+ }
+
+ time = wait_for_completion_timeout(&slave->initialization_complete,
+ msecs_to_jiffies(RT721_PROBE_TIMEOUT));
+ if (!time) {
+ dev_err(&slave->dev, "Initialization not complete, timed out\n");
+ sdw_show_ping_status(slave->bus, true);
+
+ return -ETIMEDOUT;
+ }
+
+regmap_sync:
+ slave->unattach_request = 0;
+ regcache_cache_only(rt721->regmap, false);
+ regcache_sync(rt721->regmap);
+ regcache_cache_only(rt721->mbq_regmap, false);
+ regcache_sync(rt721->mbq_regmap);
+ return 0;
+}
+
+static const struct dev_pm_ops rt721_sdca_pm = {
+ SET_SYSTEM_SLEEP_PM_OPS(rt721_sdca_dev_system_suspend, rt721_sdca_dev_resume)
+ SET_RUNTIME_PM_OPS(rt721_sdca_dev_suspend, rt721_sdca_dev_resume, NULL)
+};
+
+static struct sdw_driver rt721_sdca_sdw_driver = {
+ .driver = {
+ .name = "rt721-sdca",
+ .owner = THIS_MODULE,
+ .pm = &rt721_sdca_pm,
+ },
+ .probe = rt721_sdca_sdw_probe,
+ .remove = rt721_sdca_sdw_remove,
+ .ops = &rt721_sdca_slave_ops,
+ .id_table = rt721_sdca_id,
+};
+module_sdw_driver(rt721_sdca_sdw_driver);
+
+MODULE_DESCRIPTION("ASoC RT721 SDCA SDW driver");
+MODULE_AUTHOR("Jack Yu <jack.yu(a)realtek.com>");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt721-sdca-sdw.h b/sound/soc/codecs/rt721-sdca-sdw.h
new file mode 100644
index 000000000000..d96f30c9d290
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca-sdw.h
@@ -0,0 +1,151 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * rt721-sdca-sdw.h -- RT721 SDCA ALSA SoC audio driver header
+ *
+ * Copyright(c) 2024 Realtek Semiconductor Corp.
+ */
+
+#ifndef __RT721_SDW_H__
+#define __RT721_SDW_H__
+
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw_registers.h>
+
+static const struct reg_default rt721_sdca_reg_defaults[] = {
+ { 0x202d, 0x00 },
+ { 0x2f01, 0x00 },
+ { 0x2f02, 0x09 },
+ { 0x2f03, 0x08 },
+ { 0x2f04, 0x00 },
+ { 0x2f05, 0x0e },
+ { 0x2f06, 0x01 },
+ { 0x2f09, 0x00 },
+ { 0x2f0a, 0x00 },
+ { 0x2f35, 0x00 },
+ { 0x2f50, 0xf0 },
+ { 0x2f58, 0x07 },
+ { 0x2f59, 0x07 },
+ { 0x2f5a, 0x00 },
+ { 0x2f5b, 0x07 },
+ { 0x2f5c, 0x27 },
+ { 0x2f5d, 0x07 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS01,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS11,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_03), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_04), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_CS1F,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_IT26,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_CS31,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_OT23,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x01 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x01 },
+};
+
+static const struct reg_default rt721_sdca_mbq_defaults[] = {
+ { 0x0900007, 0xc004 },
+ { 0x2000001, 0x0000 },
+ { 0x2000002, 0x0000 },
+ { 0x2000003, 0x0000 },
+ { 0x2000013, 0x8001 },
+ { 0x200003c, 0x0000 },
+ { 0x2000046, 0x3400 },
+ // { 0x5810000, 0x702d },
+ { 0x5f00044, 0x6040 },
+ { 0x5f00045, 0x3333 },
+ { 0x5f00048, 0x0000 },
+ { 0x6100005, 0x0005 },
+ { 0x6100006, 0x0000 },
+ { 0x610000d, 0x0051 },
+ { 0x6100010, 0x0180 },
+ { 0x6100011, 0x0000 },
+ { 0x6100013, 0x0000 },
+ { 0x6100015, 0x0000 },
+ { 0x6100017, 0x8049 },
+ { 0x6100025, 0x1000 },
+ { 0x6100029, 0x0809 },
+ { 0x610002c, 0x2828 },
+ { 0x610002d, 0x2929 },
+ { 0x610002e, 0x3529 },
+ { 0x610002f, 0x2901 },
+ { 0x6100053, 0x2630 },
+ { 0x6100054, 0x2a2a },
+ { 0x6100055, 0x152f },
+ { 0x6100057, 0x2200 },
+ { 0x610005a, 0x2a4b },
+ { 0x610005b, 0x2a00 },
+ { 0x610006a, 0x0102 },
+ { 0x610006d, 0x0102 },
+ { 0x6100092, 0x4f61 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_L), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F, RT721_SDCA_CTL_FU_VOLUME,
+ CH_R), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44, RT721_SDCA_CTL_FU_CH_GAIN,
+ CH_L), 0xfe00 },
+ { SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44, RT721_SDCA_CTL_FU_CH_GAIN,
+ CH_R), 0xfe00 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_01),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_02),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_03),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15, RT721_SDCA_CTL_FU_CH_GAIN, CH_04),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_01), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_02), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_03), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E, RT721_SDCA_CTL_FU_VOLUME,
+ CH_04), 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ 0x0000 },
+ { SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06, RT721_SDCA_CTL_FU_VOLUME, CH_R),
+ 0x0000 },
+};
+
+#endif /* __RT721_SDW_H__ */
diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
new file mode 100644
index 000000000000..cca749ebbd31
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -0,0 +1,1790 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// rt721-sdca.c -- rt721 SDCA ALSA SoC audio driver
+//
+// Copyright(c) 2024 Realtek Semiconductor Corp.
+//
+//
+
+#include <linux/bitops.h>
+#include <sound/core.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <sound/initval.h>
+#include <sound/jack.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <sound/pcm.h>
+#include <linux/pm_runtime.h>
+#include <sound/pcm_params.h>
+#include <linux/soundwire/sdw_registers.h>
+#include <linux/slab.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>
+
+#include "rt721-sdca.h"
+
+static void rt721_sdca_dmic_preset(struct rt721_sdca_priv *rt721)
+{
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* Set AD07/08 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL9, 0x2a2a);
+ /* Set AD10 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL10, 0x2a00);
+ /* Set DMIC1/DMIC2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL6, 0x2a2a);
+ /* Set DMIC1/DMIC2 IT entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL5, 0x2626);
+ /* Set AD10 FU entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL8, 0x1e00);
+ /* Set DMIC1/DMIC2 FU input gain floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL7, 0x1515);
+ /* Set DMIC2 FU input gain channel floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL3, 0x0304);
+ /* Set AD10 FU channel floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL4, 0x0304);
+ /* vf71f_r12_07_06 and vf71f_r13_07_06 = 2’b00 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_CTL1, 0x0000);
+ /* Enable vf707_r12_05/vf707_r13_05 */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_IT26,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x01);
+ /* Set usd_flag_sel, usd_in_sel */
+ regmap_write(rt721->mbq_regmap, 0x5910009, 0x2e01);
+ /* Set RC calibration */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b00);
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b40);
+ /* Fine tune PDE2A latency */
+ regmap_write(rt721->regmap, 0x2f5c, 0x25);
+}
+
+static void rt721_sdca_amp_preset(struct rt721_sdca_priv *rt721)
+{;
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* Reset dc_cal_top */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x6420);
+ /* Turn back to normal dc_cal_top */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x6421);
+ /* W1C Trigger Calibration */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0xe421);
+ /* DAC04 FU entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_CH_FLOAT_CTL6, 0x5561);
+ /* Set EAPD high */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_REG,
+ RT721_GPIO_PAD_CTRL5, 0x8003);
+ /* Enable vf707_r14 */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_OT23,
+ RT721_SDCA_CTL_VENDOR_DEF, 0), 0x04);
+ /* FU 23 SPK mute control - L */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x00);
+ /* FU 23 SPK mute control - R */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x00);
+ /* FU 55 DAC04 mute control - L */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 0x00);
+ /* FU 55 DAC04 mute control - R */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_FU55,
+ RT721_SDCA_CTL_FU_MUTE, CH_02), 0x00);
+}
+
+static void rt721_sdca_jack_preset(struct rt721_sdca_priv *rt721)
+{
+ /* Power down group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8000);
+ /* VREF_HV_EN_AUTO_FAST */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF1_HV_CTRL1, 0xe000);
+ /* Power up group1/2/3_mic_pdb */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_MISC_POWER_CTL31, 0x8007);
+ /* GE0 mode related control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_GE_REL_CTRL1, 0x8011);
+ /* Button A, B, C, D bypass mode */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL3, 0xcf00);
+ /* HID1 slot enable */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL4, 0x000f);
+ /* Report ID for HID1 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL1, 0x1100);
+ /* OSC/OOC for slot 2, 3 */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_UMP_HID_CTRL5, 0x0c12);
+ /* Set JD de-bounce clock control */
+ rt721_sdca_index_write(rt721, RT721_JD_CTRL,
+ RT721_JD_1PIN_GAT_CTRL2, 0xc002);
+ /* RC calibration -1 */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b00);
+ /* RC calibration -2 */
+ rt721_sdca_index_write(rt721, RT721_RC_CALIB_CTRL,
+ RT721_RC_CALIB_CTRL0, 0x0b40);
+ /* pow_clk_12p288mhz_dre03 change to register mode */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3333);
+ /* Tune calibration timing control */
+ regmap_write(rt721->mbq_regmap, 0x5810035, 0x0036);
+ /* calibration HP amp output select control from Efuse */
+ regmap_write(rt721->mbq_regmap, 0x5810030, 0xee00);
+ /* FSM related control */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL1, 0x0140);
+ /* HP calibration related control */
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x0021);
+ /* W1C HP calibration*/
+ regmap_write(rt721->mbq_regmap, 0x5810000, 0x8021);
+ /* reg_sel_cin_hp_0010/0011 */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL18, 0x5522);
+ regmap_write(rt721->mbq_regmap, 0x5b10007, 0x2000);
+ /* sel_sensing_lr_hp */
+ regmap_write(rt721->mbq_regmap, 0x5B10017, 0x1b0f);
+ /* Release HP-JD */
+ rt721_sdca_index_write(rt721, RT721_CBJ_CTRL,
+ RT721_CBJ_A0_GAT_CTRL1, 0x2a02);
+ /* en_osw gating auto done bit */
+ rt721_sdca_index_write(rt721, RT721_CAP_PORT_CTRL,
+ RT721_HP_AMP_2CH_CAL4, 0xa105);
+ /* pow_clk_en_sw_amp_detect_sel to register mode */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3b33);
+ /* cp_sw_hp to auto mode */
+ regmap_write(rt721->mbq_regmap, 0x310400, 0x3023);
+ /* pow_clk_en_sw_amp_detect power up */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON14, 0x3f33);
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON13, 0x6048);
+ /* switch size detect threshold */
+ regmap_write(rt721->mbq_regmap, 0x310401, 0x3000);
+ regmap_write(rt721->mbq_regmap, 0x310402, 0x1b00);
+ /* en_hp_amp_detect auto mode */
+ regmap_write(rt721->mbq_regmap, 0x310300, 0x000f);
+ /* amp detect threshold */
+ regmap_write(rt721->mbq_regmap, 0x310301, 0x3000);
+ regmap_write(rt721->mbq_regmap, 0x310302, 0x1b00);
+ /* gating_sdw_link_rst_n_1_cbj_reg */
+ rt721_sdca_index_write(rt721, RT721_VENDOR_ANA_CTL,
+ RT721_UAJ_TOP_TCON17, 0x0008);
+ /* CKXEN_SDAC chopper function */
+ rt721_sdca_index_write(rt721, RT721_DAC_CTRL,
+ RT721_DAC_2CH_CTRL3, 0x55ff);
+ /* CKXSEL_SDAC chopper frequency */
+ rt721_sdca_index_write(rt721, RT721_DAC_CTRL,
+ RT721_DAC_2CH_CTRL4, 0xcc00);
+ /* Bias current for SDAC */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_MBIAS_LV_CTRL2, 0x6677);
+ /* VREF2 level selection */
+ rt721_sdca_index_write(rt721, RT721_ANA_POW_PART,
+ RT721_VREF2_LV_CTRL1, 0x7600);
+ /* ADC09/MIC2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL2, 0x1234);
+ /* LINE2 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL3, 0x3512);
+ /* DAC03/HP power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL1, 0x4040);
+ /* ADC27 power entity floating control */
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_ENT_FLOAT_CTL4, 0x1201);
+ /* Fine tune PDE40 latency */
+ regmap_write(rt721->regmap, 0x2f58, 0x07);
+}
+
+int rt721_sdca_index_write(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int value)
+{
+ struct regmap *regmap = rt721->mbq_regmap;
+ unsigned int addr = (nid << 20) | reg;
+ int ret;
+
+ ret = regmap_write(regmap, addr, value);
+ if (ret < 0)
+ dev_err(&rt721->slave->dev,
+ "Failed to set private value: %06x <= %04x ret=%d\n",
+ addr, value, ret);
+
+ return ret;
+}
+
+int rt721_sdca_index_read(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int *value)
+{
+ int ret;
+ struct regmap *regmap = rt721->mbq_regmap;
+ unsigned int addr = (nid << 20) | reg;
+
+ ret = regmap_read(regmap, addr, value);
+ if (ret < 0)
+ dev_err(&rt721->slave->dev,
+ "Failed to get private value: %06x => %04x ret=%d\n",
+ addr, *value, ret);
+
+ return ret;
+}
+
+static int rt721_sdca_index_update_bits(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int mask, unsigned int val)
+{
+ unsigned int tmp;
+ int ret;
+
+ ret = rt721_sdca_index_read(rt721, nid, reg, &tmp);
+ if (ret < 0)
+ return ret;
+
+ set_mask_bits(&tmp, mask, val);
+ return rt721_sdca_index_write(rt721, nid, reg, tmp);
+}
+
+static int rt721_sdca_btn_type(unsigned char *buffer)
+{
+ if ((*buffer & 0xf0) == 0x10 || (*buffer & 0x0f) == 0x01 ||
+ (*(buffer + 1) == 0x01) || (*(buffer + 1) == 0x10))
+ return SND_JACK_BTN_2;
+ else if ((*buffer & 0xf0) == 0x20 || (*buffer & 0x0f) == 0x02 ||
+ (*(buffer + 1) == 0x02) || (*(buffer + 1) == 0x20))
+ return SND_JACK_BTN_3;
+ else if ((*buffer & 0xf0) == 0x40 || (*buffer & 0x0f) == 0x04 ||
+ (*(buffer + 1) == 0x04) || (*(buffer + 1) == 0x40))
+ return SND_JACK_BTN_0;
+ else if ((*buffer & 0xf0) == 0x80 || (*buffer & 0x0f) == 0x08 ||
+ (*(buffer + 1) == 0x08) || (*(buffer + 1) == 0x80))
+ return SND_JACK_BTN_1;
+
+ return 0;
+}
+
+static unsigned int rt721_sdca_button_detect(struct rt721_sdca_priv *rt721)
+{
+ unsigned int btn_type = 0, offset, idx, val, owner;
+ int ret;
+ unsigned char buf[3];
+
+ /* get current UMP message owner */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), &owner);
+ if (ret < 0)
+ return 0;
+
+ /* if owner is device then there is no button event from device */
+ if (owner == 1)
+ return 0;
+
+ /* read UMP message offset */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET, 0), &offset);
+ if (ret < 0)
+ goto _end_btn_det_;
+
+ for (idx = 0; idx < sizeof(buf); idx++) {
+ ret = regmap_read(rt721->regmap,
+ RT721_BUF_ADDR_HID1 + offset + idx, &val);
+ if (ret < 0)
+ goto _end_btn_det_;
+ buf[idx] = val & 0xff;
+ }
+
+ if (buf[0] == 0x11)
+ btn_type = rt721_sdca_btn_type(&buf[1]);
+
+_end_btn_det_:
+ /* Host is owner, so set back to device */
+ if (owner == 0)
+ /* set owner to device */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), 0x01);
+
+ return btn_type;
+}
+
+static int rt721_sdca_headset_detect(struct rt721_sdca_priv *rt721)
+{
+ unsigned int det_mode;
+ int ret;
+
+ /* get detected_mode */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0), &det_mode);
+
+ if (ret < 0)
+ goto io_error;
+
+ switch (det_mode) {
+ case 0x00:
+ rt721->jack_type = 0;
+ break;
+ case 0x03:
+ rt721->jack_type = SND_JACK_HEADPHONE;
+ break;
+ case 0x05:
+ rt721->jack_type = SND_JACK_HEADSET;
+ break;
+ }
+
+ /* write selected_mode */
+ if (det_mode) {
+ ret = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), det_mode);
+ if (ret < 0)
+ goto io_error;
+ }
+
+ dev_dbg(&rt721->slave->dev,
+ "%s, detected_mode=0x%x\n", __func__, det_mode);
+
+ return 0;
+
+io_error:
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+ return ret;
+}
+
+static void rt721_sdca_jack_detect_handler(struct work_struct *work)
+{
+ struct rt721_sdca_priv *rt721 =
+ container_of(work, struct rt721_sdca_priv, jack_detect_work.work);
+ int btn_type = 0, ret;
+
+ if (!rt721->hs_jack)
+ return;
+
+ if (!rt721->component->card || !rt721->component->card->instantiated)
+ return;
+
+ /* SDW_SCP_SDCA_INT_SDCA_6 is used for jack detection */
+ if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) {
+ ret = rt721_sdca_headset_detect(rt721);
+ if (ret < 0)
+ return;
+ }
+
+ /* SDW_SCP_SDCA_INT_SDCA_8 is used for button detection */
+ if (rt721->scp_sdca_stat2 & SDW_SCP_SDCA_INT_SDCA_8)
+ btn_type = rt721_sdca_button_detect(rt721);
+
+ if (rt721->jack_type == 0)
+ btn_type = 0;
+
+ dev_dbg(&rt721->slave->dev,
+ "in %s, jack_type=%d\n", __func__, rt721->jack_type);
+ dev_dbg(&rt721->slave->dev,
+ "in %s, btn_type=0x%x\n", __func__, btn_type);
+ pr_info("rtk debug, jack_type=%d\n", rt721->jack_type);
+ pr_info("rtk debug, btn_type=0x%x\n", btn_type);
+ dev_dbg(&rt721->slave->dev,
+ "in %s, scp_sdca_stat1=0x%x, scp_sdca_stat2=0x%x\n", __func__,
+ rt721->scp_sdca_stat1, rt721->scp_sdca_stat2);
+
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type | btn_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ if (btn_type) {
+ /* button released */
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_btn_check_work, msecs_to_jiffies(200));
+ }
+}
+
+static void rt721_sdca_btn_check_handler(struct work_struct *work)
+{
+ struct rt721_sdca_priv *rt721 =
+ container_of(work, struct rt721_sdca_priv, jack_btn_check_work.work);
+ int btn_type = 0, ret, idx;
+ unsigned int det_mode, offset, val;
+ unsigned char buf[3];
+
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
+ RT721_SDCA_CTL_DETECTED_MODE, 0), &det_mode);
+ if (ret < 0)
+ goto io_error;
+
+ /* pin attached */
+ if (det_mode) {
+ /* read UMP message offset */
+ ret = regmap_read(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
+ RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET, 0), &offset);
+ if (ret < 0)
+ goto io_error;
+
+ for (idx = 0; idx < sizeof(buf); idx++) {
+ ret = regmap_read(rt721->regmap,
+ RT721_BUF_ADDR_HID1 + offset + idx, &val);
+ if (ret < 0)
+ goto io_error;
+ buf[idx] = val & 0xff;
+ }
+
+ if (buf[0] == 0x11)
+ btn_type = rt721_sdca_btn_type(&buf[1]);
+ } else
+ rt721->jack_type = 0;
+
+ dev_dbg(&rt721->slave->dev, "%s, btn_type=0x%x\n", __func__, btn_type);
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type | btn_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ if (btn_type) {
+ /* button released */
+ snd_soc_jack_report(rt721->hs_jack, rt721->jack_type,
+ SND_JACK_HEADSET |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
+ mod_delayed_work(system_power_efficient_wq,
+ &rt721->jack_btn_check_work, msecs_to_jiffies(200));
+ }
+
+ return;
+
+io_error:
+ pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
+}
+
+static void rt721_sdca_jack_init(struct rt721_sdca_priv *rt721)
+{
+ mutex_lock(&rt721->calibrate_mutex);
+ if (rt721->hs_jack) {
+ /* set SCP_SDCA_IntMask1[0]=1 */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK1,
+ SDW_SCP_SDCA_INTMASK_SDCA_0 | SDW_SCP_SDCA_INTMASK_SDCA_6);
+ /* set SCP_SDCA_IntMask2[0]=1 */
+ sdw_write_no_pm(rt721->slave, SDW_SCP_SDCA_INTMASK2,
+ SDW_SCP_SDCA_INTMASK_SDCA_8);
+ dev_dbg(&rt721->slave->dev, "in %s enable\n", __func__);
+ rt721_sdca_index_write(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_UAJ_CTL, 0x036E);
+ /* set XU(et03h) & XU(et0Dh) to Not bypassed */
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XU03,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), 0);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XU0D,
+ RT721_SDCA_CTL_SELECTED_MODE, 0), 0);
+ /* trigger GE interrupt */
+ rt721_sdca_index_update_bits(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_GE_REL_CTRL1, 0x4000, 0x4000);
+ }
+ mutex_unlock(&rt721->calibrate_mutex);
+}
+
+static int rt721_sdca_set_jack_detect(struct snd_soc_component *component,
+ struct snd_soc_jack *hs_jack, void *data)
+{
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ rt721->hs_jack = hs_jack;
+
+ ret = pm_runtime_resume_and_get(component->dev);
+ if (ret < 0) {
+ if (ret != -EACCES) {
+ dev_err(component->dev, "%s: failed to resume %d\n", __func__, ret);
+ return ret;
+ }
+ /* pm_runtime not enabled yet */
+ dev_dbg(component->dev, "%s: skipping jack init for now\n", __func__);
+ return 0;
+ }
+
+ rt721_sdca_jack_init(rt721);
+
+ pm_runtime_mark_last_busy(component->dev);
+ pm_runtime_put_autosuspend(component->dev);
+
+ return 0;
+}
+
+/* For SDCA control DAC/ADC Gain */
+static int rt721_sdca_set_gain_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int read_l, read_r, gain_l_val, gain_r_val;
+ unsigned int adc_vol_flag = 0, changed = 0;
+ unsigned int lvalue, rvalue;
+ const unsigned int interval_offset = 0xc0;
+ const unsigned int tendA = 0x200;
+ const unsigned int tendB = 0xa00;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume") ||
+ strstr(ucontrol->id.name, "FU0F Capture Volume"))
+ adc_vol_flag = 1;
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &lvalue);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &rvalue);
+
+ /* L Channel */
+ gain_l_val = ucontrol->value.integer.value[0];
+ if (gain_l_val > mc->max)
+ gain_l_val = mc->max;
+
+ if (mc->shift == 8) {
+ /* boost gain */
+ gain_l_val = gain_l_val * tendB;
+ } else if (mc->shift == 1) {
+ /* FU33 boost gain */
+ if (gain_l_val == 0)
+ gain_l_val = 0x8000;
+ else
+ gain_l_val = (gain_l_val - 1) * tendA;
+ } else {
+ /* ADC/DAC gain */
+ if (adc_vol_flag)
+ gain_l_val = 0x1e00 - ((mc->max - gain_l_val) * interval_offset);
+ else
+ gain_l_val = 0 - ((mc->max - gain_l_val) * interval_offset);
+ gain_l_val &= 0xffff;
+ }
+
+ /* R Channel */
+ gain_r_val = ucontrol->value.integer.value[1];
+ if (gain_r_val > mc->max)
+ gain_r_val = mc->max;
+
+ if (mc->shift == 8) {
+ /* boost gain */
+ gain_r_val = gain_r_val * tendB;
+ } else if (mc->shift == 1) {
+ /* FU33 boost gain */
+ if (gain_r_val == 0)
+ gain_r_val = 0x8000;
+ else
+ gain_r_val = (gain_r_val - 1) * tendA;
+ } else {
+ /* ADC/DAC gain */
+ if (adc_vol_flag)
+ gain_r_val = 0x1e00 - ((mc->max - gain_r_val) * interval_offset);
+ else
+ gain_r_val = 0 - ((mc->max - gain_r_val) * interval_offset);
+ gain_r_val &= 0xffff;
+ }
+
+ if (lvalue != gain_l_val || rvalue != gain_r_val)
+ changed = 1;
+ else
+ return 0;
+
+ /* Lch*/
+ regmap_write(rt721->mbq_regmap, mc->reg, gain_l_val);
+
+ /* Rch */
+ regmap_write(rt721->mbq_regmap, mc->rreg, gain_r_val);
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &read_l);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &read_r);
+ if (read_r == gain_r_val && read_l == gain_l_val)
+ return changed;
+
+ return -EIO;
+}
+
+static int rt721_sdca_set_gain_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ unsigned int read_l, read_r, ctl_l = 0, ctl_r = 0;
+ unsigned int adc_vol_flag = 0;
+ const unsigned int interval_offset = 0xc0;
+ const unsigned int tendB = 0xa00;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume") ||
+ strstr(ucontrol->id.name, "FU0F Capture Volume"))
+ adc_vol_flag = 1;
+
+ regmap_read(rt721->mbq_regmap, mc->reg, &read_l);
+ regmap_read(rt721->mbq_regmap, mc->rreg, &read_r);
+
+ if (mc->shift == 8) /* boost gain */
+ ctl_l = read_l / tendB;
+ else {
+ if (adc_vol_flag)
+ ctl_l = mc->max - (((0x1e00 - read_l) & 0xffff) / interval_offset);
+ else
+ ctl_l = mc->max - (((0 - read_l) & 0xffff) / interval_offset);
+ }
+
+ if (read_l != read_r) {
+ if (mc->shift == 8) /* boost gain */
+ ctl_r = read_r / tendB;
+ else { /* ADC/DAC gain */
+ if (adc_vol_flag)
+ ctl_r = mc->max - (((0x1e00 - read_r) & 0xffff) / interval_offset);
+ else
+ ctl_r = mc->max - (((0 - read_r) & 0xffff) / interval_offset);
+ }
+ } else {
+ ctl_r = ctl_l;
+ }
+
+ ucontrol->value.integer.value[0] = ctl_l;
+ ucontrol->value.integer.value[1] = ctl_r;
+
+ return 0;
+}
+
+static int rt721_sdca_set_fu1e_capture_ctl(struct rt721_sdca_priv *rt721)
+{
+ int err, i;
+ unsigned int ch_mute;
+
+ for (i = 0; i < ARRAY_SIZE(rt721->fu1e_mixer_mute); i++) {
+ ch_mute = rt721->fu1e_dapm_mute || rt721->fu1e_mixer_mute[i];
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01) + i, ch_mute);
+ if (err < 0)
+ return err;
+ }
+
+ return 0;
+}
+
+static int rt721_sdca_fu1e_capture_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ unsigned int i;
+
+ for (i = 0; i < p->count; i++)
+ ucontrol->value.integer.value[i] = !rt721->fu1e_mixer_mute[i];
+
+ return 0;
+}
+
+static int rt721_sdca_fu1e_capture_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ int err, changed = 0, i;
+
+ for (i = 0; i < p->count; i++) {
+ if (rt721->fu1e_mixer_mute[i] != !ucontrol->value.integer.value[i])
+ changed = 1;
+ rt721->fu1e_mixer_mute[i] = !ucontrol->value.integer.value[i];
+ }
+
+ err = rt721_sdca_set_fu1e_capture_ctl(rt721);
+ if (err < 0)
+ return err;
+
+ return changed;
+}
+
+static int rt721_sdca_set_fu0f_capture_ctl(struct rt721_sdca_priv *rt721)
+{
+ int err;
+ unsigned int ch_l, ch_r;
+
+ ch_l = (rt721->fu0f_dapm_mute || rt721->fu0f_mixer_l_mute) ? 0x01 : 0x00;
+ ch_r = (rt721->fu0f_dapm_mute || rt721->fu0f_mixer_r_mute) ? 0x01 : 0x00;
+
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), ch_l);
+ if (err < 0)
+ return err;
+
+ err = regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), ch_r);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static int rt721_sdca_fu0f_capture_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ ucontrol->value.integer.value[0] = !rt721->fu0f_mixer_l_mute;
+ ucontrol->value.integer.value[1] = !rt721->fu0f_mixer_r_mute;
+ return 0;
+}
+
+static int rt721_sdca_fu0f_capture_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int err, changed = 0;
+
+ if (rt721->fu0f_mixer_l_mute != !ucontrol->value.integer.value[0] ||
+ rt721->fu0f_mixer_r_mute != !ucontrol->value.integer.value[1])
+ changed = 1;
+
+ rt721->fu0f_mixer_l_mute = !ucontrol->value.integer.value[0];
+ rt721->fu0f_mixer_r_mute = !ucontrol->value.integer.value[1];
+ err = rt721_sdca_set_fu0f_capture_ctl(rt721);
+ if (err < 0)
+ return err;
+
+ return changed;
+}
+
+static int rt721_sdca_fu_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+
+ if (p->max == 1)
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ else
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ uinfo->count = p->count;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = p->max;
+ return 0;
+}
+
+static int rt721_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ unsigned int boost_step = 0x0a00;
+ unsigned int vol_max = 0x1e00;
+ unsigned int regvalue, ctl, i;
+ unsigned int adc_vol_flag = 0;
+ const unsigned int interval_offset = 0xc0;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume"))
+ adc_vol_flag = 1;
+
+ /* check all channels */
+ for (i = 0; i < p->count; i++) {
+ regmap_read(rt721->mbq_regmap, p->reg_base + i, ®value);
+
+ if (!adc_vol_flag) /* boost gain */
+ ctl = regvalue / boost_step;
+ else { /* ADC gain */
+ if (adc_vol_flag)
+ ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
+ else
+ ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
+ }
+
+ ucontrol->value.integer.value[i] = ctl;
+ }
+
+ return 0;
+}
+
+static int rt721_sdca_dmic_set_gain_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct rt721_sdca_dmic_kctrl_priv *p =
+ (struct rt721_sdca_dmic_kctrl_priv *)kcontrol->private_value;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int boost_step = 0x0a00;
+ unsigned int vol_max = 0x1e00;
+ unsigned int gain_val[4];
+ unsigned int i, adc_vol_flag = 0, changed = 0;
+ unsigned int regvalue[4];
+ const unsigned int interval_offset = 0xc0;
+ int err;
+
+ if (strstr(ucontrol->id.name, "FU1E Capture Volume"))
+ adc_vol_flag = 1;
+
+ /* check all channels */
+ for (i = 0; i < p->count; i++) {
+ regmap_read(rt721->mbq_regmap, p->reg_base + i, ®value[i]);
+
+ gain_val[i] = ucontrol->value.integer.value[i];
+ if (gain_val[i] > p->max)
+ gain_val[i] = p->max;
+
+ if (!adc_vol_flag) /* boost gain */
+ gain_val[i] = gain_val[i] * boost_step;
+ else { /* ADC gain */
+ gain_val[i] = vol_max - ((p->max - gain_val[i]) * interval_offset);
+ gain_val[i] &= 0xffff;
+ }
+
+ if (regvalue[i] != gain_val[i])
+ changed = 1;
+ }
+
+ if (!changed)
+ return 0;
+
+ for (i = 0; i < p->count; i++) {
+ err = regmap_write(rt721->mbq_regmap, p->reg_base + i, gain_val[i]);
+ if (err < 0)
+ dev_err(&rt721->slave->dev, "%#08x can't be set\n", p->reg_base + i);
+ }
+
+ return changed;
+}
+
+#define RT721_SDCA_PR_VALUE(xreg_base, xcount, xmax, xinvert) \
+ ((unsigned long)&(struct rt721_sdca_dmic_kctrl_priv) \
+ {.reg_base = xreg_base, .count = xcount, .max = xmax, \
+ .invert = xinvert})
+
+#define RT721_SDCA_FU_CTRL(xname, reg_base, xmax, xinvert, xcount) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .info = rt721_sdca_fu_info, \
+ .get = rt721_sdca_fu1e_capture_get, \
+ .put = rt721_sdca_fu1e_capture_put, \
+ .private_value = RT721_SDCA_PR_VALUE(reg_base, xcount, xmax, xinvert)}
+
+#define RT721_SDCA_EXT_TLV(xname, reg_base, xhandler_get,\
+ xhandler_put, xcount, xmax, tlv_array) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
+ SNDRV_CTL_ELEM_ACCESS_READWRITE, \
+ .tlv.p = (tlv_array), \
+ .info = rt721_sdca_fu_info, \
+ .get = xhandler_get, .put = xhandler_put, \
+ .private_value = RT721_SDCA_PR_VALUE(reg_base, xcount, xmax, 0) }
+
+static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);
+static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -1725, 75, 0);
+static const DECLARE_TLV_DB_SCALE(boost_vol_tlv, 0, 1000, 0);
+static const DECLARE_TLV_DB_SCALE(mic2_boost_vol_tlv, -200, 200, 0);
+
+static const struct snd_kcontrol_new rt721_sdca_controls[] = {
+ /* Headphone playback settings */
+ SOC_DOUBLE_R_EXT_TLV("FU05 Playback Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x57, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, out_vol_tlv),
+ /* Headset mic capture settings */
+ SOC_DOUBLE_EXT("FU0F Capture Switch", SND_SOC_NOPM, 0, 1, 1, 0,
+ rt721_sdca_fu0f_capture_get, rt721_sdca_fu0f_capture_put),
+ SOC_DOUBLE_R_EXT_TLV("FU0F Capture Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU0F,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x3f, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, mic_vol_tlv),
+ SOC_DOUBLE_R_EXT_TLV("FU33 Boost Volume",
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PLATFORM_FU44,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_R), 1, 0x15, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, mic2_boost_vol_tlv),
+ /* AMP playback settings */
+ SOC_DOUBLE_R_EXT_TLV("FU06 Playback Volume",
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_VOLUME, CH_L),
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_VOLUME, CH_R), 0, 0x57, 0,
+ rt721_sdca_set_gain_get, rt721_sdca_set_gain_put, out_vol_tlv),
+ /* DMIC capture settings */
+ RT721_SDCA_FU_CTRL("FU1E Capture Switch",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_MUTE, CH_01), 1, 1, 4),
+ RT721_SDCA_EXT_TLV("FU1E Capture Volume",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_USER_FU1E,
+ RT721_SDCA_CTL_FU_VOLUME, CH_01),
+ rt721_sdca_dmic_set_gain_get, rt721_sdca_dmic_set_gain_put,
+ 4, 0x3f, mic_vol_tlv),
+ RT721_SDCA_EXT_TLV("FU15 Boost Volume",
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_FU15,
+ RT721_SDCA_CTL_FU_CH_GAIN, CH_01),
+ rt721_sdca_dmic_set_gain_get, rt721_sdca_dmic_set_gain_put,
+ 4, 3, boost_vol_tlv),
+};
+
+static int rt721_sdca_adc_mux_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_kcontrol_component(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned int val = 0, mask_sft, mask;
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux")) {
+ mask_sft = 12;
+ mask = 0x7;
+ } else if (strstr(ucontrol->id.name, "ADC 08 R Mux")) {
+ mask_sft = 10;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 08 L Mux")) {
+ mask_sft = 8;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 R Mux")) {
+ mask_sft = 6;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 L Mux")) {
+ mask_sft = 4;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 R Mux")) {
+ mask_sft = 2;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 L Mux")) {
+ mask_sft = 0;
+ mask = 0x3;
+ } else
+ return -EINVAL;
+
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &val);
+
+ ucontrol->value.enumerated.item[0] = (val >> mask_sft) & mask;
+
+ return 0;
+}
+
+static int rt721_sdca_adc_mux_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_kcontrol_component(kcontrol);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_dapm_kcontrol_dapm(kcontrol);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+ unsigned int *item = ucontrol->value.enumerated.item;
+ unsigned int val, val2 = 0, change, mask_sft, mask;
+ unsigned int check;
+
+ if (item[0] >= e->items)
+ return -EINVAL;
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux")) {
+ mask_sft = 12;
+ mask = 0x7;
+ } else if (strstr(ucontrol->id.name, "ADC 08 R Mux")) {
+ mask_sft = 10;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 08 L Mux")) {
+ mask_sft = 8;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 R Mux")) {
+ mask_sft = 6;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 10 L Mux")) {
+ mask_sft = 4;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 R Mux")) {
+ mask_sft = 2;
+ mask = 0x3;
+ } else if (strstr(ucontrol->id.name, "ADC 07 L Mux")) {
+ mask_sft = 0;
+ mask = 0x3;
+ } else
+ return -EINVAL;
+
+ val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l;
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &val2);
+
+ if (strstr(ucontrol->id.name, "ADC 09 Mux"))
+ val2 = (val2 >> mask_sft) & 0x7;
+ else
+ val2 = (val2 >> mask_sft) & 0x3;
+
+ if (val == val2)
+ change = 0;
+ else
+ change = 1;
+
+ if (change) {
+ rt721_sdca_index_read(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, &check);
+ rt721_sdca_index_update_bits(rt721, RT721_HDA_SDCA_FLOAT,
+ RT721_HDA_LEGACY_MUX_CTL0, mask << mask_sft,
+ val << mask_sft);
+ }
+
+ snd_soc_dapm_mux_update_power(dapm, kcontrol,
+ item[0], e, NULL);
+
+ return change;
+}
+
+static const char * const adc09_mux_text[] = {
+ "MIC2",
+ "LINE1",
+ "LINE2",
+};
+static const char * const adc07_10_mux_text[] = {
+ "DMIC1 RE",
+ "DMIC1 FE",
+ "DMIC2 RE",
+ "DMIC2 FE",
+};
+
+static SOC_ENUM_SINGLE_DECL(
+ rt721_adc09_enum, SND_SOC_NOPM, 0, adc09_mux_text);
+static SOC_ENUM_SINGLE_DECL(
+ rt721_dmic_enum, SND_SOC_NOPM, 0, adc07_10_mux_text);
+
+static const struct snd_kcontrol_new rt721_sdca_adc09_mux =
+ SOC_DAPM_ENUM_EXT("ADC 09 Mux", rt721_adc09_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc08_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 08 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc08_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 08 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc10_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 10 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc10_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 10 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc07_r_mux =
+ SOC_DAPM_ENUM_EXT("ADC 07 R Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+static const struct snd_kcontrol_new rt721_sdca_adc07_l_mux =
+ SOC_DAPM_ENUM_EXT("ADC 07 L Mux", rt721_dmic_enum,
+ rt721_sdca_adc_mux_get, rt721_sdca_adc_mux_put);
+
+
+static int rt721_sdca_fu42_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ msleep(100);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_USER_FU05,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu21_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_USER_FU06,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu23_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char unmute = 0x0, mute = 0x1;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), unmute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), unmute);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_L), mute);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE23,
+ RT721_SDCA_CTL_FU_MUTE, CH_R), mute);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu113_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ rt721->fu1e_dapm_mute = false;
+ rt721_sdca_set_fu1e_capture_ctl(rt721);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ rt721->fu1e_dapm_mute = true;
+ rt721_sdca_set_fu1e_capture_ctl(rt721);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_fu36_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ rt721->fu0f_dapm_mute = false;
+ rt721_sdca_set_fu0f_capture_ctl(rt721);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ rt721->fu0f_dapm_mute = true;
+ rt721_sdca_set_fu0f_capture_ctl(rt721);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde47_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE40,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde41_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE41,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_PDE41,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde11_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_PDE2A,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static int rt721_sdca_pde34_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ unsigned char ps0 = 0x0, ps3 = 0x3;
+
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0);
+ break;
+ case SND_SOC_DAPM_PRE_PMD:
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3);
+ break;
+ }
+ return 0;
+}
+
+static const struct snd_soc_dapm_widget rt721_sdca_dapm_widgets[] = {
+ SND_SOC_DAPM_OUTPUT("HP"),
+ SND_SOC_DAPM_OUTPUT("SPK"),
+ SND_SOC_DAPM_INPUT("MIC2"),
+ SND_SOC_DAPM_INPUT("LINE1"),
+ SND_SOC_DAPM_INPUT("LINE2"),
+ SND_SOC_DAPM_INPUT("DMIC1_2"),
+ SND_SOC_DAPM_INPUT("DMIC3_4"),
+
+ SND_SOC_DAPM_SUPPLY("PDE 41", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde41_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 47", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde47_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 11", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde11_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_SUPPLY("PDE 34", SND_SOC_NOPM, 0, 0,
+ rt721_sdca_pde34_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+
+ SND_SOC_DAPM_DAC_E("FU 21", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu21_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_DAC_E("FU 23", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu23_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_DAC_E("FU 42", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu42_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_ADC_E("FU 36", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu36_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_ADC_E("FU 113", NULL, SND_SOC_NOPM, 0, 0,
+ rt721_sdca_fu113_event,
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+ SND_SOC_DAPM_MUX("ADC 09 Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc09_mux),
+ SND_SOC_DAPM_MUX("ADC 08 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc08_r_mux),
+ SND_SOC_DAPM_MUX("ADC 08 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc08_l_mux),
+ SND_SOC_DAPM_MUX("ADC 10 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc10_r_mux),
+ SND_SOC_DAPM_MUX("ADC 10 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc10_l_mux),
+ SND_SOC_DAPM_MUX("ADC 07 R Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc07_r_mux),
+ SND_SOC_DAPM_MUX("ADC 07 L Mux", SND_SOC_NOPM, 0, 0,
+ &rt721_sdca_adc07_l_mux),
+
+ SND_SOC_DAPM_AIF_IN("DP1RX", "DP1 Headphone Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("DP2TX", "DP2 Headset Capture", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_IN("DP3RX", "DP3 Speaker Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("DP6TX", "DP6 DMic Capture", 0, SND_SOC_NOPM, 0, 0),
+};
+
+static const struct snd_soc_dapm_route rt721_sdca_audio_map[] = {
+ {"FU 42", NULL, "DP1RX"},
+ {"FU 21", NULL, "DP3RX"},
+ {"FU 23", NULL, "DP3RX"},
+
+ {"ADC 09 Mux", "MIC2", "MIC2"},
+ {"ADC 09 Mux", "LINE1", "LINE1"},
+ {"ADC 09 Mux", "LINE2", "LINE2"},
+ {"ADC 07 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 07 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 07 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 07 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 07 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 07 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 07 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 07 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 08 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 08 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 08 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 08 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 08 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 08 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 08 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 08 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 10 R Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 10 R Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 10 R Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 10 R Mux", "DMIC2 FE", "DMIC3_4"},
+ {"ADC 10 L Mux", "DMIC1 RE", "DMIC1_2"},
+ {"ADC 10 L Mux", "DMIC1 FE", "DMIC1_2"},
+ {"ADC 10 L Mux", "DMIC2 RE", "DMIC3_4"},
+ {"ADC 10 L Mux", "DMIC2 FE", "DMIC3_4"},
+ {"FU 36", NULL, "PDE 34"},
+ {"FU 36", NULL, "ADC 09 Mux"},
+ {"FU 113", NULL, "PDE 11"},
+ {"FU 113", NULL, "ADC 07 R Mux"},
+ {"FU 113", NULL, "ADC 07 L Mux"},
+ {"FU 113", NULL, "ADC 10 R Mux"},
+ {"FU 113", NULL, "ADC 10 L Mux"},
+ {"DP2TX", NULL, "FU 36"},
+ {"DP6TX", NULL, "FU 113"},
+
+ {"HP", NULL, "PDE 47"},
+ {"HP", NULL, "FU 42"},
+ {"SPK", NULL, "PDE 41"},
+ {"SPK", NULL, "FU 21"},
+ {"SPK", NULL, "FU 23"},
+};
+
+static int rt721_sdca_parse_dt(struct rt721_sdca_priv *rt721, struct device *dev)
+{
+ device_property_read_u32(dev, "realtek,jd-src", &rt721->jd_src);
+
+ return 0;
+}
+
+static int rt721_sdca_probe(struct snd_soc_component *component)
+{
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ rt721_sdca_parse_dt(rt721, &rt721->slave->dev);
+ rt721->component = component;
+
+ ret = pm_runtime_resume(component->dev);
+ if (ret < 0 && ret != -EACCES)
+ return ret;
+
+ return 0;
+}
+
+static const struct snd_soc_component_driver soc_sdca_dev_rt721 = {
+ .probe = rt721_sdca_probe,
+ .controls = rt721_sdca_controls,
+ .num_controls = ARRAY_SIZE(rt721_sdca_controls),
+ .dapm_widgets = rt721_sdca_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(rt721_sdca_dapm_widgets),
+ .dapm_routes = rt721_sdca_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(rt721_sdca_audio_map),
+ .set_jack = rt721_sdca_set_jack_detect,
+ .endianness = 1,
+};
+
+static int rt721_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
+ int direction)
+{
+ snd_soc_dai_dma_data_set(dai, direction, sdw_stream);
+
+ return 0;
+}
+
+static void rt721_sdca_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ snd_soc_dai_set_dma_data(dai, substream, NULL);
+}
+
+static int rt721_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct sdw_stream_config stream_config;
+ struct sdw_port_config port_config;
+ enum sdw_data_direction direction;
+ struct sdw_stream_runtime *sdw_stream;
+ int retval, port, num_channels;
+ unsigned int sampling_rate;
+
+ dev_dbg(dai->dev, "%s %s", __func__, dai->name);
+ sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!sdw_stream)
+ return -EINVAL;
+
+ if (!rt721->slave)
+ return -EINVAL;
+
+ /*
+ * RT721_AIF1 with port = 1 for headphone playback
+ * RT721_AIF1 with port = 2 for headset-mic capture
+ * RT721_AIF2 with port = 3 for speaker playback
+ * RT721_AIF3 with port = 6 for digital-mic capture
+ */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ direction = SDW_DATA_DIR_RX;
+ if (dai->id == RT721_AIF1)
+ port = 1;
+ else if (dai->id == RT721_AIF2)
+ port = 3;
+ else
+ return -EINVAL;
+ } else {
+ direction = SDW_DATA_DIR_TX;
+ if (dai->id == RT721_AIF1)
+ port = 2;
+ else if (dai->id == RT721_AIF3)
+ port = 6;
+ else
+ return -EINVAL;
+ }
+ stream_config.frame_rate = params_rate(params);
+ stream_config.ch_count = params_channels(params);
+ stream_config.bps = snd_pcm_format_width(params_format(params));
+ stream_config.direction = direction;
+
+ num_channels = params_channels(params);
+ port_config.ch_mask = GENMASK(num_channels - 1, 0);
+ port_config.num = port;
+
+ retval = sdw_stream_add_slave(rt721->slave, &stream_config,
+ &port_config, 1, sdw_stream);
+ if (retval) {
+ dev_err(dai->dev, "Unable to configure port\n");
+ return retval;
+ }
+
+ if (params_channels(params) > 16) {
+ dev_err(component->dev, "Unsupported channels %d\n",
+ params_channels(params));
+ return -EINVAL;
+ }
+
+ /* sampling rate configuration */
+ switch (params_rate(params)) {
+ case 8000:
+ sampling_rate = RT721_SDCA_RATE_8000HZ;
+ break;
+ case 16000:
+ sampling_rate = RT721_SDCA_RATE_16000HZ;
+ break;
+ case 24000:
+ sampling_rate = RT721_SDCA_RATE_24000HZ;
+ break;
+ case 32000:
+ sampling_rate = RT721_SDCA_RATE_32000HZ;
+ break;
+ case 44100:
+ sampling_rate = RT721_SDCA_RATE_44100HZ;
+ break;
+ case 48000:
+ sampling_rate = RT721_SDCA_RATE_48000HZ;
+ break;
+ case 96000:
+ sampling_rate = RT721_SDCA_RATE_96000HZ;
+ break;
+ case 192000:
+ sampling_rate = RT721_SDCA_RATE_192000HZ;
+ break;
+ case 384000:
+ sampling_rate = RT721_SDCA_RATE_384000HZ;
+ break;
+ case 768000:
+ sampling_rate = RT721_SDCA_RATE_768000HZ;
+ break;
+ default:
+ dev_err(component->dev, "Rate %d is not supported\n",
+ params_rate(params));
+ return -EINVAL;
+ }
+
+ /* set sampling frequency */
+ if (dai->id == RT721_AIF1) {
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS01,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_CS11,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+ }
+
+ if (dai->id == RT721_AIF2)
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT_CS31,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+
+ if (dai->id == RT721_AIF3)
+ regmap_write(rt721->regmap,
+ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT_CS1F,
+ RT721_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate);
+
+ return 0;
+}
+
+static int rt721_sdca_pcm_hw_free(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
+ struct sdw_stream_runtime *sdw_stream =
+ snd_soc_dai_get_dma_data(dai, substream);
+
+ if (!rt721->slave)
+ return -EINVAL;
+
+ sdw_stream_remove_slave(rt721->slave, sdw_stream);
+ return 0;
+}
+
+#define RT721_STEREO_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \
+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000)
+#define RT721_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE)
+
+static const struct snd_soc_dai_ops rt721_sdca_ops = {
+ .hw_params = rt721_sdca_pcm_hw_params,
+ .hw_free = rt721_sdca_pcm_hw_free,
+ .set_stream = rt721_sdca_set_sdw_stream,
+ .shutdown = rt721_sdca_shutdown,
+};
+
+static struct snd_soc_dai_driver rt721_sdca_dai[] = {
+ {
+ .name = "rt721-sdca-aif1",
+ .id = RT721_AIF1,
+ .playback = {
+ .stream_name = "DP1 Headphone Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .capture = {
+ .stream_name = "DP2 Headset Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ },
+ {
+ .name = "rt721-sdca-aif2",
+ .id = RT721_AIF2,
+ .playback = {
+ .stream_name = "DP3 Speaker Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ },
+ {
+ .name = "rt721-sdca-aif3",
+ .id = RT721_AIF3,
+ .capture = {
+ .stream_name = "DP6 DMic Capture",
+ .channels_min = 1,
+ .channels_max = 4,
+ .rates = RT721_STEREO_RATES,
+ .formats = RT721_FORMATS,
+ },
+ .ops = &rt721_sdca_ops,
+ }
+};
+
+int rt721_sdca_init(struct device *dev, struct regmap *regmap,
+ struct regmap *mbq_regmap, struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721;
+
+ rt721 = devm_kzalloc(dev, sizeof(*rt721), GFP_KERNEL);
+ if (!rt721)
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, rt721);
+ rt721->slave = slave;
+ rt721->regmap = regmap;
+ rt721->mbq_regmap = mbq_regmap;
+
+ regcache_cache_only(rt721->regmap, true);
+ regcache_cache_only(rt721->mbq_regmap, true);
+
+ mutex_init(&rt721->calibrate_mutex);
+ mutex_init(&rt721->disable_irq_lock);
+
+ INIT_DELAYED_WORK(&rt721->jack_detect_work, rt721_sdca_jack_detect_handler);
+ INIT_DELAYED_WORK(&rt721->jack_btn_check_work, rt721_sdca_btn_check_handler);
+
+ /*
+ * Mark hw_init to false
+ * HW init will be performed when device reports present
+ */
+ rt721->hw_init = false;
+ rt721->first_hw_init = false;
+ rt721->fu1e_dapm_mute = true;
+ rt721->fu0f_dapm_mute = true;
+ rt721->fu0f_mixer_l_mute = rt721->fu0f_mixer_r_mute = true;
+ rt721->fu1e_mixer_mute[0] = rt721->fu1e_mixer_mute[1] =
+ rt721->fu1e_mixer_mute[2] = rt721->fu1e_mixer_mute[3] = true;
+
+ return devm_snd_soc_register_component(dev,
+ &soc_sdca_dev_rt721, rt721_sdca_dai, ARRAY_SIZE(rt721_sdca_dai));
+}
+
+int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave)
+{
+ struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
+
+ rt721->disable_irq = false;
+
+ if (rt721->hw_init)
+ return 0;
+
+ regcache_cache_only(rt721->regmap, false);
+ regcache_cache_only(rt721->mbq_regmap, false);
+ if (rt721->first_hw_init) {
+ regcache_cache_bypass(rt721->regmap, true);
+ regcache_cache_bypass(rt721->mbq_regmap, true);
+ } else {
+ /*
+ * PM runtime is only enabled when a Slave reports as Attached
+ */
+
+ /* set autosuspend parameters */
+ pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
+ pm_runtime_use_autosuspend(&slave->dev);
+
+ /* update count of parent 'active' children */
+ pm_runtime_set_active(&slave->dev);
+
+ /* make sure the device does not suspend immediately */
+ pm_runtime_mark_last_busy(&slave->dev);
+
+ pm_runtime_enable(&slave->dev);
+ }
+
+ pm_runtime_get_noresume(&slave->dev);
+ rt721_sdca_dmic_preset(rt721);
+ rt721_sdca_amp_preset(rt721);
+ rt721_sdca_jack_preset(rt721);
+ if (rt721->first_hw_init) {
+ regcache_cache_bypass(rt721->regmap, false);
+ regcache_mark_dirty(rt721->regmap);
+ regcache_cache_bypass(rt721->mbq_regmap, false);
+ regcache_mark_dirty(rt721->mbq_regmap);
+ } else
+ rt721->first_hw_init = true;
+
+ /* Mark Slave initialization complete */
+ rt721->hw_init = true;
+
+ pm_runtime_mark_last_busy(&slave->dev);
+ pm_runtime_put_autosuspend(&slave->dev);
+
+ dev_dbg(&slave->dev, "%s hw_init complete\n", __func__);
+ return 0;
+}
+
+MODULE_DESCRIPTION("ASoC RT721 SDCA SDW driver");
+MODULE_AUTHOR("Jack Yu <jack.yu(a)realtek.com>");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt721-sdca.h b/sound/soc/codecs/rt721-sdca.h
new file mode 100644
index 000000000000..69cf51bb6c95
--- /dev/null
+++ b/sound/soc/codecs/rt721-sdca.h
@@ -0,0 +1,277 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * rt721-sdca.h -- RT721 SDCA ALSA SoC audio driver header
+ *
+ * Copyright(c) 2024 Realtek Semiconductor Corp.
+ */
+
+#ifndef __RT721_H__
+#define __RT721_H__
+
+#include <linux/pm.h>
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_type.h>
+#include <sound/soc.h>
+#include <linux/workqueue.h>
+
+struct rt721_sdca_priv {
+ struct regmap *regmap;
+ struct regmap *mbq_regmap;
+ struct snd_soc_component *component;
+ struct sdw_slave *slave;
+ struct sdw_bus_params params;
+ bool hw_init;
+ bool first_hw_init;
+ struct mutex calibrate_mutex;
+ struct mutex disable_irq_lock;
+ bool disable_irq;
+ /* For Headset jack & Headphone */
+ unsigned int scp_sdca_stat1;
+ unsigned int scp_sdca_stat2;
+ struct snd_soc_jack *hs_jack;
+ struct delayed_work jack_detect_work;
+ struct delayed_work jack_btn_check_work;
+ int jack_type;
+ int jd_src;
+ bool fu0f_dapm_mute;
+ bool fu0f_mixer_l_mute;
+ bool fu0f_mixer_r_mute;
+ /* For DMIC */
+ bool fu1e_dapm_mute;
+ bool fu1e_mixer_mute[4];
+};
+
+struct rt721_sdca_dmic_kctrl_priv {
+ unsigned int reg_base;
+ unsigned int count;
+ unsigned int max;
+ unsigned int invert;
+};
+
+/* NID */
+#define RT721_ANA_POW_PART 0x01
+#define RT721_DAC_CTRL 0x04
+#define RT721_JD_CTRL 0x09
+#define RT721_CBJ_CTRL 0x0a
+#define RT721_CAP_PORT_CTRL 0x0c
+#define RT721_CLASD_AMP_CTRL 0x0d
+#define RT721_VENDOR_REG 0x20
+#define RT721_RC_CALIB_CTRL 0x40
+#define RT721_VENDOR_EQ_L 0x53
+#define RT721_VENDOR_EQ_R 0x54
+#define RT721_VENDOR_HP_CALI 0x56
+#define RT721_VENDOR_CHARGE_PUMP 0x57
+#define RT721_VENDOR_CLASD_CALI 0x58
+#define RT721_VENDOR_IMS_DRE 0x5b
+#define RT721_VENDOR_SPK_EFUSE 0x5c
+#define RT721_VENDOR_LEVEL_CTRL 0x5d
+#define RT721_VENDOR_ANA_CTL 0x5f
+#define RT721_HDA_SDCA_FLOAT 0x61
+
+/* Index (NID:01h) */
+#define RT721_MBIAS_LV_CTRL2 0x07
+#define RT721_VREF1_HV_CTRL1 0x0a
+#define RT721_VREF2_LV_CTRL1 0x0b
+
+/* Index (NID:04h) */
+#define RT721_DAC_2CH_CTRL3 0x02
+#define RT721_DAC_2CH_CTRL4 0x03
+
+/* Index (NID:09h) */
+#define RT721_JD_1PIN_GAT_CTRL2 0x07
+
+/* Index (NID:0ah) */
+#define RT721_CBJ_A0_GAT_CTRL1 0x04
+#define RT721_CBJ_A0_GAT_CTRL2 0x05
+
+/* Index (NID:0Ch) */
+#define RT721_HP_AMP_2CH_CAL1 0x05
+#define RT721_HP_AMP_2CH_CAL4 0x08
+#define RT721_HP_AMP_2CH_CAL18 0x1b
+
+/* Index (NID:0dh) */
+#define RT721_CLASD_AMP_2CH_CAL 0x14
+
+/* Index (NID:20h) */
+#define RT721_JD_PRODUCT_NUM 0x00
+#define RT721_ANALOG_BIAS_CTL3 0x04
+#define RT721_JD_CTRL1 0x09
+#define RT721_LDO2_3_CTL1 0x0e
+#define RT721_GPIO_PAD_CTRL5 0x13
+#define RT721_LDO1_CTL 0x1a
+#define RT721_HP_JD_CTRL 0x24
+#define RT721_VD_HIDDEN_CTRL 0x26
+#define RT721_CLSD_CTRL6 0x3c
+#define RT721_COMBO_JACK_AUTO_CTL1 0x45
+#define RT721_COMBO_JACK_AUTO_CTL2 0x46
+#define RT721_COMBO_JACK_AUTO_CTL3 0x47
+#define RT721_DIGITAL_MISC_CTRL4 0x4a
+#define RT721_VREFO_GAT 0x63
+#define RT721_FSM_CTL 0x67
+#define RT721_SDCA_INTR_REC 0x82
+#define RT721_SW_CONFIG1 0x8a
+#define RT721_SW_CONFIG2 0x8b
+
+/* Index (NID:40h) */
+#define RT721_RC_CALIB_CTRL0 0x00
+
+/* Index (NID:58h) */
+#define RT721_DAC_DC_CALI_CTL1 0x01
+#define RT721_DAC_DC_CALI_CTL2 0x02
+#define RT721_DAC_DC_CALI_CTL3 0x03
+
+/* Index (NID:5fh) */
+#define RT721_MISC_POWER_CTL0 0x00
+#define RT721_MISC_POWER_CTL31 0x31
+#define RT721_UAJ_TOP_TCON13 0x44
+#define RT721_UAJ_TOP_TCON14 0x45
+#define RT721_UAJ_TOP_TCON17 0x48
+
+/* Index (NID:61h) */
+#define RT721_HDA_LEGACY_MUX_CTL0 0x00
+#define RT721_HDA_LEGACY_UAJ_CTL 0x02
+#define RT721_HDA_LEGACY_CTL1 0x05
+#define RT721_HDA_LEGACY_RESET_CTL 0x06
+#define RT721_GE_REL_CTRL1 0x0d
+#define RT721_HDA_LEGACY_GPIO_WAKE_EN_CTL 0x0e
+#define RT721_GE_SDCA_RST_CTRL 0x10
+#define RT721_INT_RST_EN_CTRL 0x11
+#define RT721_XU_EVENT_EN 0x13
+#define RT721_INLINE_CTL2 0x17
+#define RT721_UMP_HID_CTRL1 0x18
+#define RT721_UMP_HID_CTRL2 0x19
+#define RT721_UMP_HID_CTRL3 0x1a
+#define RT721_UMP_HID_CTRL4 0x1b
+#define RT721_UMP_HID_CTRL5 0x1c
+#define RT721_FUNC_FLOAT_CTL0 0x22
+#define RT721_FUNC_FLOAT_CTL1 0x23
+#define RT721_FUNC_FLOAT_CTL2 0x24
+#define RT721_FUNC_FLOAT_CTL3 0x25
+#define RT721_ENT_FLOAT_CTL0 0x29
+#define RT721_ENT_FLOAT_CTL1 0x2c
+#define RT721_ENT_FLOAT_CTL2 0x2d
+#define RT721_ENT_FLOAT_CTL3 0x2e
+#define RT721_ENT_FLOAT_CTL4 0x2f
+#define RT721_CH_FLOAT_CTL1 0x45
+#define RT721_CH_FLOAT_CTL2 0x46
+#define RT721_ENT_FLOAT_CTL5 0x53
+#define RT721_ENT_FLOAT_CTL6 0x54
+#define RT721_ENT_FLOAT_CTL7 0x55
+#define RT721_ENT_FLOAT_CTL8 0x57
+#define RT721_ENT_FLOAT_CTL9 0x5a
+#define RT721_ENT_FLOAT_CTL10 0x5b
+#define RT721_CH_FLOAT_CTL3 0x6a
+#define RT721_CH_FLOAT_CTL4 0x6d
+#define RT721_CH_FLOAT_CTL5 0x70
+#define RT721_CH_FLOAT_CTL6 0x92
+
+/* Parameter & Verb control 01 (0x26)(NID:20h) */
+#define RT721_HIDDEN_REG_SW_RESET (0x1 << 14)
+
+/* Buffer address for HID */
+#define RT721_BUF_ADDR_HID1 0x44030000
+#define RT721_BUF_ADDR_HID2 0x44030020
+
+/* RT721 SDCA Control - function number */
+#define FUNC_NUM_JACK_CODEC 0x01
+#define FUNC_NUM_MIC_ARRAY 0x02
+#define FUNC_NUM_HID 0x03
+#define FUNC_NUM_AMP 0x04
+
+/* RT721 SDCA entity */
+#define RT721_SDCA_ENT_HID01 0x01
+#define RT721_SDCA_ENT_XUV 0x03
+#define RT721_SDCA_ENT_GE49 0x49
+#define RT721_SDCA_ENT_USER_FU05 0x05
+#define RT721_SDCA_ENT_USER_FU06 0x06
+#define RT721_SDCA_ENT_USER_FU0F 0x0f
+#define RT721_SDCA_ENT_USER_FU10 0x19
+#define RT721_SDCA_ENT_USER_FU1E 0x1e
+#define RT721_SDCA_ENT_FU15 0x15
+#define RT721_SDCA_ENT_PDE23 0x23
+#define RT721_SDCA_ENT_PDE40 0x40
+#define RT721_SDCA_ENT_PDE41 0x41
+#define RT721_SDCA_ENT_PDE11 0x11
+#define RT721_SDCA_ENT_PDE12 0x12
+#define RT721_SDCA_ENT_PDE2A 0x2a
+#define RT721_SDCA_ENT_CS01 0x01
+#define RT721_SDCA_ENT_CS11 0x11
+#define RT721_SDCA_ENT_CS1F 0x1f
+#define RT721_SDCA_ENT_CS1C 0x1c
+#define RT721_SDCA_ENT_CS31 0x31
+#define RT721_SDCA_ENT_OT23 0x42
+#define RT721_SDCA_ENT_IT26 0x26
+#define RT721_SDCA_ENT_IT09 0x09
+#define RT721_SDCA_ENT_PLATFORM_FU15 0x15
+#define RT721_SDCA_ENT_PLATFORM_FU44 0x44
+#define RT721_SDCA_ENT_XU03 0x03
+#define RT721_SDCA_ENT_XU0D 0x0d
+#define RT721_SDCA_ENT_FU55 0x55
+
+/* RT721 SDCA control */
+#define RT721_SDCA_CTL_SAMPLE_FREQ_INDEX 0x10
+#define RT721_SDCA_CTL_FU_MUTE 0x01
+#define RT721_SDCA_CTL_FU_VOLUME 0x02
+#define RT721_SDCA_CTL_HIDTX_CURRENT_OWNER 0x10
+#define RT721_SDCA_CTL_HIDTX_SET_OWNER_TO_DEVICE 0x11
+#define RT721_SDCA_CTL_HIDTX_MESSAGE_OFFSET 0x12
+#define RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH 0x13
+#define RT721_SDCA_CTL_SELECTED_MODE 0x01
+#define RT721_SDCA_CTL_DETECTED_MODE 0x02
+#define RT721_SDCA_CTL_REQ_POWER_STATE 0x01
+#define RT721_SDCA_CTL_VENDOR_DEF 0x30
+#define RT721_SDCA_CTL_XUV 0x34
+#define RT721_SDCA_CTL_FU_CH_GAIN 0x0b
+
+/* RT721 SDCA channel */
+#define CH_L 0x01
+#define CH_R 0x02
+#define CH_01 0x01
+#define CH_02 0x02
+#define CH_03 0x03
+#define CH_04 0x04
+#define CH_08 0x08
+#define CH_09 0x09
+#define CH_0A 0x0a
+
+/* sample frequency index */
+#define RT721_SDCA_RATE_8000HZ 0x01
+#define RT721_SDCA_RATE_11025HZ 0x02
+#define RT721_SDCA_RATE_12000HZ 0x03
+#define RT721_SDCA_RATE_16000HZ 0x04
+#define RT721_SDCA_RATE_22050HZ 0x05
+#define RT721_SDCA_RATE_24000HZ 0x06
+#define RT721_SDCA_RATE_32000HZ 0x07
+#define RT721_SDCA_RATE_44100HZ 0x08
+#define RT721_SDCA_RATE_48000HZ 0x09
+#define RT721_SDCA_RATE_88200HZ 0x0a
+#define RT721_SDCA_RATE_96000HZ 0x0b
+#define RT721_SDCA_RATE_176400HZ 0x0c
+#define RT721_SDCA_RATE_192000HZ 0x0d
+#define RT721_SDCA_RATE_384000HZ 0x0e
+#define RT721_SDCA_RATE_768000HZ 0x0f
+
+enum {
+ RT721_AIF1, /* For headset mic and headphone */
+ RT721_AIF2, /* For speaker */
+ RT721_AIF3, /* For dmic */
+ RT721_AIFS,
+};
+
+enum rt721_sdca_jd_src {
+ RT721_JD_NULL,
+ RT721_JD1,
+ RT721_JD2,
+};
+
+int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave);
+int rt721_sdca_init(struct device *dev, struct regmap *regmap,
+ struct regmap *mbq_regmap, struct sdw_slave *slave);
+int rt721_sdca_index_write(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int value);
+int rt721_sdca_index_read(struct rt721_sdca_priv *rt721,
+ unsigned int nid, unsigned int reg, unsigned int *value);
+
+int rt721_sdca_jack_detect(struct rt721_sdca_priv *rt721, bool *hp, bool *mic);
+#endif /* __RT721_H__ */
--
2.34.1
2
2
This patch fixes typos in comments in the atomisp driver.
These changes improve code readability without affecting
functionality.
Signed-off-by: Yu Jiaoliang <yujiaoliang(a)vivo.com>
---
sound/core/compress_offload.c | 2 +-
sound/core/oss/rate.c | 2 +-
sound/core/pcm_native.c | 2 +-
sound/core/sound.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index b8c0d6edbdd1..bdf1d78de833 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -288,7 +288,7 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
stream = &data->stream;
guard(mutex)(&stream->device->lock);
- /* write is allowed when stream is running or has been steup */
+ /* write is allowed when stream is running or has been setup */
switch (stream->runtime->state) {
case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED:
diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
index 98269119347f..b56eeda5e30e 100644
--- a/sound/core/oss/rate.c
+++ b/sound/core/oss/rate.c
@@ -294,7 +294,7 @@ static int rate_action(struct snd_pcm_plugin *plugin,
default:
break;
}
- return 0; /* silenty ignore other actions */
+ return 0; /* silently ignore other actions */
}
int snd_pcm_plugin_build_rate(struct snd_pcm_substream *plug,
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 99e39b5359cc..b49bc89c0758 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3115,7 +3115,7 @@ struct snd_pcm_sync_ptr32 {
} c;
} __packed;
-/* recalcuate the boundary within 32bit */
+/* recalculate the boundary within 32bit */
static snd_pcm_uframes_t recalculate_boundary(struct snd_pcm_runtime *runtime)
{
snd_pcm_uframes_t boundary;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index b9db9aa0bfcb..6531a67f13b3 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -133,7 +133,7 @@ static struct snd_minor *autoload_device(unsigned int minor)
/* /dev/aloadSEQ */
snd_request_other(minor);
}
- mutex_lock(&sound_mutex); /* reacuire lock */
+ mutex_lock(&sound_mutex); /* reacquire lock */
return snd_minors[minor];
}
#else /* !CONFIG_MODULES */
--
2.34.1
1
0
alsa-project/alsa-plugins issue #61 was opened from uis246:
There is already OSS plugin for alsa to support BSD, there are many sound server plugins for alsa. Is it possible to make such plugin for sounds api used in windows?
Not sure what is better place to start this discussion.
Issue URL : https://github.com/alsa-project/alsa-plugins/issues/61
Repository URL: https://github.com/alsa-project/alsa-plugins
1
0

[PATCH] ALSA: Drop explicit initialization of struct i2c_device_id::driver_data to 0
by Uwe Kleine-König 20 Sep '24
by Uwe Kleine-König 20 Sep '24
20 Sep '24
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig(a)baylibre.com>
---
sound/aoa/codecs/onyx.c | 2 +-
sound/aoa/codecs/tas.c | 2 +-
sound/pci/hda/cs35l41_hda_i2c.c | 2 +-
sound/pci/hda/tas2781_hda_i2c.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index e90e03bb0dc0..ac347a14f282 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -1040,7 +1040,7 @@ static void onyx_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id onyx_i2c_id[] = {
- { "MAC,pcm3052", 0 },
+ { "MAC,pcm3052" },
{ }
};
MODULE_DEVICE_TABLE(i2c,onyx_i2c_id);
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index be9822ebf9f8..804b2ebbe28f 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -927,7 +927,7 @@ static void tas_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id tas_i2c_id[] = {
- { "MAC,tas3004", 0 },
+ { "MAC,tas3004" },
{ }
};
MODULE_DEVICE_TABLE(i2c,tas_i2c_id);
diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
index 603e9bff3a71..bb84740c8520 100644
--- a/sound/pci/hda/cs35l41_hda_i2c.c
+++ b/sound/pci/hda/cs35l41_hda_i2c.c
@@ -39,7 +39,7 @@ static void cs35l41_hda_i2c_remove(struct i2c_client *clt)
}
static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
- { "cs35l41-hda", 0 },
+ { "cs35l41-hda" },
{}
};
diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index f58f434e7110..4b9dc84ce6bb 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -951,7 +951,7 @@ static const struct dev_pm_ops tas2781_hda_pm_ops = {
};
static const struct i2c_device_id tas2781_hda_i2c_id[] = {
- { "tas2781-hda", 0 },
+ { "tas2781-hda" },
{}
};
base-commit: 62f92d634458a1e308bb699986b9147a6d670457
--
2.45.2
2
1

[PATCH] ASoC: cs35l45: Corrects cs35l45_get_clk_freq_id function data type
by Ricardo Rivera-Matos 20 Sep '24
by Ricardo Rivera-Matos 20 Sep '24
20 Sep '24
Changes cs35l45_get_clk_freq_id() function data type from unsigned int
to int. This function is returns a positive index value if successful
or a negative error code if unsuccessful.
Functionally there should be no difference as long as the unsigned int
return is interpreted as an int, however it should be corrected for
readability.
Signed-off-by: Ricardo Rivera-Matos <rriveram(a)opensource.cirrus.com>
---
sound/soc/codecs/cs35l45-tables.c | 2 +-
sound/soc/codecs/cs35l45.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/cs35l45-tables.c b/sound/soc/codecs/cs35l45-tables.c
index e1cebb9e4dc6..405dab137b3b 100644
--- a/sound/soc/codecs/cs35l45-tables.c
+++ b/sound/soc/codecs/cs35l45-tables.c
@@ -315,7 +315,7 @@ static const struct {
{ 0x3B, 24576000 },
};
-unsigned int cs35l45_get_clk_freq_id(unsigned int freq)
+int cs35l45_get_clk_freq_id(unsigned int freq)
{
int i;
diff --git a/sound/soc/codecs/cs35l45.h b/sound/soc/codecs/cs35l45.h
index e2ebcf58d7e0..7a790d2acac7 100644
--- a/sound/soc/codecs/cs35l45.h
+++ b/sound/soc/codecs/cs35l45.h
@@ -507,7 +507,7 @@ extern const struct dev_pm_ops cs35l45_pm_ops;
extern const struct regmap_config cs35l45_i2c_regmap;
extern const struct regmap_config cs35l45_spi_regmap;
int cs35l45_apply_patch(struct cs35l45_private *cs35l45);
-unsigned int cs35l45_get_clk_freq_id(unsigned int freq);
+int cs35l45_get_clk_freq_id(unsigned int freq);
int cs35l45_probe(struct cs35l45_private *cs35l45);
void cs35l45_remove(struct cs35l45_private *cs35l45);
--
2.43.0
3
2
alsa-project/alsa-ucm-conf issue #442 was opened from thenameisluk:
i have similar config to https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Qualcomm/sc7…
for [homestar](https://wiki.postmarketos.org/wiki/Lenovo_IdeaPad_Duet_5_(google-…
```
# Use case configuration for ALC5682+MAX98357A on SC7180
SectionVerb {
Value {
TQ "HiFi"
}
}
SectionDevice."Speaker" {
Comment "Speaker"
Value {
PlaybackChannels 4
PlaybackPCM "hw:${CardId},1"
PlaybackPriority 100
PlaybackMixerElem "Speaker"
PlaybackVolume "Speaker Playback Volume"
}
}
SectionDevice."Mic" {
Comment "Internal Microphone"
EnableSequence [
cset "name='IF1 01 ADC Swap Mux' 1"
cset "name='Stereo1 ADC L2 Mux' 1"
cset "name='Stereo1 ADC R2 Mux' 1"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 1"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 1"
]
DisableSequence [
cset "name='Stereo1 ADC L2 Mux' 0"
cset "name='Stereo1 ADC R2 Mux' 0"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 0"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 0"
]
Value {
CapturePCM "hw:${CardId},0"
CapturePriority 100
CaptureMixerElem "STO1 ADC"
CaptureVolume "STO1 ADC Capture Volume"
}
}
SectionDevice."HDMI" {
Comment "HDMI Jack"
ConflictingDevice [
"Speaker"
]
EnableSequence [
]
DisableSequence [
]
Value {
PlaybackPriority 200
PlaybackPCM "hw:${CardId},2"
JackControl "HDMI Jack"
}
}
```
the speaker and mic section is irrelevant here
hdmi is causing issues
without
```
ConflictingDevice [
"Speaker"
]
```
pipewire doesn't want to use the ucm at all unless the hdmi is plugged in
with it
pipewire will only configure hdmi if hdmi is plugged in (when you restart it or at boot)
it's all on the same card
and the interface never goes away, only switches between
```
# amixer -c 0 contents
numid=9,iface=CARD,name='HDMI Jack'
; type=BOOLEAN,access=r-------,values=1
: values=off
...
```
without hdmi and
```
# amixer -c 0 contents
numid=9,iface=CARD,name='HDMI Jack'
; type=BOOLEAN,access=r-------,values=1
: values=on
```
with hdmi
```sudo alsactl monitor```also shows
```
node hw:0, #9 (0,0,0,HDMI Jack,0) VALUE
```
when plugging in and unplugging
knowing all this i am unable to figure out how to handle it with ucm2
and would appreciate some help getting it working without that ConflictingDevice
Issue URL : https://github.com/alsa-project/alsa-ucm-conf/issues/442
Repository URL: https://github.com/alsa-project/alsa-ucm-conf
1
0

19 Sep '24
Add new vendor_id and subsystem_id in quirk for Lenovo Y990 Laptop.
Signed-off-by: Baojun Xu <baojun.xu(a)ti.com>
---
sound/pci/hda/patch_realtek.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 480e82df7a4c..4f69fd30fdce 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10612,6 +10612,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
+ SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
--
2.43.0
2
1
UCM can load a board-specific file based on the card long_name. Remove
the constant "AMD Soundwire SOF" long_name so that the ASoC core can
set the long_name based on DMI information.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda(a)amd.com>
---
sound/soc/amd/acp/acp-sdw-sof-mach.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index 6c50c8276538..306854fb08e3 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -400,9 +400,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
return ret;
}
-/* SoC card */
-static const char sdw_card_long_name[] = "AMD Soundwire SOF";
-
static int mc_probe(struct platform_device *pdev)
{
struct snd_soc_acpi_mach *mach = dev_get_platdata(&pdev->dev);
@@ -463,8 +460,6 @@ static int mc_probe(struct platform_device *pdev)
if (!card->components)
return -ENOMEM;
- card->long_name = sdw_card_long_name;
-
/* Register the card */
ret = devm_snd_soc_register_card(card->dev, card);
if (ret) {
--
2.34.1
3
3
On 8/21/24 12:18, Cezary Rojewski wrote:
> Conditional PCM (condpcm) helps facilitate modern audio usecases such as
> Echo Cancellations and Noise Reduction. These are not invoked by the
> means of userspace application opening an endpoint (FrontEnd) but are a
> "side effect" of selected PCMs running simultaneously e.g.: if both
> Speaker (source) and Microphone Array (sink) are running, reference
> data from the Speaker and take it into account when processing capture
> for better voice command detection ratio.
The point about dependencies between capture/playback usages is
certainly valid, and we've faced it multiple times for SOF - and even
before in the mobile phone days. I am not convinced however that the
graph management suggested here solves the well-known DPCM routing
problems? See notes in no specific order below.
I am not following what the 'source' and 'sink' concepts refer to in
this context. It looks like you are referring to regular PCM devices,
i.e. Front Ends in soc-pcm parlance but examples and code make
references to Back Ends.
There are also complicated cases where the amplifiers can provide an
echo reference for AEC and I/V sensing for speaker protection. You would
want to capture both even if there's no capture happening at the
userspace level. This is a well-know DPCM routing issue where we have to
rely on a Front-End being opened and some tags in UCM to deal with loose
coupling.
It would help if you added precisions on your assumptions of where the
processing takes place. In some cases Echo cancellation is handled in
userspace, others in SOC firmware and others externally in a codec.
The notion of source/sink is also problematic when the same BE provides
two sources of information that will be split, again same problem with
amplifier feedback being used for two separate functions. What happens
if you have multiple sinks for one source?
Same for the cases where the mic input is split multiple ways with
different processing added on different PCM capture devices, e.g. for
WebRTC there's an ask for a raw input, an AEC-processed input and
AEC+NS-processed input. That's typically implemented with two splitters,
the echo reference would be used by an intermediate node inside a
firmware graph, not at the DAI/BE or host/FE levels, and such
intermediate nodes are usually not handled by soc-pcm. We really need
more than the notion of FE and BE, a two-layer solution is no longer
sufficient.
The other thing that looks weird is the dependency on both sink and
source sharing a common state. For a noise reduction there are cases
where you'd want the mic input to be stored in a history buffer so that
the noise parameters can be estimated as soon as the actual capture starts.
> Which PCMs are needed for given conditional PCM to be spawned is
> determinated by the driver when registering the condpcm.
Presumably such links should be described by a topology file? It would
be odd for a driver to have to guess when to connect processing elements.
> The functionality was initially proposed for the avs-driver [1] and,
> depending on feedback and review may either go back into avs -or- become
> a ASoC-core feature. Implementation present here is an example of how
> such functionality could look and work on the ASoC side. Compared to
> what was provided initially, the patch carries simplified version of the
> feature: no priority/overriding for already running conditional PCMs.
> Whatever is spawned is treated as a non-conflicting entity.
>
> Assumptions and design decisions:
>
> - existence and outcome of condpcm operations is entirely optional and
> shall not impact the runtime flow of PCMs that spawned given condpcm,
> e.g.: fail in cpcm->hw_params() shall not impact fe->hw_params() or
> be->hw_params() negatively. Think of it as of debugfs. Useful? Yes.
> Required for system to operate? No.
that's debatable, if the AEC setup isn't successful then is the
functionality implemented correctly? My take is no, don't fail silently
if the AEC doesn't work.
If this functionality is listed as a product requirement then it cannot
be treated as a debugfs optional thing.
Exhibit A for this is the countless cases where validation reported a
problem with a path remaining active or conversely not being setup, or a
voice quality issue. Those are not optional...
> - a condpcm is a runtime entity that's audio format independent - since
> certain FE/BEs are its dependencies already, that's no need to do
> format ruling twice. Driver may still do custom checks thanks to
> ->match() operation.
>
> - a condpcm allows for additional processing of data that flows from
> data-source - a substream instance acting as data provider -
> to sink - a substream acting as data consumer. At the same time,
> regardless of substream->stream, given substream may act as data
> source for one condpcm and data sink for another, simultaneously.
>
> - while condpcm's behaviour mimics standard PCM one, there is no
> ->open() and ->close() - FE/BEs are treated as operational starting
> with successful ->hw_params(), when hw_ruling is done and hardware is
> configured.
>
> - cpcm->prepare() gets called only when both data source and sink are
> prepared
> - cpcm->trigger(START) gets called only when both data source and sink
> are running
> - cpcm->trigger(STOP) gets called when either data source or sink is
> stopped
>
> Simplified state machine:
>
> |
> register_condpcm() |
> v
> +--+-------------+
> | DISCONNECTED |<-+
> +--+-------------+ |
> | |
> condpcm_hw_params() | |
> v |
> +--+-------------+ |
> | SETUP | | condpcm_hw_free()
> +--+-------------+ |
> | |
> condpcm_prepare() | |
> v |
> +--+----+--------+ |
> | PREPARED |--+
> +--+----------+--+
> | ^
> condpcm_start() | | condpcm_stop()
> v |
> +--+----------+--+
> | RUNNING |
> +----------------+
>
> What's missing?
> I've not covered the locking part yet. While some operations are covered
> by default thanks to snd_soc_dpcm_mutex(), it is insufficient.
> If feature goes back to the avs-driver, then I'm set due to path->mutex.
>
> The locking is one of the reasons I'm leaning towards leaving the
> condpcm within the avs-driver. For soc_condpcm_find_match() to be
> precise and do no harm, a lock must prepend the list_for_each_entry().
> Entries (substreams) of that list may be part of number of different
> components and the search may negatively impact runtime flow of
> substreams that do not care about condpcms at all.
>
> Has this been tested?
>
> Unit-like only. Typical case below with avs_condpcm_ops representing
> bunch of stubs with printfs.
>
> static struct snd_soc_condpcm_pred pred1 = {
> .card_name = "ssp0-loopback",
> .link_name = "SSP0-Codec", /* BE */
> .direction = SNDRV_PCM_STREAM_PLAYBACK,
> };
>
> static struct snd_soc_condpcm_pred pred2 = {
> .card_name = "hdaudioB0D2",
> .link_name = "HDMI1", /* FE */
> .direction = SNDRV_PCM_STREAM_PLAYBACK,
> };
It's not intuitive to follow what HDMI and SSP might have to do with
each other, nor why one is a BE and one is an FE?
If I follow the code below, the SSP loopback is a source feeds into an
HDMI sink, and SSP is a BE and HDMI an FE? Confusing example...
> static void avs_condpcms_register(struct avs_dev *adev)
> {
> (...)
> snd_soc_register_condpcm(&pred1, &pred2, &avs_condpcm_ops, adev);
> }
>
> [1]: https://lore.kernel.org/alsa-devel/20211208111301.1817725-21-cezary.rojewsk…
>
> Signed-off-by: Cezary Rojewski <cezary.rojewski(a)intel.com>
> ---
> include/sound/pcm.h | 1 +
> include/sound/soc.h | 65 ++++++++
> sound/core/pcm.c | 1 +
> sound/soc/Makefile | 2 +-
> sound/soc/soc-condpcm.c | 348 ++++++++++++++++++++++++++++++++++++++++
> sound/soc/soc-condpcm.h | 17 ++
> sound/soc/soc-core.c | 2 +
> sound/soc/soc-pcm.c | 11 ++
> 8 files changed, 446 insertions(+), 1 deletion(-)
> create mode 100644 sound/soc/soc-condpcm.c
> create mode 100644 sound/soc/soc-condpcm.h
>
> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> index ac8f3aef9205..7e635b3103a2 100644
> --- a/include/sound/pcm.h
> +++ b/include/sound/pcm.h
> @@ -482,6 +482,7 @@ struct snd_pcm_substream {
> struct list_head link_list; /* linked list member */
> struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
> struct snd_pcm_group *group; /* pointer to current group */
> + struct list_head cpcm_candidate_node;
It wouldn't hurt to describe what 'candidate' might mean here?
> /* -- assigned files -- */
> int ref_count;
> atomic_t mmap_count;
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index e844f6afc5b5..32a6b5092192 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -426,6 +426,7 @@ struct snd_jack;
> struct snd_soc_card;
> struct snd_soc_pcm_stream;
> struct snd_soc_ops;
> +struct snd_soc_condpcm;
> struct snd_soc_pcm_runtime;
> struct snd_soc_dai;
> struct snd_soc_dai_driver;
> @@ -1154,6 +1155,64 @@ struct snd_soc_card {
> #define for_each_card_widgets_safe(card, w, _w) \
> list_for_each_entry_safe(w, _w, &card->widgets, list)
>
> +/* Conditional PCM operations called by soc-pcm.c. */
> +struct snd_soc_condpcm_ops {
> + int (*match)(struct snd_soc_condpcm *, struct snd_pcm_substream *,
> + struct snd_pcm_substream *);
> + int (*hw_params)(struct snd_soc_condpcm *, struct snd_pcm_hw_params *);
> + int (*hw_free)(struct snd_soc_condpcm *);
> + int (*prepare)(struct snd_soc_condpcm *, struct snd_pcm_substream *);
> + int (*trigger)(struct snd_soc_condpcm *, struct snd_pcm_substream *, int);
> +};
> +
> +/**
> + * struct snd_soc_condpcm_pred - Predicate, describes source or sink (substream)
> + * dependency for given conditional PCM.
> + *
> + * @card_name: Name of card owning substream to find.
> + * @link_name: Name of DAI LINK owning substream to find.
> + * @direction: Whether its SNDRV_PCM_STREAM_PLAYBACK or CAPTURE.
> + */
> +struct snd_soc_condpcm_pred {
> + const char *card_name;
Please tell me the runtimes and links are in the same card...
If not, there's all kinds of power management and probe/remove issues...
> + const char *link_name;
dai link name?
> + int direction;
> +};
> +
> +/**
> + * struct snd_soc_condpcm - Conditional PCM descriptor.
> + *
> + * @ops: custom PCM operations.
> + * @preds: predicates for identifying source and sink for given conditional PCM.
predicate is a verb and a noun, not clear what you are trying to document.
> + *
> + * @source: substreaming acting as a data source, assigned at runtime.
> + * @sink: substreaming acting as a data sink, assigned at runtime.
> + * @state: current runtime state.
presumably this state is already defined that the state of sink/source?
> + *
> + * @source_node: list navigation for rtd->source_list.
> + * @sink_node: list navigation for rtd->sink_list.
> + * @node: list navigation for condpcm_list (soc-condpcm.c).
> + */
> +struct snd_soc_condpcm {
> + const struct snd_soc_condpcm_ops *ops;
> + struct snd_soc_condpcm_pred preds[2];
> +
> + struct snd_pcm_substream *source;
> + struct snd_pcm_substream *sink;
> + snd_pcm_state_t state;
> + void *private_data;
> +
> + /* Condpcms navigation for the pcm runtime. */
> + struct list_head source_node;
> + struct list_head sink_node;
> + struct list_head node;
> +};
> +
> +int snd_soc_unregister_condpcm(struct snd_soc_condpcm *cpcm);
> +struct snd_soc_condpcm *snd_soc_register_condpcm(struct snd_soc_condpcm_pred *source,
> + struct snd_soc_condpcm_pred *sink,
> + const struct snd_soc_condpcm_ops *ops,
> + void *private_data);
>
> static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
> {
> @@ -1161,6 +1220,10 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
> }
>
> /* SoC machine DAI configuration, glues a codec and cpu DAI together */
> +/*
> + * @source_cpcm_list: List of condpcms this pcm is source for.
> + * @sink_cpcm_list: List of condpcms this pcm is sink for.
> + */
> struct snd_soc_pcm_runtime {
> struct device *dev;
> struct snd_soc_card *card;
> @@ -1172,6 +1235,8 @@ struct snd_soc_pcm_runtime {
> /* Dynamic PCM BE runtime data */
> struct snd_soc_dpcm_runtime dpcm[SNDRV_PCM_STREAM_LAST + 1];
> struct snd_soc_dapm_widget *c2c_widget[SNDRV_PCM_STREAM_LAST + 1];
> + struct list_head cpcm_source_list;
> + struct list_head cpcm_sink_list;
>
> long pmdown_time;
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index dc37f3508dc7..12243cecaa11 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -663,6 +663,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
> substream->pstr = pstr;
> substream->number = idx;
> substream->stream = stream;
> + INIT_LIST_HEAD(&substream->cpcm_candidate_node);
> sprintf(substream->name, "subdevice #%i", idx);
> substream->buffer_bytes_max = UINT_MAX;
> if (prev == NULL)
> diff --git a/sound/soc/Makefile b/sound/soc/Makefile
> index 775bb38c2ed4..8004de7c500c 100644
> --- a/sound/soc/Makefile
> +++ b/sound/soc/Makefile
> @@ -1,6 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0
> snd-soc-core-y := soc-core.o soc-dapm.o soc-jack.o soc-utils.o soc-dai.o soc-component.o
> -snd-soc-core-y += soc-pcm.o soc-devres.o soc-ops.o soc-link.o soc-card.o
> +snd-soc-core-y += soc-pcm.o soc-devres.o soc-ops.o soc-link.o soc-card.o soc-condpcm.o
> snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
>
> ifneq ($(CONFIG_SND_SOC_TOPOLOGY),)
> diff --git a/sound/soc/soc-condpcm.c b/sound/soc/soc-condpcm.c
> new file mode 100644
> index 000000000000..786b3fafd714
> --- /dev/null
> +++ b/sound/soc/soc-condpcm.c
> @@ -0,0 +1,348 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +//
> +// Conditional-PCM management
> +//
> +// Copyright(c) 2024 Intel Corporation
> +//
> +// Author: Cezary Rojewski <cezary.rojewski(a)intel.com>
> +//
> +
> +#include <linux/export.h>
> +#include <linux/list.h>
> +#include <linux/slab.h>
> +#include <sound/pcm.h>
> +#include <sound/soc.h>
> +#include "soc-condpcm.h"
> +
> +/*
> + * condpcm_list - Stores all registered conditional pcms.
> + * condpcm_candidate_list - Stores all substreams that passed hw_params() step.
> + */
> +static LIST_HEAD(condpcm_list);
> +static LIST_HEAD(condpcm_candidate_list);
> +
> +static bool dpcm_prepare_done(const struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> + enum snd_soc_dpcm_state state = rtd->dpcm[substream->stream].state;
> +
> + return state == SND_SOC_DPCM_STATE_PREPARE ||
> + state == SND_SOC_DPCM_STATE_START ||
> + state == SND_SOC_DPCM_STATE_PAUSED;
> +}
> +
> +static bool dpcm_hw_params_done(const struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> + enum snd_soc_dpcm_state state = rtd->dpcm[substream->stream].state;
> +
> + return state >= SND_SOC_DPCM_STATE_HW_PARAMS &&
> + state < SND_SOC_DPCM_STATE_HW_FREE;
> +}
> +
> +static bool dpcm_start_done(const struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> + enum snd_soc_dpcm_state state = rtd->dpcm[substream->stream].state;
> +
> + return state == SND_SOC_DPCM_STATE_START ||
> + state == SND_SOC_DPCM_STATE_PAUSED;
> +}
> +
> +static int soc_condpcm_hw_params(struct snd_soc_condpcm *cpcm,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(cpcm->source);
> + struct snd_soc_pcm_runtime *rtd2 = snd_soc_substream_to_rtd(cpcm->sink);
how are the 'params' defined?
I read above
"
a condpcm is a runtime entity that's audio format independent - since
certain FE/BEs are its dependencies already, that's no need to do
format ruling twice.
"
That doesn't tell us how this 'params' is determined. This is important
for cases where the speaker output is e.g. 2ch 48kHz and the mic input
is 4ch 96kHz. If this condpcm is not managed by any usersapce action,
then what is the logic for selecting the settings in 'params'?
> + int ret;
> +
> + ret = cpcm->ops->hw_params(cpcm, params);
> + if (ret)
> + return ret;
> +
> + list_add_tail(&cpcm->source_node, &rtd->cpcm_source_list);
> + list_add_tail(&cpcm->sink_node, &rtd2->cpcm_sink_list);
> + cpcm->state = SNDRV_PCM_STATE_SETUP;
> + return 0;
> +}
There's also the well-known problem that hw_params can be called
multiple times. Here this wouldn't work with the same source/sink added
multiple times in a list.
> +
> +static void soc_condpcm_hw_free(struct snd_soc_condpcm *cpcm)
> +{
> + cpcm->ops->hw_free(cpcm);
> + list_del(&cpcm->source_node);
> + list_del(&cpcm->sink_node);
> + cpcm->state = SNDRV_PCM_STATE_DISCONNECTED;
> +}
> +
> +static void soc_condpcm_prepare(struct snd_soc_condpcm *cpcm,
> + struct snd_pcm_substream *substream)
> +{
> + int ret;
> +
> + ret = cpcm->ops->prepare(cpcm, substream);
> + if (!ret)
> + cpcm->state = SNDRV_PCM_STATE_PREPARED;
> +}
you probably need to look at the xruns and resume cases, where prepare()
is used for vastly different purposes.
> +
> +static void soc_condpcm_start(struct snd_soc_condpcm *cpcm,
> + struct snd_pcm_substream *substream, int cmd)
> +{
> + int ret;
> +
> + ret = cpcm->ops->trigger(cpcm, substream, cmd);
> + if (ret)
> + cpcm->state = SNDRV_PCM_STATE_SETUP;
> + else
> + cpcm->state = SNDRV_PCM_STATE_RUNNING;
> +}
> +
> +static void soc_condpcm_stop(struct snd_soc_condpcm *cpcm,
> + struct snd_pcm_substream *substream, int cmd)
> +{
> + int ret;
> +
> + ret = cpcm->ops->trigger(cpcm, substream, cmd);
> + if (ret || cmd != SNDRV_PCM_TRIGGER_PAUSE_PUSH)
> + cpcm->state = SNDRV_PCM_STATE_SETUP;
> + else
> + cpcm->state = SNDRV_PCM_STATE_PREPARED;
> +}
> +
> +void snd_soc_condpcms_prepare(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_condpcm *cpcm;
> +
> + /* Prepare conditional pcms only if source and sink are both preprared. */
> + list_for_each_entry(cpcm, &rtd->cpcm_source_list, source_node) {
> + if (cpcm->state == SNDRV_PCM_STATE_SETUP &&
> + dpcm_prepare_done(cpcm->sink))
> + soc_condpcm_prepare(cpcm, substream);
> + }
> +
> + list_for_each_entry(cpcm, &rtd->cpcm_sink_list, sink_node) {
> + if (cpcm->state == SNDRV_PCM_STATE_SETUP &&
> + dpcm_prepare_done(cpcm->source))
> + soc_condpcm_prepare(cpcm, substream);
> + }
> +}
> +
> +static void soc_condpcms_start(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream, int cmd)
> +{
> + struct snd_soc_condpcm *cpcm;
> +
> + /* Start conditional pcms only if source and sink are both running. */
> + list_for_each_entry(cpcm, &rtd->cpcm_source_list, source_node) {
> + if (cpcm->state == SNDRV_PCM_STATE_PREPARED &&
> + dpcm_start_done(cpcm->sink))
> + soc_condpcm_start(cpcm, substream, cmd);
> + }
> +
> + list_for_each_entry(cpcm, &rtd->cpcm_sink_list, sink_node) {
> + if (cpcm->state == SNDRV_PCM_STATE_PREPARED &&
> + dpcm_start_done(cpcm->source))
> + soc_condpcm_start(cpcm, substream, cmd);
> + }
> +}
> +
> +static void soc_condpcms_stop(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream, int cmd)
> +{
> + struct snd_soc_condpcm *cpcm;
> +
> + /* Stop conditional pcms if either source or sink is not running. */
> + list_for_each_entry(cpcm, &rtd->cpcm_source_list, source_node)
> + if (cpcm->state == SNDRV_PCM_STATE_RUNNING)
> + soc_condpcm_stop(cpcm, substream, cmd);
> +
> + list_for_each_entry(cpcm, &rtd->cpcm_sink_list, sink_node)
> + if (cpcm->state == SNDRV_PCM_STATE_RUNNING)
> + soc_condpcm_stop(cpcm, substream, cmd);
> +}
> +
> +void snd_soc_condpcms_trigger(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream, int cmd)
> +{
> + switch (cmd) {
> + case SNDRV_PCM_TRIGGER_START:
> + case SNDRV_PCM_TRIGGER_RESUME:
> + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> + soc_condpcms_start(rtd, substream, cmd);
> + break;
> + case SNDRV_PCM_TRIGGER_STOP:
> + case SNDRV_PCM_TRIGGER_SUSPEND:
> + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> + soc_condpcms_stop(rtd, substream, cmd);
> + break;
> + }
> +}
> +
> +void snd_soc_condpcms_teardown(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_condpcm *cpcm, *save;
> +
> + list_del(&substream->cpcm_candidate_node);
> +
> + /* Free all condpcms this substream spawned. */
> + list_for_each_entry_safe(cpcm, save, &rtd->cpcm_source_list, source_node)
> + soc_condpcm_hw_free(cpcm);
> + list_for_each_entry_safe(cpcm, save, &rtd->cpcm_sink_list, sink_node)
> + soc_condpcm_hw_free(cpcm);
> +}
> +
> +static bool soc_condpcm_test(struct snd_soc_condpcm *cpcm,
> + struct snd_pcm_substream *substream, int dir)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> + struct snd_soc_condpcm_pred *pred = &cpcm->preds[dir];
> +
> + return pred->direction == substream->stream &&
> + !strcmp(pred->card_name, rtd->card->name) &&
> + !strcmp(pred->link_name, rtd->dai_link->name);
> +}
> +
> +static struct snd_pcm_substream *
> +soc_condpcm_find_match(struct snd_soc_condpcm *cpcm, struct snd_pcm_substream *ignore, int dir)
> +{
> + struct snd_pcm_substream *substream;
> +
> + list_for_each_entry(substream, &condpcm_candidate_list, cpcm_candidate_node) {
> + if (substream == ignore)
> + continue;
> +
> + /* Only substreams that passed hw_params() are valid candidates. */
> + if (!dpcm_hw_params_done(substream))
> + continue;
> +
> + if (soc_condpcm_test(cpcm, substream, dir))
> + return substream;
> + }
> +
> + return NULL;
> +}
> +
> +static int soc_condpcm_walk(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params, int dir)
> +{
> + /* Temporary source/sink cache. */
> + struct snd_pcm_substream *substreams[2];
> + struct snd_soc_condpcm *cpcm;
> + int ret;
> +
> + substreams[dir] = substream;
> +
> + list_for_each_entry(cpcm, &condpcm_list, node) {
> + if (cpcm->state != SNDRV_PCM_STATE_DISCONNECTED)
> + continue;
> +
> + /* Does this cpcm match @substream? */
> + if (!soc_condpcm_test(cpcm, substream, dir))
> + continue;
> +
> + /* Find pair for the @substream. */
> + substreams[!dir] = soc_condpcm_find_match(cpcm, substream, !dir);
> + if (!substreams[!dir])
> + continue;
> +
> + /* Allow driver to have the final word. */
> + ret = cpcm->ops->match(cpcm, substreams[0], substreams[1]);
> + if (ret)
> + continue;
> + cpcm->source = substreams[0];
> + cpcm->sink = substreams[1];
> +
> + ret = soc_condpcm_hw_params(cpcm, params);
> + if (ret) {
> + cpcm->source = NULL;
> + cpcm->sink = NULL;
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +
> +/* Called by soc-pcm.c after each successful hw_params(). */
> +int snd_soc_condpcms_walk_all(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{
> + int ret;
> +
> + list_add_tail(&substream->cpcm_candidate_node, &condpcm_candidate_list);
> +
> + /* Spawn all condpcms this substream is the missing source of. */
> + ret = soc_condpcm_walk(rtd, substream, params, SNDRV_PCM_STREAM_CAPTURE);
> + if (ret)
> + return ret;
> +
> + /* Spawn all condpcms this substream is the missing sink of. */
> + return soc_condpcm_walk(rtd, substream, params, SNDRV_PCM_STREAM_PLAYBACK);
> +}
Are loops supported?
Is the order between capture and playback intentional?
Is the notion of playback/capture even relevant when trying to add
loopbacks?
Lots of questions...
4
7

17 Sep '24
Hi ALSA-ML
Cc Staging-ML, USB-ML
Many drivers are using below code to know the Sound direction.
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
This patch-set add snd_pcm_is_playback/capture() macro to handle it.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
4
119
This patch set includes two updates for the Atmel SSC DAI driver:
- Address the limitation with the S24_LE format.
- Add stream names for DPCM and future use-cases.
Codrin Ciubotariu (2):
ASoC: atmel: atmel_ssc_dai: Add stream names
ASoC: atmel: atmel_ssc_dai: Drop S24_LE support due to single channel
limitation
sound/soc/atmel/atmel_ssc_dai.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
base-commit: 5acd9952f95fb4b7da6d09a3be39195a80845eb6
--
2.34.1
2
6

[PATCH stable-6.10 regression] Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
by Peter Ujfalusi 16 Sep '24
by Peter Ujfalusi 16 Sep '24
16 Sep '24
The prop->src_dpn_prop and prop.sink_dpn_prop is allocated for the _number_
of ports and it is forced as 0 index based.
The original code was correct while the change to walk the bits and use
their position as index into the arrays is not correct.
For exmple we can have the prop.source_ports=0x2, which means we have one
port, but the prop.src_dpn_prop[1] is accessing outside of the allocated
memory.
This reverts commit 6fa78e9c41471fe43052cd6feba6eae1b0277ae3.
Cc: stable(a)vger.kernel.org # 6.10.y
Signed-off-by: Peter Ujfalusi <peter.ujfalusi(a)linux.intel.com>
---
Hi,
The reverted patch causes major regression on soundwire causing all audio
to fail.
Interestingly the patch is only in 6.10.8 and 6.10.9, not in mainline or linux-next.
soundwire sdw-master-0-1: Program transport params failed: -22
soundwire sdw-master-0-1: Program params failed: -22
SDW1-Playback: ASoC: error at snd_soc_link_prepare on SDW1-Playback: -22
Regards,
Peter
drivers/soundwire/stream.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 00191b1d2260..4e9e7d2a942d 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1286,18 +1286,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
unsigned int port_num)
{
struct sdw_dpn_prop *dpn_prop;
- unsigned long mask;
+ u8 num_ports;
int i;
if (direction == SDW_DATA_DIR_TX) {
- mask = slave->prop.source_ports;
+ num_ports = hweight32(slave->prop.source_ports);
dpn_prop = slave->prop.src_dpn_prop;
} else {
- mask = slave->prop.sink_ports;
+ num_ports = hweight32(slave->prop.sink_ports);
dpn_prop = slave->prop.sink_dpn_prop;
}
- for_each_set_bit(i, &mask, 32) {
+ for (i = 0; i < num_ports; i++) {
if (dpn_prop[i].num == port_num)
return &dpn_prop[i];
}
--
2.46.0
4
8
The following changes since commit 839a4ec06f75cec8fec2cc5fc14e921d0c3f7369:
ASoC: Intel: soc-acpi-cht: Make Lenovo Yoga Tab 3 X90F DMI match less strict (2024-08-23 11:02:53 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/asoc-v6.12
for you to fetch changes up to 2772ee6de6cf94e5f2a0c0ce6067d0796a4170ba:
ASoC: topology: Fix redundant logical jump (2024-09-13 19:40:38 +0100)
----------------------------------------------------------------
ASoC: Updates for v6.12
This is a very large set of changes, almost all in drivers rather than
the core. Even with the addition of several quite large drivers the
overall diffstat is negative thanks to the removal of some old Intel
board support which has been obsoleted by the AVS driver, helped a bit
by some factoring out into helpers (especially around the Soundwire
machine drivers for x86).
Highlights include:
- More simplifications and cleanups throughout the subsystem from
Morimoto-san.
- Extensive cleanups and refactoring of the Soundwire drivers to make
better use of helpers.
- Removal of Intel machine support obsoleted by the AVS driver.
- Lots of DT schema conversions.
- Machine support for many AMD and Intel x86 platforms.
- Support for AMD ACP 7.1, Mediatek MT6367 and MT8365, Realtek RTL1320
SoundWire and rev C, and Texas Instruments TAS2563
----------------------------------------------------------------
Alexandre Mergnat (11):
ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document
ASoC: dt-bindings: mediatek,mt8365-mt6357: Add audio sound card document
dt-bindings: mfd: mediatek: Add codec property for MT6357 PMIC
ASoC: mediatek: mt8365: Add common header
ASoC: mediatek: mt8365: Add audio clock control support
ASoC: mediatek: mt8365: Add I2S DAI support
ASoC: mediatek: mt8365: Add ADDA DAI support
ASoC: mediatek: mt8365: Add DMIC DAI support
ASoC: mediatek: mt8365: Add PCM DAI support
ASoC: mediatek: mt8365: Add the AFE driver support
ASoC: mediatek: Add MT8365 support
Andrei Simion (1):
ASoC: dt-bindings: microchip,sama7g5-spdifrx: Add common DAI reference
Andrew Kreimer (1):
ASoC: tlv320aic31xx: Fix typos
Animesh Agarwal (2):
ASoC: dt-bindings: ti,pcm512x: Convert to dtschema
ASoC: dt-bindings: fsl,imx-audio-es8328: Convert to dtschema
Arnd Bergmann (2):
ASoC: mediatek: mt8365: include linux/bitfield.h
ASoC: mediatek: mt8365: remove unused mt8365_i2s_hd_str
Balamurugan C (4):
ASoC: Intel: soc-acpi: Add entry for sof_es8336 in ARL match table.
ASoC: Intel: soc-acpi: Add entry for HDMI_In capture support in ARL match table
ASoC: Intel: sof_rt5682: Add HDMI-In capture with rt5682 support for ARL.
ASoC: Intel: ARL: Add entry for HDMI-In capture support to non-I2S codec boards.
Baojun Xu (1):
ASoC: tas2781: Remove unnecessary line feed for tasdevice_codec_remove
Bard Liao (6):
ASoC: Intel: soc-acpi-intel-ptl-match: add rt711-sdca table
ASoC: Intel: soc-acpi-intel-ptl-match: Add rt722 support
ASoC: Intel: sof_sdw: add rt1320 amp support
ASoC: SOF: Intel: hda: refactoring topology name fixup for HDA mach
ASoC: Intel: sof_sdw: move ignore_internal_dmic check earlier
ASoC: Intel: sof_sdw: overwrite mach_params->dmic_num
Biju Das (2):
ASoC: dt-bindings: renesas,rz-ssi: Document port property
ASoC: sh: rz-ssi: Add full duplex support
Binbin Zhou (7):
ASoC: loongson: Use BIT() macro
ASoC: loongson: Simplify probe() with local dev variable
ASoC: loongson: Simplify with dev_err_probe()
ASoC: loongson: Simplify if statment in loongson_card_hw_params()
ASoC: loongson: Replace if with ternary operator
ASoC: loongson: Factor out loongson_card_acpi_find_device() function
ASoC: loongson: Factor out loongson i2s enable clock functions
Brent Lu (10):
ASoC: SOF: Intel: hda: refactoring topology name fixup for SDW mach
ASoC: SOF: Intel: hda: support BT link mask in mach_params
ASoC: Intel: skl_hda_dsp_generic: support BT audio offload
ASoC: Intel: skl_hda_dsp_generic: remove hdac-hdmi support
ASoC: Intel: skl_hda_dsp_generic: use sof_hdmi_private to init HDMI
ASoC: Intel: board_helpers: support HDA link initialization
ASoC: Intel: skl_hda_dsp_generic: use common module for DAI links
ASoC: Intel: ehl_rt5660: do not check common_hdmi_codec_drv
ASoC: Intel: sof_pcm512x: do not check common_hdmi_codec_drv
ASoC: SOF: Intel: hda: remove common_hdmi_codec_drv
Cezary Rojewski (14):
ALSA: hda: Move SST device entries to AVS
ASoC: Intel: Drop skl_machine_pdata usage
ASoC: Intel: Remove bxt_rt298 board driver
ASoC: Intel: Remove bxt_da7219_max98357a board driver
ASoC: Intel: Remove kbl_rt5663_rt5514_max98927 board driver
ASoC: Intel: Remove kbl_rt5663_max98927 board driver
ASoC: Intel: Remove kbl_rt5660 board driver
ASoC: Intel: Remove kbl_da7219_max98927 board driver
ASoC: Intel: Remove kbl_da7219_max98357a board driver
ASoC: Intel: Remove skl_rt286 board driver
ASoC: Intel: Remove skl_nau88l25_ssm4567 board driver
ASoC: Intel: Remove skl_nau88l25_max98357a board driver
ASoC: Intel: Remove skylake driver
ASoC: Intel: avs: Enable by default for all SST configurations
Charles Keepax (3):
ASoC: Intel: soc-acpi: arl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: adl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: lnl: Add match entries for new cs42l43 laptops
Chen Ni (4):
ASoC: mediatek: mt8192: remove redundant null pointer check before of_node_put
ASoC: cs42l42: Convert comma to semicolon
ASoC: topology-test: Convert comma to semicolon
ASoC: Intel: skl_hda_dsp_generic: convert comma to semicolon
Christophe JAILLET (4):
ASoC: sti-sas: Constify snd_soc_component_driver struct
ASoC: cs43130: Constify snd_soc_component_driver struct
ASoC: cs43130: Constify struct reg_sequence and reg_sequences
ASoC: rt1318: Constify struct reg_sequence
Codrin Ciubotariu (5):
ASoC: atmel: mchp-i2s-mcc: Improve maxburst calculation for better performance
ASoC: atmel: mchp-i2s-mcc: Remove interface name from stream_name
ASoC: atmel: mchp-pdmc: Improve maxburst calculation for better performance
ASoC: atmel: mchp-pdmc: Add snd_soc_dai_driver name
ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls
Colin Ian King (1):
ASoC: codecs: wcd934x: make read-only array minCode_param static const
Dmitry Torokhov (1):
ASoC: tas5086: use sleeping variants of gpiod API
Fabio Estevam (7):
ASoC: fsl_audmix: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_mqs: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_rpmsg: Switch to RUNTIME_PM_OPS()
ASoC: fsl_spdif: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_ssi: Switch to SYSTEM_SLEEP_PM_OPS
ASoC: imx-audmux: Switch to SYSTEM_SLEEP_PM_OPS
ASoC: imx-pcm-rpmsg: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
Frank Li (2):
ASoC: dt-bindings: convert tlv320aic31xx.txt to yaml
ASoC: dt-bindings: Convert tpa6130a2.txt to yaml
Fred Oh (1):
ASoC: SOF: Intel: add PTL specific power control register
Geert Uytterhoeven (1):
ASoC: dt-bindings: dlg,da7213: Convert to json-schema
Gustavo A. R. Silva (1):
ASoC: SOF: sof-audio: Avoid -Wflex-array-member-not-at-end warnings
Heiko Stuebner (2):
ASoC: dt-bindings: realtek,rt5616: document mclk clock
ASoC: dt-bindings: realtek,rt5616: Document audio graph port
Hongbo Li (2):
ASoC: dapm: Use IS_ERR_OR_NULL() helper function
ASoC: adi: Use str_enabled_disabled() helper
Jens Reidel (1):
ASoC: qcom: sm8250: enable primary mi2s
Jerome Brunet (1):
ASoC: amlogic: do not use dpcm_playback/capture flags
Krzysztof Kozlowski (16):
ASoC: codecs: wsa881x: Drop unused version readout
ASoC: codecs: wsa883x: Handle reading version failure
ASoC: codecs: wsa883x: Simplify handling variant/version
ASoC: codecs: wsa884x: Simplify handling variant
ASoC: dt-bindings: qcom,apq8016-sbc-sndcard: move to separate binding
ASoC: codecs: lpass-wsa-macro: Do not hard-code dai in VI mixer
ASoC: codecs: wsa881x: Use designator array initializers for Soundwire ports
ASoC: codecs: wsa883x: Use designator array initializers for Soundwire ports
ASoC: codecs: wsa884x: Use designator array initializers for Soundwire ports
ASoC: codecs: wcd938x: Drop unused defines and enums
ASoC: codecs: wcd937x: Move max port number defines to enum
ASoC: codecs: wcd938x: Move max port number defines to enum
ASoC: codecs: wcd939x: Move max port number defines to enum
ASoC: dt-bindings: samsung,odroid: drop stale clocks
ASoC: MAINTAINERS: Drop incorrect tlv320aic31xx.txt path
ASoC: codecs: wsa884x: Implement temperature reading and hwmon
Kuninori Morimoto (19):
ASoC: rsnd: remove rsnd_mod_confirm_ssi() under DEBUG
ASoC: rsnd: use pcm_dmaengine code
ASoC: stm: use snd_pcm_direction_name()
ASoC: sof: pcm: use snd_pcm_direction_name()
ASoC: sof: intel: use snd_pcm_direction_name()
ASoC: fsl: lpc3xxx-i2s: use snd_pcm_direction_name()
ASoC: tegra: use snd_pcm_direction_name()
ASoC: soc-pcm: use snd_pcm_direction_name()
ASoC: soc-dapm: use snd_pcm_direction_name()
ASoC: remove bespoke trigger support
ASoC: soc-pcm: remove snd_soc_dpcm_stream_{lock/unlock}_irq()
ASoC: soc-pcm: remove snd_soc_dpcm_stream_lock_irqsave_nested()
ASoC: soc-pcm: Indicate warning if dpcm_playback/capture were used for availability limition
ASoC: remove snd_soc_dai_link_set_capabilities()
ASoC: Intel: sof_sdw: use playback/capture_only flags
ASoC: soc-pcm: move snd_soc_dpcm_can_be_xxx() to top
ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local function
ASoC: makes rtd->initialized bit field
ASoC: dt-bindings: renesas,rsnd: add post-init-providers property
Linus Walleij (3):
ASoC: tas2781-i2c: Drop weird GPIO code
ASoC: tas2781-i2c: Get the right GPIO line
ASoC: tas*: Drop unused GPIO includes
Liu Jing (1):
ASoC: mediatek: mt2701-cs42448: Optimize redundant code in mt2701_cs42448_machine_probe
Luca Ceresoli (3):
ASoC: dapm-graph: remove the "ROOT" cluster
ASoC: dapm-graph: visualize component On/Off bias level
ASoC: dapm-graph: show path name for non-static routes
Lukasz Majewski (1):
ASoC: dt-bindings: Convert mxs-saif.txt to fsl,saif.yaml (imx28 saif)
Ma Ke (2):
ASoC: rt5682s: Return devm_of_clk_add_hw_provider to transfer the error
ASoC: rt5682: Return devm_of_clk_add_hw_provider to transfer the error
Maciej Strozek (1):
ASoC: Intel: sof_sdw: Add quirks from some new Dell laptops
Marek Vasut (1):
ASoC: tlv320aic32x4: Add multi endpoint support
Mark Brown (37):
Add HDMI Audio support
ASoC: codecs: wsa88xx: Few cleanups
ASoC: codecs: wsa88xx and wcd93xx: Soundwire port
AMD SOF based generic SoundWire machine driver
ALSA/ASoC: use snd_pcm_direction_name()
ASoC: SOF: reshuffle and optimize structures
ASoC/SOF/PCI/Intel: add PantherLake support
ASoC: Merge fixes
ASoC: tas*: Fix up GPIO usage
ASoC: Intel: Remove skylake driver
ALSA/ASoC/SoundWire: Intel: update maximum number
ASoC: Merge up fixes
ASoC: grace time for DPCM cleanup
ASoC: Merge up fixes
ASoC: dapm-graph: add component on/off and route names
Add SOF support for ACP7.0 based platform
ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local
ASoC: Intel: boards: updates for 6.12
ASoC: dt-bindings: amlogic-sound-cards: document
Add audio support for the MediaTek Genio 350-evk
Fixes for the audio setup on the rk3588-nanopc-t6
Add i2s/tdm support for acp7.0 and acp7.1 platforms
Some clean up with helper fucntion
Add audio support for the MediaTek Genio 350-evk
ASoC: mt8365: Open code BIT() to avoid spurious warnings
ASoC: mt8365: Remove spurious unsigned long casts
ASoC: mt8365: Remove unused prototype for mt8365_afe_clk_group_48k()
ASoC: mt8365: Make non-exported functions static
ASoC: mt8365: Remove unused variables
ASoC: mt8365: Remove unused DMIC IIR coefficient configuration
ASoC: mt8365: Allow build coverage
ASoC: loongson: Simplify code formatting
ASoC: mt8365: Fix -Werror builds
Add support for primary mi2s on SM8250
ASoC: Improvements for mchp-pdmc
ASoC: Intel: boards: updates for 6.12 - part 2
AMD SoundWire machine driver code refactor
Muhammad Usama Anjum (3):
ASoC: amd: acp: Return in-case of error
ASoC: mediatek: mt8365: check validity before usage of i2s_data
ASoc: mediatek: mt8365: Remove unneeded assignment
Neil Armstrong (2):
ASoC: dt-bindings: amlogic,axg-sound-card: document clocks property
ASoC: dt-bindings: amlogic,gx-sound-card: document clocks property
Nicolas Belin (2):
ASoc: mediatek: mt8365: Add a specific soundcard for EVK
ASoC: codecs: add MT6357 support
Nikita Shubin (1):
ASoC: dt-bindings: cirrus,cs4271: Convert to dtschema
Pierre-Louis Bossart (11):
ASoC: Intel: soc-acpi: add PTL match tables
ASoC: SOF: Intel: add initial support for PTL
ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params
ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox
ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg
ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list
ALSA/ASoC/SoundWire: Intel: use single definition for SDW_INTEL_MAX_LINKS
soundwire: intel: add probe-time check on link id
soundwire: intel: increase maximum number of links
ASoC: Intel: sof_sdw: make sof_sdw_quirk static
ASoC: Intel: boards: always check the result of acpi_dev_get_first_match_dev()
Richard Fitzgerald (2):
ASoC: cs35l56: Make struct regmap_config const
ASoC: cs-amp-lib: Add KUnit test case for empty calibration entries
Rob Herring (Arm) (2):
ASoC: Use of_property_present()
ASoC: Use of_property_read_bool()
Romain Gantois (1):
ASoC: tlv320aic31xx: Add support for loading filter coefficients
Shen Lichuan (1):
ASoC: SOF: topology: Use kmemdup_array instead of kmemdup for multiple allocation
Shenghao Ding (7):
ASoC: tas2781: Add TAS2563 into the Header
ASoC: tas2781: Fix a compiling warning reported by robot kernel test due to adding tas2563_dvc_table
ASoc: tas2781: Rename dai_driver name to unify the name between TAS2563 and TAS2781
ASoc: tas2781: Remove unnecessary line feed and space
ASoC: tas2781: mark const variables tas2563_dvc_table as __maybe_unused
ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup
ASoC: tas2781: Add Calibration Kcontrols for Chromebook
Shuming Fan (1):
ASoC: rt1320: Add support for version C
Simon Trimmer (1):
ASoC: cs35l56: Use regmap_read_bypassed() to wake the device
Srinivas Kandagatla (1):
ASoC: dt-bindings: qcom,lpass-wsa-macro: correct clocks on SM8250
Takashi Iwai (1):
ASoC: Use __counted_by() annotation for snd_soc_pcm_runtime
Tang Bin (6):
ASoC: loongson: remove redundant variable assignments
ASoC: codecs: fix the right check and simplify code
ASoC: soc-ac97: Fix the incorrect description
ASoC: loongson: Add the correct judgement return
ASoC: mediatek: mt7986-afe-pcm: Remove redundant error message
ASoC: topology: Fix redundant logical jump
Uwe Kleine-König (1):
ASoC: Switch back to struct platform_driver::remove()
Venkata Prasad Potturu (12):
ASoC: amd: acp: Refactor TDM slots selction based on acp revision id
ASoC: amd: acp: Refactor I2S dai driver
ASoC: amd: acp: Update pcm hardware capabilities for acp6.3 platform
ASoC: amd: acp: Add I2S TDM support for acp6.3 platform
ASoC: amd: acp: Update pcm hardware capabilities for acp7.0 platform
ASoC: amd: acp: Add I2S master clock generation support for acp7.0 platform
ASoC: amd: acp: Set i2s clock for acp7.0 platform
ASoC: amd: acp: Modify max channels and sample rate support for acp70 dai driver
ASoC: amd: acp: Add I2S TDM support for acp7.0 platform
ASoC: amd: acp: Add pte configuration for ACP7.0 platform
ASoC: amd: acp: Add i2s master clock generation support for acp7.1 platform
ASoC: amd: acp: Add I2S TDM support for acp7.1 platform
Vijendar Mukunda (47):
ASoC: intel: rename codec_info and dai_info structures names
ASoC: intel: rename soundwire common header macros
ASoC: intel: rename soundwire machine driver soc ops
ASoC: intel: rename soundwire codec helper functions
ASoC: intel: rename maxim codec macros
ASoC: intel: rename ignore_pch_dmic variable name
ASoC: intel/sdw-utils: move soundwire machine driver soc ops
ASoC: intel: move soundwire machine driver common structures
ASoC: intel/sdw_utils: move soundwire machine driver helper functions
ASoC: intel/sdw_utils: move dmic codec helper function
ASoC: intel/sdw_utils: move rtk dmic helper functions
ASoC: intel/sdw_utils: move rt712 sdca helper functions
ASoC: intel/sdw_utils: move rt722 sdca helper functions
ASoC: intel: split soundwire machine driver private data
ASoC: intel/sdw_utils: move rt5682 codec helper function
ASoC: intel/sdw_utils: move rtk jack common helper functions
ASoC: intel/sdw_utils: move rt700 and rt711 codec helper functions
ASoC: intel/sdw_utils: move rtk amp codec helper functions
ASoC: intel/sdw_utils: move cirrus soundwire codec helper functions
ASoC: intel/sdw_utils: move maxim codec helper functions
ASoC: intel/sdw_utils: move dai id common macros
ASoC: intel/sdw_utils: move soundwire dai type macros
ASoC: intel/sdw_utils: move soundwire codec_info_list structure
ASoC: intel/sdw_utils: move machine driver dai link helper functions
ASoC: sdw_utils: refactor sof_sdw_card_late_probe function
ASoC: intel/sdw_utils: refactor init_dai_link() and init_simple_dai_link()
ASoC: soc-acpi: add pci revision id field in mach params structure
ASoC: amd: acp: add soundwire machines for acp6.3 based platform
ASoC: SOF: amd: add alternate machines for acp6.3 based platform
ASoC: SOF: amd: update mach params subsystem_rev variable
ASoC: amd/sdw_utils: add sof based soundwire generic machine driver
ASoC: amd: acp: remove MODULE_ALIAS for SoundWire machine driver
ASoC: amd: acp: add ZSC control register programming sequence
ASoC: SOF: amd: update conditional check for cache register update
ASoC: amd: acp: Convert comma to semicolon
ASoC: amd: acp: add legacy driver support for ACP7.1 based platforms
ASoC: amd: acp: replace desc->rev check with acp pci revision id
ASoC: SOF: amd: remove unused variable from sof_amd_acp_desc structure
ASoC: amd: Add acpi machine id for acp7.0 version based platform
ASoC: SOF: amd: add support for acp7.0 based platform
ASoC: amd: acp: remove MODULE_ALIAS for legacy machine driver
ASoC: amd: acp: remove MODULE_ALIAS for sof based generic machine driver
ASoC: intel: sof_sdw: rename soundwire endpoint and dailink structures
ASoC: intel: sof_sdw: rename soundwire parsing helper functions
ASoC: sdw_util/intel: move soundwire endpoint and dai link structures
ASoC: sdw_utils/intel: move soundwire endpoint parsing helper functions
ASoC: amd: acp: refactor SoundWire machine driver code
Wu Bo (1):
ASoC: dwc: change to use devm_clk_get_enabled() helpers
Yue Haibing (2):
ASoC: fsl: lpc3xxx-i2s: Remove set but not used variable 'savedbitclkrate'
ASoC: fsl: lpc3xxx: Make some symbols static
Zhang Yi (2):
ASoC: codecs: ES8326: suspend issue
ASoC: codecs: ES8326: input issue after init
Zhang Zekun (3):
ASoC: audio-graph-card: Use for_each_child_of_node_scoped() to simplify code
ASoC: audio-graph-card2: Use helper function of_get_child_count()
ASoC: meson: Remove unused declartion in header file
tangbin (3):
ASoC: loongson: Remove useless variable definitions
ASoC: loongson: remove unnecessary assignment in i2s_resume()
ASoC: loongson: fix error release
ying zuxin (1):
ASoC: codecs: Use devm_clk_get_enabled() helpers
.mailmap | 1 +
.../testing/sysfs-bus-i2c-devices-turris-omnia-mcu | 6 +-
Documentation/admin-guide/cifs/usage.rst | 2 +-
Documentation/admin-guide/kernel-parameters.txt | 4 +-
Documentation/arch/arm64/silicon-errata.rst | 18 +
.../devicetree/bindings/ata/rockchip,dwc-ahci.yaml | 3 +
.../bindings/display/panel/samsung,atna33xc20.yaml | 9 +-
.../devicetree/bindings/mfd/mediatek,mt6357.yaml | 21 +
.../bindings/sound/amlogic,axg-sound-card.yaml | 7 +
.../bindings/sound/amlogic,gx-sound-card.yaml | 7 +
.../devicetree/bindings/sound/cirrus,cs4271.yaml | 101 +
Documentation/devicetree/bindings/sound/cs4271.txt | 57 -
Documentation/devicetree/bindings/sound/da7213.txt | 45 -
.../devicetree/bindings/sound/dlg,da7213.yaml | 103 +
.../bindings/sound/fsl,imx-audio-es8328.yaml | 111 +
.../devicetree/bindings/sound/fsl,saif.yaml | 83 +
.../devicetree/bindings/sound/imx-audio-es8328.txt | 60 -
.../bindings/sound/mediatek,mt8365-afe.yaml | 130 +
.../bindings/sound/mediatek,mt8365-mt6357.yaml | 107 +
.../bindings/sound/microchip,sama7g5-spdifrx.yaml | 5 +-
.../devicetree/bindings/sound/mxs-saif.txt | 41 -
.../devicetree/bindings/sound/pcm512x.txt | 53 -
.../bindings/sound/qcom,apq8016-sbc-sndcard.yaml | 205 ++
.../bindings/sound/qcom,lpass-wsa-macro.yaml | 22 +-
.../devicetree/bindings/sound/qcom,sm8250.yaml | 137 -
.../devicetree/bindings/sound/realtek,rt5616.yaml | 12 +
.../devicetree/bindings/sound/renesas,rsnd.yaml | 6 +
.../devicetree/bindings/sound/renesas,rz-ssi.yaml | 4 +
.../devicetree/bindings/sound/samsung,odroid.yaml | 5 -
.../devicetree/bindings/sound/ti,pcm512x.yaml | 101 +
.../bindings/sound/ti,tlv320dac3100.yaml | 127 +
.../devicetree/bindings/sound/ti,tpa6130a2.yaml | 55 +
.../devicetree/bindings/sound/tlv320aic31xx.txt | 77 -
.../devicetree/bindings/sound/tpa6130a2.txt | 27 -
.../devicetree/bindings/usb/microchip,usb2514.yaml | 1 +
Documentation/driver-api/thermal/sysfs-api.rst | 65 +-
Documentation/netlink/specs/ethtool.yaml | 2 +-
Documentation/networking/ethtool-netlink.rst | 1 +
.../process/embargoed-hardware-issues.rst | 153 +-
.../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 4 +-
Documentation/virt/kvm/api.rst | 8 +-
Documentation/wmi/devices/msi-wmi-platform.rst | 6 +-
MAINTAINERS | 13 +-
Makefile | 2 +-
arch/alpha/include/asm/io.h | 4 +-
arch/arm/Kconfig | 4 +-
arch/arm/boot/compressed/Makefile | 1 +
arch/arm/boot/compressed/vmlinux.lds.S | 2 +-
arch/arm/boot/dts/arm/versatile-ab.dts | 2 +-
arch/arm/include/asm/stacktrace.h | 7 +
arch/arm/include/asm/vmlinux.lds.h | 2 +-
arch/arm/kernel/entry-armv.S | 3 +
arch/arm/kernel/entry-common.S | 3 +
arch/arm/kernel/module.c | 5 -
arch/arm/kernel/perf_callchain.c | 3 +-
arch/arm/kernel/vmlinux-xip.lds.S | 4 +-
arch/arm/kernel/vmlinux.lds.S | 6 +-
arch/arm/mach-alpine/alpine_cpu_pm.c | 2 +-
arch/arm/mach-pxa/gumstix.c | 11 +-
arch/arm/mm/proc.c | 20 +-
arch/arm64/Kconfig | 22 +-
arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi | 22 -
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 6 -
.../boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi | 2 +
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 3 +-
arch/arm64/boot/dts/ti/k3-j722s-main.dtsi | 3 +-
arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 25 +-
arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi | 4 +-
arch/arm64/include/asm/cputype.h | 4 +
arch/arm64/include/asm/jump_label.h | 1 +
arch/arm64/kernel/Makefile.syscalls | 2 +-
arch/arm64/kernel/cpu_errata.c | 11 +-
arch/arm64/kernel/jump_label.c | 11 +-
arch/loongarch/include/asm/hugetlb.h | 4 +-
arch/loongarch/include/asm/kfence.h | 6 +-
arch/loongarch/include/asm/kvm_host.h | 2 -
arch/loongarch/include/asm/kvm_para.h | 4 +-
arch/loongarch/include/asm/pgtable.h | 48 +-
arch/loongarch/kernel/Makefile.syscalls | 3 +-
arch/loongarch/kernel/efi.c | 6 +
arch/loongarch/kvm/mmu.c | 8 +-
arch/loongarch/mm/hugetlbpage.c | 6 +-
arch/loongarch/mm/init.c | 10 +-
arch/loongarch/mm/kasan_init.c | 10 +-
arch/loongarch/mm/pgtable.c | 2 +-
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/cache.h | 11 +-
arch/parisc/net/bpf_jit_core.c | 2 +-
arch/riscv/kernel/Makefile.syscalls | 2 +-
arch/riscv/kernel/cpufeature.c | 14 +-
arch/riscv/kernel/sbi-ipi.c | 2 +-
arch/riscv/mm/fault.c | 17 +-
arch/riscv/mm/init.c | 15 +-
arch/riscv/purgatory/entry.S | 2 +
arch/s390/kernel/alternative.h | 0
arch/s390/kernel/fpu.c | 2 +-
arch/s390/kernel/vmlinux.lds.S | 17 +-
arch/s390/mm/dump_pagetables.c | 140 +-
arch/s390/mm/init.c | 9 +-
arch/s390/mm/vmem.c | 13 +-
arch/um/drivers/mconsole_user.c | 2 +
arch/x86/coco/sev/core.c | 2 +-
arch/x86/entry/syscalls/syscall_64.tbl | 2 +-
arch/x86/events/core.c | 22 +-
arch/x86/events/intel/cstate.c | 5 +-
arch/x86/include/asm/cmdline.h | 4 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/asm/qspinlock.h | 12 +-
arch/x86/kernel/acpi/madt_wakeup.c | 2 +-
arch/x86/kernel/cpu/amd.c | 2 +-
arch/x86/kernel/cpu/aperfmperf.c | 6 +-
arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
arch/x86/kernel/paravirt.c | 7 +-
arch/x86/kernel/setup.c | 2 +-
arch/x86/kvm/Kconfig | 4 +-
arch/x86/kvm/lapic.c | 2 +-
arch/x86/kvm/mmu/mmu.c | 7 +-
arch/x86/kvm/svm/sev.c | 17 +-
arch/x86/kvm/svm/svm.c | 1 +
arch/x86/kvm/x86.c | 12 +-
arch/x86/lib/cmdline.c | 25 +-
arch/x86/lib/getuser.S | 4 +-
arch/x86/mm/pti.c | 51 +-
block/blk-throttle.c | 11 -
drivers/android/binder.c | 15 +-
drivers/android/binder_alloc.c | 2 +-
drivers/android/dbitmap.h | 22 +-
drivers/base/core.c | 13 +-
drivers/base/module.c | 4 +
drivers/bluetooth/Kconfig | 2 +
drivers/bluetooth/btintel.c | 3 +
drivers/bluetooth/btmtk.c | 5 +-
drivers/bluetooth/hci_qca.c | 19 +-
drivers/cache/Kconfig | 1 +
drivers/char/ds1620.c | 1 +
drivers/char/nwbutton.c | 1 +
drivers/char/nwflash.c | 1 +
drivers/cpufreq/intel_pstate.c | 1 +
drivers/edac/skx_common.h | 1 -
drivers/firmware/efi/libstub/Makefile | 7 +-
drivers/fsi/fsi-core.c | 1 +
drivers/fsi/fsi-master-aspeed.c | 1 +
drivers/fsi/fsi-master-ast-cf.c | 3 +-
drivers/fsi/fsi-master-gpio.c | 1 +
drivers/fsi/fsi-master-hub.c | 1 +
drivers/fsi/fsi-scom.c | 1 +
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 +
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 3 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 36 +-
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 27 +
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 18 +
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 8 +-
drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c | 3 +-
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 7 +-
.../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c | 3 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +
.../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 2 +
.../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 2 +
.../display/dc/resource/dcn401/dcn401_resource.c | 1 +
.../display/dc/resource/dcn401/dcn401_resource.h | 4 +-
.../gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c | 2 +
drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 +
drivers/gpu/drm/amd/include/mes_v12_api_def.h | 3 +
drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 3 +-
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppevvmath.h | 14 +-
.../gpu/drm/amd/pm/swsmu/inc/smu_v14_0_2_pptable.h | 52 +-
.../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 86 +-
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
drivers/gpu/drm/ast/ast_dp.c | 7 +
drivers/gpu/drm/ast/ast_drv.c | 5 +
drivers/gpu/drm/ast/ast_drv.h | 1 +
drivers/gpu/drm/ast/ast_mode.c | 29 +-
drivers/gpu/drm/drm_atomic_uapi.c | 14 +-
drivers/gpu/drm/drm_bridge_connector.c | 8 +-
drivers/gpu/drm/drm_buddy.c | 25 +-
drivers/gpu/drm/drm_client.c | 2 +-
drivers/gpu/drm/drm_client_modeset.c | 5 +
drivers/gpu/drm/drm_fb_helper.c | 11 +
drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 +
drivers/gpu/drm/i915/display/intel_backlight.c | 3 +
drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 6 +-
drivers/gpu/drm/i915/display/intel_hdcp_regs.h | 2 +-
drivers/gpu/drm/i915/display/intel_pps.c | 3 +
drivers/gpu/drm/i915/gem/i915_gem_mman.c | 55 +-
drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 13 +-
drivers/gpu/drm/i915/i915_perf.c | 33 -
drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_fence.c | 30 +-
drivers/gpu/drm/nouveau/nouveau_fence.h | 2 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_prime.c | 3 +-
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 1 +
drivers/gpu/drm/omapdrm/Kconfig | 1 +
drivers/gpu/drm/radeon/evergreen_cs.c | 2 +
drivers/gpu/drm/tests/drm_gem_shmem_test.c | 11 +
drivers/gpu/drm/v3d/v3d_drv.h | 4 +
drivers/gpu/drm/v3d/v3d_sched.c | 44 +-
drivers/gpu/drm/v3d/v3d_submit.c | 121 +-
drivers/gpu/drm/virtio/virtgpu_submit.c | 2 +-
drivers/gpu/drm/vmwgfx/vmw_surface_cache.h | 10 +-
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 127 +-
drivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 15 +-
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 40 +-
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 17 +-
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 62 +-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 502 ++-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 17 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 14 +-
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_prime.c | 32 +-
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 27 +-
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 33 +-
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 174 +-
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 280 +-
drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 40 +-
drivers/gpu/drm/xe/xe_hwmon.c | 3 +-
drivers/gpu/drm/xe/xe_lrc.c | 15 +-
drivers/gpu/drm/xe/xe_rtp.c | 2 +-
drivers/gpu/drm/xe/xe_sync.c | 2 +-
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 2 +-
drivers/hid/amd-sfh-hid/amd_sfh_client.c | 18 +-
drivers/hid/bpf/Kconfig | 2 +-
drivers/hid/bpf/hid_bpf_struct_ops.c | 5 +
drivers/hid/wacom_wac.c | 67 +-
drivers/hwmon/adt7475.c | 24 +-
drivers/i2c/busses/i2c-qcom-geni.c | 5 +-
drivers/i2c/i2c-slave-testunit.c | 4 +-
drivers/i2c/i2c-smbus.c | 64 +-
drivers/input/input-mt.c | 3 +
drivers/input/touchscreen/cyttsp4_core.c | 2 +-
drivers/irqchip/irq-loongarch-cpu.c | 6 +-
drivers/irqchip/irq-mbigen.c | 20 +-
drivers/irqchip/irq-meson-gpio.c | 14 +-
drivers/irqchip/irq-pic32-evic.c | 6 +-
drivers/irqchip/irq-riscv-aplic-msi.c | 32 +-
drivers/irqchip/irq-sun6i-r.c | 2 +-
drivers/irqchip/irq-xilinx-intc.c | 2 +-
drivers/media/dvb-frontends/stv0367_priv.h | 3 +
drivers/media/pci/intel/ipu6/Kconfig | 3 +-
drivers/media/usb/uvc/uvc_ctrl.c | 8 +-
drivers/misc/Kconfig | 2 +-
drivers/misc/eeprom/ee1004.c | 85 +-
drivers/net/can/usb/etas_es58x/es58x_devlink.c | 2 +-
drivers/net/dsa/bcm_sf2.c | 4 +-
drivers/net/dsa/microchip/ksz_common.c | 16 +
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 16 +-
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 14 +-
drivers/net/ethernet/freescale/fec_ptp.c | 3 +
drivers/net/ethernet/google/gve/gve_ethtool.c | 2 +-
drivers/net/ethernet/google/gve/gve_main.c | 12 +-
drivers/net/ethernet/intel/ice/ice.h | 11 +-
drivers/net/ethernet/intel/ice/ice_base.c | 4 +-
drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 +-
drivers/net/ethernet/intel/ice/ice_main.c | 4 +-
drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +
drivers/net/ethernet/intel/ice/ice_txrx.c | 10 +-
drivers/net/ethernet/intel/ice/ice_xsk.c | 184 +-
drivers/net/ethernet/intel/ice/ice_xsk.h | 14 +-
drivers/net/ethernet/intel/idpf/idpf_lib.c | 48 +-
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 43 +-
drivers/net/ethernet/intel/igc/igc_main.c | 33 +-
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +-
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 1 +
.../mellanox/mlx5/core/en_accel/ipsec_offload.c | 7 +-
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 7 +-
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 5 +-
.../net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +-
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +-
.../ethernet/mellanox/mlx5/core/sf/dev/driver.c | 1 +
.../ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
drivers/net/ethernet/meta/Kconfig | 2 +-
drivers/net/ethernet/realtek/r8169_main.c | 8 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 -
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
drivers/net/fjes/fjes_main.c | 4 +-
drivers/net/phy/aquantia/aquantia_main.c | 29 +-
drivers/net/phy/micrel.c | 34 +-
drivers/net/phy/realtek.c | 7 +
drivers/net/pse-pd/tps23881.c | 5 +-
drivers/net/usb/qmi_wwan.c | 2 +
drivers/net/usb/sr9700.c | 11 +-
drivers/net/virtio_net.c | 14 +-
drivers/net/wan/fsl_qmc_hdlc.c | 31 +-
drivers/net/wireless/ath/ath12k/pci.c | 3 +-
drivers/net/wireless/ath/ath12k/wow.c | 8 +-
drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 +
drivers/nfc/pn544/i2c.c | 2 -
drivers/nvme/host/core.c | 18 +-
drivers/nvme/host/nvme.h | 13 +-
drivers/pci/hotplug/pciehp_hpc.c | 4 +-
drivers/pci/pci.c | 15 +-
drivers/perf/riscv_pmu_sbi.c | 2 +-
drivers/platform/chrome/cros_ec_proto.c | 2 +
drivers/platform/cznic/Kconfig | 80 +-
drivers/platform/cznic/Makefile | 8 +-
drivers/platform/cznic/turris-omnia-mcu-base.c | 4 +
drivers/platform/cznic/turris-omnia-mcu.h | 42 +-
drivers/platform/x86/amd/pmc/pmc.c | 2 +
drivers/platform/x86/amd/pmc/pmc.h | 1 +
drivers/platform/x86/amd/pmf/core.c | 3 +
drivers/platform/x86/amd/pmf/pmf-quirks.c | 9 +-
drivers/platform/x86/intel/ifs/runtest.c | 2 +-
drivers/platform/x86/intel/vbtn.c | 9 +
drivers/platform/x86/sony-laptop.c | 1 -
drivers/power/supply/axp288_charger.c | 22 +-
drivers/power/supply/qcom_battmgr.c | 12 +-
drivers/power/supply/rt5033_battery.c | 1 +
drivers/s390/cio/ccwgroup.c | 1 +
drivers/s390/cio/vfio_ccw_drv.c | 1 +
drivers/scsi/isci/init.c | 6 +-
drivers/scsi/mpi3mr/mpi3mr_os.c | 11 +
drivers/scsi/mpt3sas/mpt3sas_base.c | 20 +-
drivers/scsi/sd.c | 20 +-
drivers/scsi/sr_ioctl.c | 2 +-
drivers/soundwire/intel.h | 7 +
drivers/soundwire/intel_ace2x.c | 20 +
drivers/soundwire/intel_auxdevice.c | 14 +
drivers/spi/spi-fsl-lpspi.c | 6 +-
drivers/spi/spi-hisi-kunpeng.c | 4 +
drivers/spi/spidev.c | 1 +
drivers/spmi/spmi-pmic-arb.c | 11 +-
.../pci/hive_isp_css_include/math_support.h | 5 -
.../int340x_thermal/processor_thermal_device_pci.c | 29 +-
drivers/thermal/thermal_trip.c | 4 +-
drivers/tty/serial/sc16is7xx.c | 25 +-
drivers/tty/serial/serial_core.c | 8 +
drivers/tty/vt/conmakehash.c | 20 +-
drivers/ufs/core/ufshcd-priv.h | 5 +
drivers/ufs/core/ufshcd.c | 38 +-
drivers/ufs/host/ufs-exynos.c | 3 +
drivers/usb/gadget/function/f_fs.c | 32 +-
drivers/usb/gadget/function/f_midi2.c | 21 +-
drivers/usb/gadget/function/u_audio.c | 42 +-
drivers/usb/gadget/function/u_serial.c | 1 +
drivers/usb/gadget/udc/core.c | 10 +-
drivers/usb/serial/ch341.c | 1 +
drivers/usb/serial/garmin_gps.c | 5 +-
drivers/usb/serial/mxuport.c | 1 +
drivers/usb/serial/navman.c | 1 +
drivers/usb/serial/qcaux.c | 1 +
drivers/usb/serial/spcp8x5.c | 10 -
drivers/usb/serial/symbolserial.c | 1 +
drivers/usb/serial/usb-serial-simple.c | 1 +
drivers/usb/serial/usb_debug.c | 8 +
drivers/usb/typec/mux/fsa4480.c | 14 +
drivers/usb/typec/tcpm/tcpci.c | 2 +-
drivers/usb/typec/tcpm/tcpm.c | 2 +-
drivers/usb/typec/tipd/core.c | 4 +-
drivers/usb/typec/ucsi/ucsi.c | 11 +-
drivers/usb/usbip/vhci_hcd.c | 9 +-
drivers/vdpa/octeon_ep/octep_vdpa_hw.c | 2 +-
drivers/vhost/vdpa.c | 8 +-
drivers/virtio/virtio.c | 28 +-
drivers/virtio/virtio_pci_common.c | 190 +-
drivers/virtio/virtio_pci_common.h | 16 +-
drivers/virtio/virtio_pci_modern.c | 159 +-
fs/bcachefs/acl.c | 11 +-
fs/bcachefs/acl.h | 2 +-
fs/bcachefs/alloc_background.h | 12 +-
fs/bcachefs/alloc_foreground.c | 34 +-
fs/bcachefs/alloc_foreground.h | 9 +-
fs/bcachefs/bcachefs.h | 2 +
fs/bcachefs/bcachefs_format.h | 5 +-
fs/bcachefs/btree_iter.c | 5 +
fs/bcachefs/btree_update_interior.c | 2 +-
fs/bcachefs/buckets.c | 12 +-
fs/bcachefs/buckets.h | 2 +-
fs/bcachefs/disk_accounting.c | 65 +-
fs/bcachefs/disk_accounting_format.h | 15 +-
fs/bcachefs/ec.c | 34 +-
fs/bcachefs/fs.c | 8 +-
fs/bcachefs/io_misc.c | 6 +-
fs/bcachefs/io_read.c | 1 +
fs/bcachefs/io_write.c | 5 +-
fs/bcachefs/opts.h | 5 +
fs/bcachefs/replicas.c | 1 -
fs/bcachefs/sb-downgrade.c | 27 +-
fs/bcachefs/sb-errors_format.h | 6 +-
fs/bcachefs/super-io.c | 4 +
fs/bcachefs/super.c | 1 -
fs/bcachefs/sysfs.c | 6 +-
fs/btrfs/block-group.c | 13 +-
fs/btrfs/ctree.h | 1 +
fs/btrfs/direct-io.c | 38 +-
fs/btrfs/extent-tree.c | 3 +-
fs/btrfs/extent_map.c | 2 +-
fs/btrfs/file.c | 22 +-
fs/btrfs/free-space-cache.c | 4 +-
fs/btrfs/inode.c | 28 +-
fs/btrfs/print-tree.c | 2 +-
fs/btrfs/scrub.c | 25 +-
fs/btrfs/space-info.c | 5 +-
fs/btrfs/space-info.h | 1 +
fs/btrfs/super.c | 5 +-
fs/btrfs/tests/extent-map-tests.c | 99 +
fs/btrfs/tree-checker.c | 49 +-
fs/ceph/caps.c | 35 +-
fs/ceph/super.h | 7 +-
fs/file.c | 1 +
fs/nfsd/nfsctl.c | 3 +-
fs/smb/client/cifs_debug.c | 2 +-
fs/smb/client/cifsfs.h | 4 +-
fs/smb/client/cifsglob.h | 36 +-
fs/smb/client/cifsproto.h | 2 -
fs/smb/client/inode.c | 17 +-
fs/smb/client/ioctl.c | 32 +-
fs/smb/client/misc.c | 65 +-
fs/smb/client/reparse.c | 4 +
fs/smb/client/reparse.h | 19 +-
fs/smb/client/smb2inode.c | 8 +-
fs/smb/client/smb2pdu.c | 3 +
fs/smb/client/smbdirect.c | 8 +-
fs/smb/client/trace.h | 51 +-
fs/smb/client/transport.c | 2 +-
fs/tracefs/event_inode.c | 4 +-
fs/tracefs/inode.c | 12 +-
fs/tracefs/internal.h | 5 +-
fs/xfs/libxfs/xfs_quota_defs.h | 2 +-
fs/xfs/libxfs/xfs_trans_resv.c | 28 +-
fs/xfs/scrub/agheader_repair.c | 2 +-
fs/xfs/scrub/parent.c | 2 +-
fs/xfs/scrub/trace.h | 10 +-
fs/xfs/xfs_attr_list.c | 2 +-
fs/xfs/xfs_trace.h | 10 +-
fs/xfs/xfs_xattr.c | 19 +-
include/asm-generic/vmlinux.lds.h | 11 +-
include/drm/drm_buddy.h | 2 +
include/linux/compiler.h | 9 +
include/linux/cpuhotplug.h | 2 +-
include/linux/cpumask.h | 2 +-
include/linux/ethtool.h | 10 +-
include/linux/i2c.h | 2 +-
include/linux/kvm_host.h | 9 +-
include/linux/minmax.h | 115 +-
include/linux/profile.h | 1 -
include/linux/ring_buffer.h | 1 -
include/linux/soundwire/sdw_intel.h | 8 +
include/linux/trace_events.h | 3 +-
include/linux/virtio.h | 3 +
include/linux/virtio_config.h | 4 -
include/linux/virtio_net.h | 16 +-
include/sound/cs35l56.h | 6 +-
include/sound/soc-acpi-intel-match.h | 2 +
include/sound/soc-acpi.h | 6 +-
include/sound/soc-dai.h | 6 +-
include/sound/soc-dpcm.h | 19 -
include/sound/soc.h | 7 +-
include/sound/soc_sdw_utils.h | 247 ++
include/sound/tas2563-tlv.h | 279 ++
include/sound/tas2781-tlv.h | 260 --
include/sound/tas2781.h | 71 +-
include/sound/ump_convert.h | 1 +
include/trace/events/btrfs.h | 8 +
include/trace/events/mptcp.h | 2 +-
include/uapi/asm-generic/unistd.h | 5 +-
include/ufs/ufshcd.h | 1 +
include/ufs/ufshci.h | 1 +
init/Kconfig | 1 +
io_uring/napi.c | 2 -
io_uring/net.c | 7 +-
io_uring/poll.c | 1 +
kernel/dma/debug.c | 5 +-
kernel/irq/irqdesc.c | 1 +
kernel/jump_label.c | 4 +-
kernel/kcov.c | 15 +-
kernel/kprobes.c | 4 +-
kernel/ksysfs.c | 7 +
kernel/locking/lockdep.c | 6 +
kernel/locking/qspinlock_paravirt.h | 2 +-
kernel/module/main.c | 41 +-
kernel/padata.c | 7 +
kernel/profile.c | 242 +-
kernel/sched/core.c | 68 +-
kernel/sched/cputime.c | 6 +
kernel/sched/stats.c | 10 -
kernel/task_work.c | 6 +
kernel/time/clocksource.c | 2 +-
kernel/time/ntp.c | 9 +-
kernel/time/tick-broadcast.c | 3 +-
kernel/time/timekeeping.c | 2 +-
kernel/trace/fgraph.c | 2 +-
kernel/trace/preemptirq_delay_test.c | 2 -
kernel/trace/ring_buffer.c | 12 -
kernel/trace/trace.h | 23 +
kernel/trace/trace_events.c | 41 +-
kernel/trace/trace_events_hist.c | 4 +-
kernel/trace/trace_events_inject.c | 2 +-
kernel/trace/trace_events_trigger.c | 6 +-
kernel/trace/tracing_map.c | 6 +-
lib/btree.c | 1 -
lib/decompress_unlzma.c | 2 +
lib/vsprintf.c | 2 +-
mm/list_lru.c | 28 +-
mm/memcontrol.c | 22 +-
mm/shmem.c | 14 +-
mm/slub.c | 3 +
mm/zsmalloc.c | 2 -
net/bluetooth/hci_core.c | 7 -
net/bluetooth/hci_event.c | 5 +-
net/bluetooth/hci_sync.c | 35 +
net/bluetooth/l2cap_core.c | 1 +
net/bridge/br_multicast.c | 4 +-
net/core/dev.c | 1 +
net/core/link_watch.c | 4 +-
net/core/rtnetlink.c | 2 +-
net/ethtool/ioctl.c | 61 +-
net/ethtool/rss.c | 8 +-
net/ipv4/netfilter/iptable_nat.c | 18 +-
net/ipv4/tcp_ao.c | 43 +-
net/ipv4/tcp_input.c | 23 +-
net/ipv4/tcp_offload.c | 3 +
net/ipv4/udp_offload.c | 4 +
net/ipv6/ndisc.c | 34 +-
net/ipv6/netfilter/ip6table_nat.c | 14 +-
net/iucv/af_iucv.c | 4 +-
net/l2tp/l2tp_core.c | 15 +-
net/mac80211/cfg.c | 7 +-
net/mac80211/tx.c | 5 +-
net/mac80211/util.c | 2 +-
net/mptcp/mib.c | 2 +
net/mptcp/mib.h | 2 +
net/mptcp/options.c | 5 +-
net/mptcp/pm.c | 12 +
net/mptcp/pm_netlink.c | 93 +-
net/mptcp/pm_userspace.c | 18 +
net/mptcp/protocol.c | 18 +-
net/mptcp/protocol.h | 4 +
net/mptcp/subflow.c | 26 +-
net/sched/act_ct.c | 4 +-
net/sctp/input.c | 19 +-
net/smc/af_smc.c | 7 +-
net/smc/smc_stats.h | 2 +-
net/sunrpc/svc.c | 2 +-
net/wireless/scan.c | 11 +-
net/wireless/sme.c | 1 +
rust/kernel/firmware.rs | 2 +-
scripts/syscall.tbl | 6 +-
sound/core/seq/seq_ports.h | 14 +-
sound/core/seq/seq_ump_convert.c | 132 +-
sound/core/ump_convert.c | 60 +-
sound/firewire/amdtp-stream.c | 38 +-
sound/firewire/amdtp-stream.h | 1 +
sound/hda/intel-dsp-config.c | 57 +-
sound/hda/intel-sdw-acpi.c | 5 +-
sound/pci/hda/cs35l41_hda.c | 13 -
sound/pci/hda/cs35l56_hda.c | 38 +-
sound/pci/hda/cs35l56_hda.h | 1 -
sound/pci/hda/hda_controller.h | 2 +-
sound/pci/hda/hda_generic.c | 63 +
sound/pci/hda/hda_generic.h | 1 +
sound/pci/hda/hda_intel.c | 10 +-
sound/pci/hda/patch_conexant.c | 56 +-
sound/pci/hda/patch_hdmi.c | 2 +
sound/pci/hda/patch_realtek.c | 2 +
sound/pci/hda/tas2781_hda_i2c.c | 2 +-
sound/soc/Kconfig | 2 +
sound/soc/Makefile | 1 +
sound/soc/adi/axi-i2s.c | 6 +-
sound/soc/adi/axi-spdif.c | 2 +-
sound/soc/amd/acp-config.c | 12 +
sound/soc/amd/acp-pcm-dma.c | 2 +-
sound/soc/amd/acp/Kconfig | 22 +
sound/soc/amd/acp/Makefile | 4 +
sound/soc/amd/acp/acp-i2s.c | 188 +-
sound/soc/amd/acp/acp-legacy-common.c | 40 +-
sound/soc/amd/acp/acp-legacy-mach.c | 7 -
sound/soc/amd/acp/acp-mach-common.c | 2 +-
sound/soc/amd/acp/acp-mach.h | 1 +
sound/soc/amd/acp/acp-pci.c | 4 +
sound/soc/amd/acp/acp-pdm.c | 7 +-
sound/soc/amd/acp/acp-platform.c | 117 +-
sound/soc/amd/acp/acp-rembrandt.c | 2 +-
sound/soc/amd/acp/acp-renoir.c | 2 +-
sound/soc/amd/acp/acp-sdw-sof-mach.c | 509 +++
sound/soc/amd/acp/acp-sof-mach.c | 7 -
sound/soc/amd/acp/acp63.c | 2 +-
sound/soc/amd/acp/acp70.c | 87 +-
sound/soc/amd/acp/amd-acp63-acpi-match.c | 90 +
sound/soc/amd/acp/amd.h | 27 +-
sound/soc/amd/acp/chip_offset_byte.h | 84 +-
sound/soc/amd/acp/soc_amd_sdw_common.h | 44 +
sound/soc/amd/mach-config.h | 2 +
sound/soc/amd/ps/ps-pdm-dma.c | 2 +-
sound/soc/amd/ps/ps-sdw-dma.c | 2 +-
sound/soc/amd/raven/acp3x-pcm-dma.c | 2 +-
sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +-
sound/soc/amd/vangogh/acp5x-pcm-dma.c | 2 +-
sound/soc/amd/yc/acp6x-pdm-dma.c | 2 +-
sound/soc/apple/mca.c | 2 +-
sound/soc/atmel/atmel-i2s.c | 2 +-
sound/soc/atmel/atmel_wm8904.c | 2 +-
sound/soc/atmel/mchp-i2s-mcc.c | 44 +-
sound/soc/atmel/mchp-pdmc.c | 99 +-
sound/soc/atmel/mchp-spdifrx.c | 2 +-
sound/soc/atmel/mchp-spdiftx.c | 2 +-
sound/soc/atmel/sam9g20_wm8731.c | 2 +-
sound/soc/atmel/sam9x5_wm8731.c | 2 +-
sound/soc/atmel/tse850-pcm5142.c | 2 +-
sound/soc/au1x/ac97c.c | 2 +-
sound/soc/au1x/i2sc.c | 2 +-
sound/soc/au1x/psc-ac97.c | 2 +-
sound/soc/au1x/psc-i2s.c | 2 +-
sound/soc/bcm/bcm63xx-i2s-whistler.c | 2 +-
sound/soc/bcm/cygnus-ssp.c | 2 +-
sound/soc/cirrus/edb93xx.c | 2 +-
sound/soc/cirrus/ep93xx-i2s.c | 2 +-
sound/soc/codecs/Kconfig | 7 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/ak4613.c | 4 +-
sound/soc/codecs/cs-amp-lib-test.c | 44 +
sound/soc/codecs/cs35l56-shared.c | 25 +-
sound/soc/codecs/cs42l42-sdw.c | 12 +-
sound/soc/codecs/cs42l43.c | 2 +-
sound/soc/codecs/cs43130.c | 113 +-
sound/soc/codecs/cs47l15.c | 2 +-
sound/soc/codecs/cs47l24.c | 2 +-
sound/soc/codecs/cs47l35.c | 2 +-
sound/soc/codecs/cs47l85.c | 2 +-
sound/soc/codecs/cs47l90.c | 2 +-
sound/soc/codecs/cs47l92.c | 2 +-
sound/soc/codecs/es8326.c | 6 +-
sound/soc/codecs/inno_rk3036.c | 2 +-
sound/soc/codecs/lpass-rx-macro.c | 2 +-
sound/soc/codecs/lpass-tx-macro.c | 2 +-
sound/soc/codecs/lpass-va-macro.c | 2 +-
sound/soc/codecs/lpass-wsa-macro.c | 27 +-
sound/soc/codecs/msm8916-wcd-digital.c | 2 +-
sound/soc/codecs/mt6357.c | 1855 ++++++++++
sound/soc/codecs/mt6357.h | 660 ++++
sound/soc/codecs/peb2466.c | 14 +-
sound/soc/codecs/rk817_codec.c | 2 +-
sound/soc/codecs/rt1318.c | 3 +-
sound/soc/codecs/rt1320-sdw.c | 2147 +++++++++++-
sound/soc/codecs/rt1320-sdw.h | 3 +
sound/soc/codecs/rt5682.c | 4 +-
sound/soc/codecs/rt5682s.c | 4 +-
sound/soc/codecs/sti-sas.c | 21 +-
sound/soc/codecs/tas2552.c | 1 -
sound/soc/codecs/tas2764.c | 1 -
sound/soc/codecs/tas2770.c | 1 -
sound/soc/codecs/tas2780.c | 1 -
sound/soc/codecs/tas2781-comlib.c | 35 +-
sound/soc/codecs/tas2781-fmwlib.c | 61 +-
sound/soc/codecs/tas2781-i2c.c | 953 +++++-
sound/soc/codecs/tas5086.c | 9 +-
sound/soc/codecs/tlv320aic31xx.c | 102 +-
sound/soc/codecs/tlv320aic32x4.c | 9 +
sound/soc/codecs/wcd934x.c | 4 +-
sound/soc/codecs/wcd937x.c | 2 +-
sound/soc/codecs/wcd937x.h | 34 +-
sound/soc/codecs/wcd938x.c | 20 +-
sound/soc/codecs/wcd938x.h | 4 +-
sound/soc/codecs/wcd939x.c | 2 +-
sound/soc/codecs/wcd939x.h | 6 +-
sound/soc/codecs/wm5102.c | 2 +-
sound/soc/codecs/wm5110.c | 2 +-
sound/soc/codecs/wm8994.c | 2 +-
sound/soc/codecs/wm8997.c | 2 +-
sound/soc/codecs/wm8998.c | 2 +-
sound/soc/codecs/wsa881x.c | 44 +-
sound/soc/codecs/wsa883x.c | 75 +-
sound/soc/codecs/wsa884x.c | 240 +-
sound/soc/dwc/dwc-i2s.c | 18 +-
sound/soc/fsl/fsl_asrc.c | 2 +-
sound/soc/fsl/fsl_aud2htx.c | 2 +-
sound/soc/fsl/fsl_audmix.c | 14 +-
sound/soc/fsl/fsl_dma.c | 2 +-
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/fsl/fsl_esai.c | 2 +-
sound/soc/fsl/fsl_micfil.c | 2 +-
sound/soc/fsl/fsl_mqs.c | 13 +-
sound/soc/fsl/fsl_rpmsg.c | 11 +-
sound/soc/fsl/fsl_sai.c | 2 +-
sound/soc/fsl/fsl_spdif.c | 13 +-
sound/soc/fsl/fsl_ssi.c | 8 +-
sound/soc/fsl/fsl_xcvr.c | 2 +-
sound/soc/fsl/imx-audmux.c | 8 +-
sound/soc/fsl/imx-card.c | 3 -
sound/soc/fsl/imx-pcm-rpmsg.c | 16 +-
sound/soc/fsl/imx-sgtl5000.c | 2 +-
sound/soc/fsl/lpc3xxx-i2s.c | 11 +-
sound/soc/fsl/lpc3xxx-pcm.c | 2 +-
sound/soc/fsl/mpc5200_psc_ac97.c | 2 +-
sound/soc/fsl/mpc5200_psc_i2s.c | 4 +-
sound/soc/fsl/p1022_ds.c | 2 +-
sound/soc/fsl/p1022_rdk.c | 2 +-
sound/soc/fsl/pcm030-audio-fabric.c | 2 +-
sound/soc/generic/audio-graph-card.c | 16 +-
.../soc/generic/audio-graph-card2-custom-sample.c | 2 +-
sound/soc/generic/audio-graph-card2.c | 15 +-
sound/soc/generic/simple-card.c | 4 +-
sound/soc/generic/test-component.c | 11 +-
sound/soc/img/img-i2s-in.c | 2 +-
sound/soc/img/img-i2s-out.c | 2 +-
sound/soc/img/img-parallel-out.c | 2 +-
sound/soc/img/img-spdif-in.c | 2 +-
sound/soc/img/img-spdif-out.c | 2 +-
sound/soc/img/pistachio-internal-dac.c | 2 +-
sound/soc/intel/Kconfig | 120 -
sound/soc/intel/Makefile | 1 -
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +-
sound/soc/intel/atom/sst/sst_acpi.c | 2 +-
sound/soc/intel/avs/core.c | 8 +-
sound/soc/intel/boards/Kconfig | 156 +-
sound/soc/intel/boards/Makefile | 31 +-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 720 ----
sound/soc/intel/boards/bxt_rt298.c | 670 ----
sound/soc/intel/boards/bytcht_cx2072x.c | 4 +
sound/soc/intel/boards/bytcht_da7213.c | 4 +
sound/soc/intel/boards/bytcht_es8316.c | 4 +-
sound/soc/intel/boards/bytcr_rt5640.c | 4 +-
sound/soc/intel/boards/bytcr_rt5651.c | 4 +-
sound/soc/intel/boards/bytcr_wm5102.c | 2 +-
sound/soc/intel/boards/cht_bsw_max98090_ti.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 4 +
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +
sound/soc/intel/boards/ehl_rt5660.c | 3 +-
sound/soc/intel/boards/kbl_da7219_max98357a.c | 688 ----
sound/soc/intel/boards/kbl_da7219_max98927.c | 1175 -------
sound/soc/intel/boards/kbl_rt5660.c | 567 ---
sound/soc/intel/boards/kbl_rt5663_max98927.c | 1073 ------
.../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 869 -----
sound/soc/intel/boards/skl_hda_dsp_common.c | 168 -
sound/soc/intel/boards/skl_hda_dsp_common.h | 67 -
sound/soc/intel/boards/skl_hda_dsp_generic.c | 242 +-
sound/soc/intel/boards/skl_nau88l25_max98357a.c | 704 ----
sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 751 ----
sound/soc/intel/boards/skl_rt286.c | 568 ---
sound/soc/intel/boards/sof_board_helpers.c | 152 +
sound/soc/intel/boards/sof_board_helpers.h | 3 +
sound/soc/intel/boards/sof_es8336.c | 14 +-
sound/soc/intel/boards/sof_pcm512x.c | 5 +-
sound/soc/intel/boards/sof_rt5682.c | 7 +
sound/soc/intel/boards/sof_sdw.c | 1384 +-------
sound/soc/intel/boards/sof_sdw_common.h | 172 +-
sound/soc/intel/boards/sof_sdw_hdmi.c | 16 +-
sound/soc/intel/boards/sof_ssp_amp.c | 6 +
sound/soc/intel/boards/sof_wm8804.c | 6 +-
sound/soc/intel/catpt/device.c | 2 +-
sound/soc/intel/common/Makefile | 1 +
sound/soc/intel/common/soc-acpi-intel-adl-match.c | 105 +
sound/soc/intel/common/soc-acpi-intel-arl-match.c | 263 ++
sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 6 -
sound/soc/intel/common/soc-acpi-intel-ehl-match.c | 1 -
sound/soc/intel/common/soc-acpi-intel-hda-match.c | 18 +-
sound/soc/intel/common/soc-acpi-intel-icl-match.c | 6 -
sound/soc/intel/common/soc-acpi-intel-kbl-match.c | 11 -
sound/soc/intel/common/soc-acpi-intel-lnl-match.c | 104 +
sound/soc/intel/common/soc-acpi-intel-ptl-match.c | 145 +
sound/soc/intel/common/soc-acpi-intel-skl-match.c | 5 -
sound/soc/intel/skylake/Makefile | 15 -
sound/soc/intel/skylake/bxt-sst.c | 629 ----
sound/soc/intel/skylake/cnl-sst-dsp.c | 266 --
sound/soc/intel/skylake/cnl-sst-dsp.h | 103 -
sound/soc/intel/skylake/cnl-sst.c | 508 ---
sound/soc/intel/skylake/skl-debug.c | 248 --
sound/soc/intel/skylake/skl-i2s.h | 87 -
sound/soc/intel/skylake/skl-messages.c | 1419 --------
sound/soc/intel/skylake/skl-nhlt.c | 269 --
sound/soc/intel/skylake/skl-pcm.c | 1507 --------
sound/soc/intel/skylake/skl-ssp-clk.c | 428 ---
sound/soc/intel/skylake/skl-ssp-clk.h | 108 -
sound/soc/intel/skylake/skl-sst-cldma.c | 373 --
sound/soc/intel/skylake/skl-sst-cldma.h | 243 --
sound/soc/intel/skylake/skl-sst-dsp.c | 462 ---
sound/soc/intel/skylake/skl-sst-dsp.h | 256 --
sound/soc/intel/skylake/skl-sst-ipc.c | 1071 ------
sound/soc/intel/skylake/skl-sst-ipc.h | 169 -
sound/soc/intel/skylake/skl-sst-utils.c | 425 ---
sound/soc/intel/skylake/skl-sst.c | 599 ----
sound/soc/intel/skylake/skl-topology.c | 3605 --------------------
sound/soc/intel/skylake/skl-topology.h | 524 ---
sound/soc/intel/skylake/skl.c | 1177 -------
sound/soc/intel/skylake/skl.h | 207 --
sound/soc/kirkwood/kirkwood-i2s.c | 2 +-
sound/soc/loongson/loongson_card.c | 125 +-
sound/soc/loongson/loongson_dma.c | 25 +-
sound/soc/loongson/loongson_i2s.c | 115 +-
sound/soc/loongson/loongson_i2s.h | 24 +-
sound/soc/loongson/loongson_i2s_pci.c | 51 +-
sound/soc/mediatek/Kconfig | 20 +
sound/soc/mediatek/Makefile | 1 +
sound/soc/mediatek/common/mtk-btcvsd.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-cs42448.c | 16 +-
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 2 +-
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 9 +-
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 2 +-
.../mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 4 +-
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8365/Makefile | 15 +
sound/soc/mediatek/mt8365/mt8365-afe-clk.c | 421 +++
sound/soc/mediatek/mt8365/mt8365-afe-clk.h | 32 +
sound/soc/mediatek/mt8365/mt8365-afe-common.h | 448 +++
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 2274 ++++++++++++
sound/soc/mediatek/mt8365/mt8365-dai-adda.c | 311 ++
sound/soc/mediatek/mt8365/mt8365-dai-dmic.c | 310 ++
sound/soc/mediatek/mt8365/mt8365-dai-i2s.c | 846 +++++
sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 293 ++
sound/soc/mediatek/mt8365/mt8365-mt6357.c | 343 ++
sound/soc/mediatek/mt8365/mt8365-reg.h | 993 ++++++
sound/soc/meson/aiu-fifo.h | 2 -
sound/soc/meson/aiu.c | 2 +-
sound/soc/meson/axg-card.c | 13 +-
sound/soc/meson/gx-card.c | 3 +-
sound/soc/meson/meson-card-utils.c | 4 +-
sound/soc/mxs/mxs-sgtl5000.c | 2 +-
sound/soc/pxa/mmp-sspa.c | 2 +-
sound/soc/pxa/pxa2xx-ac97.c | 2 +-
sound/soc/qcom/common.c | 1 -
sound/soc/qcom/lpass-apq8016.c | 2 +-
sound/soc/qcom/lpass-ipq806x.c | 2 +-
sound/soc/qcom/lpass-sc7180.c | 2 +-
sound/soc/qcom/lpass-sc7280.c | 2 +-
sound/soc/qcom/qdsp6/q6routing.c | 2 +-
sound/soc/qcom/sm8250.c | 8 +
sound/soc/rockchip/rockchip_i2s.c | 2 +-
sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
sound/soc/rockchip/rockchip_pdm.c | 2 +-
sound/soc/rockchip/rockchip_rt5645.c | 2 +-
sound/soc/rockchip/rockchip_spdif.c | 2 +-
sound/soc/samsung/arndale.c | 2 +-
sound/soc/samsung/i2s.c | 2 +-
sound/soc/samsung/odroid.c | 2 +-
sound/soc/samsung/pcm.c | 2 +-
sound/soc/samsung/snow.c | 2 +-
sound/soc/samsung/spdif.c | 2 +-
sound/soc/sdw_utils/Kconfig | 6 +
sound/soc/sdw_utils/Makefile | 11 +
.../soc_sdw_bridge_cs35l56.c} | 56 +-
.../soc_sdw_cs42l42.c} | 13 +-
.../soc_sdw_cs42l43.c} | 38 +-
.../soc_sdw_cs_amp.c} | 18 +-
.../sof_sdw_dmic.c => sdw_utils/soc_sdw_dmic.c} | 10 +-
.../sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} | 56 +-
.../soc_sdw_rt5682.c} | 12 +-
.../sof_sdw_rt700.c => sdw_utils/soc_sdw_rt700.c} | 12 +-
.../sof_sdw_rt711.c => sdw_utils/soc_sdw_rt711.c} | 38 +-
.../soc_sdw_rt712_sdca.c} | 10 +-
.../soc_sdw_rt722_sdca.c} | 10 +-
.../soc_sdw_rt_amp.c} | 43 +-
.../soc_sdw_rt_amp_coeff_tables.h} | 6 +-
.../soc_sdw_rt_dmic.c} | 11 +-
.../soc_sdw_rt_sdca_jack_common.c} | 40 +-
sound/soc/sdw_utils/soc_sdw_utils.c | 1170 +++++++
sound/soc/sh/Kconfig | 1 +
sound/soc/sh/fsi.c | 2 +-
sound/soc/sh/hac.c | 2 +-
sound/soc/sh/rcar/adg.c | 4 +-
sound/soc/sh/rcar/core.c | 19 +-
sound/soc/sh/rcar/dma.c | 75 +-
sound/soc/sh/rcar/rsnd.h | 10 -
sound/soc/sh/rcar/ssi.c | 2 +-
sound/soc/sh/rz-ssi.c | 259 +-
sound/soc/sh/siu_dai.c | 2 +-
sound/soc/soc-ac97.c | 4 +-
sound/soc/soc-core.c | 21 +-
sound/soc/soc-dai.c | 58 -
sound/soc/soc-dapm.c | 5 +-
sound/soc/soc-pcm.c | 362 +-
sound/soc/soc-topology-test.c | 132 +-
sound/soc/soc-topology.c | 9 +-
sound/soc/sof/amd/Kconfig | 11 +
sound/soc/sof/amd/Makefile | 4 +-
sound/soc/sof/amd/acp-common.c | 3 +
sound/soc/sof/amd/acp-dsp-offset.h | 24 +-
sound/soc/sof/amd/acp-loader.c | 2 +-
sound/soc/sof/amd/acp.c | 88 +-
sound/soc/sof/amd/acp.h | 11 +-
sound/soc/sof/amd/acp70.c | 142 +
sound/soc/sof/amd/pci-acp63.c | 2 +-
sound/soc/sof/amd/pci-acp70.c | 112 +
sound/soc/sof/amd/pci-rmb.c | 1 -
sound/soc/sof/amd/pci-rn.c | 1 -
sound/soc/sof/amd/pci-vangogh.c | 1 -
sound/soc/sof/imx/imx8.c | 2 +-
sound/soc/sof/imx/imx8m.c | 2 +-
sound/soc/sof/imx/imx8ulp.c | 2 +-
sound/soc/sof/intel/Kconfig | 17 +
sound/soc/sof/intel/Makefile | 2 +
sound/soc/sof/intel/bdw.c | 2 +-
sound/soc/sof/intel/byt.c | 2 +-
sound/soc/sof/intel/hda-dsp.c | 1 +
sound/soc/sof/intel/hda-stream.c | 4 +-
sound/soc/sof/intel/hda.c | 282 +-
sound/soc/sof/intel/hda.h | 1 +
sound/soc/sof/intel/lnl.c | 27 +
sound/soc/sof/intel/mtl.c | 16 +-
sound/soc/sof/intel/mtl.h | 2 +
sound/soc/sof/intel/pci-ptl.c | 77 +
sound/soc/sof/intel/shim.h | 1 +
sound/soc/sof/mediatek/mt8186/mt8186.c | 2 +-
sound/soc/sof/mediatek/mt8195/mt8195.c | 2 +-
sound/soc/sof/pcm.c | 2 +-
sound/soc/sof/sof-audio.h | 8 +-
sound/soc/sof/sof-priv.h | 16 +-
sound/soc/sof/topology.c | 8 +-
sound/soc/sprd/sprd-mcdt.c | 2 +-
sound/soc/starfive/jh7110_pwmdac.c | 2 +-
sound/soc/starfive/jh7110_tdm.c | 2 +-
sound/soc/stm/stm32_adfsdm.c | 2 +-
sound/soc/stm/stm32_i2s.c | 6 +-
sound/soc/stm/stm32_sai_sub.c | 2 +-
sound/soc/stm/stm32_spdifrx.c | 2 +-
sound/soc/sunxi/sun4i-codec.c | 2 +-
sound/soc/sunxi/sun4i-i2s.c | 2 +-
sound/soc/sunxi/sun4i-spdif.c | 2 +-
sound/soc/sunxi/sun50i-dmic.c | 2 +-
sound/soc/sunxi/sun8i-codec.c | 2 +-
sound/soc/tegra/tegra186_asrc.c | 2 +-
sound/soc/tegra/tegra186_dspk.c | 2 +-
sound/soc/tegra/tegra20_ac97.c | 2 +-
sound/soc/tegra/tegra20_i2s.c | 2 +-
sound/soc/tegra/tegra210_admaif.c | 2 +-
sound/soc/tegra/tegra210_adx.c | 2 +-
sound/soc/tegra/tegra210_ahub.c | 2 +-
sound/soc/tegra/tegra210_amx.c | 2 +-
sound/soc/tegra/tegra210_dmic.c | 2 +-
sound/soc/tegra/tegra210_i2s.c | 18 +-
sound/soc/tegra/tegra210_mixer.c | 2 +-
sound/soc/tegra/tegra210_mvc.c | 2 +-
sound/soc/tegra/tegra210_ope.c | 2 +-
sound/soc/tegra/tegra210_sfc.c | 2 +-
sound/soc/tegra/tegra30_ahub.c | 2 +-
sound/soc/tegra/tegra30_i2s.c | 2 +-
sound/soc/tegra/tegra_audio_graph_card.c | 2 +-
sound/soc/tegra/tegra_pcm.c | 2 +-
sound/soc/ti/ams-delta.c | 2 +-
sound/soc/ti/davinci-i2s.c | 2 +-
sound/soc/ti/davinci-mcasp.c | 2 +-
sound/soc/ti/omap-mcbsp.c | 2 +-
sound/soc/uniphier/aio-ld11.c | 2 +-
sound/soc/uniphier/aio-pxs2.c | 2 +-
sound/soc/uniphier/evea.c | 2 +-
sound/soc/ux500/mop500.c | 2 +-
sound/soc/ux500/ux500_msp_dai.c | 2 +-
sound/soc/xilinx/xlnx_formatter_pcm.c | 2 +-
sound/soc/xilinx/xlnx_spdif.c | 2 +-
sound/soc/xtensa/xtfpga-i2s.c | 2 +-
sound/usb/line6/driver.c | 5 +
sound/usb/quirks-table.h | 4 +
sound/usb/stream.c | 4 +-
tools/build/feature/Makefile | 53 +-
tools/perf/Documentation/Build.txt | 28 +
tools/perf/Makefile.config | 20 +-
tools/perf/Makefile.perf | 27 +-
.../pmu-events/arch/riscv/andes/ax45/firmware.json | 2 +-
.../pmu-events/arch/riscv/riscv-sbi-firmware.json | 2 +-
.../pmu-events/arch/riscv/sifive/u74/firmware.json | 2 +-
.../arch/riscv/starfive/dubhe-80/firmware.json | 2 +-
.../arch/riscv/thead/c900-legacy/firmware.json | 2 +-
tools/perf/util/callchain.c | 2 +-
tools/sound/dapm-graph | 44 +-
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/prog_tests/uprobe_syscall.c | 4 +-
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 4 +-
tools/testing/selftests/drivers/net/hw/rss_ctx.py | 37 +-
tools/testing/selftests/hid/hid_bpf.c | 26 +
tools/testing/selftests/hid/progs/hid.c | 2 +-
.../testing/selftests/hid/progs/hid_bpf_helpers.h | 2 +-
tools/testing/selftests/kselftest/ksft.py | 2 +-
tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 +-
tools/testing/selftests/mm/Makefile | 2 +-
tools/testing/selftests/mm/mremap_test.c | 2 +
tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +-
tools/testing/selftests/net/mptcp/mptcp_join.sh | 158 +-
tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +
virt/kvm/Kconfig | 4 +-
virt/kvm/guest_memfd.c | 227 +-
virt/kvm/kvm_main.c | 49 +-
984 files changed, 25292 insertions(+), 30662 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/cirrus,cs4271.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/cs4271.txt
delete mode 100644 Documentation/devicetree/bindings/sound/da7213.txt
create mode 100644 Documentation/devicetree/bindings/sound/dlg,da7213.yaml
create mode 100644 Documentation/devicetree/bindings/sound/fsl,imx-audio-es8328.yaml
create mode 100644 Documentation/devicetree/bindings/sound/fsl,saif.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/imx-audio-es8328.txt
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8365-afe.yaml
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8365-mt6357.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/mxs-saif.txt
delete mode 100644 Documentation/devicetree/bindings/sound/pcm512x.txt
create mode 100644 Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,pcm512x.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,tlv320dac3100.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,tpa6130a2.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
delete mode 100644 Documentation/devicetree/bindings/sound/tpa6130a2.txt
delete mode 100644 arch/s390/kernel/alternative.h
create mode 100644 include/sound/soc_sdw_utils.h
create mode 100644 include/sound/tas2563-tlv.h
create mode 100644 sound/soc/amd/acp/acp-sdw-sof-mach.c
create mode 100644 sound/soc/amd/acp/amd-acp63-acpi-match.c
create mode 100644 sound/soc/amd/acp/soc_amd_sdw_common.h
create mode 100644 sound/soc/codecs/mt6357.c
create mode 100644 sound/soc/codecs/mt6357.h
delete mode 100644 sound/soc/intel/boards/bxt_da7219_max98357a.c
delete mode 100644 sound/soc/intel/boards/bxt_rt298.c
delete mode 100644 sound/soc/intel/boards/kbl_da7219_max98357a.c
delete mode 100644 sound/soc/intel/boards/kbl_da7219_max98927.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5660.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5663_max98927.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
delete mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c
delete mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h
delete mode 100644 sound/soc/intel/boards/skl_nau88l25_max98357a.c
delete mode 100644 sound/soc/intel/boards/skl_nau88l25_ssm4567.c
delete mode 100644 sound/soc/intel/boards/skl_rt286.c
create mode 100644 sound/soc/intel/common/soc-acpi-intel-ptl-match.c
delete mode 100644 sound/soc/intel/skylake/Makefile
delete mode 100644 sound/soc/intel/skylake/bxt-sst.c
delete mode 100644 sound/soc/intel/skylake/cnl-sst-dsp.c
delete mode 100644 sound/soc/intel/skylake/cnl-sst-dsp.h
delete mode 100644 sound/soc/intel/skylake/cnl-sst.c
delete mode 100644 sound/soc/intel/skylake/skl-debug.c
delete mode 100644 sound/soc/intel/skylake/skl-i2s.h
delete mode 100644 sound/soc/intel/skylake/skl-messages.c
delete mode 100644 sound/soc/intel/skylake/skl-nhlt.c
delete mode 100644 sound/soc/intel/skylake/skl-pcm.c
delete mode 100644 sound/soc/intel/skylake/skl-ssp-clk.c
delete mode 100644 sound/soc/intel/skylake/skl-ssp-clk.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-cldma.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-cldma.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-dsp.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-dsp.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-ipc.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-ipc.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-utils.c
delete mode 100644 sound/soc/intel/skylake/skl-sst.c
delete mode 100644 sound/soc/intel/skylake/skl-topology.c
delete mode 100644 sound/soc/intel/skylake/skl-topology.h
delete mode 100644 sound/soc/intel/skylake/skl.c
delete mode 100644 sound/soc/intel/skylake/skl.h
create mode 100644 sound/soc/mediatek/mt8365/Makefile
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-clk.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-clk.h
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-common.h
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-adda.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-dmic.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-i2s.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-pcm.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-mt6357.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-reg.h
create mode 100644 sound/soc/sdw_utils/Kconfig
create mode 100644 sound/soc/sdw_utils/Makefile
rename sound/soc/{intel/boards/bridge_cs35l56.c => sdw_utils/soc_sdw_bridge_cs35l56.c} (63%)
rename sound/soc/{intel/boards/sof_sdw_cs42l42.c => sdw_utils/soc_sdw_cs42l42.c} (82%)
rename sound/soc/{intel/boards/sof_sdw_cs42l43.c => sdw_utils/soc_sdw_cs42l43.c} (73%)
rename sound/soc/{intel/boards/sof_sdw_cs_amp.c => sdw_utils/soc_sdw_cs_amp.c} (66%)
rename sound/soc/{intel/boards/sof_sdw_dmic.c => sdw_utils/soc_sdw_dmic.c} (71%)
rename sound/soc/{intel/boards/sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} (63%)
rename sound/soc/{intel/boards/sof_sdw_rt5682.c => sdw_utils/soc_sdw_rt5682.c} (82%)
rename sound/soc/{intel/boards/sof_sdw_rt700.c => sdw_utils/soc_sdw_rt700.c} (81%)
rename sound/soc/{intel/boards/sof_sdw_rt711.c => sdw_utils/soc_sdw_rt711.c} (70%)
rename sound/soc/{intel/boards/sof_sdw_rt712_sdca.c => sdw_utils/soc_sdw_rt712_sdca.c} (74%)
rename sound/soc/{intel/boards/sof_sdw_rt722_sdca.c => sdw_utils/soc_sdw_rt722_sdca.c} (68%)
rename sound/soc/{intel/boards/sof_sdw_rt_amp.c => sdw_utils/soc_sdw_rt_amp.c} (84%)
rename sound/soc/{intel/boards/sof_sdw_amp_coeff_tables.h => sdw_utils/soc_sdw_rt_amp_coeff_tables.h} (97%)
rename sound/soc/{intel/boards/sof_sdw_rt_dmic.c => sdw_utils/soc_sdw_rt_dmic.c} (70%)
rename sound/soc/{intel/boards/sof_sdw_rt_sdca_jack_common.c => sdw_utils/soc_sdw_rt_sdca_jack_common.c} (78%)
create mode 100644 sound/soc/sdw_utils/soc_sdw_utils.c
create mode 100644 sound/soc/sof/amd/acp70.c
create mode 100644 sound/soc/sof/amd/pci-acp70.c
create mode 100644 sound/soc/sof/intel/pci-ptl.c
1
1
The following changes since commit 839a4ec06f75cec8fec2cc5fc14e921d0c3f7369:
ASoC: Intel: soc-acpi-cht: Make Lenovo Yoga Tab 3 X90F DMI match less strict (2024-08-23 11:02:53 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/asoc-v6.12
for you to fetch changes up to 2772ee6de6cf94e5f2a0c0ce6067d0796a4170ba:
ASoC: topology: Fix redundant logical jump (2024-09-13 19:40:38 +0100)
----------------------------------------------------------------
ASoC: Updates for v6.12
This is a very large set of changes, almost all in drivers rather than
the core. Even with the addition of several quite large drivers the
overall diffstat is negative thanks to the removal of some old Intel
board support which has been obsoleted by the AVS driver, helped a bit
by some factoring out into helpers (especially around the Soundwire
machine drivers for x86).
Highlights include:
- More simplifications and cleanups throughout the subsystem from
Morimoto-san.
- Extensive cleanups and refactoring of the Soundwire drivers to make
better use of helpers.
- Removal of Intel machine support obsoleted by the AVS driver.
- Lots of DT schema conversions.
- Machine support for many AMD and Intel x86 platforms.
- Support for AMD ACP 7.1, Mediatek MT6367 and MT8365, Realtek RTL1320
SoundWire and rev C, and Texas Instruments TAS2563
----------------------------------------------------------------
Alexandre Mergnat (11):
ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document
ASoC: dt-bindings: mediatek,mt8365-mt6357: Add audio sound card document
dt-bindings: mfd: mediatek: Add codec property for MT6357 PMIC
ASoC: mediatek: mt8365: Add common header
ASoC: mediatek: mt8365: Add audio clock control support
ASoC: mediatek: mt8365: Add I2S DAI support
ASoC: mediatek: mt8365: Add ADDA DAI support
ASoC: mediatek: mt8365: Add DMIC DAI support
ASoC: mediatek: mt8365: Add PCM DAI support
ASoC: mediatek: mt8365: Add the AFE driver support
ASoC: mediatek: Add MT8365 support
Andrei Simion (1):
ASoC: dt-bindings: microchip,sama7g5-spdifrx: Add common DAI reference
Andrew Kreimer (1):
ASoC: tlv320aic31xx: Fix typos
Animesh Agarwal (2):
ASoC: dt-bindings: ti,pcm512x: Convert to dtschema
ASoC: dt-bindings: fsl,imx-audio-es8328: Convert to dtschema
Arnd Bergmann (2):
ASoC: mediatek: mt8365: include linux/bitfield.h
ASoC: mediatek: mt8365: remove unused mt8365_i2s_hd_str
Balamurugan C (4):
ASoC: Intel: soc-acpi: Add entry for sof_es8336 in ARL match table.
ASoC: Intel: soc-acpi: Add entry for HDMI_In capture support in ARL match table
ASoC: Intel: sof_rt5682: Add HDMI-In capture with rt5682 support for ARL.
ASoC: Intel: ARL: Add entry for HDMI-In capture support to non-I2S codec boards.
Baojun Xu (1):
ASoC: tas2781: Remove unnecessary line feed for tasdevice_codec_remove
Bard Liao (6):
ASoC: Intel: soc-acpi-intel-ptl-match: add rt711-sdca table
ASoC: Intel: soc-acpi-intel-ptl-match: Add rt722 support
ASoC: Intel: sof_sdw: add rt1320 amp support
ASoC: SOF: Intel: hda: refactoring topology name fixup for HDA mach
ASoC: Intel: sof_sdw: move ignore_internal_dmic check earlier
ASoC: Intel: sof_sdw: overwrite mach_params->dmic_num
Biju Das (2):
ASoC: dt-bindings: renesas,rz-ssi: Document port property
ASoC: sh: rz-ssi: Add full duplex support
Binbin Zhou (7):
ASoC: loongson: Use BIT() macro
ASoC: loongson: Simplify probe() with local dev variable
ASoC: loongson: Simplify with dev_err_probe()
ASoC: loongson: Simplify if statment in loongson_card_hw_params()
ASoC: loongson: Replace if with ternary operator
ASoC: loongson: Factor out loongson_card_acpi_find_device() function
ASoC: loongson: Factor out loongson i2s enable clock functions
Brent Lu (10):
ASoC: SOF: Intel: hda: refactoring topology name fixup for SDW mach
ASoC: SOF: Intel: hda: support BT link mask in mach_params
ASoC: Intel: skl_hda_dsp_generic: support BT audio offload
ASoC: Intel: skl_hda_dsp_generic: remove hdac-hdmi support
ASoC: Intel: skl_hda_dsp_generic: use sof_hdmi_private to init HDMI
ASoC: Intel: board_helpers: support HDA link initialization
ASoC: Intel: skl_hda_dsp_generic: use common module for DAI links
ASoC: Intel: ehl_rt5660: do not check common_hdmi_codec_drv
ASoC: Intel: sof_pcm512x: do not check common_hdmi_codec_drv
ASoC: SOF: Intel: hda: remove common_hdmi_codec_drv
Cezary Rojewski (14):
ALSA: hda: Move SST device entries to AVS
ASoC: Intel: Drop skl_machine_pdata usage
ASoC: Intel: Remove bxt_rt298 board driver
ASoC: Intel: Remove bxt_da7219_max98357a board driver
ASoC: Intel: Remove kbl_rt5663_rt5514_max98927 board driver
ASoC: Intel: Remove kbl_rt5663_max98927 board driver
ASoC: Intel: Remove kbl_rt5660 board driver
ASoC: Intel: Remove kbl_da7219_max98927 board driver
ASoC: Intel: Remove kbl_da7219_max98357a board driver
ASoC: Intel: Remove skl_rt286 board driver
ASoC: Intel: Remove skl_nau88l25_ssm4567 board driver
ASoC: Intel: Remove skl_nau88l25_max98357a board driver
ASoC: Intel: Remove skylake driver
ASoC: Intel: avs: Enable by default for all SST configurations
Charles Keepax (3):
ASoC: Intel: soc-acpi: arl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: adl: Add match entries for new cs42l43 laptops
ASoC: Intel: soc-acpi: lnl: Add match entries for new cs42l43 laptops
Chen Ni (4):
ASoC: mediatek: mt8192: remove redundant null pointer check before of_node_put
ASoC: cs42l42: Convert comma to semicolon
ASoC: topology-test: Convert comma to semicolon
ASoC: Intel: skl_hda_dsp_generic: convert comma to semicolon
Christophe JAILLET (4):
ASoC: sti-sas: Constify snd_soc_component_driver struct
ASoC: cs43130: Constify snd_soc_component_driver struct
ASoC: cs43130: Constify struct reg_sequence and reg_sequences
ASoC: rt1318: Constify struct reg_sequence
Codrin Ciubotariu (5):
ASoC: atmel: mchp-i2s-mcc: Improve maxburst calculation for better performance
ASoC: atmel: mchp-i2s-mcc: Remove interface name from stream_name
ASoC: atmel: mchp-pdmc: Improve maxburst calculation for better performance
ASoC: atmel: mchp-pdmc: Add snd_soc_dai_driver name
ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls
Colin Ian King (1):
ASoC: codecs: wcd934x: make read-only array minCode_param static const
Dmitry Torokhov (1):
ASoC: tas5086: use sleeping variants of gpiod API
Fabio Estevam (7):
ASoC: fsl_audmix: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_mqs: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_rpmsg: Switch to RUNTIME_PM_OPS()
ASoC: fsl_spdif: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
ASoC: fsl_ssi: Switch to SYSTEM_SLEEP_PM_OPS
ASoC: imx-audmux: Switch to SYSTEM_SLEEP_PM_OPS
ASoC: imx-pcm-rpmsg: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
Frank Li (2):
ASoC: dt-bindings: convert tlv320aic31xx.txt to yaml
ASoC: dt-bindings: Convert tpa6130a2.txt to yaml
Fred Oh (1):
ASoC: SOF: Intel: add PTL specific power control register
Geert Uytterhoeven (1):
ASoC: dt-bindings: dlg,da7213: Convert to json-schema
Gustavo A. R. Silva (1):
ASoC: SOF: sof-audio: Avoid -Wflex-array-member-not-at-end warnings
Heiko Stuebner (2):
ASoC: dt-bindings: realtek,rt5616: document mclk clock
ASoC: dt-bindings: realtek,rt5616: Document audio graph port
Hongbo Li (2):
ASoC: dapm: Use IS_ERR_OR_NULL() helper function
ASoC: adi: Use str_enabled_disabled() helper
Jens Reidel (1):
ASoC: qcom: sm8250: enable primary mi2s
Jerome Brunet (1):
ASoC: amlogic: do not use dpcm_playback/capture flags
Krzysztof Kozlowski (16):
ASoC: codecs: wsa881x: Drop unused version readout
ASoC: codecs: wsa883x: Handle reading version failure
ASoC: codecs: wsa883x: Simplify handling variant/version
ASoC: codecs: wsa884x: Simplify handling variant
ASoC: dt-bindings: qcom,apq8016-sbc-sndcard: move to separate binding
ASoC: codecs: lpass-wsa-macro: Do not hard-code dai in VI mixer
ASoC: codecs: wsa881x: Use designator array initializers for Soundwire ports
ASoC: codecs: wsa883x: Use designator array initializers for Soundwire ports
ASoC: codecs: wsa884x: Use designator array initializers for Soundwire ports
ASoC: codecs: wcd938x: Drop unused defines and enums
ASoC: codecs: wcd937x: Move max port number defines to enum
ASoC: codecs: wcd938x: Move max port number defines to enum
ASoC: codecs: wcd939x: Move max port number defines to enum
ASoC: dt-bindings: samsung,odroid: drop stale clocks
ASoC: MAINTAINERS: Drop incorrect tlv320aic31xx.txt path
ASoC: codecs: wsa884x: Implement temperature reading and hwmon
Kuninori Morimoto (19):
ASoC: rsnd: remove rsnd_mod_confirm_ssi() under DEBUG
ASoC: rsnd: use pcm_dmaengine code
ASoC: stm: use snd_pcm_direction_name()
ASoC: sof: pcm: use snd_pcm_direction_name()
ASoC: sof: intel: use snd_pcm_direction_name()
ASoC: fsl: lpc3xxx-i2s: use snd_pcm_direction_name()
ASoC: tegra: use snd_pcm_direction_name()
ASoC: soc-pcm: use snd_pcm_direction_name()
ASoC: soc-dapm: use snd_pcm_direction_name()
ASoC: remove bespoke trigger support
ASoC: soc-pcm: remove snd_soc_dpcm_stream_{lock/unlock}_irq()
ASoC: soc-pcm: remove snd_soc_dpcm_stream_lock_irqsave_nested()
ASoC: soc-pcm: Indicate warning if dpcm_playback/capture were used for availability limition
ASoC: remove snd_soc_dai_link_set_capabilities()
ASoC: Intel: sof_sdw: use playback/capture_only flags
ASoC: soc-pcm: move snd_soc_dpcm_can_be_xxx() to top
ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local function
ASoC: makes rtd->initialized bit field
ASoC: dt-bindings: renesas,rsnd: add post-init-providers property
Linus Walleij (3):
ASoC: tas2781-i2c: Drop weird GPIO code
ASoC: tas2781-i2c: Get the right GPIO line
ASoC: tas*: Drop unused GPIO includes
Liu Jing (1):
ASoC: mediatek: mt2701-cs42448: Optimize redundant code in mt2701_cs42448_machine_probe
Luca Ceresoli (3):
ASoC: dapm-graph: remove the "ROOT" cluster
ASoC: dapm-graph: visualize component On/Off bias level
ASoC: dapm-graph: show path name for non-static routes
Lukasz Majewski (1):
ASoC: dt-bindings: Convert mxs-saif.txt to fsl,saif.yaml (imx28 saif)
Ma Ke (2):
ASoC: rt5682s: Return devm_of_clk_add_hw_provider to transfer the error
ASoC: rt5682: Return devm_of_clk_add_hw_provider to transfer the error
Maciej Strozek (1):
ASoC: Intel: sof_sdw: Add quirks from some new Dell laptops
Marek Vasut (1):
ASoC: tlv320aic32x4: Add multi endpoint support
Mark Brown (37):
Add HDMI Audio support
ASoC: codecs: wsa88xx: Few cleanups
ASoC: codecs: wsa88xx and wcd93xx: Soundwire port
AMD SOF based generic SoundWire machine driver
ALSA/ASoC: use snd_pcm_direction_name()
ASoC: SOF: reshuffle and optimize structures
ASoC/SOF/PCI/Intel: add PantherLake support
ASoC: Merge fixes
ASoC: tas*: Fix up GPIO usage
ASoC: Intel: Remove skylake driver
ALSA/ASoC/SoundWire: Intel: update maximum number
ASoC: Merge up fixes
ASoC: grace time for DPCM cleanup
ASoC: Merge up fixes
ASoC: dapm-graph: add component on/off and route names
Add SOF support for ACP7.0 based platform
ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local
ASoC: Intel: boards: updates for 6.12
ASoC: dt-bindings: amlogic-sound-cards: document
Add audio support for the MediaTek Genio 350-evk
Fixes for the audio setup on the rk3588-nanopc-t6
Add i2s/tdm support for acp7.0 and acp7.1 platforms
Some clean up with helper fucntion
Add audio support for the MediaTek Genio 350-evk
ASoC: mt8365: Open code BIT() to avoid spurious warnings
ASoC: mt8365: Remove spurious unsigned long casts
ASoC: mt8365: Remove unused prototype for mt8365_afe_clk_group_48k()
ASoC: mt8365: Make non-exported functions static
ASoC: mt8365: Remove unused variables
ASoC: mt8365: Remove unused DMIC IIR coefficient configuration
ASoC: mt8365: Allow build coverage
ASoC: loongson: Simplify code formatting
ASoC: mt8365: Fix -Werror builds
Add support for primary mi2s on SM8250
ASoC: Improvements for mchp-pdmc
ASoC: Intel: boards: updates for 6.12 - part 2
AMD SoundWire machine driver code refactor
Muhammad Usama Anjum (3):
ASoC: amd: acp: Return in-case of error
ASoC: mediatek: mt8365: check validity before usage of i2s_data
ASoc: mediatek: mt8365: Remove unneeded assignment
Neil Armstrong (2):
ASoC: dt-bindings: amlogic,axg-sound-card: document clocks property
ASoC: dt-bindings: amlogic,gx-sound-card: document clocks property
Nicolas Belin (2):
ASoc: mediatek: mt8365: Add a specific soundcard for EVK
ASoC: codecs: add MT6357 support
Nikita Shubin (1):
ASoC: dt-bindings: cirrus,cs4271: Convert to dtschema
Pierre-Louis Bossart (11):
ASoC: Intel: soc-acpi: add PTL match tables
ASoC: SOF: Intel: add initial support for PTL
ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params
ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox
ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg
ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list
ALSA/ASoC/SoundWire: Intel: use single definition for SDW_INTEL_MAX_LINKS
soundwire: intel: add probe-time check on link id
soundwire: intel: increase maximum number of links
ASoC: Intel: sof_sdw: make sof_sdw_quirk static
ASoC: Intel: boards: always check the result of acpi_dev_get_first_match_dev()
Richard Fitzgerald (2):
ASoC: cs35l56: Make struct regmap_config const
ASoC: cs-amp-lib: Add KUnit test case for empty calibration entries
Rob Herring (Arm) (2):
ASoC: Use of_property_present()
ASoC: Use of_property_read_bool()
Romain Gantois (1):
ASoC: tlv320aic31xx: Add support for loading filter coefficients
Shen Lichuan (1):
ASoC: SOF: topology: Use kmemdup_array instead of kmemdup for multiple allocation
Shenghao Ding (7):
ASoC: tas2781: Add TAS2563 into the Header
ASoC: tas2781: Fix a compiling warning reported by robot kernel test due to adding tas2563_dvc_table
ASoc: tas2781: Rename dai_driver name to unify the name between TAS2563 and TAS2781
ASoc: tas2781: Remove unnecessary line feed and space
ASoC: tas2781: mark const variables tas2563_dvc_table as __maybe_unused
ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup
ASoC: tas2781: Add Calibration Kcontrols for Chromebook
Shuming Fan (1):
ASoC: rt1320: Add support for version C
Simon Trimmer (1):
ASoC: cs35l56: Use regmap_read_bypassed() to wake the device
Srinivas Kandagatla (1):
ASoC: dt-bindings: qcom,lpass-wsa-macro: correct clocks on SM8250
Takashi Iwai (1):
ASoC: Use __counted_by() annotation for snd_soc_pcm_runtime
Tang Bin (6):
ASoC: loongson: remove redundant variable assignments
ASoC: codecs: fix the right check and simplify code
ASoC: soc-ac97: Fix the incorrect description
ASoC: loongson: Add the correct judgement return
ASoC: mediatek: mt7986-afe-pcm: Remove redundant error message
ASoC: topology: Fix redundant logical jump
Uwe Kleine-König (1):
ASoC: Switch back to struct platform_driver::remove()
Venkata Prasad Potturu (12):
ASoC: amd: acp: Refactor TDM slots selction based on acp revision id
ASoC: amd: acp: Refactor I2S dai driver
ASoC: amd: acp: Update pcm hardware capabilities for acp6.3 platform
ASoC: amd: acp: Add I2S TDM support for acp6.3 platform
ASoC: amd: acp: Update pcm hardware capabilities for acp7.0 platform
ASoC: amd: acp: Add I2S master clock generation support for acp7.0 platform
ASoC: amd: acp: Set i2s clock for acp7.0 platform
ASoC: amd: acp: Modify max channels and sample rate support for acp70 dai driver
ASoC: amd: acp: Add I2S TDM support for acp7.0 platform
ASoC: amd: acp: Add pte configuration for ACP7.0 platform
ASoC: amd: acp: Add i2s master clock generation support for acp7.1 platform
ASoC: amd: acp: Add I2S TDM support for acp7.1 platform
Vijendar Mukunda (47):
ASoC: intel: rename codec_info and dai_info structures names
ASoC: intel: rename soundwire common header macros
ASoC: intel: rename soundwire machine driver soc ops
ASoC: intel: rename soundwire codec helper functions
ASoC: intel: rename maxim codec macros
ASoC: intel: rename ignore_pch_dmic variable name
ASoC: intel/sdw-utils: move soundwire machine driver soc ops
ASoC: intel: move soundwire machine driver common structures
ASoC: intel/sdw_utils: move soundwire machine driver helper functions
ASoC: intel/sdw_utils: move dmic codec helper function
ASoC: intel/sdw_utils: move rtk dmic helper functions
ASoC: intel/sdw_utils: move rt712 sdca helper functions
ASoC: intel/sdw_utils: move rt722 sdca helper functions
ASoC: intel: split soundwire machine driver private data
ASoC: intel/sdw_utils: move rt5682 codec helper function
ASoC: intel/sdw_utils: move rtk jack common helper functions
ASoC: intel/sdw_utils: move rt700 and rt711 codec helper functions
ASoC: intel/sdw_utils: move rtk amp codec helper functions
ASoC: intel/sdw_utils: move cirrus soundwire codec helper functions
ASoC: intel/sdw_utils: move maxim codec helper functions
ASoC: intel/sdw_utils: move dai id common macros
ASoC: intel/sdw_utils: move soundwire dai type macros
ASoC: intel/sdw_utils: move soundwire codec_info_list structure
ASoC: intel/sdw_utils: move machine driver dai link helper functions
ASoC: sdw_utils: refactor sof_sdw_card_late_probe function
ASoC: intel/sdw_utils: refactor init_dai_link() and init_simple_dai_link()
ASoC: soc-acpi: add pci revision id field in mach params structure
ASoC: amd: acp: add soundwire machines for acp6.3 based platform
ASoC: SOF: amd: add alternate machines for acp6.3 based platform
ASoC: SOF: amd: update mach params subsystem_rev variable
ASoC: amd/sdw_utils: add sof based soundwire generic machine driver
ASoC: amd: acp: remove MODULE_ALIAS for SoundWire machine driver
ASoC: amd: acp: add ZSC control register programming sequence
ASoC: SOF: amd: update conditional check for cache register update
ASoC: amd: acp: Convert comma to semicolon
ASoC: amd: acp: add legacy driver support for ACP7.1 based platforms
ASoC: amd: acp: replace desc->rev check with acp pci revision id
ASoC: SOF: amd: remove unused variable from sof_amd_acp_desc structure
ASoC: amd: Add acpi machine id for acp7.0 version based platform
ASoC: SOF: amd: add support for acp7.0 based platform
ASoC: amd: acp: remove MODULE_ALIAS for legacy machine driver
ASoC: amd: acp: remove MODULE_ALIAS for sof based generic machine driver
ASoC: intel: sof_sdw: rename soundwire endpoint and dailink structures
ASoC: intel: sof_sdw: rename soundwire parsing helper functions
ASoC: sdw_util/intel: move soundwire endpoint and dai link structures
ASoC: sdw_utils/intel: move soundwire endpoint parsing helper functions
ASoC: amd: acp: refactor SoundWire machine driver code
Wu Bo (1):
ASoC: dwc: change to use devm_clk_get_enabled() helpers
Yue Haibing (2):
ASoC: fsl: lpc3xxx-i2s: Remove set but not used variable 'savedbitclkrate'
ASoC: fsl: lpc3xxx: Make some symbols static
Zhang Yi (2):
ASoC: codecs: ES8326: suspend issue
ASoC: codecs: ES8326: input issue after init
Zhang Zekun (3):
ASoC: audio-graph-card: Use for_each_child_of_node_scoped() to simplify code
ASoC: audio-graph-card2: Use helper function of_get_child_count()
ASoC: meson: Remove unused declartion in header file
tangbin (3):
ASoC: loongson: Remove useless variable definitions
ASoC: loongson: remove unnecessary assignment in i2s_resume()
ASoC: loongson: fix error release
ying zuxin (1):
ASoC: codecs: Use devm_clk_get_enabled() helpers
.mailmap | 1 +
.../testing/sysfs-bus-i2c-devices-turris-omnia-mcu | 6 +-
Documentation/admin-guide/cifs/usage.rst | 2 +-
Documentation/admin-guide/kernel-parameters.txt | 4 +-
Documentation/arch/arm64/silicon-errata.rst | 18 +
.../devicetree/bindings/ata/rockchip,dwc-ahci.yaml | 3 +
.../bindings/display/panel/samsung,atna33xc20.yaml | 9 +-
.../devicetree/bindings/mfd/mediatek,mt6357.yaml | 21 +
.../bindings/sound/amlogic,axg-sound-card.yaml | 7 +
.../bindings/sound/amlogic,gx-sound-card.yaml | 7 +
.../devicetree/bindings/sound/cirrus,cs4271.yaml | 101 +
Documentation/devicetree/bindings/sound/cs4271.txt | 57 -
Documentation/devicetree/bindings/sound/da7213.txt | 45 -
.../devicetree/bindings/sound/dlg,da7213.yaml | 103 +
.../bindings/sound/fsl,imx-audio-es8328.yaml | 111 +
.../devicetree/bindings/sound/fsl,saif.yaml | 83 +
.../devicetree/bindings/sound/imx-audio-es8328.txt | 60 -
.../bindings/sound/mediatek,mt8365-afe.yaml | 130 +
.../bindings/sound/mediatek,mt8365-mt6357.yaml | 107 +
.../bindings/sound/microchip,sama7g5-spdifrx.yaml | 5 +-
.../devicetree/bindings/sound/mxs-saif.txt | 41 -
.../devicetree/bindings/sound/pcm512x.txt | 53 -
.../bindings/sound/qcom,apq8016-sbc-sndcard.yaml | 205 ++
.../bindings/sound/qcom,lpass-wsa-macro.yaml | 22 +-
.../devicetree/bindings/sound/qcom,sm8250.yaml | 137 -
.../devicetree/bindings/sound/realtek,rt5616.yaml | 12 +
.../devicetree/bindings/sound/renesas,rsnd.yaml | 6 +
.../devicetree/bindings/sound/renesas,rz-ssi.yaml | 4 +
.../devicetree/bindings/sound/samsung,odroid.yaml | 5 -
.../devicetree/bindings/sound/ti,pcm512x.yaml | 101 +
.../bindings/sound/ti,tlv320dac3100.yaml | 127 +
.../devicetree/bindings/sound/ti,tpa6130a2.yaml | 55 +
.../devicetree/bindings/sound/tlv320aic31xx.txt | 77 -
.../devicetree/bindings/sound/tpa6130a2.txt | 27 -
.../devicetree/bindings/usb/microchip,usb2514.yaml | 1 +
Documentation/driver-api/thermal/sysfs-api.rst | 65 +-
Documentation/netlink/specs/ethtool.yaml | 2 +-
Documentation/networking/ethtool-netlink.rst | 1 +
.../process/embargoed-hardware-issues.rst | 153 +-
.../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 4 +-
Documentation/virt/kvm/api.rst | 8 +-
Documentation/wmi/devices/msi-wmi-platform.rst | 6 +-
MAINTAINERS | 13 +-
Makefile | 2 +-
arch/alpha/include/asm/io.h | 4 +-
arch/arm/Kconfig | 4 +-
arch/arm/boot/compressed/Makefile | 1 +
arch/arm/boot/compressed/vmlinux.lds.S | 2 +-
arch/arm/boot/dts/arm/versatile-ab.dts | 2 +-
arch/arm/include/asm/stacktrace.h | 7 +
arch/arm/include/asm/vmlinux.lds.h | 2 +-
arch/arm/kernel/entry-armv.S | 3 +
arch/arm/kernel/entry-common.S | 3 +
arch/arm/kernel/module.c | 5 -
arch/arm/kernel/perf_callchain.c | 3 +-
arch/arm/kernel/vmlinux-xip.lds.S | 4 +-
arch/arm/kernel/vmlinux.lds.S | 6 +-
arch/arm/mach-alpine/alpine_cpu_pm.c | 2 +-
arch/arm/mach-pxa/gumstix.c | 11 +-
arch/arm/mm/proc.c | 20 +-
arch/arm64/Kconfig | 22 +-
arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi | 22 -
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 6 -
.../boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi | 2 +
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 3 +-
arch/arm64/boot/dts/ti/k3-j722s-main.dtsi | 3 +-
arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 25 +-
arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi | 4 +-
arch/arm64/include/asm/cputype.h | 4 +
arch/arm64/include/asm/jump_label.h | 1 +
arch/arm64/kernel/Makefile.syscalls | 2 +-
arch/arm64/kernel/cpu_errata.c | 11 +-
arch/arm64/kernel/jump_label.c | 11 +-
arch/loongarch/include/asm/hugetlb.h | 4 +-
arch/loongarch/include/asm/kfence.h | 6 +-
arch/loongarch/include/asm/kvm_host.h | 2 -
arch/loongarch/include/asm/kvm_para.h | 4 +-
arch/loongarch/include/asm/pgtable.h | 48 +-
arch/loongarch/kernel/Makefile.syscalls | 3 +-
arch/loongarch/kernel/efi.c | 6 +
arch/loongarch/kvm/mmu.c | 8 +-
arch/loongarch/mm/hugetlbpage.c | 6 +-
arch/loongarch/mm/init.c | 10 +-
arch/loongarch/mm/kasan_init.c | 10 +-
arch/loongarch/mm/pgtable.c | 2 +-
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/cache.h | 11 +-
arch/parisc/net/bpf_jit_core.c | 2 +-
arch/riscv/kernel/Makefile.syscalls | 2 +-
arch/riscv/kernel/cpufeature.c | 14 +-
arch/riscv/kernel/sbi-ipi.c | 2 +-
arch/riscv/mm/fault.c | 17 +-
arch/riscv/mm/init.c | 15 +-
arch/riscv/purgatory/entry.S | 2 +
arch/s390/kernel/alternative.h | 0
arch/s390/kernel/fpu.c | 2 +-
arch/s390/kernel/vmlinux.lds.S | 17 +-
arch/s390/mm/dump_pagetables.c | 140 +-
arch/s390/mm/init.c | 9 +-
arch/s390/mm/vmem.c | 13 +-
arch/um/drivers/mconsole_user.c | 2 +
arch/x86/coco/sev/core.c | 2 +-
arch/x86/entry/syscalls/syscall_64.tbl | 2 +-
arch/x86/events/core.c | 22 +-
arch/x86/events/intel/cstate.c | 5 +-
arch/x86/include/asm/cmdline.h | 4 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/asm/qspinlock.h | 12 +-
arch/x86/kernel/acpi/madt_wakeup.c | 2 +-
arch/x86/kernel/cpu/amd.c | 2 +-
arch/x86/kernel/cpu/aperfmperf.c | 6 +-
arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
arch/x86/kernel/paravirt.c | 7 +-
arch/x86/kernel/setup.c | 2 +-
arch/x86/kvm/Kconfig | 4 +-
arch/x86/kvm/lapic.c | 2 +-
arch/x86/kvm/mmu/mmu.c | 7 +-
arch/x86/kvm/svm/sev.c | 17 +-
arch/x86/kvm/svm/svm.c | 1 +
arch/x86/kvm/x86.c | 12 +-
arch/x86/lib/cmdline.c | 25 +-
arch/x86/lib/getuser.S | 4 +-
arch/x86/mm/pti.c | 51 +-
block/blk-throttle.c | 11 -
drivers/android/binder.c | 15 +-
drivers/android/binder_alloc.c | 2 +-
drivers/android/dbitmap.h | 22 +-
drivers/base/core.c | 13 +-
drivers/base/module.c | 4 +
drivers/bluetooth/Kconfig | 2 +
drivers/bluetooth/btintel.c | 3 +
drivers/bluetooth/btmtk.c | 5 +-
drivers/bluetooth/hci_qca.c | 19 +-
drivers/cache/Kconfig | 1 +
drivers/char/ds1620.c | 1 +
drivers/char/nwbutton.c | 1 +
drivers/char/nwflash.c | 1 +
drivers/cpufreq/intel_pstate.c | 1 +
drivers/edac/skx_common.h | 1 -
drivers/firmware/efi/libstub/Makefile | 7 +-
drivers/fsi/fsi-core.c | 1 +
drivers/fsi/fsi-master-aspeed.c | 1 +
drivers/fsi/fsi-master-ast-cf.c | 3 +-
drivers/fsi/fsi-master-gpio.c | 1 +
drivers/fsi/fsi-master-hub.c | 1 +
drivers/fsi/fsi-scom.c | 1 +
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 +
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 3 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 36 +-
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 27 +
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 18 +
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 8 +-
drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c | 3 +-
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 7 +-
.../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c | 3 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +
.../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 2 +
.../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 2 +
.../display/dc/resource/dcn401/dcn401_resource.c | 1 +
.../display/dc/resource/dcn401/dcn401_resource.h | 4 +-
.../gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c | 2 +
drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 +
drivers/gpu/drm/amd/include/mes_v12_api_def.h | 3 +
drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 3 +-
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppevvmath.h | 14 +-
.../gpu/drm/amd/pm/swsmu/inc/smu_v14_0_2_pptable.h | 52 +-
.../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 86 +-
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
drivers/gpu/drm/ast/ast_dp.c | 7 +
drivers/gpu/drm/ast/ast_drv.c | 5 +
drivers/gpu/drm/ast/ast_drv.h | 1 +
drivers/gpu/drm/ast/ast_mode.c | 29 +-
drivers/gpu/drm/drm_atomic_uapi.c | 14 +-
drivers/gpu/drm/drm_bridge_connector.c | 8 +-
drivers/gpu/drm/drm_buddy.c | 25 +-
drivers/gpu/drm/drm_client.c | 2 +-
drivers/gpu/drm/drm_client_modeset.c | 5 +
drivers/gpu/drm/drm_fb_helper.c | 11 +
drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 +
drivers/gpu/drm/i915/display/intel_backlight.c | 3 +
drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 6 +-
drivers/gpu/drm/i915/display/intel_hdcp_regs.h | 2 +-
drivers/gpu/drm/i915/display/intel_pps.c | 3 +
drivers/gpu/drm/i915/gem/i915_gem_mman.c | 55 +-
drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 13 +-
drivers/gpu/drm/i915/i915_perf.c | 33 -
drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_fence.c | 30 +-
drivers/gpu/drm/nouveau/nouveau_fence.h | 2 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_prime.c | 3 +-
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 1 +
drivers/gpu/drm/omapdrm/Kconfig | 1 +
drivers/gpu/drm/radeon/evergreen_cs.c | 2 +
drivers/gpu/drm/tests/drm_gem_shmem_test.c | 11 +
drivers/gpu/drm/v3d/v3d_drv.h | 4 +
drivers/gpu/drm/v3d/v3d_sched.c | 44 +-
drivers/gpu/drm/v3d/v3d_submit.c | 121 +-
drivers/gpu/drm/virtio/virtgpu_submit.c | 2 +-
drivers/gpu/drm/vmwgfx/vmw_surface_cache.h | 10 +-
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 127 +-
drivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 15 +-
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 40 +-
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 17 +-
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 62 +-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 502 ++-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 17 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 14 +-
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_prime.c | 32 +-
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 27 +-
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 33 +-
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 174 +-
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 280 +-
drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 40 +-
drivers/gpu/drm/xe/xe_hwmon.c | 3 +-
drivers/gpu/drm/xe/xe_lrc.c | 15 +-
drivers/gpu/drm/xe/xe_rtp.c | 2 +-
drivers/gpu/drm/xe/xe_sync.c | 2 +-
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 2 +-
drivers/hid/amd-sfh-hid/amd_sfh_client.c | 18 +-
drivers/hid/bpf/Kconfig | 2 +-
drivers/hid/bpf/hid_bpf_struct_ops.c | 5 +
drivers/hid/wacom_wac.c | 67 +-
drivers/hwmon/adt7475.c | 24 +-
drivers/i2c/busses/i2c-qcom-geni.c | 5 +-
drivers/i2c/i2c-slave-testunit.c | 4 +-
drivers/i2c/i2c-smbus.c | 64 +-
drivers/input/input-mt.c | 3 +
drivers/input/touchscreen/cyttsp4_core.c | 2 +-
drivers/irqchip/irq-loongarch-cpu.c | 6 +-
drivers/irqchip/irq-mbigen.c | 20 +-
drivers/irqchip/irq-meson-gpio.c | 14 +-
drivers/irqchip/irq-pic32-evic.c | 6 +-
drivers/irqchip/irq-riscv-aplic-msi.c | 32 +-
drivers/irqchip/irq-sun6i-r.c | 2 +-
drivers/irqchip/irq-xilinx-intc.c | 2 +-
drivers/media/dvb-frontends/stv0367_priv.h | 3 +
drivers/media/pci/intel/ipu6/Kconfig | 3 +-
drivers/media/usb/uvc/uvc_ctrl.c | 8 +-
drivers/misc/Kconfig | 2 +-
drivers/misc/eeprom/ee1004.c | 85 +-
drivers/net/can/usb/etas_es58x/es58x_devlink.c | 2 +-
drivers/net/dsa/bcm_sf2.c | 4 +-
drivers/net/dsa/microchip/ksz_common.c | 16 +
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 16 +-
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 14 +-
drivers/net/ethernet/freescale/fec_ptp.c | 3 +
drivers/net/ethernet/google/gve/gve_ethtool.c | 2 +-
drivers/net/ethernet/google/gve/gve_main.c | 12 +-
drivers/net/ethernet/intel/ice/ice.h | 11 +-
drivers/net/ethernet/intel/ice/ice_base.c | 4 +-
drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 +-
drivers/net/ethernet/intel/ice/ice_main.c | 4 +-
drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +
drivers/net/ethernet/intel/ice/ice_txrx.c | 10 +-
drivers/net/ethernet/intel/ice/ice_xsk.c | 184 +-
drivers/net/ethernet/intel/ice/ice_xsk.h | 14 +-
drivers/net/ethernet/intel/idpf/idpf_lib.c | 48 +-
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 43 +-
drivers/net/ethernet/intel/igc/igc_main.c | 33 +-
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +-
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 1 +
.../mellanox/mlx5/core/en_accel/ipsec_offload.c | 7 +-
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 7 +-
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 5 +-
.../net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +-
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +-
.../ethernet/mellanox/mlx5/core/sf/dev/driver.c | 1 +
.../ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
drivers/net/ethernet/meta/Kconfig | 2 +-
drivers/net/ethernet/realtek/r8169_main.c | 8 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 -
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
drivers/net/fjes/fjes_main.c | 4 +-
drivers/net/phy/aquantia/aquantia_main.c | 29 +-
drivers/net/phy/micrel.c | 34 +-
drivers/net/phy/realtek.c | 7 +
drivers/net/pse-pd/tps23881.c | 5 +-
drivers/net/usb/qmi_wwan.c | 2 +
drivers/net/usb/sr9700.c | 11 +-
drivers/net/virtio_net.c | 14 +-
drivers/net/wan/fsl_qmc_hdlc.c | 31 +-
drivers/net/wireless/ath/ath12k/pci.c | 3 +-
drivers/net/wireless/ath/ath12k/wow.c | 8 +-
drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 +
drivers/nfc/pn544/i2c.c | 2 -
drivers/nvme/host/core.c | 18 +-
drivers/nvme/host/nvme.h | 13 +-
drivers/pci/hotplug/pciehp_hpc.c | 4 +-
drivers/pci/pci.c | 15 +-
drivers/perf/riscv_pmu_sbi.c | 2 +-
drivers/platform/chrome/cros_ec_proto.c | 2 +
drivers/platform/cznic/Kconfig | 80 +-
drivers/platform/cznic/Makefile | 8 +-
drivers/platform/cznic/turris-omnia-mcu-base.c | 4 +
drivers/platform/cznic/turris-omnia-mcu.h | 42 +-
drivers/platform/x86/amd/pmc/pmc.c | 2 +
drivers/platform/x86/amd/pmc/pmc.h | 1 +
drivers/platform/x86/amd/pmf/core.c | 3 +
drivers/platform/x86/amd/pmf/pmf-quirks.c | 9 +-
drivers/platform/x86/intel/ifs/runtest.c | 2 +-
drivers/platform/x86/intel/vbtn.c | 9 +
drivers/platform/x86/sony-laptop.c | 1 -
drivers/power/supply/axp288_charger.c | 22 +-
drivers/power/supply/qcom_battmgr.c | 12 +-
drivers/power/supply/rt5033_battery.c | 1 +
drivers/s390/cio/ccwgroup.c | 1 +
drivers/s390/cio/vfio_ccw_drv.c | 1 +
drivers/scsi/isci/init.c | 6 +-
drivers/scsi/mpi3mr/mpi3mr_os.c | 11 +
drivers/scsi/mpt3sas/mpt3sas_base.c | 20 +-
drivers/scsi/sd.c | 20 +-
drivers/scsi/sr_ioctl.c | 2 +-
drivers/soundwire/intel.h | 7 +
drivers/soundwire/intel_ace2x.c | 20 +
drivers/soundwire/intel_auxdevice.c | 14 +
drivers/spi/spi-fsl-lpspi.c | 6 +-
drivers/spi/spi-hisi-kunpeng.c | 4 +
drivers/spi/spidev.c | 1 +
drivers/spmi/spmi-pmic-arb.c | 11 +-
.../pci/hive_isp_css_include/math_support.h | 5 -
.../int340x_thermal/processor_thermal_device_pci.c | 29 +-
drivers/thermal/thermal_trip.c | 4 +-
drivers/tty/serial/sc16is7xx.c | 25 +-
drivers/tty/serial/serial_core.c | 8 +
drivers/tty/vt/conmakehash.c | 20 +-
drivers/ufs/core/ufshcd-priv.h | 5 +
drivers/ufs/core/ufshcd.c | 38 +-
drivers/ufs/host/ufs-exynos.c | 3 +
drivers/usb/gadget/function/f_fs.c | 32 +-
drivers/usb/gadget/function/f_midi2.c | 21 +-
drivers/usb/gadget/function/u_audio.c | 42 +-
drivers/usb/gadget/function/u_serial.c | 1 +
drivers/usb/gadget/udc/core.c | 10 +-
drivers/usb/serial/ch341.c | 1 +
drivers/usb/serial/garmin_gps.c | 5 +-
drivers/usb/serial/mxuport.c | 1 +
drivers/usb/serial/navman.c | 1 +
drivers/usb/serial/qcaux.c | 1 +
drivers/usb/serial/spcp8x5.c | 10 -
drivers/usb/serial/symbolserial.c | 1 +
drivers/usb/serial/usb-serial-simple.c | 1 +
drivers/usb/serial/usb_debug.c | 8 +
drivers/usb/typec/mux/fsa4480.c | 14 +
drivers/usb/typec/tcpm/tcpci.c | 2 +-
drivers/usb/typec/tcpm/tcpm.c | 2 +-
drivers/usb/typec/tipd/core.c | 4 +-
drivers/usb/typec/ucsi/ucsi.c | 11 +-
drivers/usb/usbip/vhci_hcd.c | 9 +-
drivers/vdpa/octeon_ep/octep_vdpa_hw.c | 2 +-
drivers/vhost/vdpa.c | 8 +-
drivers/virtio/virtio.c | 28 +-
drivers/virtio/virtio_pci_common.c | 190 +-
drivers/virtio/virtio_pci_common.h | 16 +-
drivers/virtio/virtio_pci_modern.c | 159 +-
fs/bcachefs/acl.c | 11 +-
fs/bcachefs/acl.h | 2 +-
fs/bcachefs/alloc_background.h | 12 +-
fs/bcachefs/alloc_foreground.c | 34 +-
fs/bcachefs/alloc_foreground.h | 9 +-
fs/bcachefs/bcachefs.h | 2 +
fs/bcachefs/bcachefs_format.h | 5 +-
fs/bcachefs/btree_iter.c | 5 +
fs/bcachefs/btree_update_interior.c | 2 +-
fs/bcachefs/buckets.c | 12 +-
fs/bcachefs/buckets.h | 2 +-
fs/bcachefs/disk_accounting.c | 65 +-
fs/bcachefs/disk_accounting_format.h | 15 +-
fs/bcachefs/ec.c | 34 +-
fs/bcachefs/fs.c | 8 +-
fs/bcachefs/io_misc.c | 6 +-
fs/bcachefs/io_read.c | 1 +
fs/bcachefs/io_write.c | 5 +-
fs/bcachefs/opts.h | 5 +
fs/bcachefs/replicas.c | 1 -
fs/bcachefs/sb-downgrade.c | 27 +-
fs/bcachefs/sb-errors_format.h | 6 +-
fs/bcachefs/super-io.c | 4 +
fs/bcachefs/super.c | 1 -
fs/bcachefs/sysfs.c | 6 +-
fs/btrfs/block-group.c | 13 +-
fs/btrfs/ctree.h | 1 +
fs/btrfs/direct-io.c | 38 +-
fs/btrfs/extent-tree.c | 3 +-
fs/btrfs/extent_map.c | 2 +-
fs/btrfs/file.c | 22 +-
fs/btrfs/free-space-cache.c | 4 +-
fs/btrfs/inode.c | 28 +-
fs/btrfs/print-tree.c | 2 +-
fs/btrfs/scrub.c | 25 +-
fs/btrfs/space-info.c | 5 +-
fs/btrfs/space-info.h | 1 +
fs/btrfs/super.c | 5 +-
fs/btrfs/tests/extent-map-tests.c | 99 +
fs/btrfs/tree-checker.c | 49 +-
fs/ceph/caps.c | 35 +-
fs/ceph/super.h | 7 +-
fs/file.c | 1 +
fs/nfsd/nfsctl.c | 3 +-
fs/smb/client/cifs_debug.c | 2 +-
fs/smb/client/cifsfs.h | 4 +-
fs/smb/client/cifsglob.h | 36 +-
fs/smb/client/cifsproto.h | 2 -
fs/smb/client/inode.c | 17 +-
fs/smb/client/ioctl.c | 32 +-
fs/smb/client/misc.c | 65 +-
fs/smb/client/reparse.c | 4 +
fs/smb/client/reparse.h | 19 +-
fs/smb/client/smb2inode.c | 8 +-
fs/smb/client/smb2pdu.c | 3 +
fs/smb/client/smbdirect.c | 8 +-
fs/smb/client/trace.h | 51 +-
fs/smb/client/transport.c | 2 +-
fs/tracefs/event_inode.c | 4 +-
fs/tracefs/inode.c | 12 +-
fs/tracefs/internal.h | 5 +-
fs/xfs/libxfs/xfs_quota_defs.h | 2 +-
fs/xfs/libxfs/xfs_trans_resv.c | 28 +-
fs/xfs/scrub/agheader_repair.c | 2 +-
fs/xfs/scrub/parent.c | 2 +-
fs/xfs/scrub/trace.h | 10 +-
fs/xfs/xfs_attr_list.c | 2 +-
fs/xfs/xfs_trace.h | 10 +-
fs/xfs/xfs_xattr.c | 19 +-
include/asm-generic/vmlinux.lds.h | 11 +-
include/drm/drm_buddy.h | 2 +
include/linux/compiler.h | 9 +
include/linux/cpuhotplug.h | 2 +-
include/linux/cpumask.h | 2 +-
include/linux/ethtool.h | 10 +-
include/linux/i2c.h | 2 +-
include/linux/kvm_host.h | 9 +-
include/linux/minmax.h | 115 +-
include/linux/profile.h | 1 -
include/linux/ring_buffer.h | 1 -
include/linux/soundwire/sdw_intel.h | 8 +
include/linux/trace_events.h | 3 +-
include/linux/virtio.h | 3 +
include/linux/virtio_config.h | 4 -
include/linux/virtio_net.h | 16 +-
include/sound/cs35l56.h | 6 +-
include/sound/soc-acpi-intel-match.h | 2 +
include/sound/soc-acpi.h | 6 +-
include/sound/soc-dai.h | 6 +-
include/sound/soc-dpcm.h | 19 -
include/sound/soc.h | 7 +-
include/sound/soc_sdw_utils.h | 247 ++
include/sound/tas2563-tlv.h | 279 ++
include/sound/tas2781-tlv.h | 260 --
include/sound/tas2781.h | 71 +-
include/sound/ump_convert.h | 1 +
include/trace/events/btrfs.h | 8 +
include/trace/events/mptcp.h | 2 +-
include/uapi/asm-generic/unistd.h | 5 +-
include/ufs/ufshcd.h | 1 +
include/ufs/ufshci.h | 1 +
init/Kconfig | 1 +
io_uring/napi.c | 2 -
io_uring/net.c | 7 +-
io_uring/poll.c | 1 +
kernel/dma/debug.c | 5 +-
kernel/irq/irqdesc.c | 1 +
kernel/jump_label.c | 4 +-
kernel/kcov.c | 15 +-
kernel/kprobes.c | 4 +-
kernel/ksysfs.c | 7 +
kernel/locking/lockdep.c | 6 +
kernel/locking/qspinlock_paravirt.h | 2 +-
kernel/module/main.c | 41 +-
kernel/padata.c | 7 +
kernel/profile.c | 242 +-
kernel/sched/core.c | 68 +-
kernel/sched/cputime.c | 6 +
kernel/sched/stats.c | 10 -
kernel/task_work.c | 6 +
kernel/time/clocksource.c | 2 +-
kernel/time/ntp.c | 9 +-
kernel/time/tick-broadcast.c | 3 +-
kernel/time/timekeeping.c | 2 +-
kernel/trace/fgraph.c | 2 +-
kernel/trace/preemptirq_delay_test.c | 2 -
kernel/trace/ring_buffer.c | 12 -
kernel/trace/trace.h | 23 +
kernel/trace/trace_events.c | 41 +-
kernel/trace/trace_events_hist.c | 4 +-
kernel/trace/trace_events_inject.c | 2 +-
kernel/trace/trace_events_trigger.c | 6 +-
kernel/trace/tracing_map.c | 6 +-
lib/btree.c | 1 -
lib/decompress_unlzma.c | 2 +
lib/vsprintf.c | 2 +-
mm/list_lru.c | 28 +-
mm/memcontrol.c | 22 +-
mm/shmem.c | 14 +-
mm/slub.c | 3 +
mm/zsmalloc.c | 2 -
net/bluetooth/hci_core.c | 7 -
net/bluetooth/hci_event.c | 5 +-
net/bluetooth/hci_sync.c | 35 +
net/bluetooth/l2cap_core.c | 1 +
net/bridge/br_multicast.c | 4 +-
net/core/dev.c | 1 +
net/core/link_watch.c | 4 +-
net/core/rtnetlink.c | 2 +-
net/ethtool/ioctl.c | 61 +-
net/ethtool/rss.c | 8 +-
net/ipv4/netfilter/iptable_nat.c | 18 +-
net/ipv4/tcp_ao.c | 43 +-
net/ipv4/tcp_input.c | 23 +-
net/ipv4/tcp_offload.c | 3 +
net/ipv4/udp_offload.c | 4 +
net/ipv6/ndisc.c | 34 +-
net/ipv6/netfilter/ip6table_nat.c | 14 +-
net/iucv/af_iucv.c | 4 +-
net/l2tp/l2tp_core.c | 15 +-
net/mac80211/cfg.c | 7 +-
net/mac80211/tx.c | 5 +-
net/mac80211/util.c | 2 +-
net/mptcp/mib.c | 2 +
net/mptcp/mib.h | 2 +
net/mptcp/options.c | 5 +-
net/mptcp/pm.c | 12 +
net/mptcp/pm_netlink.c | 93 +-
net/mptcp/pm_userspace.c | 18 +
net/mptcp/protocol.c | 18 +-
net/mptcp/protocol.h | 4 +
net/mptcp/subflow.c | 26 +-
net/sched/act_ct.c | 4 +-
net/sctp/input.c | 19 +-
net/smc/af_smc.c | 7 +-
net/smc/smc_stats.h | 2 +-
net/sunrpc/svc.c | 2 +-
net/wireless/scan.c | 11 +-
net/wireless/sme.c | 1 +
rust/kernel/firmware.rs | 2 +-
scripts/syscall.tbl | 6 +-
sound/core/seq/seq_ports.h | 14 +-
sound/core/seq/seq_ump_convert.c | 132 +-
sound/core/ump_convert.c | 60 +-
sound/firewire/amdtp-stream.c | 38 +-
sound/firewire/amdtp-stream.h | 1 +
sound/hda/intel-dsp-config.c | 57 +-
sound/hda/intel-sdw-acpi.c | 5 +-
sound/pci/hda/cs35l41_hda.c | 13 -
sound/pci/hda/cs35l56_hda.c | 38 +-
sound/pci/hda/cs35l56_hda.h | 1 -
sound/pci/hda/hda_controller.h | 2 +-
sound/pci/hda/hda_generic.c | 63 +
sound/pci/hda/hda_generic.h | 1 +
sound/pci/hda/hda_intel.c | 10 +-
sound/pci/hda/patch_conexant.c | 56 +-
sound/pci/hda/patch_hdmi.c | 2 +
sound/pci/hda/patch_realtek.c | 2 +
sound/pci/hda/tas2781_hda_i2c.c | 2 +-
sound/soc/Kconfig | 2 +
sound/soc/Makefile | 1 +
sound/soc/adi/axi-i2s.c | 6 +-
sound/soc/adi/axi-spdif.c | 2 +-
sound/soc/amd/acp-config.c | 12 +
sound/soc/amd/acp-pcm-dma.c | 2 +-
sound/soc/amd/acp/Kconfig | 22 +
sound/soc/amd/acp/Makefile | 4 +
sound/soc/amd/acp/acp-i2s.c | 188 +-
sound/soc/amd/acp/acp-legacy-common.c | 40 +-
sound/soc/amd/acp/acp-legacy-mach.c | 7 -
sound/soc/amd/acp/acp-mach-common.c | 2 +-
sound/soc/amd/acp/acp-mach.h | 1 +
sound/soc/amd/acp/acp-pci.c | 4 +
sound/soc/amd/acp/acp-pdm.c | 7 +-
sound/soc/amd/acp/acp-platform.c | 117 +-
sound/soc/amd/acp/acp-rembrandt.c | 2 +-
sound/soc/amd/acp/acp-renoir.c | 2 +-
sound/soc/amd/acp/acp-sdw-sof-mach.c | 509 +++
sound/soc/amd/acp/acp-sof-mach.c | 7 -
sound/soc/amd/acp/acp63.c | 2 +-
sound/soc/amd/acp/acp70.c | 87 +-
sound/soc/amd/acp/amd-acp63-acpi-match.c | 90 +
sound/soc/amd/acp/amd.h | 27 +-
sound/soc/amd/acp/chip_offset_byte.h | 84 +-
sound/soc/amd/acp/soc_amd_sdw_common.h | 44 +
sound/soc/amd/mach-config.h | 2 +
sound/soc/amd/ps/ps-pdm-dma.c | 2 +-
sound/soc/amd/ps/ps-sdw-dma.c | 2 +-
sound/soc/amd/raven/acp3x-pcm-dma.c | 2 +-
sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +-
sound/soc/amd/vangogh/acp5x-pcm-dma.c | 2 +-
sound/soc/amd/yc/acp6x-pdm-dma.c | 2 +-
sound/soc/apple/mca.c | 2 +-
sound/soc/atmel/atmel-i2s.c | 2 +-
sound/soc/atmel/atmel_wm8904.c | 2 +-
sound/soc/atmel/mchp-i2s-mcc.c | 44 +-
sound/soc/atmel/mchp-pdmc.c | 99 +-
sound/soc/atmel/mchp-spdifrx.c | 2 +-
sound/soc/atmel/mchp-spdiftx.c | 2 +-
sound/soc/atmel/sam9g20_wm8731.c | 2 +-
sound/soc/atmel/sam9x5_wm8731.c | 2 +-
sound/soc/atmel/tse850-pcm5142.c | 2 +-
sound/soc/au1x/ac97c.c | 2 +-
sound/soc/au1x/i2sc.c | 2 +-
sound/soc/au1x/psc-ac97.c | 2 +-
sound/soc/au1x/psc-i2s.c | 2 +-
sound/soc/bcm/bcm63xx-i2s-whistler.c | 2 +-
sound/soc/bcm/cygnus-ssp.c | 2 +-
sound/soc/cirrus/edb93xx.c | 2 +-
sound/soc/cirrus/ep93xx-i2s.c | 2 +-
sound/soc/codecs/Kconfig | 7 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/ak4613.c | 4 +-
sound/soc/codecs/cs-amp-lib-test.c | 44 +
sound/soc/codecs/cs35l56-shared.c | 25 +-
sound/soc/codecs/cs42l42-sdw.c | 12 +-
sound/soc/codecs/cs42l43.c | 2 +-
sound/soc/codecs/cs43130.c | 113 +-
sound/soc/codecs/cs47l15.c | 2 +-
sound/soc/codecs/cs47l24.c | 2 +-
sound/soc/codecs/cs47l35.c | 2 +-
sound/soc/codecs/cs47l85.c | 2 +-
sound/soc/codecs/cs47l90.c | 2 +-
sound/soc/codecs/cs47l92.c | 2 +-
sound/soc/codecs/es8326.c | 6 +-
sound/soc/codecs/inno_rk3036.c | 2 +-
sound/soc/codecs/lpass-rx-macro.c | 2 +-
sound/soc/codecs/lpass-tx-macro.c | 2 +-
sound/soc/codecs/lpass-va-macro.c | 2 +-
sound/soc/codecs/lpass-wsa-macro.c | 27 +-
sound/soc/codecs/msm8916-wcd-digital.c | 2 +-
sound/soc/codecs/mt6357.c | 1855 ++++++++++
sound/soc/codecs/mt6357.h | 660 ++++
sound/soc/codecs/peb2466.c | 14 +-
sound/soc/codecs/rk817_codec.c | 2 +-
sound/soc/codecs/rt1318.c | 3 +-
sound/soc/codecs/rt1320-sdw.c | 2147 +++++++++++-
sound/soc/codecs/rt1320-sdw.h | 3 +
sound/soc/codecs/rt5682.c | 4 +-
sound/soc/codecs/rt5682s.c | 4 +-
sound/soc/codecs/sti-sas.c | 21 +-
sound/soc/codecs/tas2552.c | 1 -
sound/soc/codecs/tas2764.c | 1 -
sound/soc/codecs/tas2770.c | 1 -
sound/soc/codecs/tas2780.c | 1 -
sound/soc/codecs/tas2781-comlib.c | 35 +-
sound/soc/codecs/tas2781-fmwlib.c | 61 +-
sound/soc/codecs/tas2781-i2c.c | 953 +++++-
sound/soc/codecs/tas5086.c | 9 +-
sound/soc/codecs/tlv320aic31xx.c | 102 +-
sound/soc/codecs/tlv320aic32x4.c | 9 +
sound/soc/codecs/wcd934x.c | 4 +-
sound/soc/codecs/wcd937x.c | 2 +-
sound/soc/codecs/wcd937x.h | 34 +-
sound/soc/codecs/wcd938x.c | 20 +-
sound/soc/codecs/wcd938x.h | 4 +-
sound/soc/codecs/wcd939x.c | 2 +-
sound/soc/codecs/wcd939x.h | 6 +-
sound/soc/codecs/wm5102.c | 2 +-
sound/soc/codecs/wm5110.c | 2 +-
sound/soc/codecs/wm8994.c | 2 +-
sound/soc/codecs/wm8997.c | 2 +-
sound/soc/codecs/wm8998.c | 2 +-
sound/soc/codecs/wsa881x.c | 44 +-
sound/soc/codecs/wsa883x.c | 75 +-
sound/soc/codecs/wsa884x.c | 240 +-
sound/soc/dwc/dwc-i2s.c | 18 +-
sound/soc/fsl/fsl_asrc.c | 2 +-
sound/soc/fsl/fsl_aud2htx.c | 2 +-
sound/soc/fsl/fsl_audmix.c | 14 +-
sound/soc/fsl/fsl_dma.c | 2 +-
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/fsl/fsl_esai.c | 2 +-
sound/soc/fsl/fsl_micfil.c | 2 +-
sound/soc/fsl/fsl_mqs.c | 13 +-
sound/soc/fsl/fsl_rpmsg.c | 11 +-
sound/soc/fsl/fsl_sai.c | 2 +-
sound/soc/fsl/fsl_spdif.c | 13 +-
sound/soc/fsl/fsl_ssi.c | 8 +-
sound/soc/fsl/fsl_xcvr.c | 2 +-
sound/soc/fsl/imx-audmux.c | 8 +-
sound/soc/fsl/imx-card.c | 3 -
sound/soc/fsl/imx-pcm-rpmsg.c | 16 +-
sound/soc/fsl/imx-sgtl5000.c | 2 +-
sound/soc/fsl/lpc3xxx-i2s.c | 11 +-
sound/soc/fsl/lpc3xxx-pcm.c | 2 +-
sound/soc/fsl/mpc5200_psc_ac97.c | 2 +-
sound/soc/fsl/mpc5200_psc_i2s.c | 4 +-
sound/soc/fsl/p1022_ds.c | 2 +-
sound/soc/fsl/p1022_rdk.c | 2 +-
sound/soc/fsl/pcm030-audio-fabric.c | 2 +-
sound/soc/generic/audio-graph-card.c | 16 +-
.../soc/generic/audio-graph-card2-custom-sample.c | 2 +-
sound/soc/generic/audio-graph-card2.c | 15 +-
sound/soc/generic/simple-card.c | 4 +-
sound/soc/generic/test-component.c | 11 +-
sound/soc/img/img-i2s-in.c | 2 +-
sound/soc/img/img-i2s-out.c | 2 +-
sound/soc/img/img-parallel-out.c | 2 +-
sound/soc/img/img-spdif-in.c | 2 +-
sound/soc/img/img-spdif-out.c | 2 +-
sound/soc/img/pistachio-internal-dac.c | 2 +-
sound/soc/intel/Kconfig | 120 -
sound/soc/intel/Makefile | 1 -
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +-
sound/soc/intel/atom/sst/sst_acpi.c | 2 +-
sound/soc/intel/avs/core.c | 8 +-
sound/soc/intel/boards/Kconfig | 156 +-
sound/soc/intel/boards/Makefile | 31 +-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 720 ----
sound/soc/intel/boards/bxt_rt298.c | 670 ----
sound/soc/intel/boards/bytcht_cx2072x.c | 4 +
sound/soc/intel/boards/bytcht_da7213.c | 4 +
sound/soc/intel/boards/bytcht_es8316.c | 4 +-
sound/soc/intel/boards/bytcr_rt5640.c | 4 +-
sound/soc/intel/boards/bytcr_rt5651.c | 4 +-
sound/soc/intel/boards/bytcr_wm5102.c | 2 +-
sound/soc/intel/boards/cht_bsw_max98090_ti.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5645.c | 4 +
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +
sound/soc/intel/boards/ehl_rt5660.c | 3 +-
sound/soc/intel/boards/kbl_da7219_max98357a.c | 688 ----
sound/soc/intel/boards/kbl_da7219_max98927.c | 1175 -------
sound/soc/intel/boards/kbl_rt5660.c | 567 ---
sound/soc/intel/boards/kbl_rt5663_max98927.c | 1073 ------
.../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 869 -----
sound/soc/intel/boards/skl_hda_dsp_common.c | 168 -
sound/soc/intel/boards/skl_hda_dsp_common.h | 67 -
sound/soc/intel/boards/skl_hda_dsp_generic.c | 242 +-
sound/soc/intel/boards/skl_nau88l25_max98357a.c | 704 ----
sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 751 ----
sound/soc/intel/boards/skl_rt286.c | 568 ---
sound/soc/intel/boards/sof_board_helpers.c | 152 +
sound/soc/intel/boards/sof_board_helpers.h | 3 +
sound/soc/intel/boards/sof_es8336.c | 14 +-
sound/soc/intel/boards/sof_pcm512x.c | 5 +-
sound/soc/intel/boards/sof_rt5682.c | 7 +
sound/soc/intel/boards/sof_sdw.c | 1384 +-------
sound/soc/intel/boards/sof_sdw_common.h | 172 +-
sound/soc/intel/boards/sof_sdw_hdmi.c | 16 +-
sound/soc/intel/boards/sof_ssp_amp.c | 6 +
sound/soc/intel/boards/sof_wm8804.c | 6 +-
sound/soc/intel/catpt/device.c | 2 +-
sound/soc/intel/common/Makefile | 1 +
sound/soc/intel/common/soc-acpi-intel-adl-match.c | 105 +
sound/soc/intel/common/soc-acpi-intel-arl-match.c | 263 ++
sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 6 -
sound/soc/intel/common/soc-acpi-intel-ehl-match.c | 1 -
sound/soc/intel/common/soc-acpi-intel-hda-match.c | 18 +-
sound/soc/intel/common/soc-acpi-intel-icl-match.c | 6 -
sound/soc/intel/common/soc-acpi-intel-kbl-match.c | 11 -
sound/soc/intel/common/soc-acpi-intel-lnl-match.c | 104 +
sound/soc/intel/common/soc-acpi-intel-ptl-match.c | 145 +
sound/soc/intel/common/soc-acpi-intel-skl-match.c | 5 -
sound/soc/intel/skylake/Makefile | 15 -
sound/soc/intel/skylake/bxt-sst.c | 629 ----
sound/soc/intel/skylake/cnl-sst-dsp.c | 266 --
sound/soc/intel/skylake/cnl-sst-dsp.h | 103 -
sound/soc/intel/skylake/cnl-sst.c | 508 ---
sound/soc/intel/skylake/skl-debug.c | 248 --
sound/soc/intel/skylake/skl-i2s.h | 87 -
sound/soc/intel/skylake/skl-messages.c | 1419 --------
sound/soc/intel/skylake/skl-nhlt.c | 269 --
sound/soc/intel/skylake/skl-pcm.c | 1507 --------
sound/soc/intel/skylake/skl-ssp-clk.c | 428 ---
sound/soc/intel/skylake/skl-ssp-clk.h | 108 -
sound/soc/intel/skylake/skl-sst-cldma.c | 373 --
sound/soc/intel/skylake/skl-sst-cldma.h | 243 --
sound/soc/intel/skylake/skl-sst-dsp.c | 462 ---
sound/soc/intel/skylake/skl-sst-dsp.h | 256 --
sound/soc/intel/skylake/skl-sst-ipc.c | 1071 ------
sound/soc/intel/skylake/skl-sst-ipc.h | 169 -
sound/soc/intel/skylake/skl-sst-utils.c | 425 ---
sound/soc/intel/skylake/skl-sst.c | 599 ----
sound/soc/intel/skylake/skl-topology.c | 3605 --------------------
sound/soc/intel/skylake/skl-topology.h | 524 ---
sound/soc/intel/skylake/skl.c | 1177 -------
sound/soc/intel/skylake/skl.h | 207 --
sound/soc/kirkwood/kirkwood-i2s.c | 2 +-
sound/soc/loongson/loongson_card.c | 125 +-
sound/soc/loongson/loongson_dma.c | 25 +-
sound/soc/loongson/loongson_i2s.c | 115 +-
sound/soc/loongson/loongson_i2s.h | 24 +-
sound/soc/loongson/loongson_i2s_pci.c | 51 +-
sound/soc/mediatek/Kconfig | 20 +
sound/soc/mediatek/Makefile | 1 +
sound/soc/mediatek/common/mtk-btcvsd.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-cs42448.c | 16 +-
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 2 +-
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 9 +-
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 2 +-
.../mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 4 +-
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8365/Makefile | 15 +
sound/soc/mediatek/mt8365/mt8365-afe-clk.c | 421 +++
sound/soc/mediatek/mt8365/mt8365-afe-clk.h | 32 +
sound/soc/mediatek/mt8365/mt8365-afe-common.h | 448 +++
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 2274 ++++++++++++
sound/soc/mediatek/mt8365/mt8365-dai-adda.c | 311 ++
sound/soc/mediatek/mt8365/mt8365-dai-dmic.c | 310 ++
sound/soc/mediatek/mt8365/mt8365-dai-i2s.c | 846 +++++
sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 293 ++
sound/soc/mediatek/mt8365/mt8365-mt6357.c | 343 ++
sound/soc/mediatek/mt8365/mt8365-reg.h | 993 ++++++
sound/soc/meson/aiu-fifo.h | 2 -
sound/soc/meson/aiu.c | 2 +-
sound/soc/meson/axg-card.c | 13 +-
sound/soc/meson/gx-card.c | 3 +-
sound/soc/meson/meson-card-utils.c | 4 +-
sound/soc/mxs/mxs-sgtl5000.c | 2 +-
sound/soc/pxa/mmp-sspa.c | 2 +-
sound/soc/pxa/pxa2xx-ac97.c | 2 +-
sound/soc/qcom/common.c | 1 -
sound/soc/qcom/lpass-apq8016.c | 2 +-
sound/soc/qcom/lpass-ipq806x.c | 2 +-
sound/soc/qcom/lpass-sc7180.c | 2 +-
sound/soc/qcom/lpass-sc7280.c | 2 +-
sound/soc/qcom/qdsp6/q6routing.c | 2 +-
sound/soc/qcom/sm8250.c | 8 +
sound/soc/rockchip/rockchip_i2s.c | 2 +-
sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
sound/soc/rockchip/rockchip_pdm.c | 2 +-
sound/soc/rockchip/rockchip_rt5645.c | 2 +-
sound/soc/rockchip/rockchip_spdif.c | 2 +-
sound/soc/samsung/arndale.c | 2 +-
sound/soc/samsung/i2s.c | 2 +-
sound/soc/samsung/odroid.c | 2 +-
sound/soc/samsung/pcm.c | 2 +-
sound/soc/samsung/snow.c | 2 +-
sound/soc/samsung/spdif.c | 2 +-
sound/soc/sdw_utils/Kconfig | 6 +
sound/soc/sdw_utils/Makefile | 11 +
.../soc_sdw_bridge_cs35l56.c} | 56 +-
.../soc_sdw_cs42l42.c} | 13 +-
.../soc_sdw_cs42l43.c} | 38 +-
.../soc_sdw_cs_amp.c} | 18 +-
.../sof_sdw_dmic.c => sdw_utils/soc_sdw_dmic.c} | 10 +-
.../sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} | 56 +-
.../soc_sdw_rt5682.c} | 12 +-
.../sof_sdw_rt700.c => sdw_utils/soc_sdw_rt700.c} | 12 +-
.../sof_sdw_rt711.c => sdw_utils/soc_sdw_rt711.c} | 38 +-
.../soc_sdw_rt712_sdca.c} | 10 +-
.../soc_sdw_rt722_sdca.c} | 10 +-
.../soc_sdw_rt_amp.c} | 43 +-
.../soc_sdw_rt_amp_coeff_tables.h} | 6 +-
.../soc_sdw_rt_dmic.c} | 11 +-
.../soc_sdw_rt_sdca_jack_common.c} | 40 +-
sound/soc/sdw_utils/soc_sdw_utils.c | 1170 +++++++
sound/soc/sh/Kconfig | 1 +
sound/soc/sh/fsi.c | 2 +-
sound/soc/sh/hac.c | 2 +-
sound/soc/sh/rcar/adg.c | 4 +-
sound/soc/sh/rcar/core.c | 19 +-
sound/soc/sh/rcar/dma.c | 75 +-
sound/soc/sh/rcar/rsnd.h | 10 -
sound/soc/sh/rcar/ssi.c | 2 +-
sound/soc/sh/rz-ssi.c | 259 +-
sound/soc/sh/siu_dai.c | 2 +-
sound/soc/soc-ac97.c | 4 +-
sound/soc/soc-core.c | 21 +-
sound/soc/soc-dai.c | 58 -
sound/soc/soc-dapm.c | 5 +-
sound/soc/soc-pcm.c | 362 +-
sound/soc/soc-topology-test.c | 132 +-
sound/soc/soc-topology.c | 9 +-
sound/soc/sof/amd/Kconfig | 11 +
sound/soc/sof/amd/Makefile | 4 +-
sound/soc/sof/amd/acp-common.c | 3 +
sound/soc/sof/amd/acp-dsp-offset.h | 24 +-
sound/soc/sof/amd/acp-loader.c | 2 +-
sound/soc/sof/amd/acp.c | 88 +-
sound/soc/sof/amd/acp.h | 11 +-
sound/soc/sof/amd/acp70.c | 142 +
sound/soc/sof/amd/pci-acp63.c | 2 +-
sound/soc/sof/amd/pci-acp70.c | 112 +
sound/soc/sof/amd/pci-rmb.c | 1 -
sound/soc/sof/amd/pci-rn.c | 1 -
sound/soc/sof/amd/pci-vangogh.c | 1 -
sound/soc/sof/imx/imx8.c | 2 +-
sound/soc/sof/imx/imx8m.c | 2 +-
sound/soc/sof/imx/imx8ulp.c | 2 +-
sound/soc/sof/intel/Kconfig | 17 +
sound/soc/sof/intel/Makefile | 2 +
sound/soc/sof/intel/bdw.c | 2 +-
sound/soc/sof/intel/byt.c | 2 +-
sound/soc/sof/intel/hda-dsp.c | 1 +
sound/soc/sof/intel/hda-stream.c | 4 +-
sound/soc/sof/intel/hda.c | 282 +-
sound/soc/sof/intel/hda.h | 1 +
sound/soc/sof/intel/lnl.c | 27 +
sound/soc/sof/intel/mtl.c | 16 +-
sound/soc/sof/intel/mtl.h | 2 +
sound/soc/sof/intel/pci-ptl.c | 77 +
sound/soc/sof/intel/shim.h | 1 +
sound/soc/sof/mediatek/mt8186/mt8186.c | 2 +-
sound/soc/sof/mediatek/mt8195/mt8195.c | 2 +-
sound/soc/sof/pcm.c | 2 +-
sound/soc/sof/sof-audio.h | 8 +-
sound/soc/sof/sof-priv.h | 16 +-
sound/soc/sof/topology.c | 8 +-
sound/soc/sprd/sprd-mcdt.c | 2 +-
sound/soc/starfive/jh7110_pwmdac.c | 2 +-
sound/soc/starfive/jh7110_tdm.c | 2 +-
sound/soc/stm/stm32_adfsdm.c | 2 +-
sound/soc/stm/stm32_i2s.c | 6 +-
sound/soc/stm/stm32_sai_sub.c | 2 +-
sound/soc/stm/stm32_spdifrx.c | 2 +-
sound/soc/sunxi/sun4i-codec.c | 2 +-
sound/soc/sunxi/sun4i-i2s.c | 2 +-
sound/soc/sunxi/sun4i-spdif.c | 2 +-
sound/soc/sunxi/sun50i-dmic.c | 2 +-
sound/soc/sunxi/sun8i-codec.c | 2 +-
sound/soc/tegra/tegra186_asrc.c | 2 +-
sound/soc/tegra/tegra186_dspk.c | 2 +-
sound/soc/tegra/tegra20_ac97.c | 2 +-
sound/soc/tegra/tegra20_i2s.c | 2 +-
sound/soc/tegra/tegra210_admaif.c | 2 +-
sound/soc/tegra/tegra210_adx.c | 2 +-
sound/soc/tegra/tegra210_ahub.c | 2 +-
sound/soc/tegra/tegra210_amx.c | 2 +-
sound/soc/tegra/tegra210_dmic.c | 2 +-
sound/soc/tegra/tegra210_i2s.c | 18 +-
sound/soc/tegra/tegra210_mixer.c | 2 +-
sound/soc/tegra/tegra210_mvc.c | 2 +-
sound/soc/tegra/tegra210_ope.c | 2 +-
sound/soc/tegra/tegra210_sfc.c | 2 +-
sound/soc/tegra/tegra30_ahub.c | 2 +-
sound/soc/tegra/tegra30_i2s.c | 2 +-
sound/soc/tegra/tegra_audio_graph_card.c | 2 +-
sound/soc/tegra/tegra_pcm.c | 2 +-
sound/soc/ti/ams-delta.c | 2 +-
sound/soc/ti/davinci-i2s.c | 2 +-
sound/soc/ti/davinci-mcasp.c | 2 +-
sound/soc/ti/omap-mcbsp.c | 2 +-
sound/soc/uniphier/aio-ld11.c | 2 +-
sound/soc/uniphier/aio-pxs2.c | 2 +-
sound/soc/uniphier/evea.c | 2 +-
sound/soc/ux500/mop500.c | 2 +-
sound/soc/ux500/ux500_msp_dai.c | 2 +-
sound/soc/xilinx/xlnx_formatter_pcm.c | 2 +-
sound/soc/xilinx/xlnx_spdif.c | 2 +-
sound/soc/xtensa/xtfpga-i2s.c | 2 +-
sound/usb/line6/driver.c | 5 +
sound/usb/quirks-table.h | 4 +
sound/usb/stream.c | 4 +-
tools/build/feature/Makefile | 53 +-
tools/perf/Documentation/Build.txt | 28 +
tools/perf/Makefile.config | 20 +-
tools/perf/Makefile.perf | 27 +-
.../pmu-events/arch/riscv/andes/ax45/firmware.json | 2 +-
.../pmu-events/arch/riscv/riscv-sbi-firmware.json | 2 +-
.../pmu-events/arch/riscv/sifive/u74/firmware.json | 2 +-
.../arch/riscv/starfive/dubhe-80/firmware.json | 2 +-
.../arch/riscv/thead/c900-legacy/firmware.json | 2 +-
tools/perf/util/callchain.c | 2 +-
tools/sound/dapm-graph | 44 +-
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/prog_tests/uprobe_syscall.c | 4 +-
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 4 +-
tools/testing/selftests/drivers/net/hw/rss_ctx.py | 37 +-
tools/testing/selftests/hid/hid_bpf.c | 26 +
tools/testing/selftests/hid/progs/hid.c | 2 +-
.../testing/selftests/hid/progs/hid_bpf_helpers.h | 2 +-
tools/testing/selftests/kselftest/ksft.py | 2 +-
tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 +-
tools/testing/selftests/mm/Makefile | 2 +-
tools/testing/selftests/mm/mremap_test.c | 2 +
tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +-
tools/testing/selftests/net/mptcp/mptcp_join.sh | 158 +-
tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +
virt/kvm/Kconfig | 4 +-
virt/kvm/guest_memfd.c | 227 +-
virt/kvm/kvm_main.c | 49 +-
984 files changed, 25292 insertions(+), 30662 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/cirrus,cs4271.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/cs4271.txt
delete mode 100644 Documentation/devicetree/bindings/sound/da7213.txt
create mode 100644 Documentation/devicetree/bindings/sound/dlg,da7213.yaml
create mode 100644 Documentation/devicetree/bindings/sound/fsl,imx-audio-es8328.yaml
create mode 100644 Documentation/devicetree/bindings/sound/fsl,saif.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/imx-audio-es8328.txt
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8365-afe.yaml
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8365-mt6357.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/mxs-saif.txt
delete mode 100644 Documentation/devicetree/bindings/sound/pcm512x.txt
create mode 100644 Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,pcm512x.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,tlv320dac3100.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,tpa6130a2.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
delete mode 100644 Documentation/devicetree/bindings/sound/tpa6130a2.txt
delete mode 100644 arch/s390/kernel/alternative.h
create mode 100644 include/sound/soc_sdw_utils.h
create mode 100644 include/sound/tas2563-tlv.h
create mode 100644 sound/soc/amd/acp/acp-sdw-sof-mach.c
create mode 100644 sound/soc/amd/acp/amd-acp63-acpi-match.c
create mode 100644 sound/soc/amd/acp/soc_amd_sdw_common.h
create mode 100644 sound/soc/codecs/mt6357.c
create mode 100644 sound/soc/codecs/mt6357.h
delete mode 100644 sound/soc/intel/boards/bxt_da7219_max98357a.c
delete mode 100644 sound/soc/intel/boards/bxt_rt298.c
delete mode 100644 sound/soc/intel/boards/kbl_da7219_max98357a.c
delete mode 100644 sound/soc/intel/boards/kbl_da7219_max98927.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5660.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5663_max98927.c
delete mode 100644 sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
delete mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c
delete mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h
delete mode 100644 sound/soc/intel/boards/skl_nau88l25_max98357a.c
delete mode 100644 sound/soc/intel/boards/skl_nau88l25_ssm4567.c
delete mode 100644 sound/soc/intel/boards/skl_rt286.c
create mode 100644 sound/soc/intel/common/soc-acpi-intel-ptl-match.c
delete mode 100644 sound/soc/intel/skylake/Makefile
delete mode 100644 sound/soc/intel/skylake/bxt-sst.c
delete mode 100644 sound/soc/intel/skylake/cnl-sst-dsp.c
delete mode 100644 sound/soc/intel/skylake/cnl-sst-dsp.h
delete mode 100644 sound/soc/intel/skylake/cnl-sst.c
delete mode 100644 sound/soc/intel/skylake/skl-debug.c
delete mode 100644 sound/soc/intel/skylake/skl-i2s.h
delete mode 100644 sound/soc/intel/skylake/skl-messages.c
delete mode 100644 sound/soc/intel/skylake/skl-nhlt.c
delete mode 100644 sound/soc/intel/skylake/skl-pcm.c
delete mode 100644 sound/soc/intel/skylake/skl-ssp-clk.c
delete mode 100644 sound/soc/intel/skylake/skl-ssp-clk.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-cldma.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-cldma.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-dsp.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-dsp.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-ipc.c
delete mode 100644 sound/soc/intel/skylake/skl-sst-ipc.h
delete mode 100644 sound/soc/intel/skylake/skl-sst-utils.c
delete mode 100644 sound/soc/intel/skylake/skl-sst.c
delete mode 100644 sound/soc/intel/skylake/skl-topology.c
delete mode 100644 sound/soc/intel/skylake/skl-topology.h
delete mode 100644 sound/soc/intel/skylake/skl.c
delete mode 100644 sound/soc/intel/skylake/skl.h
create mode 100644 sound/soc/mediatek/mt8365/Makefile
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-clk.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-clk.h
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-common.h
create mode 100644 sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-adda.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-dmic.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-i2s.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-dai-pcm.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-mt6357.c
create mode 100644 sound/soc/mediatek/mt8365/mt8365-reg.h
create mode 100644 sound/soc/sdw_utils/Kconfig
create mode 100644 sound/soc/sdw_utils/Makefile
rename sound/soc/{intel/boards/bridge_cs35l56.c => sdw_utils/soc_sdw_bridge_cs35l56.c} (63%)
rename sound/soc/{intel/boards/sof_sdw_cs42l42.c => sdw_utils/soc_sdw_cs42l42.c} (82%)
rename sound/soc/{intel/boards/sof_sdw_cs42l43.c => sdw_utils/soc_sdw_cs42l43.c} (73%)
rename sound/soc/{intel/boards/sof_sdw_cs_amp.c => sdw_utils/soc_sdw_cs_amp.c} (66%)
rename sound/soc/{intel/boards/sof_sdw_dmic.c => sdw_utils/soc_sdw_dmic.c} (71%)
rename sound/soc/{intel/boards/sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} (63%)
rename sound/soc/{intel/boards/sof_sdw_rt5682.c => sdw_utils/soc_sdw_rt5682.c} (82%)
rename sound/soc/{intel/boards/sof_sdw_rt700.c => sdw_utils/soc_sdw_rt700.c} (81%)
rename sound/soc/{intel/boards/sof_sdw_rt711.c => sdw_utils/soc_sdw_rt711.c} (70%)
rename sound/soc/{intel/boards/sof_sdw_rt712_sdca.c => sdw_utils/soc_sdw_rt712_sdca.c} (74%)
rename sound/soc/{intel/boards/sof_sdw_rt722_sdca.c => sdw_utils/soc_sdw_rt722_sdca.c} (68%)
rename sound/soc/{intel/boards/sof_sdw_rt_amp.c => sdw_utils/soc_sdw_rt_amp.c} (84%)
rename sound/soc/{intel/boards/sof_sdw_amp_coeff_tables.h => sdw_utils/soc_sdw_rt_amp_coeff_tables.h} (97%)
rename sound/soc/{intel/boards/sof_sdw_rt_dmic.c => sdw_utils/soc_sdw_rt_dmic.c} (70%)
rename sound/soc/{intel/boards/sof_sdw_rt_sdca_jack_common.c => sdw_utils/soc_sdw_rt_sdca_jack_common.c} (78%)
create mode 100644 sound/soc/sdw_utils/soc_sdw_utils.c
create mode 100644 sound/soc/sof/amd/acp70.c
create mode 100644 sound/soc/sof/amd/pci-acp70.c
create mode 100644 sound/soc/sof/intel/pci-ptl.c
2
1
The following changes since commit 77212f300bfd6fb3edaabd1daf863cabb521854a:
ASoC: codecs: lpass-va-macro: set the default codec version for sm8250 (2024-08-30 13:54:24 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/asoc-fix-v6.11-rc7
for you to fetch changes up to 4f9a71435953f941969a4f017e2357db62d85a86:
ASoC: meson: axg-card: fix 'use-after-free' (2024-09-11 16:16:34 +0100)
----------------------------------------------------------------
ASoC: Fixes for v6.11
A few last minute fixes, plus an update for Pierre's contact details and
status. It'd be good to get these into v6.11 (especially the
MAINTAINERS update) but it wouldn't be the end of the world if they
waited for the merge window, none of them are super remarkable and it's
just a question of timing that they're last minute.
----------------------------------------------------------------
Arseniy Krasnov (1):
ASoC: meson: axg-card: fix 'use-after-free'
Bard Liao (2):
ASoC: Intel: soc-acpi-intel-lnl-match: add missing empty item
ASoC: Intel: soc-acpi-intel-mtl-match: add missing empty item
Pierre-Louis Bossart (1):
MAINTAINERS: update Pierre Bossart's email and role
Shenghao Ding (1):
ASoC: tas2781: fix to save the dsp bin file name into the correct array in case name_prefix is not NULL
Su Hui (1):
ASoC: codecs: avoid possible garbage value in peb2466_reg_read()
.mailmap | 1 +
MAINTAINERS | 6 +++---
sound/soc/codecs/peb2466.c | 3 ++-
sound/soc/codecs/tas2781-i2c.c | 2 +-
sound/soc/intel/common/soc-acpi-intel-lnl-match.c | 1 +
sound/soc/intel/common/soc-acpi-intel-mtl-match.c | 1 +
sound/soc/meson/axg-card.c | 3 ++-
7 files changed, 11 insertions(+), 6 deletions(-)
2
1

13 Sep '24
Add calibration related kcontrol for speaker impedance calibration and
speaker leakage check for Chromebook.
Signed-off-by: Shenghao Ding <shenghao-ding(a)ti.com>
---
v3:
- Add missing grammatical period
- Refer to the functions as func() in comments.
- Create a macro for calibration register setting to reduce the line
- | Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409030627.SFdj22Xs-lkp@intel.com/
v2:
- Add channel no into the log for error debug
- | Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://urldefense.com/v3/__https://lore.kernel.org/oe-kbuild-all/202407131…
- renamae tasdevice_chn_switch to put it in a single line
- With inverted check this entire function becomes neater in
tasdev_chn_switch.
- Add registers for TAS2563 and TAS2781 calibration.
- Add cali_data_backup for regsiter restore after calibration.
- Add is_user_space_calidata to store the flag where the calibrated
from, user space or bin file from driver parsing.
- tasdevice_chn_switch for chip switch among multiple chips(tas2563
or tas2781)
- Add loading the calibrated values from user space in
tasdev_load_calibrated_data
- Correct no dsp no work, it can still work in bypass mode.
- Add calibrated register setting for tas2563&tas2781.
- Define tas2781_cali_control and tas2563_cali_control for calibration
---
include/sound/tas2781.h | 68 +++
sound/soc/codecs/tas2781-comlib.c | 26 +
sound/soc/codecs/tas2781-fmwlib.c | 60 +-
sound/soc/codecs/tas2781-i2c.c | 887 +++++++++++++++++++++++++++++-
4 files changed, 1030 insertions(+), 11 deletions(-)
diff --git a/include/sound/tas2781.h b/include/sound/tas2781.h
index dbda552398b5..8cd6da0480b7 100644
--- a/include/sound/tas2781.h
+++ b/include/sound/tas2781.h
@@ -49,12 +49,59 @@
/*I2C Checksum */
#define TASDEVICE_I2CChecksum TASDEVICE_REG(0x0, 0x0, 0x7E)
+/* XM_340 */
+#define TASDEVICE_XM_A1_REG TASDEVICE_REG(0x64, 0x63, 0x3c)
+/* XM_341 */
+#define TASDEVICE_XM_A2_REG TASDEVICE_REG(0x64, 0x63, 0x38)
+
/* Volume control */
#define TAS2563_DVC_LVL TASDEVICE_REG(0x00, 0x02, 0x0C)
#define TAS2781_DVC_LVL TASDEVICE_REG(0x0, 0x0, 0x1A)
#define TAS2781_AMP_LEVEL TASDEVICE_REG(0x0, 0x0, 0x03)
#define TAS2781_AMP_LEVEL_MASK GENMASK(5, 1)
+#define TAS2563_IDLE TASDEVICE_REG(0x00, 0x00, 0x3e)
+#define TAS2563_PRM_R0_REG TASDEVICE_REG(0x00, 0x0f, 0x34)
+
+#define TAS2563_RUNTIME_RE_REG_TF TASDEVICE_REG(0x64, 0x02, 0x70)
+#define TAS2563_RUNTIME_RE_REG TASDEVICE_REG(0x64, 0x02, 0x48)
+
+#define TAS2563_PRM_ENFF_REG TASDEVICE_REG(0x00, 0x0d, 0x54)
+#define TAS2563_PRM_DISTCK_REG TASDEVICE_REG(0x00, 0x0d, 0x58)
+#define TAS2563_PRM_TE_SCTHR_REG TASDEVICE_REG(0x00, 0x0f, 0x60)
+#define TAS2563_PRM_PLT_FLAG_REG TASDEVICE_REG(0x00, 0x0d, 0x74)
+#define TAS2563_PRM_SINEGAIN_REG TASDEVICE_REG(0x00, 0x0d, 0x7c)
+/* prm_Int_B0 */
+#define TAS2563_TE_TA1_REG TASDEVICE_REG(0x00, 0x10, 0x0c)
+/* prm_Int_A1 */
+#define TAS2563_TE_TA1_AT_REG TASDEVICE_REG(0x00, 0x10, 0x10)
+/* prm_TE_Beta */
+#define TAS2563_TE_TA2_REG TASDEVICE_REG(0x00, 0x0f, 0x64)
+/* prm_TE_Beta1 */
+#define TAS2563_TE_AT_REG TASDEVICE_REG(0x00, 0x0f, 0x68)
+/* prm_TE_1_Beta1 */
+#define TAS2563_TE_DT_REG TASDEVICE_REG(0x00, 0x0f, 0x70)
+
+#define TAS2781_PRM_INT_MASK_REG TASDEVICE_REG(0x00, 0x00, 0x3b)
+#define TAS2781_PRM_CLK_CFG_REG TASDEVICE_REG(0x00, 0x00, 0x5c)
+#define TAS2781_PRM_RSVD_REG TASDEVICE_REG(0x00, 0x01, 0x19)
+#define TAS2781_PRM_TEST_57_REG TASDEVICE_REG(0x00, 0xfd, 0x39)
+#define TAS2781_PRM_TEST_62_REG TASDEVICE_REG(0x00, 0xfd, 0x3e)
+#define TAS2781_PRM_PVDD_UVLO_REG TASDEVICE_REG(0x00, 0x00, 0x71)
+#define TAS2781_PRM_CHNL_0_REG TASDEVICE_REG(0x00, 0x00, 0x03)
+#define TAS2781_PRM_NG_CFG0_REG TASDEVICE_REG(0x00, 0x00, 0x35)
+#define TAS2781_PRM_IDLE_CH_DET_REG TASDEVICE_REG(0x00, 0x00, 0x66)
+#define TAS2781_PRM_PLT_FLAG_REG TASDEVICE_REG(0x00, 0x14, 0x38)
+#define TAS2781_PRM_SINEGAIN_REG TASDEVICE_REG(0x00, 0x14, 0x40)
+#define TAS2781_PRM_SINEGAIN2_REG TASDEVICE_REG(0x00, 0x14, 0x44)
+
+#define TAS2781_TEST_UNLOCK_REG TASDEVICE_REG(0x00, 0xFD, 0x0D)
+#define TAS2781_TEST_PAGE_UNLOCK 0x0D
+
+#define TAS2781_RUNTIME_LATCH_RE_REG TASDEVICE_REG(0x00, 0x00, 0x49)
+#define TAS2781_RUNTIME_RE_REG_TF TASDEVICE_REG(0x64, 0x62, 0x48)
+#define TAS2781_RUNTIME_RE_REG TASDEVICE_REG(0x64, 0x63, 0x44)
+
#define TASDEVICE_CMD_SING_W 0x1
#define TASDEVICE_CMD_BURST 0x2
#define TASDEVICE_CMD_DELAY 0x3
@@ -70,7 +117,15 @@ enum device_catlog_id {
OTHERS
};
+struct bulk_reg_val {
+ int reg;
+ unsigned char val[4];
+ unsigned char val_len;
+ bool is_locked;
+};
+
struct tasdevice {
+ struct bulk_reg_val *cali_data_backup;
struct tasdevice_fw *cali_data_fmw;
unsigned int dev_addr;
unsigned int err_code;
@@ -81,9 +136,19 @@ struct tasdevice {
bool is_loaderr;
};
+struct cali_reg {
+ unsigned int r0_reg;
+ unsigned int r0_low_reg;
+ unsigned int invr0_reg;
+ unsigned int pow_reg;
+ unsigned int tlimit_reg;
+};
+
struct calidata {
unsigned char *data;
unsigned long total_sz;
+ struct cali_reg cali_reg_array;
+ unsigned int cali_dat_sz_per_dev;
};
struct tasdevice_priv {
@@ -119,6 +184,7 @@ struct tasdevice_priv {
bool force_fwload_status;
bool playback_started;
bool isacpi;
+ bool is_user_space_calidata;
unsigned int global_addr;
int (*fw_parse_variable_header)(struct tasdevice_priv *tas_priv,
@@ -145,6 +211,8 @@ int tasdevice_init(struct tasdevice_priv *tas_priv);
void tasdevice_remove(struct tasdevice_priv *tas_priv);
int tasdevice_save_calibration(struct tasdevice_priv *tas_priv);
void tasdevice_apply_calibration(struct tasdevice_priv *tas_priv);
+int tasdev_chn_switch(struct tasdevice_priv *tas_priv,
+ unsigned short chn);
int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
unsigned short chn, unsigned int reg, unsigned int *value);
int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
diff --git a/sound/soc/codecs/tas2781-comlib.c b/sound/soc/codecs/tas2781-comlib.c
index 664c371796d6..1e0b3aa95749 100644
--- a/sound/soc/codecs/tas2781-comlib.c
+++ b/sound/soc/codecs/tas2781-comlib.c
@@ -88,6 +88,32 @@ static int tasdevice_change_chn_book(struct tasdevice_priv *tas_priv,
return ret;
}
+int tasdev_chn_switch(struct tasdevice_priv *tas_priv,
+ unsigned short chn)
+{
+ struct i2c_client *client = (struct i2c_client *)tas_priv->client;
+ struct tasdevice *tasdev = &tas_priv->tasdevice[chn];
+ struct regmap *map = tas_priv->regmap;
+ int ret;
+
+ if (client->addr != tasdev->dev_addr) {
+ client->addr = tasdev->dev_addr;
+ /* All devices share the same regmap, clear the page
+ * inside regmap once switching to another device.
+ * Register 0 at any pages and any books inside tas2781
+ * is the same one for page-switching.
+ */
+ ret = regmap_write(map, TASDEVICE_PAGE_SELECT, 0);
+ if (ret < 0) {
+ dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
+ return ret;
+ }
+ return 1;
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(tasdev_chn_switch);
+
int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
unsigned short chn, unsigned int reg, unsigned int *val)
{
diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index f3a7605f0710..3de0132c345d 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -2151,20 +2151,61 @@ static int tasdevice_load_data(struct tasdevice_priv *tas_priv,
static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i)
{
+ struct tasdevice_fw *cal_fmw = priv->tasdevice[i].cali_data_fmw;
+ struct calidata *cali_data = &priv->cali_data;
+ struct cali_reg *p = &cali_data->cali_reg_array;
+ unsigned char *data = cali_data->data;
struct tasdevice_calibration *cal;
- struct tasdevice_fw *cal_fmw;
+ int k = i * (cali_data->cali_dat_sz_per_dev + 1);
+ int rc;
- cal_fmw = priv->tasdevice[i].cali_data_fmw;
+ /* Load the calibrated data from cal bin file */
+ if (!priv->is_user_space_calidata && cal_fmw) {
+ cal = cal_fmw->calibrations;
- /* No calibrated data for current devices, playback will go ahead. */
- if (!cal_fmw)
+ if (cal)
+ load_calib_data(priv, &cal->dev_data);
return;
-
- cal = cal_fmw->calibrations;
- if (!cal)
+ }
+ if (!priv->is_user_space_calidata)
+ return;
+ /* load calibrated data from user space */
+ if (data[k] != i) {
+ dev_err(priv->dev, "%s: no cal-data for dev %d from usr-spc\n",
+ __func__, i);
return;
+ }
+ k++;
- load_calib_data(priv, &cal->dev_data);
+ rc = tasdevice_dev_bulk_write(priv, i, p->r0_reg, &(data[k]), 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d r0_reg bulk_wr err = %d\n", i, rc);
+ return;
+ }
+ k += 4;
+ rc = tasdevice_dev_bulk_write(priv, i, p->r0_low_reg, &(data[k]), 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d r0_low_reg err = %d\n", i, rc);
+ return;
+ }
+ k += 4;
+ rc = tasdevice_dev_bulk_write(priv, i, p->invr0_reg, &(data[k]), 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d invr0_reg err = %d\n", i, rc);
+ return;
+ }
+ k += 4;
+ rc = tasdevice_dev_bulk_write(priv, i, p->pow_reg, &(data[k]), 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d pow_reg bulk_wr err = %d\n", i, rc);
+ return;
+ }
+ k += 4;
+ rc = tasdevice_dev_bulk_write(priv, i, p->tlimit_reg, &(data[k]), 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d tlimit_reg err = %d\n", i, rc);
+ return;
+ }
}
int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
@@ -2259,9 +2300,10 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
tas_priv->tasdevice[i].cur_conf = cfg_no;
}
}
- } else
+ } else {
dev_dbg(tas_priv->dev, "%s: Unneeded loading dsp conf %d\n",
__func__, cfg_no);
+ }
status |= cfg_info[rca_conf_no]->active_dev;
diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
index 3bc10d615fd3..d0ba7cbe03a8 100644
--- a/sound/soc/codecs/tas2781-i2c.c
+++ b/sound/soc/codecs/tas2781-i2c.c
@@ -33,6 +33,69 @@
#include <sound/tas2781-tlv.h>
#include <asm/unaligned.h>
+#define X2563_CL_STT_VAL(xreg, xval) \
+{ .reg = xreg, \
+ .val = { xval }, \
+ .val_len = 1, }
+
+#define X2563_CL_STT_4BYTS(xreg, byte0, byte1, byte2, byte3) \
+{ .reg = xreg, \
+ .val = { byte0, byte1, byte2, byte3 }, \
+ .val_len = 4, }
+
+static const struct bulk_reg_val tas2563_cali_start_reg[] = {
+ X2563_CL_STT_VAL(TAS2563_IDLE, 0x00),
+ X2563_CL_STT_4BYTS(TAS2563_PRM_ENFF_REG, 0x40, 0x00, 0x00, 0x00),
+ X2563_CL_STT_4BYTS(TAS2563_PRM_DISTCK_REG, 0x40, 0x00, 0x00, 0x00),
+ X2563_CL_STT_4BYTS(TAS2563_PRM_TE_SCTHR_REG, 0x7f, 0xff, 0xff, 0xff),
+ X2563_CL_STT_4BYTS(TAS2563_PRM_PLT_FLAG_REG, 0x40, 0x00, 0x00, 0x00),
+ X2563_CL_STT_4BYTS(TAS2563_PRM_SINEGAIN_REG, 0x0a, 0x3d, 0x70, 0xa4),
+ X2563_CL_STT_4BYTS(TAS2563_TE_TA1_REG, 0x00, 0x36, 0x91, 0x5e),
+ X2563_CL_STT_4BYTS(TAS2563_TE_TA1_AT_REG, 0x00, 0x36, 0x91, 0x5e),
+ X2563_CL_STT_4BYTS(TAS2563_TE_TA2_REG, 0x00, 0x06, 0xd3, 0x72),
+ X2563_CL_STT_4BYTS(TAS2563_TE_AT_REG, 0x00, 0x36, 0x91, 0x5e),
+ X2563_CL_STT_4BYTS(TAS2563_TE_DT_REG, 0x00, 0x36, 0x91, 0x5e),
+};
+
+#define X2781_CL_STT_VAL(xreg, xval, xlocked) \
+{ .reg = xreg, \
+ .val = { xval }, \
+ .val_len = 1, \
+ .is_locked = xlocked, }
+
+#define X2781_CL_STT_4BYTS_UNLOCKED(xreg, byte0, byte1, byte2, byte3) \
+{ .reg = xreg, \
+ .val = { byte0, byte1, byte2, byte3 }, \
+ .val_len = 4, \
+ .is_locked = false, }
+
+#define X2781_CL_STT_LEN_UNLOCKED(xreg) \
+{ .reg = xreg, \
+ .val_len = 4, \
+ .is_locked = false, }
+
+static const struct bulk_reg_val tas2781_cali_start_reg[] = {
+ X2781_CL_STT_VAL(TAS2781_PRM_INT_MASK_REG, 0xfe, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_CLK_CFG_REG, 0xdd, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_RSVD_REG, 0x20, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_TEST_57_REG, 0x14, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_TEST_62_REG, 0x45, true),
+ X2781_CL_STT_VAL(TAS2781_PRM_PVDD_UVLO_REG, 0x03, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_CHNL_0_REG, 0xa8, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_NG_CFG0_REG, 0xb9, false),
+ X2781_CL_STT_VAL(TAS2781_PRM_IDLE_CH_DET_REG, 0x92, false),
+ /*
+ * This register is pilot tone threshold, different with the
+ * calibration tool version, it will be updated in
+ * tas2781_calib_start_put(), set to 1mA.
+ */
+ X2781_CL_STT_4BYTS_UNLOCKED(0, 0x00, 0x00, 0x00, 0x56),
+ X2781_CL_STT_4BYTS_UNLOCKED(TAS2781_PRM_PLT_FLAG_REG,
+ 0x40, 0x00, 0x00, 0x00),
+ X2781_CL_STT_LEN_UNLOCKED(TAS2781_PRM_SINEGAIN_REG),
+ X2781_CL_STT_LEN_UNLOCKED(TAS2781_PRM_SINEGAIN2_REG),
+};
+
static const struct i2c_device_id tasdevice_id[] = {
{ "tas2563", TAS2563 },
{ "tas2781", TAS2781 },
@@ -141,6 +204,557 @@ static int tasdev_force_fwload_put(struct snd_kcontrol *kcontrol,
return change;
}
+static int tasdev_cali_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ struct calidata *cali_data = &priv->cali_data;
+ struct cali_reg *p = &cali_data->cali_reg_array;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned char *data = cali_data->data;
+ unsigned int i = 0;
+ unsigned int j, k;
+ int rc;
+
+ guard(mutex)(&priv->codec_lock);
+ if (!priv->is_user_space_calidata)
+ return -1;
+
+ if (!p->r0_reg)
+ return -1;
+
+ dst[i++] = bytes_ext->max;
+ dst[i++] = 'r';
+
+ dst[i++] = TASDEVICE_BOOK_ID(p->r0_reg);
+ dst[i++] = TASDEVICE_PAGE_ID(p->r0_reg);
+ dst[i++] = TASDEVICE_PAGE_REG(p->r0_reg);
+
+ dst[i++] = TASDEVICE_BOOK_ID(p->r0_low_reg);
+ dst[i++] = TASDEVICE_PAGE_ID(p->r0_low_reg);
+ dst[i++] = TASDEVICE_PAGE_REG(p->r0_low_reg);
+
+ dst[i++] = TASDEVICE_BOOK_ID(p->invr0_reg);
+ dst[i++] = TASDEVICE_PAGE_ID(p->invr0_reg);
+ dst[i++] = TASDEVICE_PAGE_REG(p->invr0_reg);
+
+ dst[i++] = TASDEVICE_BOOK_ID(p->pow_reg);
+ dst[i++] = TASDEVICE_PAGE_ID(p->pow_reg);
+ dst[i++] = TASDEVICE_PAGE_REG(p->pow_reg);
+
+ dst[i++] = TASDEVICE_BOOK_ID(p->tlimit_reg);
+ dst[i++] = TASDEVICE_PAGE_ID(p->tlimit_reg);
+ dst[i++] = TASDEVICE_PAGE_REG(p->tlimit_reg);
+
+ for (j = 0, k = 0; j < priv->ndev; j++) {
+ if (j == data[k]) {
+ dst[i++] = j;
+ k++;
+ } else {
+ dev_err(priv->dev, "chn %d device %u not match\n",
+ j, data[k]);
+ k += 21;
+ continue;
+ }
+ rc = tasdevice_dev_bulk_read(priv, j, p->r0_reg, &dst[i], 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d r0_reg bulk_rd err = %d\n",
+ j, rc);
+ i += 20;
+ k += 20;
+ continue;
+ }
+ rc = memcmp(&dst[i], &data[k], 4);
+ if (rc != 0)
+ dev_dbg(priv->dev, "chn %d r0_data is not same\n", j);
+ k += 4;
+ i += 4;
+ rc = tasdevice_dev_bulk_read(priv, j, p->r0_low_reg,
+ &dst[i], 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d r0_low bulk_rd err = %d\n",
+ j, rc);
+ i += 16;
+ k += 16;
+ continue;
+ }
+ rc = memcmp(&dst[i], &data[k], 4);
+ if (rc != 0)
+ dev_dbg(priv->dev, "chn %d r0_low is not same\n", j);
+ i += 4;
+ k += 4;
+ rc = tasdevice_dev_bulk_read(priv, j, p->invr0_reg,
+ &dst[i], 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d invr0 bulk_rd err = %d\n",
+ j, rc);
+ i += 12;
+ k += 12;
+ continue;
+ }
+ rc = memcmp(&dst[i], &data[k], 4);
+ if (rc != 0)
+ dev_dbg(priv->dev, "chn %d invr0 is not same\n", j);
+ i += 4;
+ k += 4;
+ rc = tasdevice_dev_bulk_read(priv, j, p->pow_reg, &dst[i], 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d pow_reg bulk_rd err = %d\n",
+ j, rc);
+ i += 8;
+ k += 8;
+ continue;
+ }
+ rc = memcmp(&dst[i], &data[k], 4);
+ if (rc != 0)
+ dev_dbg(priv->dev, "chn %d pow_reg is not same\n", j);
+ i += 4;
+ k += 4;
+ rc = tasdevice_dev_bulk_read(priv, j, p->tlimit_reg,
+ &dst[i], 4);
+ if (rc < 0) {
+ dev_err(priv->dev, "chn %d tlimit bulk_rd err = %d\n",
+ j, rc);
+ }
+ rc = memcmp(&dst[i], &data[k], 4);
+ if (rc != 0)
+ dev_dbg(priv->dev, "chn %d tlimit is not same\n", j);
+ i += 4;
+ k += 4;
+ }
+ return 0;
+}
+
+static int calib_data_get(struct tasdevice_priv *tas_priv, int reg,
+ unsigned char *dst)
+{
+ struct i2c_client *clt = (struct i2c_client *)tas_priv->client;
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ int rc = -1;
+ int i;
+
+ for (i = 0; i < tas_priv->ndev; i++) {
+ if (clt->addr == tasdev[i].dev_addr) {
+ /* First byte is the device index. */
+ dst[0] = i;
+ rc = tasdevice_dev_bulk_read(tas_priv, i, reg, &dst[1],
+ 4);
+ break;
+ }
+ }
+
+ return rc;
+}
+
+static void sngl_calib_start(struct tasdevice_priv *tas_priv, int i,
+ int *reg, unsigned char *dat)
+{
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ struct bulk_reg_val *p = tasdev[i].cali_data_backup;
+ const int sum = ARRAY_SIZE(tas2781_cali_start_reg);
+ int j;
+
+ if (p == NULL)
+ return;
+
+ /* Store the current setting from the chip */
+ for (j = 0; j < sum; j++) {
+ if (p[j].val_len == 1) {
+ if (p[j].is_locked)
+ tasdevice_dev_write(tas_priv, i,
+ TAS2781_TEST_UNLOCK_REG,
+ TAS2781_TEST_PAGE_UNLOCK);
+ tasdevice_dev_read(tas_priv, i, p[j].reg,
+ (int *)&p[j].val[0]);
+ } else {
+ switch (p[j].reg) {
+ case 0: {
+ if (!reg[0])
+ continue;
+ p[j].reg = reg[0];
+ }
+ break;
+ case TAS2781_PRM_PLT_FLAG_REG:
+ p[j].reg = reg[1];
+ break;
+ case TAS2781_PRM_SINEGAIN_REG:
+ p[j].reg = reg[2];
+ break;
+ case TAS2781_PRM_SINEGAIN2_REG:
+ p[j].reg = reg[3];
+ break;
+ }
+ tasdevice_dev_bulk_read(tas_priv, i, p[j].reg,
+ p[j].val, 4);
+ }
+ }
+
+ /* Update the setting for calibration */
+ for (j = 0; j < sum - 2; j++) {
+ if (p[j].val_len == 1) {
+ if (p[j].is_locked)
+ tasdevice_dev_write(tas_priv, i,
+ TAS2781_TEST_UNLOCK_REG,
+ TAS2781_TEST_PAGE_UNLOCK);
+ tasdevice_dev_write(tas_priv, i, p[j].reg,
+ tas2781_cali_start_reg[j].val[0]);
+ } else {
+ if (!p[j].reg)
+ continue;
+ tasdevice_dev_bulk_write(tas_priv, i, p[j].reg,
+ (unsigned char *)
+ tas2781_cali_start_reg[j].val, 4);
+ }
+ }
+
+ tasdevice_dev_bulk_write(tas_priv, i, p[j].reg, &dat[1], 4);
+ tasdevice_dev_bulk_write(tas_priv, i, p[j + 1].reg, &dat[5], 4);
+}
+
+static int tas2781_calib_start_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dat = ucontrol->value.bytes.data;
+ int i, reg[4];
+ int j = 0;
+
+ guard(mutex)(&priv->codec_lock);
+ if (priv->chip_id != TAS2781 || bytes_ext->max != dat[0] ||
+ dat[1] != 'r') {
+ dev_err(priv->dev, "%s: package fmt or chipid incorrect\n",
+ __func__);
+ return 0;
+ }
+ j += 2;
+ /* refresh pilot tone and SineGain register */
+ for (i = 0; i < ARRAY_SIZE(reg); i++) {
+ reg[i] = TASDEVICE_REG(dat[j], dat[j + 1], dat[j + 2]);
+ j += 3;
+ }
+
+ for (i = 0; i < priv->ndev; i++) {
+ int k = i * 9 + j;
+
+ if (dat[k] != i) {
+ dev_err(priv->dev, "%s:no cal-setting for dev %d\n",
+ __func__, i);
+ continue;
+ }
+ sngl_calib_start(priv, i, reg, dat + k);
+ }
+ return 1;
+}
+
+static void tas2781_calib_stop_put(struct tasdevice_priv *tas_priv)
+{
+ const int sum = ARRAY_SIZE(tas2781_cali_start_reg);
+ int i, j;
+
+ for (i = 0; i < tas_priv->ndev; i++) {
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ struct bulk_reg_val *p = tasdev[i].cali_data_backup;
+
+ if (p == NULL)
+ continue;
+
+ for (j = 0; j < sum; j++) {
+ if (p[j].val_len == 1) {
+ if (p[j].is_locked)
+ tasdevice_dev_write(tas_priv, i,
+ TAS2781_TEST_UNLOCK_REG,
+ TAS2781_TEST_PAGE_UNLOCK);
+ tasdevice_dev_write(tas_priv, i, p[j].reg,
+ p[j].val[0]);
+ } else {
+ if (!p[j].reg)
+ continue;
+ tasdevice_dev_bulk_write(tas_priv, i, p[j].reg,
+ p[j].val, 4);
+ }
+ }
+ }
+}
+
+static int tas2563_calib_start_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct bulk_reg_val *q = (struct bulk_reg_val *)tas2563_cali_start_reg;
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ const int sum = ARRAY_SIZE(tas2563_cali_start_reg);
+ int rc = 1;
+ int i, j;
+
+ guard(mutex)(&tas_priv->codec_lock);
+ if (tas_priv->chip_id != TAS2563) {
+ rc = -1;
+ goto out;
+ }
+
+ for (i = 0; i < tas_priv->ndev; i++) {
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ struct bulk_reg_val *p = tasdev[i].cali_data_backup;
+
+ if (p == NULL)
+ continue;
+ for (j = 0; j < sum; j++) {
+ if (p[j].val_len == 1)
+ tasdevice_dev_read(tas_priv,
+ i, p[j].reg,
+ (unsigned int *)&p[j].val[0]);
+ else
+ tasdevice_dev_bulk_read(tas_priv,
+ i, p[j].reg, p[j].val, 4);
+ }
+
+ for (j = 0; j < sum; j++) {
+ if (p[j].val_len == 1)
+ tasdevice_dev_write(tas_priv, i, p[j].reg,
+ q[j].val[0]);
+ else
+ tasdevice_dev_bulk_write(tas_priv, i, p[j].reg,
+ q[j].val, 4);
+ }
+ }
+out:
+ return rc;
+}
+
+static void tas2563_calib_stop_put(struct tasdevice_priv *tas_priv)
+{
+ const int sum = ARRAY_SIZE(tas2563_cali_start_reg);
+ int i, j;
+
+ for (i = 0; i < tas_priv->ndev; i++) {
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ struct bulk_reg_val *p = tasdev[i].cali_data_backup;
+
+ if (p == NULL)
+ continue;
+
+ for (j = 0; j < sum; j++) {
+ if (p[j].val_len == 1)
+ tasdevice_dev_write(tas_priv, i, p[j].reg,
+ p[j].val[0]);
+ else
+ tasdevice_dev_bulk_write(tas_priv, i, p[j].reg,
+ p[j].val, 4);
+ }
+ }
+}
+
+static int tasdev_calib_stop_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp);
+
+ guard(mutex)(&priv->codec_lock);
+ if (priv->chip_id == TAS2563)
+ tas2563_calib_stop_put(priv);
+ else
+ tas2781_calib_stop_put(priv);
+
+ return 1;
+}
+
+static int tasdev_cali_data_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ struct calidata *cali_data = &priv->cali_data;
+ struct cali_reg *p = &cali_data->cali_reg_array;
+ unsigned char *src = ucontrol->value.bytes.data;
+ unsigned char *dst = cali_data->data;
+ int rc = 1, i = 0;
+ int j;
+
+ guard(mutex)(&priv->codec_lock);
+ if (src[0] != bytes_ext->max || src[1] != 'r') {
+ dev_err(priv->dev, "%s: pkg fmt invalid\n", __func__);
+ return 0;
+ }
+ for (j = 0; j < priv->ndev; j++) {
+ if (src[17 + j * 21] != j) {
+ dev_err(priv->dev, "%s: pkg fmt invalid\n", __func__);
+ return 0;
+ }
+ }
+ i += 2;
+ priv->is_user_space_calidata = true;
+
+ p->r0_reg = TASDEVICE_REG(src[i], src[i + 1], src[i + 2]);
+ i += 3;
+ p->r0_low_reg = TASDEVICE_REG(src[i], src[i + 1], src[i + 2]);
+ i += 3;
+ p->invr0_reg = TASDEVICE_REG(src[i], src[i + 1], src[i + 2]);
+ i += 3;
+ p->pow_reg = TASDEVICE_REG(src[i], src[i + 1], src[i + 2]);
+ i += 3;
+ p->tlimit_reg = TASDEVICE_REG(src[i], src[i + 1], src[i + 2]);
+ i += 3;
+
+ memcpy(dst, &src[i], cali_data->total_sz);
+ return rc;
+}
+
+static int tas2781_latch_reg_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct i2c_client *clt = (struct i2c_client *)tas_priv->client;
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ int i, val, rc = -1;
+
+ dst[0] = bytes_ext->max;
+ guard(mutex)(&tas_priv->codec_lock);
+ for (i = 0; i < tas_priv->ndev; i++) {
+ if (clt->addr == tasdev[i].dev_addr) {
+ /* First byte is the device index. */
+ dst[1] = i;
+ rc = tasdevice_dev_read(tas_priv, i,
+ TAS2781_RUNTIME_LATCH_RE_REG, &val);
+ if (rc < 0)
+ dev_err(tas_priv->dev, "%s, get value error\n",
+ __func__);
+ else
+ dst[2] = val;
+
+ break;
+ }
+ }
+
+ return rc;
+}
+
+static int tasdev_tf_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned int reg;
+ int rc = -1;
+
+ if (tas_priv->chip_id == TAS2781)
+ reg = TAS2781_RUNTIME_RE_REG_TF;
+ else
+ reg = TAS2563_RUNTIME_RE_REG_TF;
+
+ guard(mutex)(&tas_priv->codec_lock);
+ dst[0] = bytes_ext->max;
+ rc = calib_data_get(tas_priv, reg, &dst[1]);
+
+ return rc;
+}
+
+static int tasdev_re_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned int reg;
+ int rc = -1;
+
+ if (tas_priv->chip_id == TAS2781)
+ reg = TAS2781_RUNTIME_RE_REG;
+ else
+ reg = TAS2563_RUNTIME_RE_REG;
+ guard(mutex)(&tas_priv->codec_lock);
+ dst[0] = bytes_ext->max;
+ rc = calib_data_get(tas_priv, reg, &dst[1]);
+
+ return rc;
+}
+
+static int tasdev_r0_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct calidata *cali_data = &tas_priv->cali_data;
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned int reg;
+ int rc = -1;
+
+ guard(mutex)(&tas_priv->codec_lock);
+
+ if (tas_priv->chip_id == TAS2563)
+ reg = TAS2563_PRM_R0_REG;
+ else if (cali_data->cali_reg_array.r0_reg)
+ reg = cali_data->cali_reg_array.r0_reg;
+ else
+ return -1;
+ dst[0] = bytes_ext->max;
+ rc = calib_data_get(tas_priv, reg, &dst[1]);
+
+ return rc;
+}
+
+static int tasdev_XMA1_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned int reg = TASDEVICE_XM_A1_REG;
+ int rc = -1;
+
+ guard(mutex)(&tas_priv->codec_lock);
+ dst[0] = bytes_ext->max;
+ rc = calib_data_get(tas_priv, reg, &dst[1]);
+
+ return rc;
+}
+
+static int tasdev_XMA2_data_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp);
+ struct soc_bytes_ext *bytes_ext =
+ (struct soc_bytes_ext *) kcontrol->private_value;
+ unsigned char *dst = ucontrol->value.bytes.data;
+ unsigned int reg = TASDEVICE_XM_A2_REG;
+ int rc = -1;
+
+ guard(mutex)(&tas_priv->codec_lock);
+ dst[0] = bytes_ext->max;
+ rc = calib_data_get(tas_priv, reg, &dst[1]);
+
+ return rc;
+}
+
+static int tasdev_nop_get(
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ return 0;
+}
+
static int tas2563_digital_gain_get(
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
@@ -241,6 +855,16 @@ static const struct snd_kcontrol_new tasdevice_snd_controls[] = {
tasdev_force_fwload_get, tasdev_force_fwload_put),
};
+static const struct snd_kcontrol_new tasdevice_cali_controls[] = {
+ SOC_SINGLE_EXT("Calibration Stop", SND_SOC_NOPM, 0, 1, 0,
+ tasdev_nop_get, tasdev_calib_stop_put),
+ SND_SOC_BYTES_EXT("Amp TF Data", 6, tasdev_tf_data_get, NULL),
+ SND_SOC_BYTES_EXT("Amp RE Data", 6, tasdev_re_data_get, NULL),
+ SND_SOC_BYTES_EXT("Amp R0 Data", 6, tasdev_r0_data_get, NULL),
+ SND_SOC_BYTES_EXT("Amp XMA1 Data", 6, tasdev_XMA1_data_get, NULL),
+ SND_SOC_BYTES_EXT("Amp XMA2 Data", 6, tasdev_XMA2_data_get, NULL),
+};
+
static const struct snd_kcontrol_new tas2781_snd_controls[] = {
SOC_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL,
1, 0, 20, 0, tas2781_amp_getvol,
@@ -250,6 +874,10 @@ static const struct snd_kcontrol_new tas2781_snd_controls[] = {
tas2781_digital_putvol, dvc_tlv),
};
+static const struct snd_kcontrol_new tas2781_cali_controls[] = {
+ SND_SOC_BYTES_EXT("Amp Latch Data", 3, tas2781_latch_reg_get, NULL),
+};
+
static const struct snd_kcontrol_new tas2563_snd_controls[] = {
SOC_SINGLE_RANGE_EXT_TLV("Speaker Digital Volume", TAS2563_DVC_LVL, 0,
0, ARRAY_SIZE(tas2563_dvc_table) - 1, 0,
@@ -257,6 +885,11 @@ static const struct snd_kcontrol_new tas2563_snd_controls[] = {
tas2563_dvc_tlv),
};
+static const struct snd_kcontrol_new tas2563_cali_controls[] = {
+ SOC_SINGLE_EXT("Calibration Start", SND_SOC_NOPM, 0, 1, 0,
+ tasdev_nop_get, tas2563_calib_start_put),
+};
+
static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -274,6 +907,31 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
return ret;
}
+static int tasdevice_info_active_num(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
+
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = tas_priv->ndev - 1;
+
+ return 0;
+}
+
+static int tasdevice_info_chip_id(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ uinfo->count = 1;
+ uinfo->value.integer.min = TAS2563;
+ uinfo->value.integer.max = TAS2781;
+
+ return 0;
+}
+
static int tasdevice_info_programs(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
@@ -330,6 +988,17 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol,
return 0;
}
+static int tasdevice_get_chip_id(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
+
+ ucontrol->value.integer.value[0] = tas_priv->chip_id;
+
+ return 0;
+}
+
static int tasdevice_create_control(struct tasdevice_priv *tas_priv)
{
struct snd_kcontrol_new *prof_ctrls;
@@ -421,11 +1090,47 @@ static int tasdevice_configuration_put(
return ret;
}
+static int tasdevice_active_num_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
+ struct i2c_client *clt = (struct i2c_client *)tas_priv->client;
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ int i;
+
+ for (i = 0; i < tas_priv->ndev; i++) {
+ if (clt->addr == tasdev[i].dev_addr) {
+ ucontrol->value.integer.value[0] = i;
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+static int tasdevice_active_num_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
+ int dev_id = ucontrol->value.integer.value[0];
+ int max = tas_priv->ndev - 1, rc;
+
+ dev_id = clamp(dev_id, 0, max);
+
+ guard(mutex)(&tas_priv->codec_lock);
+ rc = tasdev_chn_switch(tas_priv, dev_id);
+
+ return rc;
+}
+
static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv)
{
struct snd_kcontrol_new *dsp_ctrls;
- char *prog_name, *conf_name;
- int nr_controls = 2;
+ char *active_dev_num, *chip_id;
+ char *conf_name, *prog_name;
+ int nr_controls = 4;
int mix_index = 0;
int ret;
@@ -466,6 +1171,30 @@ static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv)
dsp_ctrls[mix_index].put = tasdevice_configuration_put;
mix_index++;
+ active_dev_num = devm_kstrdup(tas_priv->dev, "Activate Tasdevice Num",
+ GFP_KERNEL);
+ if (!active_dev_num) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ dsp_ctrls[mix_index].name = active_dev_num;
+ dsp_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+ dsp_ctrls[mix_index].info = tasdevice_info_active_num;
+ dsp_ctrls[mix_index].get = tasdevice_active_num_get;
+ dsp_ctrls[mix_index].put = tasdevice_active_num_put;
+ mix_index++;
+
+ chip_id = devm_kstrdup(tas_priv->dev, "Tasdevice Chip Id", GFP_KERNEL);
+ if (!chip_id) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ dsp_ctrls[mix_index].name = chip_id;
+ dsp_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+ dsp_ctrls[mix_index].info = tasdevice_info_chip_id;
+ dsp_ctrls[mix_index].get = tasdevice_get_chip_id;
+ mix_index++;
+
ret = snd_soc_add_component_controls(tas_priv->codec, dsp_ctrls,
nr_controls < mix_index ? nr_controls : mix_index);
@@ -473,6 +1202,149 @@ static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv)
return ret;
}
+static int tasdevice_create_cali_ctrls(struct tasdevice_priv *priv)
+{
+ struct calidata *cali_data = &priv->cali_data;
+ struct tasdevice *tasdev = priv->tasdevice;
+ struct soc_bytes_ext *ext_cali_data;
+ struct snd_kcontrol_new *cali_ctrls;
+ unsigned int nctrls;
+ char *cali_name;
+ int rc, i;
+
+ rc = snd_soc_add_component_controls(priv->codec,
+ tasdevice_cali_controls, ARRAY_SIZE(tasdevice_cali_controls));
+ if (rc < 0) {
+ dev_err(priv->dev, "%s: Add cali controls err rc = %d",
+ __func__, rc);
+ return rc;
+ }
+
+ if (priv->chip_id == TAS2781) {
+ cali_ctrls = (struct snd_kcontrol_new *)tas2781_cali_controls;
+ nctrls = ARRAY_SIZE(tas2781_cali_controls);
+ for (i = 0; i < priv->ndev; i++) {
+ tasdev[i].cali_data_backup =
+ kmemdup(tas2781_cali_start_reg,
+ sizeof(tas2781_cali_start_reg), GFP_KERNEL);
+ if (!tasdev[i].cali_data_backup)
+ return -ENOMEM;
+ }
+ } else {
+ cali_ctrls = (struct snd_kcontrol_new *)tas2563_cali_controls;
+ nctrls = ARRAY_SIZE(tas2563_cali_controls);
+ for (i = 0; i < priv->ndev; i++) {
+ tasdev[i].cali_data_backup =
+ kmemdup(tas2563_cali_start_reg,
+ sizeof(tas2563_cali_start_reg), GFP_KERNEL);
+ if (!tasdev[i].cali_data_backup)
+ return -ENOMEM;
+ }
+ }
+
+ rc = snd_soc_add_component_controls(priv->codec, cali_ctrls, nctrls);
+ if (rc < 0) {
+ dev_err(priv->dev, "%s: Add chip cali ctrls err rc = %d",
+ __func__, rc);
+ return rc;
+ }
+
+ /* index for cali_ctrls */
+ i = 0;
+ if (priv->chip_id == TAS2781)
+ nctrls = 2;
+ else
+ nctrls = 1;
+
+ /*
+ * Alloc kcontrol via devm_kzalloc(), which don't manually
+ * free the kcontrol。
+ */
+ cali_ctrls = devm_kcalloc(priv->dev, nctrls,
+ sizeof(cali_ctrls[0]), GFP_KERNEL);
+ if (!cali_ctrls)
+ return -ENOMEM;
+
+ ext_cali_data = devm_kzalloc(priv->dev, sizeof(*ext_cali_data),
+ GFP_KERNEL);
+ if (!ext_cali_data)
+ return -ENOMEM;
+
+ cali_name = devm_kstrdup(priv->dev, "Speaker Calibrated Data",
+ GFP_KERNEL);
+ if (!cali_name)
+ return -ENOMEM;
+ /* the number of calibrated data per tas2563/tas2781 */
+ cali_data->cali_dat_sz_per_dev = 20;
+ /*
+ * Data structure for tas2563/tas2781 calibrated data:
+ * Pkg len (1 byte)
+ * Reg id (1 byte, constant 'r')
+ * book, page, register array for calibrated data (15 bytes)
+ * for (i = 0; i < Device-Sum; i++) {
+ * Device #i index_info (1 byte)
+ * Calibrated data for Device #i (20 bytes)
+ * }
+ */
+ ext_cali_data->max = priv->ndev *
+ (cali_data->cali_dat_sz_per_dev + 1) + 1 + 15 + 1;
+ priv->cali_data.total_sz = priv->ndev *
+ (cali_data->cali_dat_sz_per_dev + 1);
+ priv->cali_data.data = devm_kzalloc(priv->dev,
+ ext_cali_data->max, GFP_KERNEL);
+ cali_ctrls[i].name = cali_name;
+ cali_ctrls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+ cali_ctrls[i].info = snd_soc_bytes_info_ext;
+ cali_ctrls[i].get = tasdev_cali_data_get;
+ cali_ctrls[i].put = tasdev_cali_data_put;
+ cali_ctrls[i].private_value = (unsigned long)ext_cali_data;
+ i++;
+
+ cali_data->data = devm_kzalloc(priv->dev, cali_data->total_sz,
+ GFP_KERNEL);
+ if (!cali_data->data)
+ return -ENOMEM;
+
+ if (priv->chip_id == TAS2781) {
+ struct soc_bytes_ext *ext_cali_start;
+ char *cali_start_name;
+
+ ext_cali_start = devm_kzalloc(priv->dev,
+ sizeof(*ext_cali_start), GFP_KERNEL);
+ if (!ext_cali_start)
+ return -ENOMEM;
+
+ cali_start_name = devm_kstrdup(priv->dev,
+ "Calibration Start", GFP_KERNEL);
+ if (!cali_start_name)
+ return -ENOMEM;
+ /*
+ * package structure for tas2781 ftc start:
+ * Pkg len (1 byte)
+ * Reg id (1 byte, constant 'r')
+ * book, page, register for pilot threshold, pilot tone
+ * and sine gain (12 bytes)
+ * for (i = 0; i < Device-Sum; i++) {
+ * Device #i index_info (1 byte)
+ * Sine gain for Device #i (8 bytes)
+ * }
+ */
+ ext_cali_start->max = 14 + priv->ndev * 9;
+ cali_ctrls[i].name = cali_start_name;
+ cali_ctrls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+ cali_ctrls[i].info = snd_soc_bytes_info_ext;
+ cali_ctrls[i].put = tas2781_calib_start_put;
+ cali_ctrls[i].get = tasdev_nop_get;
+ cali_ctrls[i].private_value = (unsigned long)ext_cali_start;
+ i++;
+ }
+
+ rc = snd_soc_add_component_controls(priv->codec, cali_ctrls,
+ nctrls < i ? nctrls : i);
+
+ return rc;
+}
+
static void tasdevice_fw_ready(const struct firmware *fmw,
void *context)
{
@@ -519,6 +1391,12 @@ static void tasdevice_fw_ready(const struct firmware *fmw,
goto out;
}
+ ret = tasdevice_create_cali_ctrls(tas_priv);
+ if (ret) {
+ dev_err(tas_priv->dev, "cali controls error\n");
+ goto out;
+ }
+
tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;
/* If calibrated data occurs error, dsp will still works with default
@@ -720,6 +1598,11 @@ static int tasdevice_codec_probe(struct snd_soc_component *codec)
static void tasdevice_deinit(void *context)
{
struct tasdevice_priv *tas_priv = (struct tasdevice_priv *) context;
+ struct tasdevice *tasdev = tas_priv->tasdevice;
+ int i;
+
+ for (i = 0; i < tas_priv->ndev; i++)
+ kfree(tasdev[i].cali_data_backup);
tasdevice_config_info_remove(tas_priv);
tasdevice_dsp_remove(tas_priv);
--
2.34.1
2
1
This patch series moves common Soundwire endpoint parsing and dai
creation logic to common placeholder from Intel generic SoundWire
machine driver code to make it generic. AMD SoundWire machine driver
code is refactored to use these functions for SoundWire endpoint
parsing and dai creation logic.
Link: https://github.com/thesofproject/linux/pull/5171
Reviewed-by: Bard Liao <yung-chuan.liao(a)linux.intel.com>
Vijendar Mukunda (5):
ASoC: intel: sof_sdw: rename soundwire endpoint and dailink structures
ASoC: intel: sof_sdw: rename soundwire parsing helper functions
ASoC: sdw_util/intel: move soundwire endpoint and dai link structures
ASoC: sdw_utils/intel: move soundwire endpoint parsing helper
functions
ASoC: amd: acp: refactor SoundWire machine driver code
include/sound/soc_sdw_utils.h | 31 ++
sound/soc/amd/acp/acp-sdw-sof-mach.c | 540 ++++++++-------------------
sound/soc/intel/boards/sof_sdw.c | 195 +---------
sound/soc/sdw_utils/soc_sdw_utils.c | 161 ++++++++
4 files changed, 354 insertions(+), 573 deletions(-)
--
2.34.1
2
6

13 Sep '24
From: Codrin Ciubotariu <codrin.ciubotariu(a)microchip.com>
Avoid removing these controls, as doing so can cause issues if the stream
is initiated from another control. Ensure these controls remain intact when
the stream is started or finished. Instead of removing them, return an
-EBUSY error code to indicate that the controller is busy, especially when
the audio filter and the SINC filter are in use.
[andrei.simion(a)microchip.com: Reword the commit title and the commit
message. Replace spinlock and busy variable with atomic_t busy_stream.]
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu(a)microchip.com>
Signed-off-by: Andrei Simion <andrei.simion(a)microchip.com>
---
v1 -> v2:
- drop spinlock and u8 busy:1;
- use atomic_t variable busy_stream
- use atomic_read, atomic_set
---
sound/soc/atmel/mchp-pdmc.c | 57 ++++++++++---------------------------
1 file changed, 15 insertions(+), 42 deletions(-)
diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c
index d97d153ee375..939cd44ebc8a 100644
--- a/sound/soc/atmel/mchp-pdmc.c
+++ b/sound/soc/atmel/mchp-pdmc.c
@@ -124,6 +124,7 @@ struct mchp_pdmc {
int mic_no;
int sinc_order;
bool audio_filter_en;
+ atomic_t busy_stream;
};
static const char *const mchp_pdmc_sinc_filter_order_text[] = {
@@ -167,6 +168,10 @@ static int mchp_pdmc_sinc_order_put(struct snd_kcontrol *kcontrol,
return -EINVAL;
val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l;
+
+ if (atomic_read(&dd->busy_stream))
+ return -EBUSY;
+
if (val == dd->sinc_order)
return 0;
@@ -193,6 +198,9 @@ static int mchp_pdmc_af_put(struct snd_kcontrol *kcontrol,
struct mchp_pdmc *dd = snd_soc_component_get_drvdata(component);
bool af = uvalue->value.integer.value[0] ? true : false;
+ if (atomic_read(&dd->busy_stream))
+ return -EBUSY;
+
if (dd->audio_filter_en == af)
return 0;
@@ -379,52 +387,10 @@ static const struct snd_kcontrol_new mchp_pdmc_snd_controls[] = {
},
};
-static int mchp_pdmc_close(struct snd_soc_component *component,
- struct snd_pcm_substream *substream)
-{
- return snd_soc_add_component_controls(component, mchp_pdmc_snd_controls,
- ARRAY_SIZE(mchp_pdmc_snd_controls));
-}
-
-static int mchp_pdmc_open(struct snd_soc_component *component,
- struct snd_pcm_substream *substream)
-{
- int i;
-
- /* remove controls that can't be changed at runtime */
- for (i = 0; i < ARRAY_SIZE(mchp_pdmc_snd_controls); i++) {
- const struct snd_kcontrol_new *control = &mchp_pdmc_snd_controls[i];
- struct snd_ctl_elem_id id;
- int err;
-
- if (component->name_prefix)
- snprintf(id.name, sizeof(id.name), "%s %s", component->name_prefix,
- control->name);
- else
- strscpy(id.name, control->name, sizeof(id.name));
-
- id.numid = 0;
- id.iface = control->iface;
- id.device = control->device;
- id.subdevice = control->subdevice;
- id.index = control->index;
- err = snd_ctl_remove_id(component->card->snd_card, &id);
- if (err < 0)
- dev_err(component->dev, "%d: Failed to remove %s\n", err,
- control->name);
- }
-
- return 0;
-}
-
static const struct snd_soc_component_driver mchp_pdmc_dai_component = {
.name = "mchp-pdmc",
.controls = mchp_pdmc_snd_controls,
.num_controls = ARRAY_SIZE(mchp_pdmc_snd_controls),
- .open = &mchp_pdmc_open,
- .close = &mchp_pdmc_close,
- .legacy_dai_naming = 1,
- .trigger_start = SND_SOC_TRIGGER_ORDER_LDC,
};
static const unsigned int mchp_pdmc_1mic[] = {1};
@@ -587,6 +553,11 @@ static int mchp_pdmc_hw_params(struct snd_pcm_substream *substream,
cfgr_val |= MCHP_PDMC_CFGR_BSSEL(i);
}
+ /*
+ * from these point forward, we consider the controller busy, so the
+ * audio filter and SINC order can't be changed
+ */
+ atomic_set(&dd->busy_stream, 1);
for (osr_start = dd->audio_filter_en ? 64 : 8;
osr_start <= 256 && best_diff_rate; osr_start *= 2) {
long round_rate;
@@ -1143,6 +1114,8 @@ static void mchp_pdmc_remove(struct platform_device *pdev)
{
struct mchp_pdmc *dd = platform_get_drvdata(pdev);
+ atomic_set(&dd->busy_stream, 0);
+
if (!pm_runtime_status_suspended(dd->dev))
mchp_pdmc_runtime_suspend(dd->dev);
base-commit: 5acd9952f95fb4b7da6d09a3be39195a80845eb6
--
2.34.1
2
1

12 Sep '24
alsa-project/alsa-utils pull request #275 was opened from sadguitarius:
fixes #274
Request URL : https://github.com/alsa-project/alsa-utils/pull/275
Patch URL : https://github.com/alsa-project/alsa-utils/pull/275.patch
Repository URL: https://github.com/alsa-project/alsa-utils
1
0

12 Sep '24
alsa-project/alsa-utils issue #274 was opened from sadguitarius:
Hi, just wanted to point out that aseqsend is failing because the value returned by getopt_long can never be -1 since it's a char.
Issue URL : https://github.com/alsa-project/alsa-utils/issues/274
Repository URL: https://github.com/alsa-project/alsa-utils
1
0
Specify shortnames for the following Logitech Devices: Rally bar, Rally
bar mini, Tap, MeetUp and Huddle.
Signed-off-by: Joshua Pius <joshuapius(a)chromium.org>
---
sound/usb/card.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 778de9244f1e..9c411b82a218 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -384,6 +384,12 @@ static const struct usb_audio_device_name usb_audio_names[] = {
/* Creative/Toshiba Multimedia Center SB-0500 */
DEVICE_NAME(0x041e, 0x3048, "Toshiba", "SB-0500"),
+ /* Logitech Audio Devices */
+ DEVICE_NAME(0x046d, 0x0867, "Logitech, Inc.", "Logi-MeetUp"),
+ DEVICE_NAME(0x046d, 0x0874, "Logitech, Inc.", "Logi-Tap-Audio"),
+ DEVICE_NAME(0x046d, 0x087c, "Logitech, Inc.", "Logi-Huddle"),
+ DEVICE_NAME(0x046d, 0x0898, "Logitech, Inc.", "Logi-RB-Audio"),
+ DEVICE_NAME(0x046d, 0x08d2, "Logitech, Inc.", "Logi-RBM-Audio"),
DEVICE_NAME(0x046d, 0x0990, "Logitech, Inc.", "QuickCam Pro 9000"),
DEVICE_NAME(0x05e1, 0x0408, "Syntek", "STK1160"),
--
2.46.0.598.g6f2099f65c-goog
2
1
This adds basic audio support for the Iron Device SMA1307 amplifier
Kiseok Jo (3):
ASoC: sma1307: Add driver for Iron Device SMA1307
ASoC: dt-bindings: irondevice,sma1307: Add initial DT binding
doc: ABI: testing: sma1307: Add support for SMA1307
.../ABI/testing/sysfs-bus-i2c-devices-sma1307 | 17 +
.../bindings/sound/irondevice,sma1307.yaml | 54 +
sound/soc/codecs/Kconfig | 8 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/sma1307.c | 2191 +++++++++++++++++
sound/soc/codecs/sma1307.h | 454 ++++
6 files changed, 2726 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-sma1307
create mode 100644 Documentation/devicetree/bindings/sound/irondevice,sma1307.yaml
create mode 100644 sound/soc/codecs/sma1307.c
create mode 100644 sound/soc/codecs/sma1307.h
--
2.39.2
6
22
This patch set is intended to enhance the functionality and maintainability
of the mchp-pdmc driver:
- Enhances performance by refining maxburst logic.
- Introduces a name for better identification and management.
- Ensures controls remain intact when streams start/finish,
returning -EBUSY if the controller is busy.
Codrin Ciubotariu (3):
ASoC: atmel: mchp-pdmc: Improve maxburst calculation for better
performance
ASoC: atmel: mchp-pdmc: Add snd_soc_dai_driver name
ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls
sound/soc/atmel/mchp-pdmc.c | 118 +++++++++++++++++++-----------------
1 file changed, 63 insertions(+), 55 deletions(-)
base-commit: 6708132e80a2ced620bde9b9c36e426183544a23
--
2.34.1
3
6

ucm2: soundwire: rt722: add ConflictingDevice in each device
by GitHub pull_request - opened 12 Sep '24
by GitHub pull_request - opened 12 Sep '24
12 Sep '24
alsa-project/alsa-ucm-conf pull request #441 was opened from shumingfan:
This patch allows only one input and one output to be opened simultaneously.
Request URL : https://github.com/alsa-project/alsa-ucm-conf/pull/441
Patch URL : https://github.com/alsa-project/alsa-ucm-conf/pull/441.patch
Repository URL: https://github.com/alsa-project/alsa-ucm-conf
1
0
Specify shortnames for the following Logitech Devices: Rally bar, Rally
bar mini, Tap, MeetUp and Huddle.
Signed-off-by: Joshua Pius <joshuapius(a)google.com>
---
sound/usb/card.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 778de9244f1e..9c411b82a218 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -384,6 +384,12 @@ static const struct usb_audio_device_name usb_audio_names[] = {
/* Creative/Toshiba Multimedia Center SB-0500 */
DEVICE_NAME(0x041e, 0x3048, "Toshiba", "SB-0500"),
+ /* Logitech Audio Devices */
+ DEVICE_NAME(0x046d, 0x0867, "Logitech, Inc.", "Logi-MeetUp"),
+ DEVICE_NAME(0x046d, 0x0874, "Logitech, Inc.", "Logi-Tap-Audio"),
+ DEVICE_NAME(0x046d, 0x087c, "Logitech, Inc.", "Logi-Huddle"),
+ DEVICE_NAME(0x046d, 0x0898, "Logitech, Inc.", "Logi-RB-Audio"),
+ DEVICE_NAME(0x046d, 0x08d2, "Logitech, Inc.", "Logi-RBM-Audio"),
DEVICE_NAME(0x046d, 0x0990, "Logitech, Inc.", "QuickCam Pro 9000"),
DEVICE_NAME(0x05e1, 0x0408, "Syntek", "STK1160"),
--
2.46.0.598.g6f2099f65c-goog
3
5
alsa-project/alsa-utils issue #273 was opened from buboleck:
Hello,
Recently I got Creative Sound Blaster X3 (SB1810) as it seemed it works fine with linux. I'm using Gentoo with Plasma desktop (ALSA + Pipewire) and the onboard sound is OK but the SB X3 seems is misbehaving, I found that the volume controls for RearLeft is swapped with Center and RearRight is swapped with the LFE. (Also tried live Ubuntu 24.04 same issue)
On the other hand maybe related, I was not able to get stereo upmix working in any way, ALSA upmix does not want to work as also the Pipiwire upmix.
Gentoo kernel 6.10.9
alsa-lib-1.2.12
alsa-tools-1.2.11
alsa-utils-1.2.12
alsa-plugins-1.2.12
pyalsa-1.2.12
Issue URL : https://github.com/alsa-project/alsa-utils/issues/273
Repository URL: https://github.com/alsa-project/alsa-utils
1
0

12 Sep '24
alsa-project/alsa-ucm-conf issue #440 was opened from JL2210:
I have a laptop keyboard with a key to mute the microphone. Using this key mutes whichever mic is selected as default. However, the light on the key only changes with the internal microphone rather than the active mic.
Pressing the key when a headset is plugged in doesn't change the LED, but pressing it without a headset does.
[alsa-info.txt](https://github.com/user-attachments/files/16971038/alsa-info…
Issue URL : https://github.com/alsa-project/alsa-ucm-conf/issues/440
Repository URL: https://github.com/alsa-project/alsa-ucm-conf
1
0
Buffer 'card->dai_link' is reallocated in 'meson_card_reallocate_links()',
so move 'pad' pointer initialization after this function when memory is
already reallocated.
Kasan bug report:
==================================================================
BUG: KASAN: slab-use-after-free in axg_card_add_link+0x76c/0x9bc
Read of size 8 at addr ffff000000e8b260 by task modprobe/356
CPU: 0 PID: 356 Comm: modprobe Tainted: G O 6.9.12-sdkernel #1
Call trace:
dump_backtrace+0x94/0xec
show_stack+0x18/0x24
dump_stack_lvl+0x78/0x90
print_report+0xfc/0x5c0
kasan_report+0xb8/0xfc
__asan_load8+0x9c/0xb8
axg_card_add_link+0x76c/0x9bc [snd_soc_meson_axg_sound_card]
meson_card_probe+0x344/0x3b8 [snd_soc_meson_card_utils]
platform_probe+0x8c/0xf4
really_probe+0x110/0x39c
__driver_probe_device+0xb8/0x18c
driver_probe_device+0x108/0x1d8
__driver_attach+0xd0/0x25c
bus_for_each_dev+0xe0/0x154
driver_attach+0x34/0x44
bus_add_driver+0x134/0x294
driver_register+0xa8/0x1e8
__platform_driver_register+0x44/0x54
axg_card_pdrv_init+0x20/0x1000 [snd_soc_meson_axg_sound_card]
do_one_initcall+0xdc/0x25c
do_init_module+0x10c/0x334
load_module+0x24c4/0x26cc
init_module_from_file+0xd4/0x128
__arm64_sys_finit_module+0x1f4/0x41c
invoke_syscall+0x60/0x188
el0_svc_common.constprop.0+0x78/0x13c
do_el0_svc+0x30/0x40
el0_svc+0x38/0x78
el0t_64_sync_handler+0x100/0x12c
el0t_64_sync+0x190/0x194
Fixes: 7864a79f37b5 ("ASoC: meson: add axg sound card support")
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Arseniy Krasnov <avkrasnov(a)salutedevices.com>
---
sound/soc/meson/axg-card.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c
index 8c5605c1e34e8..eb0302f207407 100644
--- a/sound/soc/meson/axg-card.c
+++ b/sound/soc/meson/axg-card.c
@@ -104,7 +104,7 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card,
int *index)
{
struct meson_card *priv = snd_soc_card_get_drvdata(card);
- struct snd_soc_dai_link *pad = &card->dai_link[*index];
+ struct snd_soc_dai_link *pad;
struct snd_soc_dai_link *lb;
struct snd_soc_dai_link_component *dlc;
int ret;
@@ -114,6 +114,7 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card,
if (ret)
return ret;
+ pad = &card->dai_link[*index];
lb = &card->dai_link[*index + 1];
lb->name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-lb", pad->name);
--
2.30.1
3
2

[PATCH v3] ASoC: dt-bindings: renesas,rsnd: add post-init-providers property
by Kuninori Morimoto 11 Sep '24
by Kuninori Morimoto 11 Sep '24
11 Sep '24
At least if rsnd is using DPCM connection on Audio-Graph-Card2,
fw_devlink might doesn't have enough information to break the cycle
(Same problem might occur with Multi-CPU/Codec or Codec2Codec).
In such case, rsnd driver will not be probed.
Add post-init-providers support to break the link cycle.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
---
v2 -> v3
- remove "|" from description
- removed common post-init-providers description
- 100 char to 80 char for 1 line
Documentation/devicetree/bindings/sound/renesas,rsnd.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
index 07ec6247d9def..3bc93c59535e9 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
@@ -112,6 +112,12 @@ properties:
description: List of necessary clock names.
# details are defined below
+ post-init-providers:
+ description: At least if rsnd is using DPCM connection on Audio-Graph-Card2,
+ fw_devlink might doesn't have enough information to break the cycle. rsnd
+ driver will not be probed in such case. Same problem might occur with
+ Multi-CPU/Codec or Codec2Codec.
+
# ports is below
port:
$ref: audio-graph-port.yaml#/definitions/port-base
--
2.43.0
3
2

[PATCH] ASoC: dt-bindings: microchip,sama7g5-spdifrx: Add common DAI reference
by Andrei Simion 11 Sep '24
by Andrei Simion 11 Sep '24
11 Sep '24
Update the spdifrx yaml file to reference the dai-common.yaml schema,
enabling the use of the 'sound-name-prefix' property
Signed-off-by: Andrei Simion <andrei.simion(a)microchip.com>
---
.../devicetree/bindings/sound/microchip,sama7g5-spdifrx.yaml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/microchip,sama7g5-spdifrx.yaml b/Documentation/devicetree/bindings/sound/microchip,sama7g5-spdifrx.yaml
index 2f43c684ab88..7fbab5871be4 100644
--- a/Documentation/devicetree/bindings/sound/microchip,sama7g5-spdifrx.yaml
+++ b/Documentation/devicetree/bindings/sound/microchip,sama7g5-spdifrx.yaml
@@ -13,6 +13,9 @@ description:
The Microchip Sony/Philips Digital Interface Receiver is a serial port
compliant with the IEC-60958 standard.
+allOf:
+ - $ref: dai-common.yaml#
+
properties:
"#sound-dai-cells":
const: 0
@@ -53,7 +56,7 @@ required:
- dmas
- dma-names
-additionalProperties: false
+unevaluatedProperties: false
examples:
- |
base-commit: 6708132e80a2ced620bde9b9c36e426183544a23
--
2.34.1
3
2

11 Sep '24
Clang static checker (scan-build) warning:
sound/soc/codecs/peb2466.c:232:8:
Assigned value is garbage or undefined [core.uninitialized.Assign]
232 | *val = tmp;
| ^ ~~~
When peb2466_read_byte() fails, 'tmp' will have a garbage value.
Add a judgemnet to avoid this problem.
Fixes: 227f609c7c0e ("ASoC: codecs: Add support for the Infineon PEB2466 codec")
Signed-off-by: Su Hui <suhui(a)nfschina.com>
---
sound/soc/codecs/peb2466.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c
index 76ee7e3f4d9b..67ea70cef0c7 100644
--- a/sound/soc/codecs/peb2466.c
+++ b/sound/soc/codecs/peb2466.c
@@ -229,7 +229,8 @@ static int peb2466_reg_read(void *context, unsigned int reg, unsigned int *val)
case PEB2466_CMD_XOP:
case PEB2466_CMD_SOP:
ret = peb2466_read_byte(peb2466, reg, &tmp);
- *val = tmp;
+ if (!ret)
+ *val = tmp;
break;
default:
dev_err(&peb2466->spi->dev, "Not a XOP or SOP command\n");
--
2.30.2
2
1
This patch adds support for the primary mi2s interface on devices using SM8250
audio drivers. Tested on SM7150 (xiaomi-davinci). SM7150 sound is close to
SM8250 and we intend to use it as a fallback in the future.
To: Srinivas Kandagatla <srinivas.kandagatla(a)linaro.org>
To: Liam Girdwood <lgirdwood(a)gmail.com>
To: Mark Brown <broonie(a)kernel.org>
To: Jaroslav Kysela <perex(a)perex.cz>
To: Takashi Iwai <tiwai(a)suse.com>
Cc: alsa-devel(a)alsa-project.org
Cc: linux-arm-msm(a)vger.kernel.org
Cc: linux-sound(a)vger.kernel.org
Cc: linux-kernel(a)vger.kernel.org
Cc: linux(a)mainlining.org
Jens Reidel (1):
ASoC: qcom: sm8250: enable primary mi2s
sound/soc/qcom/sm8250.c | 8 ++++++++
1 file changed, 8 insertions(+)
--
2.46.0
4
5
This patchset adds rate definitions for 12kHz, 24kHz and 128kHz.
It is follow-up on the series/discussion [0] about adding 128kHz for
spdif/eARC support. The outcome was to add 12kHz and 24kHz as well and
clean up the drivers that no longer require custom rules to allow these
rates.
Identifying these drivers is not straight forward, I tried my best but I
may have missed some. Those will continue to work anyway so it is not
critical. Some drivers using these rates have not been changed on
purpose. The reason for this may be:
* The driver used other uncommon rates that still don't have a definition
so a custom rule is still required.
* The constraint structure is used in some other way by the driver and
removing it would not help the readability or maintainability. This is
the case the freescale asrc drivers for example.
There is one change per driver so, if there is a problem later on, it will
easier to properly add Fixes tag.
The series has been tested with
* ARM64 defconfig - spdif 128kHz at runtime.
* x86_64 allmodconfig - compile test only
Last, the change adding IEC958 definitions has been dropped for this
patchset and will be resent separately
[0]: https://lore.kernel.org/all/20240628122429.2018059-1-jbrunet@baylibre.com/
---
Jerome Brunet (13):
ALSA: pcm: add more sample rate definitions
ALSA: cmipci: drop SNDRV_PCM_RATE_KNOT
ALSA: emu10k1: drop SNDRV_PCM_RATE_KNOT
ALSA: hdsp: drop SNDRV_PCM_RATE_KNOT
ALSA: hdspm: drop SNDRV_PCM_RATE_KNOT
ASoC: cs35l36: drop SNDRV_PCM_RATE_KNOT
ASoC: cs35l41: drop SNDRV_PCM_RATE_KNOT
ASoC: cs53l30: drop SNDRV_PCM_RATE_KNOT
ASoC: Intel: avs: drop SNDRV_PCM_RATE_KNOT
ASoC: qcom: q6asm-dai: drop SNDRV_PCM_RATE_KNOT
ASoC: sunxi: sun4i-codec: drop SNDRV_PCM_RATE_KNOT
ASoC: cs35l34: drop useless rate contraint
ASoC: spdif: extend supported rates to 768kHz
include/sound/pcm.h | 31 +++++++++++++++++--------------
sound/core/pcm_native.c | 6 +++---
sound/pci/cmipci.c | 32 +++++++++-----------------------
sound/pci/emu10k1/emupcm.c | 31 +++++--------------------------
sound/pci/rme9652/hdsp.c | 18 ++++++------------
sound/pci/rme9652/hdspm.c | 16 +---------------
sound/soc/codecs/cs35l34.c | 21 ---------------------
sound/soc/codecs/cs35l36.c | 34 ++++++++++++----------------------
sound/soc/codecs/cs35l41.c | 34 +++++++++++-----------------------
sound/soc/codecs/cs53l30.c | 24 +++---------------------
sound/soc/codecs/spdif_receiver.c | 3 ++-
sound/soc/codecs/spdif_transmitter.c | 3 ++-
sound/soc/intel/avs/pcm.c | 22 ++++++----------------
sound/soc/qcom/qdsp6/q6asm-dai.c | 31 ++++++++++---------------------
sound/soc/sunxi/sun4i-codec.c | 28 +++++++++-------------------
15 files changed, 96 insertions(+), 238 deletions(-)
---
base-commit: 785f4052380684dbcc156203c537c799e2f4be09
change-id: 20240905-alsa-12-24-128-8edab4c08dd4
Best regards,
--
Jerome
11
35

[PATCH 1/2] ASoC: amd: acp: remove MODULE_ALIAS for legacy machine driver
by Vijendar Mukunda 11 Sep '24
by Vijendar Mukunda 11 Sep '24
11 Sep '24
As module device table added for AMD legacy machine driver, MODULE_ALIAS
is not required. Remove MODULE_ALIAS for AMD legacy machine driver.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda(a)amd.com>
---
sound/soc/amd/acp/acp-legacy-mach.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c
index 0d529e32e552..d104f7e8fdcd 100644
--- a/sound/soc/amd/acp/acp-legacy-mach.c
+++ b/sound/soc/amd/acp/acp-legacy-mach.c
@@ -242,11 +242,4 @@ module_platform_driver(acp_asoc_audio);
MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
MODULE_DESCRIPTION("ACP chrome audio support");
-MODULE_ALIAS("platform:acp3xalc56821019");
-MODULE_ALIAS("platform:acp3xalc5682sm98360");
-MODULE_ALIAS("platform:acp3xalc5682s1019");
-MODULE_ALIAS("platform:acp3x-es83xx");
-MODULE_ALIAS("platform:rmb-nau8825-max");
-MODULE_ALIAS("platform:rmb-rt5682s-rt1019");
-MODULE_ALIAS("platform:acp-pdm-mach");
MODULE_LICENSE("GPL v2");
--
2.34.1
2
2

[PATCH v1 0/4] Add static channel mapping between soundwire master and slave
by Mohammad Rafi Shaik 11 Sep '24
by Mohammad Rafi Shaik 11 Sep '24
11 Sep '24
Add static channel map support between soundwire master and slave.
This patch series will resolve channel mask mismatch between master and slave.
Scenario: wcd937x AMIC2 usecase
Master Slave (wcd937x)
+--------------+ +--------------+
| +--------+ | | +--------+ |
AMIC1 ----->| | PORT1 | | | | TX1 | |<-----------AMIC1
AMIC2 ----->| | | | | | | |
| +--------+ | | +--------+ |
| | | |
AMIC3 ----->| +--------+ | | +--------+ |
| | PORT2 | | | | TX2 | |<-----------AMIC2
| | | | | | | |<-----------AMIC3
| +--------+ | | +--------+ |
| | | |
| +--------+ | | +--------+ |
DMIC0...DMIC3------>| | PORT3 | | | | TX3 | |<-----------DMIC0...DMIC3
| | | | | | | |<-----------MBHC
| +--------+ | | +--------+ |
| | | |
| +--------+ | | +--------+ |
DMIC4...DMIC37----->| | PORT4 | | | | TX4 | |<-----------DMIC4...DMIC7
| | | | | | | |
| +--------+ | | +--------+ |
| | | |
+------------- + +--------------+
For AMIC2 usecase, The Slave need to configure TX2 Port with channel mask 1 and
for Master required PORT1 with channel mask 2,
In existing design master and slave configured with same channel mask, it will fail
AMIC2 usecase.
The New design will help to configure channel mapping between master and slave from
device tree.
Mohammad Rafi Shaik (4):
ASoC: dt-bindings: wcd938x-sdw: Add static channel mapping support
soundwire: stream: Add set_master_channel_map() to set static channel
mapping
soundwire: qcom: Add static channel mapping support in soundwire
master
ASoC: codecs: wcd937x: Add static channel mapping support in
wcd937x-sdw
.../bindings/sound/qcom,wcd937x-sdw.yaml | 28 ++++++++++
drivers/soundwire/qcom.c | 18 +++++++
drivers/soundwire/stream.c | 16 ++++++
include/linux/soundwire/sdw.h | 5 ++
sound/soc/codecs/wcd937x-sdw.c | 52 ++++++++++++++++---
sound/soc/codecs/wcd937x.c | 12 ++++-
sound/soc/codecs/wcd937x.h | 6 ++-
7 files changed, 126 insertions(+), 11 deletions(-)
base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
--
2.25.1
6
10