@@ -96,14 +96,19 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
9696 return 0 ;
9797}
9898
99- static int da7219_clk_enable (struct snd_pcm_substream * substream ,
100- int wclk_rate , int bclk_rate )
99+ static int da7219_clk_enable (struct snd_pcm_substream * substream )
101100{
102101 int ret = 0 ;
103102 struct snd_soc_pcm_runtime * rtd = substream -> private_data ;
104103
105- clk_set_rate (da7219_dai_wclk , wclk_rate );
106- clk_set_rate (da7219_dai_bclk , bclk_rate );
104+ /*
105+ * Set wclk to 48000 because the rate constraint of this driver is
106+ * 48000. ADAU7002 spec: "The ADAU7002 requires a BCLK rate that is
107+ * minimum of 64x the LRCLK sample rate." DA7219 is the only clk
108+ * source so for all codecs we have to limit bclk to 64X lrclk.
109+ */
110+ clk_set_rate (da7219_dai_wclk , 48000 );
111+ clk_set_rate (da7219_dai_bclk , 48000 * 64 );
107112 ret = clk_prepare_enable (da7219_dai_bclk );
108113 if (ret < 0 ) {
109114 dev_err (rtd -> dev , "can't enable master clock %d\n" , ret );
@@ -156,7 +161,7 @@ static int cz_da7219_play_startup(struct snd_pcm_substream *substream)
156161 & constraints_rates );
157162
158163 machine -> play_i2s_instance = I2S_SP_INSTANCE ;
159- return 0 ;
164+ return da7219_clk_enable ( substream ) ;
160165}
161166
162167static int cz_da7219_cap_startup (struct snd_pcm_substream * substream )
@@ -178,7 +183,7 @@ static int cz_da7219_cap_startup(struct snd_pcm_substream *substream)
178183
179184 machine -> cap_i2s_instance = I2S_SP_INSTANCE ;
180185 machine -> capture_channel = CAP_CHANNEL1 ;
181- return 0 ;
186+ return da7219_clk_enable ( substream ) ;
182187}
183188
184189static int cz_max_startup (struct snd_pcm_substream * substream )
@@ -199,7 +204,7 @@ static int cz_max_startup(struct snd_pcm_substream *substream)
199204 & constraints_rates );
200205
201206 machine -> play_i2s_instance = I2S_BT_INSTANCE ;
202- return 0 ;
207+ return da7219_clk_enable ( substream ) ;
203208}
204209
205210static int cz_dmic0_startup (struct snd_pcm_substream * substream )
@@ -220,7 +225,7 @@ static int cz_dmic0_startup(struct snd_pcm_substream *substream)
220225 & constraints_rates );
221226
222227 machine -> cap_i2s_instance = I2S_BT_INSTANCE ;
223- return 0 ;
228+ return da7219_clk_enable ( substream ) ;
224229}
225230
226231static int cz_dmic1_startup (struct snd_pcm_substream * substream )
@@ -242,25 +247,7 @@ static int cz_dmic1_startup(struct snd_pcm_substream *substream)
242247
243248 machine -> cap_i2s_instance = I2S_SP_INSTANCE ;
244249 machine -> capture_channel = CAP_CHANNEL0 ;
245- return 0 ;
246- }
247-
248- static int cz_da7219_params (struct snd_pcm_substream * substream ,
249- struct snd_pcm_hw_params * params )
250- {
251- int wclk , bclk ;
252-
253- wclk = params_rate (params );
254- bclk = wclk * params_channels (params ) *
255- snd_pcm_format_width (params_format (params ));
256- /* ADAU7002 spec: "The ADAU7002 requires a BCLK rate
257- * that is minimum of 64x the LRCLK sample rate."
258- * DA7219 is the only clk source so for all codecs
259- * we have to limit bclk to 64X lrclk.
260- */
261- if (bclk < (wclk * 64 ))
262- bclk = wclk * 64 ;
263- return da7219_clk_enable (substream , wclk , bclk );
250+ return da7219_clk_enable (substream );
264251}
265252
266253static void cz_da7219_shutdown (struct snd_pcm_substream * substream )
@@ -271,31 +258,26 @@ static void cz_da7219_shutdown(struct snd_pcm_substream *substream)
271258static const struct snd_soc_ops cz_da7219_play_ops = {
272259 .startup = cz_da7219_play_startup ,
273260 .shutdown = cz_da7219_shutdown ,
274- .hw_params = cz_da7219_params ,
275261};
276262
277263static const struct snd_soc_ops cz_da7219_cap_ops = {
278264 .startup = cz_da7219_cap_startup ,
279265 .shutdown = cz_da7219_shutdown ,
280- .hw_params = cz_da7219_params ,
281266};
282267
283268static const struct snd_soc_ops cz_max_play_ops = {
284269 .startup = cz_max_startup ,
285270 .shutdown = cz_da7219_shutdown ,
286- .hw_params = cz_da7219_params ,
287271};
288272
289273static const struct snd_soc_ops cz_dmic0_cap_ops = {
290274 .startup = cz_dmic0_startup ,
291275 .shutdown = cz_da7219_shutdown ,
292- .hw_params = cz_da7219_params ,
293276};
294277
295278static const struct snd_soc_ops cz_dmic1_cap_ops = {
296279 .startup = cz_dmic1_startup ,
297280 .shutdown = cz_da7219_shutdown ,
298- .hw_params = cz_da7219_params ,
299281};
300282
301283SND_SOC_DAILINK_DEF (designware1 ,
0 commit comments