Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: bytcr_rt5640: Add new swapped-speakers quirk

Some BYTCR x86 tablets with a rt5640 codec have the left and right channels
of their speakers swapped.

Add a new BYT_RT5640_SWAPPED_SPEAKERS quirk for this which sets
cfg-spk:swapped in the components string to let userspace know
about the swapping so that the UCM profile can configure the mixer
to correct this.

Enable this new quirk on the Medion Lifetab S10346 which has its
speakers swapped.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20231217213221.49424-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Hans de Goede and committed by
Mark Brown
b1b6131b 99c7bb44

+13 -6
+13 -6
sound/soc/intel/boards/bytcr_rt5640.c
··· 83 83 #define BYT_RT5640_HSMIC2_ON_IN1 BIT(27) 84 84 #define BYT_RT5640_JD_HP_ELITEP_1000G2 BIT(28) 85 85 #define BYT_RT5640_USE_AMCR0F28 BIT(29) 86 + #define BYT_RT5640_SWAPPED_SPEAKERS BIT(30) 86 87 87 88 #define BYTCR_INPUT_DEFAULTS \ 88 89 (BYT_RT5640_IN3_MAP | \ ··· 158 157 dev_info(dev, "quirk MONO_SPEAKER enabled\n"); 159 158 if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) 160 159 dev_info(dev, "quirk NO_SPEAKERS enabled\n"); 160 + if (byt_rt5640_quirk & BYT_RT5640_SWAPPED_SPEAKERS) 161 + dev_info(dev, "quirk SWAPPED_SPEAKERS enabled\n"); 161 162 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT) 162 163 dev_info(dev, "quirk LINEOUT enabled\n"); 163 164 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2) ··· 906 903 DMI_MATCH(DMI_BIOS_DATE, "10/22/2015"), 907 904 }, 908 905 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | 906 + BYT_RT5640_SWAPPED_SPEAKERS | 909 907 BYT_RT5640_SSP0_AIF1 | 910 908 BYT_RT5640_MCLK_EN), 911 909 }, ··· 1635 1631 const char *platform_name; 1636 1632 struct acpi_device *adev; 1637 1633 struct device *codec_dev; 1634 + const char *cfg_spk; 1638 1635 bool sof_parent; 1639 1636 int ret_val = 0; 1640 1637 int dai_index = 0; 1641 - int i, cfg_spk; 1642 - int aif; 1638 + int i, aif; 1643 1639 1644 1640 is_bytcr = false; 1645 1641 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ··· 1799 1795 } 1800 1796 1801 1797 if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) { 1802 - cfg_spk = 0; 1798 + cfg_spk = "0"; 1803 1799 spk_type = "none"; 1804 1800 } else if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) { 1805 - cfg_spk = 1; 1801 + cfg_spk = "1"; 1806 1802 spk_type = "mono"; 1803 + } else if (byt_rt5640_quirk & BYT_RT5640_SWAPPED_SPEAKERS) { 1804 + cfg_spk = "swapped"; 1805 + spk_type = "swapped"; 1807 1806 } else { 1808 - cfg_spk = 2; 1807 + cfg_spk = "2"; 1809 1808 spk_type = "stereo"; 1810 1809 } 1811 1810 ··· 1823 1816 headset2_string = " cfg-hs2:in1"; 1824 1817 1825 1818 snprintf(byt_rt5640_components, sizeof(byt_rt5640_components), 1826 - "cfg-spk:%d cfg-mic:%s aif:%d%s%s", cfg_spk, 1819 + "cfg-spk:%s cfg-mic:%s aif:%d%s%s", cfg_spk, 1827 1820 map_name[BYT_RT5640_MAP(byt_rt5640_quirk)], aif, 1828 1821 lineout_string, headset2_string); 1829 1822 byt_rt5640_card.components = byt_rt5640_components;