Commit 2324c8f4 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: qcom: q6asm-dai: 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/87r23v90ek.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e198048b
...@@ -206,16 +206,16 @@ static void event_handler(uint32_t opcode, uint32_t token, ...@@ -206,16 +206,16 @@ static void event_handler(uint32_t opcode, uint32_t token,
} }
} }
static int q6asm_dai_prepare(struct snd_pcm_substream *substream) static int q6asm_dai_prepare(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct q6asm_dai_rtd *prtd = runtime->private_data; struct q6asm_dai_rtd *prtd = runtime->private_data;
struct snd_soc_component *c = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct q6asm_dai_data *pdata; struct q6asm_dai_data *pdata;
int ret, i; int ret, i;
pdata = snd_soc_component_get_drvdata(c); pdata = snd_soc_component_get_drvdata(component);
if (!pdata) if (!pdata)
return -EINVAL; return -EINVAL;
...@@ -294,7 +294,8 @@ static int q6asm_dai_prepare(struct snd_pcm_substream *substream) ...@@ -294,7 +294,8 @@ static int q6asm_dai_prepare(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int q6asm_dai_trigger(struct snd_pcm_substream *substream, int cmd) static int q6asm_dai_trigger(struct snd_soc_component *component,
struct snd_pcm_substream *substream, int cmd)
{ {
int ret = 0; int ret = 0;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -322,21 +323,21 @@ static int q6asm_dai_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -322,21 +323,21 @@ static int q6asm_dai_trigger(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
static int q6asm_dai_open(struct snd_pcm_substream *substream) static int q6asm_dai_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct snd_soc_dai *cpu_dai = soc_prtd->cpu_dai; struct snd_soc_dai *cpu_dai = soc_prtd->cpu_dai;
struct snd_soc_component *c = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct q6asm_dai_rtd *prtd; struct q6asm_dai_rtd *prtd;
struct q6asm_dai_data *pdata; struct q6asm_dai_data *pdata;
struct device *dev = c->dev; struct device *dev = component->dev;
int ret = 0; int ret = 0;
int stream_id; int stream_id;
stream_id = cpu_dai->driver->id; stream_id = cpu_dai->driver->id;
pdata = snd_soc_component_get_drvdata(c); pdata = snd_soc_component_get_drvdata(component);
if (!pdata) { if (!pdata) {
pr_err("Drv data not found ..\n"); pr_err("Drv data not found ..\n");
return -EINVAL; return -EINVAL;
...@@ -414,7 +415,8 @@ static int q6asm_dai_open(struct snd_pcm_substream *substream) ...@@ -414,7 +415,8 @@ static int q6asm_dai_open(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int q6asm_dai_close(struct snd_pcm_substream *substream) static int q6asm_dai_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
...@@ -435,7 +437,8 @@ static int q6asm_dai_close(struct snd_pcm_substream *substream) ...@@ -435,7 +437,8 @@ static int q6asm_dai_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static snd_pcm_uframes_t q6asm_dai_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t q6asm_dai_pointer(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -447,21 +450,20 @@ static snd_pcm_uframes_t q6asm_dai_pointer(struct snd_pcm_substream *substream) ...@@ -447,21 +450,20 @@ static snd_pcm_uframes_t q6asm_dai_pointer(struct snd_pcm_substream *substream)
return bytes_to_frames(runtime, (prtd->pcm_irq_pos)); return bytes_to_frames(runtime, (prtd->pcm_irq_pos));
} }
static int q6asm_dai_mmap(struct snd_pcm_substream *substream, static int q6asm_dai_mmap(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct device *dev = component->dev;
struct snd_soc_component *c = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct device *dev = c->dev;
return dma_mmap_coherent(dev, vma, return dma_mmap_coherent(dev, vma,
runtime->dma_area, runtime->dma_addr, runtime->dma_area, runtime->dma_addr,
runtime->dma_bytes); runtime->dma_bytes);
} }
static int q6asm_dai_hw_params(struct snd_pcm_substream *substream, static int q6asm_dai_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_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -482,17 +484,6 @@ static int q6asm_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -482,17 +484,6 @@ static int q6asm_dai_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
static struct snd_pcm_ops q6asm_dai_ops = {
.open = q6asm_dai_open,
.hw_params = q6asm_dai_hw_params,
.close = q6asm_dai_close,
.ioctl = snd_pcm_lib_ioctl,
.prepare = q6asm_dai_prepare,
.trigger = q6asm_dai_trigger,
.pointer = q6asm_dai_pointer,
.mmap = q6asm_dai_mmap,
};
static void compress_event_handler(uint32_t opcode, uint32_t token, static void compress_event_handler(uint32_t opcode, uint32_t token,
uint32_t *payload, void *priv) uint32_t *payload, void *priv)
{ {
...@@ -800,15 +791,15 @@ static struct snd_compr_ops q6asm_dai_compr_ops = { ...@@ -800,15 +791,15 @@ static struct snd_compr_ops q6asm_dai_compr_ops = {
.ack = q6asm_dai_compr_ack, .ack = q6asm_dai_compr_ack,
}; };
static int q6asm_dai_pcm_new(struct snd_soc_pcm_runtime *rtd) static int q6asm_dai_pcm_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_pcm_substream *psubstream, *csubstream; struct snd_pcm_substream *psubstream, *csubstream;
struct snd_soc_component *c = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
struct device *dev; struct device *dev;
int size, ret; int size, ret;
dev = c->dev; dev = component->dev;
size = q6asm_dai_hardware_playback.buffer_bytes_max; size = q6asm_dai_hardware_playback.buffer_bytes_max;
psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
if (psubstream) { if (psubstream) {
...@@ -835,7 +826,8 @@ static int q6asm_dai_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -835,7 +826,8 @@ static int q6asm_dai_pcm_new(struct snd_soc_pcm_runtime *rtd)
return 0; return 0;
} }
static void q6asm_dai_pcm_free(struct snd_pcm *pcm) static void q6asm_dai_pcm_free(struct snd_soc_component *component,
struct snd_pcm *pcm)
{ {
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
int i; int i;
...@@ -852,9 +844,16 @@ static void q6asm_dai_pcm_free(struct snd_pcm *pcm) ...@@ -852,9 +844,16 @@ static void q6asm_dai_pcm_free(struct snd_pcm *pcm)
static const struct snd_soc_component_driver q6asm_fe_dai_component = { static const struct snd_soc_component_driver q6asm_fe_dai_component = {
.name = DRV_NAME, .name = DRV_NAME,
.ops = &q6asm_dai_ops, .open = q6asm_dai_open,
.pcm_new = q6asm_dai_pcm_new, .hw_params = q6asm_dai_hw_params,
.pcm_free = q6asm_dai_pcm_free, .close = q6asm_dai_close,
.ioctl = snd_soc_pcm_lib_ioctl,
.prepare = q6asm_dai_prepare,
.trigger = q6asm_dai_trigger,
.pointer = q6asm_dai_pointer,
.mmap = q6asm_dai_mmap,
.pcm_construct = q6asm_dai_pcm_new,
.pcm_destruct = q6asm_dai_pcm_free,
.compr_ops = &q6asm_dai_compr_ops, .compr_ops = &q6asm_dai_compr_ops,
}; };
......
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