Skip to content

Commit b1b6131

Browse files
jwrdegoedebroonie
authored andcommitted
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>
1 parent 99c7bb4 commit b1b6131

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

sound/soc/intel/boards/bytcr_rt5640.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum {
8383
#define BYT_RT5640_HSMIC2_ON_IN1 BIT(27)
8484
#define BYT_RT5640_JD_HP_ELITEP_1000G2 BIT(28)
8585
#define BYT_RT5640_USE_AMCR0F28 BIT(29)
86+
#define BYT_RT5640_SWAPPED_SPEAKERS BIT(30)
8687

8788
#define BYTCR_INPUT_DEFAULTS \
8889
(BYT_RT5640_IN3_MAP | \
@@ -157,6 +158,8 @@ static void log_quirks(struct device *dev)
157158
dev_info(dev, "quirk MONO_SPEAKER enabled\n");
158159
if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)
159160
dev_info(dev, "quirk NO_SPEAKERS enabled\n");
161+
if (byt_rt5640_quirk & BYT_RT5640_SWAPPED_SPEAKERS)
162+
dev_info(dev, "quirk SWAPPED_SPEAKERS enabled\n");
160163
if (byt_rt5640_quirk & BYT_RT5640_LINEOUT)
161164
dev_info(dev, "quirk LINEOUT enabled\n");
162165
if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
@@ -903,6 +906,7 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
903906
DMI_MATCH(DMI_BIOS_DATE, "10/22/2015"),
904907
},
905908
.driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
909+
BYT_RT5640_SWAPPED_SPEAKERS |
906910
BYT_RT5640_SSP0_AIF1 |
907911
BYT_RT5640_MCLK_EN),
908912
},
@@ -1631,11 +1635,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
16311635
const char *platform_name;
16321636
struct acpi_device *adev;
16331637
struct device *codec_dev;
1638+
const char *cfg_spk;
16341639
bool sof_parent;
16351640
int ret_val = 0;
16361641
int dai_index = 0;
1637-
int i, cfg_spk;
1638-
int aif;
1642+
int i, aif;
16391643

16401644
is_bytcr = false;
16411645
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -1795,13 +1799,16 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
17951799
}
17961800

17971801
if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) {
1798-
cfg_spk = 0;
1802+
cfg_spk = "0";
17991803
spk_type = "none";
18001804
} else if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) {
1801-
cfg_spk = 1;
1805+
cfg_spk = "1";
18021806
spk_type = "mono";
1807+
} else if (byt_rt5640_quirk & BYT_RT5640_SWAPPED_SPEAKERS) {
1808+
cfg_spk = "swapped";
1809+
spk_type = "swapped";
18031810
} else {
1804-
cfg_spk = 2;
1811+
cfg_spk = "2";
18051812
spk_type = "stereo";
18061813
}
18071814

@@ -1816,7 +1823,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
18161823
headset2_string = " cfg-hs2:in1";
18171824

18181825
snprintf(byt_rt5640_components, sizeof(byt_rt5640_components),
1819-
"cfg-spk:%d cfg-mic:%s aif:%d%s%s", cfg_spk,
1826+
"cfg-spk:%s cfg-mic:%s aif:%d%s%s", cfg_spk,
18201827
map_name[BYT_RT5640_MAP(byt_rt5640_quirk)], aif,
18211828
lineout_string, headset2_string);
18221829
byt_rt5640_card.components = byt_rt5640_components;

0 commit comments

Comments
 (0)