diff mbox series

[1/6] ASoC: Intel: cht_bsw_rt5672: Change bus format to I2S 2 channel

Message ID 20200628155231.71089-2-hdegoede@redhat.com
State Accepted
Commit 0ceb8a36d023d4bb4ffca3474a452fb1dfaa0ef2
Headers show
Series [1/6] ASoC: Intel: cht_bsw_rt5672: Change bus format to I2S 2 channel | expand

Commit Message

Hans de Goede June 28, 2020, 3:52 p.m. UTC
The default mode for SSP configuration is TDM 4 slot and so far we were
using this for the bus format on cht-bsw-rt56732 boards.

One board, the Lenovo Miix 2 10 uses not 1 but 2 codecs connected to SSP2.
The second piggy-backed, output-only codec is inside the keyboard-dock
(which has extra speakers). Unlike the main rt5672 codec, we cannot
configure this codec, it is hard coded to use 2 channel 24 bit I2S.

Using 4 channel TDM leads to the dock speakers codec (which listens in on
the data send from the SSP to the rt5672 codec) emiting horribly distorted
sound.

Since we only support 2 channels anyways, there is no need for TDM on any
cht-bsw-rt5672 designs. So we can simply use I2S 2ch everywhere.

This commit fixes the Lenovo Miix 2 10 dock speakers issue by changing
the bus format set in cht_codec_fixup() to I2S 2 channel.

This change has been tested on the following devices with a rt5672 codec:

Lenovo Miix 2 10
Lenovo Thinkpad 8
Lenovo Thinkpad 10 (gen 1)

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1786723
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

Comments

Hans de Goede July 3, 2020, 8:28 a.m. UTC | #1
Hi,

On 7/1/20 9:46 PM, Pierre-Louis Bossart wrote:
> 

> 

> On 7/1/20 2:33 PM, Sasha Levin wrote:

>> Hi

>>

>> [This is an automated email]

>>

>> This commit has been processed because it contains a -stable tag.

>> The stable tag indicates that it's relevant for the following trees: all

>>

>> The bot has tested the following trees: v5.7.6, v5.4.49, v4.19.130, v4.14.186, v4.9.228, v4.4.228.

>>

>> v5.7.6: Build OK!

>> v5.4.49: Failed to apply! Possible dependencies:

>>      0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")

> 

> This patch is probably the missing dependency, but it's quite large and invasive.

> 

> if we wanted to apply this patch to stable versions < 5.7, we should replace all occurrences of

> 

> asoc_rtd_to_cpu(rtd, 0) by rtd->cpu_dai

> 

> and

> 

> asoc_rtd_to_codec(rtd, 0) by rtd->codec_dai


This fix affects only 1 model tablet, so I think it is fine to just add it to 5.7
and skip it for older kernels.

Regards,

Hans
Mark Brown July 3, 2020, 5:03 p.m. UTC | #2
On Sun, 28 Jun 2020 17:52:26 +0200, Hans de Goede wrote:
> The default mode for SSP configuration is TDM 4 slot and so far we were

> using this for the bus format on cht-bsw-rt56732 boards.

> 

> One board, the Lenovo Miix 2 10 uses not 1 but 2 codecs connected to SSP2.

> The second piggy-backed, output-only codec is inside the keyboard-dock

> (which has extra speakers). Unlike the main rt5672 codec, we cannot

> configure this codec, it is hard coded to use 2 channel 24 bit I2S.

> 

> [...]


Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: rt5670: Remove struct rt5670_platform_data
      commit: c14f61a89c1335f95d9b37624ee157fb1fd424ee
[2/2] ASoC: rt5670: Rename dev_gpio to gpio1_is_irq
      commit: 883330c11fa6dca55e30f8612398b3e0abc51dc5

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
Sasha Levin July 10, 2020, 2:02 p.m. UTC | #3
Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.7.6, v5.4.49, v4.19.130, v4.14.186, v4.9.228, v4.4.228.

v5.7.6: Build OK!
v5.4.49: Failed to apply! Possible dependencies:
    0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
    157b006f6be46 ("ASoC: bdw-rt5677: Add a DAI link for rt5677 SPI PCM device")
    17fe95d6df932 ("ASoC: Intel: boards: Add CML m/c using RT1011 and RT5682")
    332719b1840b9 ("ASoC: Intel: bytcr_rt5640: Remove code duplication in byt_rt5640_codec_fixup")
    35dc19ad86fdf ("ASoC: Intel: Add machine driver for da7219_max98373")
    461c623270e4f ("ASoC: rt5677: Load firmware via SPI using delayed work")
    4f0637eae56f0 ("ASoC: Intel: common: add ACPI matching tables for JSL")
    57ad18906f242 ("ASoC: Intel: bxt-da7219-max98357a: common hdmi codec support")
    59bbd703ea2ea ("ASoC: intel: sof_rt5682: common hdmi codec support")
    5b425814f13f3 ("ASoC: intel: Add Broadwell rt5650 machine driver")
    7d2ae58376658 ("ASoC: Intel: bxt_rt298: common hdmi codec support")
    8039105987fcd ("ASoC: Intel: boards: sof_rt5682: use dependency on SOF_HDA_LINK")
    a0e0d135427cf ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI")
    ba0b3a977ecf5 ("ASoC: rt5677: Set ADC clock to use PLL and enable ASRC")
    dfe87aa86cd92 ("ASoC: Intel: glk_rt5682_max98357a: common hdmi codec support")
    f40ed2e8db8d5 ("ASoC: Intel: sof_pcm512x: add support for SOF platforms with pcm512x")

v4.19.130: Failed to apply! Possible dependencies:
    0b7990e38971d ("ASoC: add for_each_rtd_codec_dai() macro")
    0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
    10b02b53a9986 ("ASoC: Intel: select relevant machine drivers for SOF")
    35bc99aaa1a3a ("ASoC: Intel: Skylake: Add more platform granularity")
    5b425814f13f3 ("ASoC: intel: Add Broadwell rt5650 machine driver")
    6bae5ea949892 ("ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers")
    7c33b5f16915a ("ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs")
    8c4e7c2ee8096 ("ASoC: Intel: Skylake: fix Kconfigs, make HDaudio codec optional")
    98061fdbfccc0 ("ASoC: add for_each_card_links() macro")
    bca0ac1d96739 ("ASoC: Intel: Boards: Add KBL Dialog Maxim I2S machine driver")
    bcb1fd1fcd650 ("ASoC: add for_each_card_rtds() macro")
    e894efef9ac7c ("ASoC: core: add support to card rebind")

v4.14.186: Failed to apply! Possible dependencies:
    0b7990e38971d ("ASoC: add for_each_rtd_codec_dai() macro")
    0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
    1a11d88f499ce ("ASoC: meson: add tdm formatter base driver")
    273d778ef38a8 ("ASoC: snd_soc_component_driver has endianness")
    291bfb928863d ("ASoC: topology: Revert recent changes while boot errors are investigated")
    45f8cb57da0d7 ("ASoC: core: Allow topology to override machine driver FE DAI link config.")
    53eb4b7aaa045 ("ASoC: meson: add axg spdif output")
    57d552e3ea760 ("ASoC: meson: add axg frddr driver")
    5d61f0ba6524d ("ASoC: pcm: Sync delayed work before releasing resources")
    69941bab7c7ae ("ASoC: snd_soc_component_driver has non_legacy_dai_naming")
    6dc4fa179fb86 ("ASoC: meson: add axg fifo base driver")
    7864a79f37b55 ("ASoC: meson: add axg sound card support")
    7a679ea75a1bc ("ASoC: Intel: Enable tdm slots for max98927")
    7ba236ce58bd7 ("ASoC: add Component level set_bias_level")
    7ed4877b403c9 ("ASoC: meson: add axg toddr driver")
    98061fdbfccc0 ("ASoC: add for_each_card_links() macro")
    9900a4226c785 ("ASoC: remove unneeded dai->driver->ops check")
    a655de808cbde ("ASoC: core: Allow topology to override machine driver FE DAI link config.")
    bcb1fd1fcd650 ("ASoC: add for_each_card_rtds() macro")
    bf14adcc4ddd1 ("ASoC: Intel: cht-bsw-rt5672: allow for topology-defined codec-dai setup")
    c41c2a355b863 ("ASoC: meson: add tdm output driver")
    d60e4f1e4be5e ("ASoC: meson: add tdm interface driver")
    e0dac41b8c21d ("ASoC: soc-core: add snd_soc_add_component()")
    f11a5c27f9287 ("ASoC: core: Add name prefix for machines with topology rewrites")
    f523acebbb74f ("ASoC: add Component level pcm_new/pcm_free v2")
    fbb16563c6c2b ("ASoC: snd_soc_component_driver has pmdown_time")

v4.9.228: Failed to apply! Possible dependencies:
    0b7990e38971d ("ASoC: add for_each_rtd_codec_dai() macro")
    0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
    17fb175520e54 ("ASoC: Define API to find a dai link")
    1a11d88f499ce ("ASoC: meson: add tdm formatter base driver")
    1a653aa447256 ("ASoC: core: replace aux_comp_list to component_dev_list")
    273d778ef38a8 ("ASoC: snd_soc_component_driver has endianness")
    2a18483a7fb41 ("ASoC: Intel: Add Kabylake machine driver for RT5514, RT5663 and MAX98927")
    44c07365e9e2c ("ASoC: add Component level set_jack")
    53eb4b7aaa045 ("ASoC: meson: add axg spdif output")
    57d552e3ea760 ("ASoC: meson: add axg frddr driver")
    69941bab7c7ae ("ASoC: snd_soc_component_driver has non_legacy_dai_naming")
    6dc4fa179fb86 ("ASoC: meson: add axg fifo base driver")
    71ccef0df533c ("ASoC: add Component level set_sysclk")
    759db1c4660b5 ("ASoC: Intel: boards: add card for MinnowBoardMax/Up I2S access")
    7864a79f37b55 ("ASoC: meson: add axg sound card support")
    7a679ea75a1bc ("ASoC: Intel: Enable tdm slots for max98927")
    7ba236ce58bd7 ("ASoC: add Component level set_bias_level")
    7ed4877b403c9 ("ASoC: meson: add axg toddr driver")
    804e73adf5cf4 ("ASoC: rt5670: Fix GPIO headset detection regression")
    82cf89de2c9c2 ("ASoC: Intel: add machine driver for BYT/CHT + DA7213")
    9178feb4538e0 ("ASoC: add Component level suspend/resume")
    98061fdbfccc0 ("ASoC: add for_each_card_links() macro")
    a655de808cbde ("ASoC: core: Allow topology to override machine driver FE DAI link config.")
    bcb1fd1fcd650 ("ASoC: add for_each_card_rtds() macro")
    bf14adcc4ddd1 ("ASoC: Intel: cht-bsw-rt5672: allow for topology-defined codec-dai setup")
    c41c2a355b863 ("ASoC: meson: add tdm output driver")
    d60e4f1e4be5e ("ASoC: meson: add tdm interface driver")
    d9fc40639dc1b ("ASoC: core: replace codec_dev_list to component_dev_list on Card")
    ec040dd5ef647 ("ASoC: Intel: Add Kabylake Realtek Maxim machine driver")
    ef641e5d5e6c7 ("ASoC: add Component level set_pll")
    fbb16563c6c2b ("ASoC: snd_soc_component_driver has pmdown_time")

v4.4.228: Failed to apply! Possible dependencies:
    0d1571c197a92 ("ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
    17fb175520e54 ("ASoC: Define API to find a dai link")
    1a497983a5ae6 ("ASoC: Change the PCM runtime array to a list")
    49a5ba1cd9da4 ("ASoC: soc_bind_dai_link() directly returns success for a bound DAI link")
    6f2f1ff0de83a ("ASoC: Change 2nd argument of soc_bind_dai_link() to DAI link pointer")
    804e73adf5cf4 ("ASoC: rt5670: Fix GPIO headset detection regression")
    923c5e61ecd9b ("ASoC: Define soc_init_dai_link() to wrap link intialization.")
    98061fdbfccc0 ("ASoC: add for_each_card_links() macro")
    bcb1fd1fcd650 ("ASoC: add for_each_card_rtds() macro")
    bf14adcc4ddd1 ("ASoC: Intel: cht-bsw-rt5672: allow for topology-defined codec-dai setup")
    f8f80361d07d5 ("ASoC: Implement DAI links in a list & define API to add/remove a link")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 7a43c70a1378..22e432768edb 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -253,21 +253,20 @@  static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
 
 	/*
-	 * Default mode for SSP configuration is TDM 4 slot
+	 * Default mode for SSP configuration is TDM 4 slot. One board/design,
+	 * the Lenovo Miix 2 10 uses not 1 but 2 codecs connected to SSP2. The
+	 * second piggy-backed, output-only codec is inside the keyboard-dock
+	 * (which has extra speakers). Unlike the main rt5672 codec, we cannot
+	 * configure this codec, it is hard coded to use 2 channel 24 bit I2S.
+	 * Since we only support 2 channels anyways, there is no need for TDM
+	 * on any cht-bsw-rt5672 designs. So we simply use I2S 2ch everywhere.
 	 */
-	ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0),
-				  SND_SOC_DAIFMT_DSP_B |
-				  SND_SOC_DAIFMT_IB_NF |
+	ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
+				  SND_SOC_DAIFMT_I2S     |
+				  SND_SOC_DAIFMT_NB_NF   |
 				  SND_SOC_DAIFMT_CBS_CFS);
 	if (ret < 0) {
-		dev_err(rtd->dev, "can't set format to TDM %d\n", ret);
-		return ret;
-	}
-
-	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
-	ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xF, 0xF, 4, 24);
-	if (ret < 0) {
-		dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
+		dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
 		return ret;
 	}