Skip to content

Commit 56da9a5

Browse files
committed
Bugfix: AC101 miss channels order in cpu_dai, channel map IN(0,1,2,3,4,5,6,7)->OUT(2,3,4,5,6,7,0,1)
1 parent c336774 commit 56da9a5

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

ac101.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ struct ac10x_priv {
101101
struct regulator_bulk_data *supplies;
102102

103103
struct work_struct codec_resume;
104+
struct delayed_work dlywork;
105+
int trgr_cnt;
104106
};
105107

106108
void get_configuration(void)
@@ -1219,7 +1221,6 @@ static int ac10x_aif_mute(struct snd_soc_dai *codec_dai, int mute)
12191221

12201222
#if !_MORE_WIDGETS
12211223
if (!mute) {
1222-
ac10x_aif1clk(codec, SND_SOC_DAPM_PRE_PMU);
12231224
late_enable_dac(codec, SND_SOC_DAPM_PRE_PMU);
12241225
ac10x_headphone_event(codec, SND_SOC_DAPM_POST_PMU);
12251226
if (drc_used) {
@@ -1279,6 +1280,8 @@ static int ac10x_hw_params(struct snd_pcm_substream *substream,
12791280

12801281
AC10X_DBG("%s() L%d +++\n", __func__, __LINE__);
12811282

1283+
ac10x->trgr_cnt = 0;
1284+
12821285
channels = params_channels(params);
12831286
aif1_lrck_div = 16 * channels;
12841287

@@ -1543,6 +1546,20 @@ static int ac10x_set_bias_level(struct snd_soc_codec *codec,
15431546
return 0;
15441547
}
15451548

1549+
/*
1550+
* due to miss channels order in cpu_dai, we meed defer the clock starting.
1551+
*/
1552+
static void ac10x_work_start_clock(struct work_struct *work) {
1553+
struct ac10x_priv *ac10x = container_of(work, struct ac10x_priv, dlywork.work);
1554+
1555+
/* enable global clock */
1556+
#if !_MORE_WIDGETS
1557+
ac10x_aif1clk(ac10x->codec, SND_SOC_DAPM_PRE_PMU);
1558+
#endif
1559+
1560+
return;
1561+
}
1562+
15461563
static int ac10x_trigger(struct snd_pcm_substream *substream, int cmd,
15471564
struct snd_soc_dai *dai)
15481565
{
@@ -1553,6 +1570,27 @@ static int ac10x_trigger(struct snd_pcm_substream *substream, int cmd,
15531570
AC10X_DBG("%s() stream=%d cmd=%d\n",
15541571
__FUNCTION__, substream->stream, cmd);
15551572

1573+
switch (cmd) {
1574+
case SNDRV_PCM_TRIGGER_START:
1575+
case SNDRV_PCM_TRIGGER_RESUME:
1576+
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1577+
if (ac10x->trgr_cnt++ > 0) {
1578+
break;
1579+
}
1580+
1581+
/* delayed clock starting */
1582+
schedule_delayed_work(&ac10x->dlywork, msecs_to_jiffies(30));
1583+
break;
1584+
1585+
case SNDRV_PCM_TRIGGER_STOP:
1586+
case SNDRV_PCM_TRIGGER_SUSPEND:
1587+
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1588+
break;
1589+
default:
1590+
ret = -EINVAL;
1591+
}
1592+
1593+
15561594
return 0;
15571595
}
15581596

@@ -1702,6 +1740,7 @@ static int ac10x_codec_probe(struct snd_soc_codec *codec)
17021740
}
17031741
ac10x->codec = codec;
17041742

1743+
INIT_DELAYED_WORK(&ac10x->dlywork, ac10x_work_start_clock);
17051744
INIT_WORK(&ac10x->codec_resume, codec_resume_work);
17061745
ac10x->dac_enable = 0;
17071746
ac10x->adc_enable = 0;

0 commit comments

Comments
 (0)