Skip to content

Commit d69a155

Browse files
antonliubroonie
authored andcommitted
ASoC: Intel: cirrus-common: fix incorrect channel mapping
The default mapping of ASPRX1 (DAC source) is slot 0. Change the slot mapping of right amplifiers (WR and TR) to slot 1 to receive right channel data. Also update the ACPI instance ID mapping according to HW configuration. Signed-off-by: xliu <[email protected]> Signed-off-by: Brent Lu <[email protected]> Acked-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ef8d89b commit d69a155

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

sound/soc/intel/boards/sof_cirrus_common.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,29 @@ static struct snd_soc_dai_link_component cs35l41_components[] = {
5454
},
5555
};
5656

57+
/*
58+
* Mapping between ACPI instance id and speaker position.
59+
*
60+
* Four speakers:
61+
* 0: Tweeter left, 1: Woofer left
62+
* 2: Tweeter right, 3: Woofer right
63+
*/
5764
static struct snd_soc_codec_conf cs35l41_codec_conf[] = {
5865
{
5966
.dlc = COMP_CODEC_CONF(CS35L41_DEV0_NAME),
60-
.name_prefix = "WL",
67+
.name_prefix = "TL",
6168
},
6269
{
6370
.dlc = COMP_CODEC_CONF(CS35L41_DEV1_NAME),
64-
.name_prefix = "WR",
71+
.name_prefix = "WL",
6572
},
6673
{
6774
.dlc = COMP_CODEC_CONF(CS35L41_DEV2_NAME),
68-
.name_prefix = "TL",
75+
.name_prefix = "TR",
6976
},
7077
{
7178
.dlc = COMP_CODEC_CONF(CS35L41_DEV3_NAME),
72-
.name_prefix = "TR",
79+
.name_prefix = "WR",
7380
},
7481
};
7582

@@ -101,6 +108,21 @@ static int cs35l41_init(struct snd_soc_pcm_runtime *rtd)
101108
return ret;
102109
}
103110

111+
/*
112+
* Channel map:
113+
*
114+
* TL/WL: ASPRX1 on slot 0, ASPRX2 on slot 1 (default)
115+
* TR/WR: ASPRX1 on slot 1, ASPRX2 on slot 0
116+
*/
117+
static const struct {
118+
unsigned int rx[2];
119+
} cs35l41_channel_map[] = {
120+
{.rx = {0, 1}}, /* TL */
121+
{.rx = {0, 1}}, /* WL */
122+
{.rx = {1, 0}}, /* TR */
123+
{.rx = {1, 0}}, /* WR */
124+
};
125+
104126
static int cs35l41_hw_params(struct snd_pcm_substream *substream,
105127
struct snd_pcm_hw_params *params)
106128
{
@@ -134,6 +156,16 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream,
134156
ret);
135157
return ret;
136158
}
159+
160+
/* setup channel map */
161+
ret = snd_soc_dai_set_channel_map(codec_dai, 0, NULL,
162+
ARRAY_SIZE(cs35l41_channel_map[i].rx),
163+
(unsigned int *)cs35l41_channel_map[i].rx);
164+
if (ret < 0) {
165+
dev_err(codec_dai->dev, "fail to set channel map, ret %d\n",
166+
ret);
167+
return ret;
168+
}
137169
}
138170

139171
return 0;

0 commit comments

Comments
 (0)