@@ -80,8 +80,15 @@ static const struct snd_soc_dapm_widget mtk_dai_pcm_widgets[] = {
80
80
mtk_dai_pcm_o001_mix ,
81
81
ARRAY_SIZE (mtk_dai_pcm_o001_mix )),
82
82
83
+ SND_SOC_DAPM_SUPPLY ("PCM_EN" , PCM_INTF_CON1 ,
84
+ PCM_INTF_CON1_PCM_EN_SHIFT , 0 , NULL , 0 ),
85
+
83
86
SND_SOC_DAPM_INPUT ("PCM1_INPUT" ),
84
87
SND_SOC_DAPM_OUTPUT ("PCM1_OUTPUT" ),
88
+
89
+ SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc11" ),
90
+ SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc12" ),
91
+ SND_SOC_DAPM_CLOCK_SUPPLY ("aud_pcmif" ),
85
92
};
86
93
87
94
static const struct snd_soc_dapm_route mtk_dai_pcm_routes [] = {
@@ -97,22 +104,18 @@ static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = {
97
104
{"PCM1 Playback" , NULL , "O000" },
98
105
{"PCM1 Playback" , NULL , "O001" },
99
106
107
+ {"PCM1 Playback" , NULL , "PCM_EN" },
108
+ {"PCM1 Playback" , NULL , "aud_asrc12" },
109
+ {"PCM1 Playback" , NULL , "aud_pcmif" },
110
+
111
+ {"PCM1 Capture" , NULL , "PCM_EN" },
112
+ {"PCM1 Capture" , NULL , "aud_asrc11" },
113
+ {"PCM1 Capture" , NULL , "aud_pcmif" },
114
+
100
115
{"PCM1_OUTPUT" , NULL , "PCM1 Playback" },
101
116
{"PCM1 Capture" , NULL , "PCM1_INPUT" },
102
117
};
103
118
104
- static void mtk_dai_pcm_enable (struct mtk_base_afe * afe )
105
- {
106
- regmap_update_bits (afe -> regmap , PCM_INTF_CON1 ,
107
- PCM_INTF_CON1_PCM_EN , PCM_INTF_CON1_PCM_EN );
108
- }
109
-
110
- static void mtk_dai_pcm_disable (struct mtk_base_afe * afe )
111
- {
112
- regmap_update_bits (afe -> regmap , PCM_INTF_CON1 ,
113
- PCM_INTF_CON1_PCM_EN , 0x0 );
114
- }
115
-
116
119
static int mtk_dai_pcm_configure (struct snd_pcm_substream * substream ,
117
120
struct snd_soc_dai * dai )
118
121
{
@@ -207,54 +210,22 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
207
210
}
208
211
209
212
/* dai ops */
210
- static int mtk_dai_pcm_startup (struct snd_pcm_substream * substream ,
211
- struct snd_soc_dai * dai )
212
- {
213
- struct mtk_base_afe * afe = snd_soc_dai_get_drvdata (dai );
214
- struct mt8195_afe_private * afe_priv = afe -> platform_priv ;
215
-
216
- if (dai -> component -> active )
217
- return 0 ;
218
-
219
- mt8195_afe_enable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_ASRC11 ]);
220
- mt8195_afe_enable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_ASRC12 ]);
221
- mt8195_afe_enable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_PCMIF ]);
222
-
223
- return 0 ;
224
- }
225
-
226
- static void mtk_dai_pcm_shutdown (struct snd_pcm_substream * substream ,
227
- struct snd_soc_dai * dai )
228
- {
229
- struct mtk_base_afe * afe = snd_soc_dai_get_drvdata (dai );
230
- struct mt8195_afe_private * afe_priv = afe -> platform_priv ;
231
-
232
- if (dai -> component -> active )
233
- return ;
234
-
235
- mtk_dai_pcm_disable (afe );
236
-
237
- mt8195_afe_disable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_PCMIF ]);
238
- mt8195_afe_disable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_ASRC12 ]);
239
- mt8195_afe_disable_clk (afe , afe_priv -> clk [MT8195_CLK_AUD_ASRC11 ]);
240
- }
241
-
242
213
static int mtk_dai_pcm_prepare (struct snd_pcm_substream * substream ,
243
214
struct snd_soc_dai * dai )
244
215
{
245
- struct mtk_base_afe * afe = snd_soc_dai_get_drvdata (dai );
246
- int ret = 0 ;
216
+ int ret ;
247
217
248
- if (snd_soc_dai_stream_active (dai , SNDRV_PCM_STREAM_PLAYBACK ) &&
249
- snd_soc_dai_stream_active (dai , SNDRV_PCM_STREAM_CAPTURE ))
218
+ dev_dbg (dai -> dev , "%s(), id %d, stream %d, widget active p %d, c %d\n" ,
219
+ __func__ , dai -> id , substream -> stream ,
220
+ dai -> playback_widget -> active , dai -> capture_widget -> active );
221
+
222
+ if (dai -> playback_widget -> active || dai -> capture_widget -> active )
250
223
return 0 ;
251
224
252
225
ret = mtk_dai_pcm_configure (substream , dai );
253
226
if (ret )
254
227
return ret ;
255
228
256
- mtk_dai_pcm_enable (afe );
257
-
258
229
return 0 ;
259
230
}
260
231
@@ -316,8 +287,6 @@ static int mtk_dai_pcm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
316
287
}
317
288
318
289
static const struct snd_soc_dai_ops mtk_dai_pcm_ops = {
319
- .startup = mtk_dai_pcm_startup ,
320
- .shutdown = mtk_dai_pcm_shutdown ,
321
290
.prepare = mtk_dai_pcm_prepare ,
322
291
.set_fmt = mtk_dai_pcm_set_fmt ,
323
292
};
0 commit comments