Commit bb361351 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: intel: sst-baytrail-pcm: remove snd_pcm_ops

snd_pcm_ops is no longer needed.
Let's use component driver callback.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfu3af24.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9b9974d3
...@@ -58,11 +58,11 @@ struct sst_byt_priv_data { ...@@ -58,11 +58,11 @@ struct sst_byt_priv_data {
}; };
/* this may get called several times by oss emulation */ /* this may get called several times by oss emulation */
static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream, static int sst_byt_pcm_hw_params(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
struct sst_byt *byt = pdata->byt; struct sst_byt *byt = pdata->byt;
...@@ -121,7 +121,8 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -121,7 +121,8 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
static int sst_byt_pcm_hw_free(struct snd_pcm_substream *substream) static int sst_byt_pcm_hw_free(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
...@@ -164,10 +165,10 @@ static void sst_byt_pcm_work(struct work_struct *work) ...@@ -164,10 +165,10 @@ static void sst_byt_pcm_work(struct work_struct *work)
sst_byt_pcm_restore_stream_context(pcm_data->substream); sst_byt_pcm_restore_stream_context(pcm_data->substream);
} }
static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) static int sst_byt_pcm_trigger(struct snd_soc_component *component,
struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
struct sst_byt *byt = pdata->byt; struct sst_byt *byt = pdata->byt;
...@@ -228,11 +229,11 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data) ...@@ -228,11 +229,11 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data)
return pos; return pos;
} }
static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
...@@ -241,10 +242,10 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream ...@@ -241,10 +242,10 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream
return bytes_to_frames(runtime, pcm_data->hw_ptr); return bytes_to_frames(runtime, pcm_data->hw_ptr);
} }
static int sst_byt_pcm_open(struct snd_pcm_substream *substream) static int sst_byt_pcm_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
struct sst_byt *byt = pdata->byt; struct sst_byt *byt = pdata->byt;
...@@ -269,10 +270,10 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream) ...@@ -269,10 +270,10 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int sst_byt_pcm_close(struct snd_pcm_substream *substream) static int sst_byt_pcm_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
struct sst_byt *byt = pdata->byt; struct sst_byt *byt = pdata->byt;
...@@ -294,7 +295,8 @@ static int sst_byt_pcm_close(struct snd_pcm_substream *substream) ...@@ -294,7 +295,8 @@ static int sst_byt_pcm_close(struct snd_pcm_substream *substream)
return ret; return ret;
} }
static int sst_byt_pcm_mmap(struct snd_pcm_substream *substream, static int sst_byt_pcm_mmap(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
...@@ -303,22 +305,11 @@ static int sst_byt_pcm_mmap(struct snd_pcm_substream *substream, ...@@ -303,22 +305,11 @@ static int sst_byt_pcm_mmap(struct snd_pcm_substream *substream,
return snd_pcm_lib_default_mmap(substream, vma); return snd_pcm_lib_default_mmap(substream, vma);
} }
static const struct snd_pcm_ops sst_byt_pcm_ops = { static int sst_byt_pcm_new(struct snd_soc_component *component,
.open = sst_byt_pcm_open, struct snd_soc_pcm_runtime *rtd)
.close = sst_byt_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = sst_byt_pcm_hw_params,
.hw_free = sst_byt_pcm_hw_free,
.trigger = sst_byt_pcm_trigger,
.pointer = sst_byt_pcm_pointer,
.mmap = sst_byt_pcm_mmap,
};
static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
size_t size; size_t size;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_pdata *pdata = dev_get_platdata(component->dev); struct sst_pdata *pdata = dev_get_platdata(component->dev);
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
...@@ -380,8 +371,15 @@ static int sst_byt_pcm_probe(struct snd_soc_component *component) ...@@ -380,8 +371,15 @@ static int sst_byt_pcm_probe(struct snd_soc_component *component)
static const struct snd_soc_component_driver byt_dai_component = { static const struct snd_soc_component_driver byt_dai_component = {
.name = DRV_NAME, .name = DRV_NAME,
.probe = sst_byt_pcm_probe, .probe = sst_byt_pcm_probe,
.ops = &sst_byt_pcm_ops, .open = sst_byt_pcm_open,
.pcm_new = sst_byt_pcm_new, .close = sst_byt_pcm_close,
.ioctl = snd_soc_pcm_lib_ioctl,
.hw_params = sst_byt_pcm_hw_params,
.hw_free = sst_byt_pcm_hw_free,
.trigger = sst_byt_pcm_trigger,
.pointer = sst_byt_pcm_pointer,
.mmap = sst_byt_pcm_mmap,
.pcm_construct = sst_byt_pcm_new,
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment