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

ASoC: rt5514-spi: 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/87ftkb90df.wl-kuninori.morimoto.gx@renesas.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent dfd00af5
Loading
Loading
Loading
Loading
+21 −20
Original line number Original line Diff line number Diff line
@@ -201,18 +201,18 @@ static irqreturn_t rt5514_spi_irq(int irq, void *data)
}
}


/* PCM for streaming audio from the DSP buffer */
/* PCM for streaming audio from the DSP buffer */
static int rt5514_spi_pcm_open(struct snd_pcm_substream *substream)
static int rt5514_spi_pcm_open(struct snd_soc_component *component,
			       struct snd_pcm_substream *substream)
{
{
	snd_soc_set_runtime_hwparams(substream, &rt5514_spi_pcm_hardware);
	snd_soc_set_runtime_hwparams(substream, &rt5514_spi_pcm_hardware);


	return 0;
	return 0;
}
}


static int rt5514_spi_hw_params(struct snd_pcm_substream *substream,
static int rt5514_spi_hw_params(struct snd_soc_component *component,
				struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *hw_params)
				struct snd_pcm_hw_params *hw_params)
{
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	struct rt5514_dsp *rt5514_dsp =
	struct rt5514_dsp *rt5514_dsp =
		snd_soc_component_get_drvdata(component);
		snd_soc_component_get_drvdata(component);
	int ret;
	int ret;
@@ -234,10 +234,9 @@ static int rt5514_spi_hw_params(struct snd_pcm_substream *substream,
	return ret;
	return ret;
}
}


static int rt5514_spi_hw_free(struct snd_pcm_substream *substream)
static int rt5514_spi_hw_free(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 rt5514_dsp *rt5514_dsp =
	struct rt5514_dsp *rt5514_dsp =
		snd_soc_component_get_drvdata(component);
		snd_soc_component_get_drvdata(component);


@@ -251,24 +250,22 @@ static int rt5514_spi_hw_free(struct snd_pcm_substream *substream)
}
}


static snd_pcm_uframes_t rt5514_spi_pcm_pointer(
static snd_pcm_uframes_t rt5514_spi_pcm_pointer(
		struct snd_soc_component *component,
		struct snd_pcm_substream *substream)
		struct snd_pcm_substream *substream)
{
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
	struct rt5514_dsp *rt5514_dsp =
	struct rt5514_dsp *rt5514_dsp =
		snd_soc_component_get_drvdata(component);
		snd_soc_component_get_drvdata(component);


	return bytes_to_frames(runtime, rt5514_dsp->dma_offset);
	return bytes_to_frames(runtime, rt5514_dsp->dma_offset);
}
}


static const struct snd_pcm_ops rt5514_spi_pcm_ops = {
static struct page *rt5514_spi_pcm_page(struct snd_soc_component *component,
	.open		= rt5514_spi_pcm_open,
					struct snd_pcm_substream *substream,
	.hw_params	= rt5514_spi_hw_params,
					unsigned long offset)
	.hw_free	= rt5514_spi_hw_free,
{
	.pointer	= rt5514_spi_pcm_pointer,
	return snd_pcm_lib_get_vmalloc_page(substream, offset);
	.page		= snd_pcm_lib_get_vmalloc_page,
}
};


static int rt5514_spi_pcm_probe(struct snd_soc_component *component)
static int rt5514_spi_pcm_probe(struct snd_soc_component *component)
{
{
@@ -304,7 +301,11 @@ static int rt5514_spi_pcm_probe(struct snd_soc_component *component)
static const struct snd_soc_component_driver rt5514_spi_component = {
static const struct snd_soc_component_driver rt5514_spi_component = {
	.name		= DRV_NAME,
	.name		= DRV_NAME,
	.probe		= rt5514_spi_pcm_probe,
	.probe		= rt5514_spi_pcm_probe,
	.ops = &rt5514_spi_pcm_ops,
	.open		= rt5514_spi_pcm_open,
	.hw_params	= rt5514_spi_hw_params,
	.hw_free	= rt5514_spi_hw_free,
	.pointer	= rt5514_spi_pcm_pointer,
	.page		= rt5514_spi_pcm_page,
};
};


/**
/**