@@ -101,6 +101,8 @@ struct ac10x_priv {
101
101
struct regulator_bulk_data * supplies ;
102
102
103
103
struct work_struct codec_resume ;
104
+ struct delayed_work dlywork ;
105
+ int trgr_cnt ;
104
106
};
105
107
106
108
void get_configuration (void )
@@ -1219,7 +1221,6 @@ static int ac10x_aif_mute(struct snd_soc_dai *codec_dai, int mute)
1219
1221
1220
1222
#if !_MORE_WIDGETS
1221
1223
if (!mute ) {
1222
- ac10x_aif1clk (codec , SND_SOC_DAPM_PRE_PMU );
1223
1224
late_enable_dac (codec , SND_SOC_DAPM_PRE_PMU );
1224
1225
ac10x_headphone_event (codec , SND_SOC_DAPM_POST_PMU );
1225
1226
if (drc_used ) {
@@ -1279,6 +1280,8 @@ static int ac10x_hw_params(struct snd_pcm_substream *substream,
1279
1280
1280
1281
AC10X_DBG ("%s() L%d +++\n" , __func__ , __LINE__ );
1281
1282
1283
+ ac10x -> trgr_cnt = 0 ;
1284
+
1282
1285
channels = params_channels (params );
1283
1286
aif1_lrck_div = 16 * channels ;
1284
1287
@@ -1543,6 +1546,20 @@ static int ac10x_set_bias_level(struct snd_soc_codec *codec,
1543
1546
return 0 ;
1544
1547
}
1545
1548
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
+
1546
1563
static int ac10x_trigger (struct snd_pcm_substream * substream , int cmd ,
1547
1564
struct snd_soc_dai * dai )
1548
1565
{
@@ -1553,6 +1570,27 @@ static int ac10x_trigger(struct snd_pcm_substream *substream, int cmd,
1553
1570
AC10X_DBG ("%s() stream=%d cmd=%d\n" ,
1554
1571
__FUNCTION__ , substream -> stream , cmd );
1555
1572
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
+
1556
1594
return 0 ;
1557
1595
}
1558
1596
@@ -1702,6 +1740,7 @@ static int ac10x_codec_probe(struct snd_soc_codec *codec)
1702
1740
}
1703
1741
ac10x -> codec = codec ;
1704
1742
1743
+ INIT_DELAYED_WORK (& ac10x -> dlywork , ac10x_work_start_clock );
1705
1744
INIT_WORK (& ac10x -> codec_resume , codec_resume_work );
1706
1745
ac10x -> dac_enable = 0 ;
1707
1746
ac10x -> adc_enable = 0 ;
0 commit comments