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

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.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9b9974d3
Loading
Loading
Loading
Loading
+25 −27
Original line number Diff line number Diff line
@@ -58,11 +58,11 @@ struct sst_byt_priv_data {
};

/* 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_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_pcm_data *pcm_data = &pdata->pcm[substream->stream];
	struct sst_byt *byt = pdata->byt;
@@ -121,7 +121,8 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream,
	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;

@@ -164,10 +165,10 @@ static void sst_byt_pcm_work(struct work_struct *work)
		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_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	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 *byt = pdata->byt;
@@ -228,11 +229,11 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data)
	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_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_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
	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_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	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 *byt = pdata->byt;
@@ -269,10 +270,10 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream)
	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_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	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 *byt = pdata->byt;
@@ -294,7 +295,8 @@ out:
	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 snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -303,22 +305,11 @@ static int sst_byt_pcm_mmap(struct snd_pcm_substream *substream,
	return snd_pcm_lib_default_mmap(substream, vma);
}

static const struct snd_pcm_ops sst_byt_pcm_ops = {
	.open		= sst_byt_pcm_open,
	.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)
static int sst_byt_pcm_new(struct snd_soc_component *component,
			   struct snd_soc_pcm_runtime *rtd)
{
	struct snd_pcm *pcm = rtd->pcm;
	size_t size;
	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	struct sst_pdata *pdata = dev_get_platdata(component->dev);

	if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
@@ -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 = {
	.name		= DRV_NAME,
	.probe		= sst_byt_pcm_probe,
	.ops		= &sst_byt_pcm_ops,
	.pcm_new	= sst_byt_pcm_new,
	.open		= sst_byt_pcm_open,
	.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