[PATCH 0/4] ASoC: Intel: boards: updates for 6.11 - part2
Minor additions and cleanups this time.
Bard Liao (1): ASoC: Intel: sof_sdw: select PINCTRL_CS42L43 and SPI_CS42L43
Brent Lu (1): ASoC: Intel: maxim-common: add max_98373_get_tx_mask function
Pierre-Louis Bossart (2): ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C
sound/soc/intel/boards/Kconfig | 2 + sound/soc/intel/boards/sof_maxim_common.c | 56 +++++++++++++++++------ sound/soc/intel/boards/sof_sdw.c | 18 ++++++++ 3 files changed, 63 insertions(+), 13 deletions(-)
Experimental tests show that JD2_100K is required, otherwise the jack is detected always even with nothing plugged-in.
To avoid matching with other known quirks the SKU information is used.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/intel/boards/sof_sdw.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index b646b32dd311..89b92a061489 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -277,6 +277,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { SOF_BT_OFFLOAD_SSP(2) | SOF_SSP_BT_OFFLOAD_PRESENT), }, + { + .callback = sof_sdw_quirk_cb, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), + DMI_MATCH(DMI_PRODUCT_SKU, "0000000000070000"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | + RT711_JD2_100K), + }, { .callback = sof_sdw_quirk_cb, .matches = {
From: Brent Lu brent.lu@intel.com
Add a helper function max_98373_get_tx_mask() to get tx mask from max98373 ACPI device properties at runtime.
Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com Signed-off-by: Brent Lu brent.lu@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/intel/boards/sof_maxim_common.c | 56 +++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-)
diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c index f965b172fa36..fcc3b95e57a4 100644 --- a/sound/soc/intel/boards/sof_maxim_common.c +++ b/sound/soc/intel/boards/sof_maxim_common.c @@ -77,19 +77,36 @@ static struct snd_soc_dai_link_component max_98373_components[] = { * According to the definition of 'DAI Sel Mux' mixer in max98373.c, rx mask * should choose two channels from TDM slots, the LSB of rx mask is left channel * and the other one is right channel. - * - * For tx mask, each codec requires two channels: one for V-sense and the other - * one for I-sense. Must match the device property "maxim,vmon-slot-no" and - * "maxim,imon-slot-no" in ACPI table. */ static const struct { - unsigned int tx; unsigned int rx; } max_98373_tdm_mask[] = { - {.tx = 0x03, .rx = 0x3}, - {.tx = 0x0c, .rx = 0x3}, + {.rx = 0x3}, + {.rx = 0x3}, };
+/* + * The tx mask indicates which channel(s) contains output IV-sense data and + * others should set to Hi-Z. Here we get the channel number from codec's ACPI + * device property "maxim,vmon-slot-no" and "maxim,imon-slot-no" to generate the + * mask. Refer to the max98373_slot_config() function in max98373.c codec driver. + */ +static unsigned int max_98373_get_tx_mask(struct device *dev) +{ + int vmon_slot; + int imon_slot; + + if (device_property_read_u32(dev, "maxim,vmon-slot-no", &vmon_slot)) + vmon_slot = 0; + + if (device_property_read_u32(dev, "maxim,imon-slot-no", &imon_slot)) + imon_slot = 1; + + dev_dbg(dev, "vmon_slot %d imon_slot %d\n", vmon_slot, imon_slot); + + return (0x1 << vmon_slot) | (0x1 << imon_slot); +} + static int max_98373_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -98,6 +115,8 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai; int i; int tdm_slots; + unsigned int tx_mask; + unsigned int tx_mask_used = 0x0; int ret = 0;
for_each_rtd_codec_dais(rtd, i, codec_dai) { @@ -117,13 +136,26 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream, return -EINVAL; }
+ /* get the tx mask from ACPI device properties */ + tx_mask = max_98373_get_tx_mask(codec_dai->dev); + if (!tx_mask) + return -EINVAL; + + if (tx_mask & tx_mask_used) { + dev_err(codec_dai->dev, "invalid tx mask 0x%x, used 0x%x\n", + tx_mask, tx_mask_used); + return -EINVAL; + } + + tx_mask_used |= tx_mask; + /* * check if tdm slot number is too small for channel * allocation */ - if (fls(max_98373_tdm_mask[i].tx) > tdm_slots) { + if (fls(tx_mask) > tdm_slots) { dev_err(codec_dai->dev, "slot mismatch, tx %d slots %d\n", - fls(max_98373_tdm_mask[i].tx), tdm_slots); + fls(tx_mask), tdm_slots); return -EINVAL; }
@@ -134,12 +166,10 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream, }
dev_dbg(codec_dai->dev, "set tdm slot: tx 0x%x rx 0x%x slots %d width %d\n", - max_98373_tdm_mask[i].tx, - max_98373_tdm_mask[i].rx, + tx_mask, max_98373_tdm_mask[i].rx, tdm_slots, params_width(params));
- ret = snd_soc_dai_set_tdm_slot(codec_dai, - max_98373_tdm_mask[i].tx, + ret = snd_soc_dai_set_tdm_slot(codec_dai, tx_mask, max_98373_tdm_mask[i].rx, tdm_slots, params_width(params));
On Mon, Jun 24, 2024 at 02:11:17PM +0200, Pierre-Louis Bossart wrote:
From: Brent Lu brent.lu@intel.com
Add a helper function max_98373_get_tx_mask() to get tx mask from max98373 ACPI device properties at runtime.
Similarly here.
On 6/24/24 14:37, Mark Brown wrote:
On Mon, Jun 24, 2024 at 02:11:17PM +0200, Pierre-Louis Bossart wrote:
From: Brent Lu brent.lu@intel.com
Add a helper function max_98373_get_tx_mask() to get tx mask from max98373 ACPI device properties at runtime.
Similarly here.
I may have misunderstood Brent's patch but this isn't a fix really, more a cleanup to use ACPI when possible, with a fallback to the existing hard-coded setup if ACPI properties are not found.
I don't think it's a real 'fix' impacting users, in the linux-stable sense, nor that this needs to be back-ported with case.
Brent, please chime in if I am mistaken?
On Mon, Jun 24, 2024 at 05:26:37PM +0200, Pierre-Louis Bossart wrote:
On 6/24/24 14:37, Mark Brown wrote:
On Mon, Jun 24, 2024 at 02:11:17PM +0200, Pierre-Louis Bossart wrote:
From: Brent Lu brent.lu@intel.com
Add a helper function max_98373_get_tx_mask() to get tx mask from max98373 ACPI device properties at runtime.
Similarly here.
I may have misunderstood Brent's patch but this isn't a fix really, more a cleanup to use ACPI when possible, with a fallback to the existing hard-coded setup if ACPI properties are not found.
I don't think it's a real 'fix' impacting users, in the linux-stable sense, nor that this needs to be back-ported with case.
Brent, please chime in if I am mistaken?
Yes, in this case the issue is that everything else looked like it should be a fix but this isn't.
Jack detection needs to rely on JD2, as most other Dell AlderLake-based devices.
Closes: https://github.com/thesofproject/linux/issues/5021 Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com --- sound/soc/intel/boards/sof_sdw.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 89b92a061489..e94849b84a6b 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -406,6 +406,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { /* No Jack */ .driver_data = (void *)SOF_SDW_TGL_HDMI, }, + { + .callback = sof_sdw_quirk_cb, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0B8C"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | + RT711_JD2), + }, { .callback = sof_sdw_quirk_cb, .matches = {
From: Bard Liao yung-chuan.liao@linux.intel.com
Cs42l43 bridge mode needs the two configurations.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/intel/boards/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index 4e0586034de4..f1faa5dd2a4f 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -677,6 +677,8 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH select SND_SOC_CS42L43_SDW select MFD_CS42L43 select MFD_CS42L43_SDW + select PINCTRL_CS42L43 + select SPI_CS42L43 select SND_SOC_CS35L56_SPI select SND_SOC_CS35L56_SDW select SND_SOC_DMIC
On Mon, 24 Jun 2024 14:11:15 +0200, Pierre-Louis Bossart wrote:
Minor additions and cleanups this time.
Bard Liao (1): ASoC: Intel: sof_sdw: select PINCTRL_CS42L43 and SPI_CS42L43
Brent Lu (1): ASoC: Intel: maxim-common: add max_98373_get_tx_mask function
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP commit: 65c90df918205bc84f5448550cde76a54dae5f52 [2/4] ASoC: Intel: maxim-common: add max_98373_get_tx_mask function commit: e364ffceab9252c06388727250d7583d6e0aea87 [3/4] ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C commit: 92d5b5930e7d55ca07b483490d6298eee828bbe4 [4/4] ASoC: Intel: sof_sdw: select PINCTRL_CS42L43 and SPI_CS42L43 commit: c073f0757663c104271c8749f7e6b19b29c7b8ac
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Mark Brown
-
Pierre-Louis Bossart