ssm2602.c (959d851caa48829eb85cb85aa949fd6b4c5d5bc6) ssm2602.c (e6968a1719a88afa4708ff43696d6615f0be90be)
1/*
2 * File: sound/soc/codecs/ssm2602.c
3 * Author: Cliff Cai <Cliff.Cai@analog.com>
4 *
5 * Created: Tue June 06 2008
6 * Description: Driver for ssm2602 sound chip
7 *
8 * Modified:

--- 240 unchanged lines hidden (view full) ---

249 }
250 return -EINVAL;
251}
252
253static int ssm2602_hw_params(struct snd_pcm_substream *substream,
254 struct snd_pcm_hw_params *params,
255 struct snd_soc_dai *dai)
256{
1/*
2 * File: sound/soc/codecs/ssm2602.c
3 * Author: Cliff Cai <Cliff.Cai@analog.com>
4 *
5 * Created: Tue June 06 2008
6 * Description: Driver for ssm2602 sound chip
7 *
8 * Modified:

--- 240 unchanged lines hidden (view full) ---

249 }
250 return -EINVAL;
251}
252
253static int ssm2602_hw_params(struct snd_pcm_substream *substream,
254 struct snd_pcm_hw_params *params,
255 struct snd_soc_dai *dai)
256{
257 struct snd_soc_pcm_runtime *rtd = substream->private_data;
258 struct snd_soc_codec *codec = rtd->codec;
257 struct snd_soc_codec *codec = dai->codec;
259 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
260 u16 iface = snd_soc_read(codec, SSM2602_IFACE) & 0xfff3;
261 int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params));
262
263 if (substream == ssm2602->slave_substream) {
264 dev_dbg(codec->dev, "Ignoring hw_params for slave substream\n");
265 return 0;
266 }

--- 19 unchanged lines hidden (view full) ---

286 }
287 snd_soc_write(codec, SSM2602_IFACE, iface);
288 return 0;
289}
290
291static int ssm2602_startup(struct snd_pcm_substream *substream,
292 struct snd_soc_dai *dai)
293{
258 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
259 u16 iface = snd_soc_read(codec, SSM2602_IFACE) & 0xfff3;
260 int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params));
261
262 if (substream == ssm2602->slave_substream) {
263 dev_dbg(codec->dev, "Ignoring hw_params for slave substream\n");
264 return 0;
265 }

--- 19 unchanged lines hidden (view full) ---

285 }
286 snd_soc_write(codec, SSM2602_IFACE, iface);
287 return 0;
288}
289
290static int ssm2602_startup(struct snd_pcm_substream *substream,
291 struct snd_soc_dai *dai)
292{
294 struct snd_soc_pcm_runtime *rtd = substream->private_data;
295 struct snd_soc_codec *codec = rtd->codec;
293 struct snd_soc_codec *codec = dai->codec;
296 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
297 struct snd_pcm_runtime *master_runtime;
298
299 /* The DAI has shared clocks so if we already have a playback or
300 * capture going then constrain this substream to match it.
301 * TODO: the ssm2602 allows pairs of non-matching PB/REC rates
302 */
303 if (ssm2602->master_substream) {

--- 19 unchanged lines hidden (view full) ---

323 ssm2602->master_substream = substream;
324
325 return 0;
326}
327
328static void ssm2602_shutdown(struct snd_pcm_substream *substream,
329 struct snd_soc_dai *dai)
330{
294 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
295 struct snd_pcm_runtime *master_runtime;
296
297 /* The DAI has shared clocks so if we already have a playback or
298 * capture going then constrain this substream to match it.
299 * TODO: the ssm2602 allows pairs of non-matching PB/REC rates
300 */
301 if (ssm2602->master_substream) {

--- 19 unchanged lines hidden (view full) ---

321 ssm2602->master_substream = substream;
322
323 return 0;
324}
325
326static void ssm2602_shutdown(struct snd_pcm_substream *substream,
327 struct snd_soc_dai *dai)
328{
331 struct snd_soc_pcm_runtime *rtd = substream->private_data;
332 struct snd_soc_codec *codec = rtd->codec;
329 struct snd_soc_codec *codec = dai->codec;
333 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
334
335 if (ssm2602->master_substream == substream)
336 ssm2602->master_substream = ssm2602->slave_substream;
337
338 ssm2602->slave_substream = NULL;
339}
340

--- 433 unchanged lines hidden ---
330 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
331
332 if (ssm2602->master_substream == substream)
333 ssm2602->master_substream = ssm2602->slave_substream;
334
335 ssm2602->slave_substream = NULL;
336}
337

--- 433 unchanged lines hidden ---