ASoC: fsl: mpc5200_dma: remove snd_pcm_ops
snd_pcm_ops is no longer needed. Let's use component driver callback. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a7aj90cx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
							parent
							
								
									4ac85de997
								
							
						
					
					
						commit
						6d1048bc11
					
				| @ -98,7 +98,8 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream) | |||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int psc_dma_hw_free(struct snd_pcm_substream *substream) | static int psc_dma_hw_free(struct snd_soc_component *component, | ||||||
|  | 			   struct snd_pcm_substream *substream) | ||||||
| { | { | ||||||
| 	snd_pcm_set_runtime_buffer(substream, NULL); | 	snd_pcm_set_runtime_buffer(substream, NULL); | ||||||
| 	return 0; | 	return 0; | ||||||
| @ -110,7 +111,8 @@ static int psc_dma_hw_free(struct snd_pcm_substream *substream) | |||||||
|  * This function is called by ALSA to start, stop, pause, and resume the DMA |  * This function is called by ALSA to start, stop, pause, and resume the DMA | ||||||
|  * transfer of data. |  * transfer of data. | ||||||
|  */ |  */ | ||||||
| static int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd) | static int psc_dma_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 psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 	struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||||||
| @ -210,7 +212,8 @@ static const struct snd_pcm_hardware psc_dma_hardware = { | |||||||
| 	.fifo_size		= 512, | 	.fifo_size		= 512, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static int psc_dma_open(struct snd_pcm_substream *substream) | static int psc_dma_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 *rtd = substream->private_data; | 	struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||||||
| @ -238,7 +241,8 @@ static int psc_dma_open(struct snd_pcm_substream *substream) | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int psc_dma_close(struct snd_pcm_substream *substream) | static int psc_dma_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 psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 	struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||||||
| @ -263,7 +267,8 @@ static int psc_dma_close(struct snd_pcm_substream *substream) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static snd_pcm_uframes_t | static snd_pcm_uframes_t | ||||||
| psc_dma_pointer(struct snd_pcm_substream *substream) | psc_dma_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 psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 	struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||||||
| @ -280,29 +285,19 @@ psc_dma_pointer(struct snd_pcm_substream *substream) | |||||||
| 	return bytes_to_frames(substream->runtime, count); | 	return bytes_to_frames(substream->runtime, count); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int | static int psc_dma_hw_params(struct snd_soc_component *component, | ||||||
| psc_dma_hw_params(struct snd_pcm_substream *substream, | 			     struct snd_pcm_substream *substream, | ||||||
| 			 struct snd_pcm_hw_params *params) | 			     struct snd_pcm_hw_params *params) | ||||||
| { | { | ||||||
| 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static const struct snd_pcm_ops psc_dma_ops = { | static int psc_dma_new(struct snd_soc_component *component, | ||||||
| 	.open		= psc_dma_open, | 		       struct snd_soc_pcm_runtime *rtd) | ||||||
| 	.close		= psc_dma_close, |  | ||||||
| 	.hw_free	= psc_dma_hw_free, |  | ||||||
| 	.ioctl		= snd_pcm_lib_ioctl, |  | ||||||
| 	.pointer	= psc_dma_pointer, |  | ||||||
| 	.trigger	= psc_dma_trigger, |  | ||||||
| 	.hw_params	= psc_dma_hw_params, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) |  | ||||||
| { | { | ||||||
| 	struct snd_card *card = rtd->card->snd_card; | 	struct snd_card *card = rtd->card->snd_card; | ||||||
| 	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |  | ||||||
| 	struct snd_soc_dai *dai = rtd->cpu_dai; | 	struct snd_soc_dai *dai = rtd->cpu_dai; | ||||||
| 	struct snd_pcm *pcm = rtd->pcm; | 	struct snd_pcm *pcm = rtd->pcm; | ||||||
| 	size_t size = psc_dma_hardware.buffer_bytes_max; | 	size_t size = psc_dma_hardware.buffer_bytes_max; | ||||||
| @ -341,10 +336,10 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) | |||||||
| 	return -ENOMEM; | 	return -ENOMEM; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void psc_dma_free(struct snd_pcm *pcm) | static void psc_dma_free(struct snd_soc_component *component, | ||||||
|  | 			 struct snd_pcm *pcm) | ||||||
| { | { | ||||||
| 	struct snd_soc_pcm_runtime *rtd = pcm->private_data; | 	struct snd_soc_pcm_runtime *rtd = pcm->private_data; | ||||||
| 	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |  | ||||||
| 	struct snd_pcm_substream *substream; | 	struct snd_pcm_substream *substream; | ||||||
| 	int stream; | 	int stream; | ||||||
| 
 | 
 | ||||||
| @ -362,9 +357,15 @@ static void psc_dma_free(struct snd_pcm *pcm) | |||||||
| 
 | 
 | ||||||
| static const struct snd_soc_component_driver mpc5200_audio_dma_component = { | static const struct snd_soc_component_driver mpc5200_audio_dma_component = { | ||||||
| 	.name		= DRV_NAME, | 	.name		= DRV_NAME, | ||||||
| 	.ops		= &psc_dma_ops, | 	.open		= psc_dma_open, | ||||||
| 	.pcm_new	= &psc_dma_new, | 	.close		= psc_dma_close, | ||||||
| 	.pcm_free	= &psc_dma_free, | 	.hw_free	= psc_dma_hw_free, | ||||||
|  | 	.ioctl		= snd_soc_pcm_lib_ioctl, | ||||||
|  | 	.pointer	= psc_dma_pointer, | ||||||
|  | 	.trigger	= psc_dma_trigger, | ||||||
|  | 	.hw_params	= psc_dma_hw_params, | ||||||
|  | 	.pcm_construct	= psc_dma_new, | ||||||
|  | 	.pcm_destruct	= psc_dma_free, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| int mpc5200_audio_dma_create(struct platform_device *op) | int mpc5200_audio_dma_create(struct platform_device *op) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user