static int sst_byt_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); struct sst_byt *byt = pdata->byt; dev_dbg(rtd->dev, "PCM: open\n"); pcm_data = &pdata->pcm[rtd->cpu_dai->id]; mutex_lock(&pcm_data->mutex); snd_soc_pcm_set_drvdata(rtd, pcm_data); pcm_data->substream = substream; snd_soc_set_runtime_hwparams(substream, &sst_byt_pcm_hardware); pcm_data->stream = sst_byt_stream_new(byt, rtd->cpu_dai->id + 1, byt_notify_pointer, pcm_data); if (pcm_data->stream == NULL) { dev_err(rtd->dev, "failed to create stream\n"); mutex_unlock(&pcm_data->mutex); return -EINVAL; } mutex_unlock(&pcm_data->mutex); return 0; }
static int hsw_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); struct hsw_pcm_data *pcm_data; struct sst_hsw *hsw = pdata->hsw; pcm_data = &pdata->pcm[rtd->cpu_dai->id]; mutex_lock(&pcm_data->mutex); snd_soc_pcm_set_drvdata(rtd, pcm_data); pcm_data->substream = substream; snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware); pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id, hsw_notify_pointer, pcm_data); if (pcm_data->stream == NULL) { dev_err(rtd->dev, "error: failed to create stream\n"); mutex_unlock(&pcm_data->mutex); return -EINVAL; } /* Set previous saved volume */ sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0, 0, pcm_data->volume[0]); sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0, 1, pcm_data->volume[1]); mutex_unlock(&pcm_data->mutex); return 0; }
static int imx_asrc_cs42888_init(struct snd_soc_pcm_runtime *rtd) { snd_soc_pcm_set_drvdata(rtd, (void *)esai_asrc); return 0; }