2 * Renesas R-Car SRU/SCU/SSIU/SSI support
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
16 * Renesas R-Car sound device structure
20 * SRU : Sound Routing Unit
21 * - SRC : Sampling Rate Converter
23 * - CTU : Channel Count Conversion Unit
25 * - DVC : Digital Volume and Mute Function
26 * - SSI : Serial Sound Interface
30 * SCU : Sampling Rate Converter Unit
31 * - SRC : Sampling Rate Converter
33 * - CTU : Channel Count Conversion Unit
35 * - DVC : Digital Volume and Mute Function
36 * SSIU : Serial Sound Interface Unit
37 * - SSI : Serial Sound Interface
45 * | ** this depends on Gen1/Gen2
49 * | ** these depend on data path
50 * | ** gen and platform data control it
54 * | +- playback -> [mod] -> [mod] -> [mod] -> ...
57 * | +- capture -> [mod] -> [mod] -> [mod] -> ...
61 * | +- playback -> [mod] -> [mod] -> [mod] -> ...
64 * | +- capture -> [mod] -> [mod] -> [mod] -> ...
67 * | ** these control ssi
76 * | ** these control src
86 * for_each_rsnd_dai(xx, priv, xx)
87 * rdai[0] => rdai[1] => rdai[2] => ...
89 * for_each_rsnd_mod(xx, rdai, xx)
90 * [mod] => [mod] => [mod] => ...
92 * rsnd_dai_call(xxx, fn )
93 * [mod]->fn() -> [mod]->fn() -> [mod]->fn()...
96 #include <linux/pm_runtime.h>
97 #include <linux/shdma-base.h>
100 #define RSND_RATES SNDRV_PCM_RATE_8000_96000
101 #define RSND_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
103 static struct rsnd_of_data rsnd_of_data_gen1 = {
107 static struct rsnd_of_data rsnd_of_data_gen2 = {
111 static struct of_device_id rsnd_of_match[] = {
112 { .compatible = "renesas,rcar_sound-gen1", .data = &rsnd_of_data_gen1 },
113 { .compatible = "renesas,rcar_sound-gen2", .data = &rsnd_of_data_gen2 },
116 MODULE_DEVICE_TABLE(of, rsnd_of_match);
119 * rsnd_platform functions
121 #define rsnd_platform_call(priv, dai, func, param...) \
122 (!(priv->info->func) ? 0 : \
123 priv->info->func(param))
125 #define rsnd_is_enable_path(io, name) \
126 ((io)->info ? (io)->info->name : NULL)
127 #define rsnd_info_id(priv, io, name) \
128 ((io)->info->name - priv->info->name##_info)
133 char *rsnd_mod_name(struct rsnd_mod *mod)
135 if (!mod || !mod->ops)
138 return mod->ops->name;
141 void rsnd_mod_init(struct rsnd_priv *priv,
142 struct rsnd_mod *mod,
143 struct rsnd_mod_ops *ops,
144 enum rsnd_mod_type type,
156 static void __rsnd_dma_start(struct rsnd_dma *dma);
157 static void rsnd_dma_continue(struct rsnd_dma *dma)
159 /* push next A or B plane */
160 dma->submit_loop = 1;
161 schedule_work(&dma->work);
164 void rsnd_dma_start(struct rsnd_dma *dma)
166 /* push both A and B plane*/
168 dma->submit_loop = 2;
169 __rsnd_dma_start(dma);
172 void rsnd_dma_stop(struct rsnd_dma *dma)
174 dma->submit_loop = 0;
175 cancel_work_sync(&dma->work);
176 dmaengine_terminate_all(dma->chan);
179 static void rsnd_dma_complete(void *data)
181 struct rsnd_dma *dma = (struct rsnd_dma *)data;
182 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
183 struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
184 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
187 rsnd_lock(priv, flags);
190 * Renesas sound Gen1 needs 1 DMAC,
192 * In Gen2 case, it are Audio-DMAC, and Audio-DMAC-peri-peri.
193 * But, Audio-DMAC-peri-peri doesn't have interrupt,
194 * and this driver is assuming that here.
196 * If Audio-DMAC-peri-peri has interrpt,
197 * rsnd_dai_pointer_update() will be called twice,
198 * ant it will breaks io->byte_pos
200 if (dma->submit_loop)
201 rsnd_dma_continue(dma);
203 rsnd_unlock(priv, flags);
205 rsnd_dai_pointer_update(io, io->byte_per_period);
208 static void __rsnd_dma_start(struct rsnd_dma *dma)
210 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
211 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
212 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
213 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
214 struct device *dev = rsnd_priv_to_dev(priv);
215 struct dma_async_tx_descriptor *desc;
217 size_t len = io->byte_per_period;
220 for (i = 0; i < dma->submit_loop; i++) {
222 buf = runtime->dma_addr +
223 rsnd_dai_pointer_offset(io, dma->offset + len);
226 desc = dmaengine_prep_slave_single(
227 dma->chan, buf, len, dma->dir,
228 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
230 dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
234 desc->callback = rsnd_dma_complete;
235 desc->callback_param = dma;
237 if (dmaengine_submit(desc) < 0) {
238 dev_err(dev, "dmaengine_submit() fail\n");
242 dma_async_issue_pending(dma->chan);
246 static void rsnd_dma_do_work(struct work_struct *work)
248 struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
250 __rsnd_dma_start(dma);
253 int rsnd_dma_available(struct rsnd_dma *dma)
258 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
261 struct device *dev = rsnd_priv_to_dev(priv);
262 struct dma_slave_config cfg;
267 dev_err(dev, "it already has dma channel\n");
272 dma_cap_set(DMA_SLAVE, mask);
274 dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
276 is_play ? "tx" : "rx");
278 dev_err(dev, "can't get dma channel\n");
283 cfg.dst_addr = 0; /* use default addr when playback */
284 cfg.src_addr = 0; /* use default addr when capture */
285 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
287 ret = dmaengine_slave_config(dma->chan, &cfg);
289 goto rsnd_dma_init_err;
291 dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
292 INIT_WORK(&dma->work, rsnd_dma_do_work);
297 rsnd_dma_quit(priv, dma);
302 void rsnd_dma_quit(struct rsnd_priv *priv,
303 struct rsnd_dma *dma)
306 dma_release_channel(dma->chan);
314 #define __rsnd_mod_call(mod, func, rdai, io) \
316 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
317 struct device *dev = rsnd_priv_to_dev(priv); \
318 dev_dbg(dev, "%s [%d] %s\n", \
319 rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
320 (mod)->ops->func(mod, rdai, io); \
323 #define rsnd_mod_call(mod, func, rdai, io) \
324 (!(mod) ? -ENODEV : \
325 !((mod)->ops->func) ? 0 : \
326 __rsnd_mod_call(mod, func, (rdai), (io)))
328 #define rsnd_dai_call(rdai, io, fn) \
330 struct rsnd_mod *mod; \
332 for (i = 0; i < RSND_MOD_MAX; i++) { \
333 mod = (io)->mod[i]; \
336 ret = rsnd_mod_call(mod, fn, (rdai), (io)); \
343 static int rsnd_dai_connect(struct rsnd_mod *mod,
344 struct rsnd_dai_stream *io)
349 if (io->mod[mod->type]) {
350 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
351 struct device *dev = rsnd_priv_to_dev(priv);
353 dev_err(dev, "%s%d is not empty\n",
359 io->mod[mod->type] = mod;
365 int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai)
367 int id = rdai - priv->rdai;
369 if ((id < 0) || (id >= rsnd_rdai_nr(priv)))
375 struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id)
377 if ((id < 0) || (id >= rsnd_rdai_nr(priv)))
380 return priv->rdai + id;
383 static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
385 struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai);
387 return rsnd_dai_get(priv, dai->id);
390 int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io)
392 return &rdai->playback == io;
396 * rsnd_soc_dai functions
398 int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional)
400 struct snd_pcm_substream *substream = io->substream;
401 struct snd_pcm_runtime *runtime = substream->runtime;
402 int pos = io->byte_pos + additional;
404 pos %= (runtime->periods * io->byte_per_period);
409 void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int byte)
411 io->byte_pos += byte;
413 if (io->byte_pos >= io->next_period_byte) {
414 struct snd_pcm_substream *substream = io->substream;
415 struct snd_pcm_runtime *runtime = substream->runtime;
418 io->next_period_byte += io->byte_per_period;
420 if (io->period_pos >= runtime->periods) {
423 io->next_period_byte = io->byte_per_period;
426 snd_pcm_period_elapsed(substream);
430 static int rsnd_dai_stream_init(struct rsnd_dai_stream *io,
431 struct snd_pcm_substream *substream)
433 struct snd_pcm_runtime *runtime = substream->runtime;
435 io->substream = substream;
438 io->byte_per_period = runtime->period_size *
440 samples_to_bytes(runtime, 1);
441 io->next_period_byte = io->byte_per_period;
447 struct snd_soc_dai *rsnd_substream_to_dai(struct snd_pcm_substream *substream)
449 struct snd_soc_pcm_runtime *rtd = substream->private_data;
455 struct rsnd_dai_stream *rsnd_rdai_to_io(struct rsnd_dai *rdai,
456 struct snd_pcm_substream *substream)
458 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
459 return &rdai->playback;
461 return &rdai->capture;
464 static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
465 struct snd_soc_dai *dai)
467 struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai);
468 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
469 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
470 struct rsnd_mod *mod = rsnd_ssi_mod_get_frm_dai(priv,
471 rsnd_dai_id(priv, rdai),
472 rsnd_dai_is_play(rdai, io));
473 int ssi_id = rsnd_mod_id(mod);
477 rsnd_lock(priv, flags);
480 case SNDRV_PCM_TRIGGER_START:
481 ret = rsnd_dai_stream_init(io, substream);
483 goto dai_trigger_end;
485 ret = rsnd_platform_call(priv, dai, start, ssi_id);
487 goto dai_trigger_end;
489 ret = rsnd_dai_call(rdai, io, init);
491 goto dai_trigger_end;
493 ret = rsnd_dai_call(rdai, io, start);
495 goto dai_trigger_end;
497 case SNDRV_PCM_TRIGGER_STOP:
498 ret = rsnd_dai_call(rdai, io, stop);
500 goto dai_trigger_end;
502 ret = rsnd_dai_call(rdai, io, quit);
504 goto dai_trigger_end;
506 ret = rsnd_platform_call(priv, dai, stop, ssi_id);
508 goto dai_trigger_end;
515 rsnd_unlock(priv, flags);
520 static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
522 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
524 /* set master/slave audio interface */
525 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
526 case SND_SOC_DAIFMT_CBM_CFM:
527 rdai->clk_master = 0;
529 case SND_SOC_DAIFMT_CBS_CFS:
530 rdai->clk_master = 1; /* codec is slave, cpu is master */
536 /* set clock inversion */
537 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
538 case SND_SOC_DAIFMT_NB_IF:
539 rdai->bit_clk_inv = 0;
540 rdai->frm_clk_inv = 1;
542 case SND_SOC_DAIFMT_IB_NF:
543 rdai->bit_clk_inv = 1;
544 rdai->frm_clk_inv = 0;
546 case SND_SOC_DAIFMT_IB_IF:
547 rdai->bit_clk_inv = 1;
548 rdai->frm_clk_inv = 1;
550 case SND_SOC_DAIFMT_NB_NF:
552 rdai->bit_clk_inv = 0;
553 rdai->frm_clk_inv = 0;
558 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
559 case SND_SOC_DAIFMT_I2S:
561 rdai->data_alignment = 0;
563 case SND_SOC_DAIFMT_LEFT_J:
565 rdai->data_alignment = 0;
567 case SND_SOC_DAIFMT_RIGHT_J:
569 rdai->data_alignment = 1;
576 static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
577 .trigger = rsnd_soc_dai_trigger,
578 .set_fmt = rsnd_soc_dai_set_fmt,
581 static int rsnd_path_init(struct rsnd_priv *priv,
582 struct rsnd_dai *rdai,
583 struct rsnd_dai_stream *io)
585 struct rsnd_mod *mod;
586 struct rsnd_dai_platform_info *dai_info = rdai->info;
592 * Gen1 is created by SRU/SSI, and this SRU is base module of
593 * Gen2's SCU/SSIU/SSI. (Gen2 SCU/SSIU came from SRU)
596 * Gen1 SRU = Gen2 SCU + SSIU + etc
598 * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is
602 if (rsnd_is_enable_path(io, ssi))
603 ssi_id = rsnd_info_id(priv, io, ssi);
604 if (rsnd_is_enable_path(io, src))
605 src_id = rsnd_info_id(priv, io, src);
608 mod = rsnd_ssi_mod_get_frm_dai(priv,
609 rsnd_dai_id(priv, rdai),
610 rsnd_dai_is_play(rdai, io));
613 ssi_id = src_id = rsnd_mod_id(mod);
620 mod = rsnd_src_mod_get(priv, src_id);
621 ret = rsnd_dai_connect(mod, io);
628 mod = rsnd_ssi_mod_get(priv, ssi_id);
629 ret = rsnd_dai_connect(mod, io);
637 static void rsnd_of_parse_dai(struct platform_device *pdev,
638 const struct rsnd_of_data *of_data,
639 struct rsnd_priv *priv)
641 struct device_node *dai_node, *dai_np;
642 struct device_node *ssi_node, *ssi_np;
643 struct device_node *src_node, *src_np;
644 struct device_node *playback, *capture;
645 struct rsnd_dai_platform_info *dai_info;
646 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
647 struct device *dev = &pdev->dev;
649 int dai_i, ssi_i, src_i;
654 dai_node = of_get_child_by_name(dev->of_node, "rcar_sound,dai");
658 nr = of_get_child_count(dai_node);
662 dai_info = devm_kzalloc(dev,
663 sizeof(struct rsnd_dai_platform_info) * nr,
666 dev_err(dev, "dai info allocation error\n");
670 info->dai_info_nr = nr;
671 info->dai_info = dai_info;
673 ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
674 src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
676 #define mod_parse(name) \
678 struct rsnd_##name##_platform_info *name##_info; \
681 for_each_child_of_node(name##_node, name##_np) { \
682 name##_info = info->name##_info + name##_i; \
684 if (name##_np == playback) \
685 dai_info->playback.name = name##_info; \
686 if (name##_np == capture) \
687 dai_info->capture.name = name##_info; \
697 for_each_child_of_node(dai_node, dai_np) {
698 dai_info = info->dai_info + dai_i;
702 playback = of_parse_phandle(dai_np, "playback", i);
703 capture = of_parse_phandle(dai_np, "capture", i);
705 if (!playback && !capture)
712 of_node_put(playback);
714 of_node_put(capture);
721 static int rsnd_dai_probe(struct platform_device *pdev,
722 const struct rsnd_of_data *of_data,
723 struct rsnd_priv *priv)
725 struct snd_soc_dai_driver *drv;
726 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
727 struct rsnd_dai *rdai;
728 struct rsnd_mod *pmod, *cmod;
729 struct device *dev = rsnd_priv_to_dev(priv);
733 rsnd_of_parse_dai(pdev, of_data, priv);
736 * dai_nr should be set via dai_info_nr,
737 * but allow it to keeping compatible
739 dai_nr = info->dai_info_nr;
742 for (dai_nr = 0; dai_nr < 32; dai_nr++) {
743 pmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 1);
744 cmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 0);
752 dev_err(dev, "no dai\n");
756 drv = devm_kzalloc(dev, sizeof(*drv) * dai_nr, GFP_KERNEL);
757 rdai = devm_kzalloc(dev, sizeof(*rdai) * dai_nr, GFP_KERNEL);
759 dev_err(dev, "dai allocate failed\n");
763 priv->rdai_nr = dai_nr;
767 for (i = 0; i < dai_nr; i++) {
769 rdai[i].info = &info->dai_info[i];
771 pmod = rsnd_ssi_mod_get_frm_dai(priv, i, 1);
772 cmod = rsnd_ssi_mod_get_frm_dai(priv, i, 0);
777 snprintf(rdai[i].name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", i);
780 * init snd_soc_dai_driver
782 drv[i].name = rdai[i].name;
783 drv[i].ops = &rsnd_soc_dai_ops;
785 drv[i].playback.rates = RSND_RATES;
786 drv[i].playback.formats = RSND_FMTS;
787 drv[i].playback.channels_min = 2;
788 drv[i].playback.channels_max = 2;
791 rdai[i].playback.info = &info->dai_info[i].playback;
792 rsnd_path_init(priv, &rdai[i], &rdai[i].playback);
795 drv[i].capture.rates = RSND_RATES;
796 drv[i].capture.formats = RSND_FMTS;
797 drv[i].capture.channels_min = 2;
798 drv[i].capture.channels_max = 2;
801 rdai[i].capture.info = &info->dai_info[i].capture;
802 rsnd_path_init(priv, &rdai[i], &rdai[i].capture);
805 dev_dbg(dev, "%s (%s/%s)\n", rdai[i].name,
806 pmod ? "play" : " -- ",
807 cmod ? "capture" : " -- ");
816 static struct snd_pcm_hardware rsnd_pcm_hardware = {
817 .info = SNDRV_PCM_INFO_INTERLEAVED |
818 SNDRV_PCM_INFO_MMAP |
819 SNDRV_PCM_INFO_MMAP_VALID,
820 .buffer_bytes_max = 64 * 1024,
821 .period_bytes_min = 32,
822 .period_bytes_max = 8192,
828 static int rsnd_pcm_open(struct snd_pcm_substream *substream)
830 struct snd_pcm_runtime *runtime = substream->runtime;
833 snd_soc_set_runtime_hwparams(substream, &rsnd_pcm_hardware);
835 ret = snd_pcm_hw_constraint_integer(runtime,
836 SNDRV_PCM_HW_PARAM_PERIODS);
841 static int rsnd_hw_params(struct snd_pcm_substream *substream,
842 struct snd_pcm_hw_params *hw_params)
844 return snd_pcm_lib_malloc_pages(substream,
845 params_buffer_bytes(hw_params));
848 static snd_pcm_uframes_t rsnd_pointer(struct snd_pcm_substream *substream)
850 struct snd_pcm_runtime *runtime = substream->runtime;
851 struct snd_soc_dai *dai = rsnd_substream_to_dai(substream);
852 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
853 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
855 return bytes_to_frames(runtime, io->byte_pos);
858 static struct snd_pcm_ops rsnd_pcm_ops = {
859 .open = rsnd_pcm_open,
860 .ioctl = snd_pcm_lib_ioctl,
861 .hw_params = rsnd_hw_params,
862 .hw_free = snd_pcm_lib_free_pages,
863 .pointer = rsnd_pointer,
870 #define PREALLOC_BUFFER (32 * 1024)
871 #define PREALLOC_BUFFER_MAX (32 * 1024)
873 static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
875 return snd_pcm_lib_preallocate_pages_for_all(
878 rtd->card->snd_card->dev,
879 PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
882 static void rsnd_pcm_free(struct snd_pcm *pcm)
884 snd_pcm_lib_preallocate_free_for_all(pcm);
887 static struct snd_soc_platform_driver rsnd_soc_platform = {
888 .ops = &rsnd_pcm_ops,
889 .pcm_new = rsnd_pcm_new,
890 .pcm_free = rsnd_pcm_free,
893 static const struct snd_soc_component_driver rsnd_soc_component = {
900 static int rsnd_probe(struct platform_device *pdev)
902 struct rcar_snd_info *info;
903 struct rsnd_priv *priv;
904 struct device *dev = &pdev->dev;
905 struct rsnd_dai *rdai;
906 const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev);
907 const struct rsnd_of_data *of_data;
908 int (*probe_func[])(struct platform_device *pdev,
909 const struct rsnd_of_data *of_data,
910 struct rsnd_priv *priv) = {
922 info = devm_kzalloc(&pdev->dev,
923 sizeof(struct rcar_snd_info), GFP_KERNEL);
924 of_data = of_id->data;
926 info = pdev->dev.platform_data;
930 dev_err(dev, "driver needs R-Car sound information\n");
937 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
939 dev_err(dev, "priv allocate failed\n");
945 spin_lock_init(&priv->lock);
950 for (i = 0; i < ARRAY_SIZE(probe_func); i++) {
951 ret = probe_func[i](pdev, of_data, priv);
956 for_each_rsnd_dai(rdai, priv, i) {
957 ret = rsnd_dai_call(rdai, &rdai->playback, probe);
961 ret = rsnd_dai_call(rdai, &rdai->capture, probe);
969 ret = snd_soc_register_platform(dev, &rsnd_soc_platform);
971 dev_err(dev, "cannot snd soc register\n");
975 ret = snd_soc_register_component(dev, &rsnd_soc_component,
976 priv->daidrv, rsnd_rdai_nr(priv));
978 dev_err(dev, "cannot snd dai register\n");
982 dev_set_drvdata(dev, priv);
984 pm_runtime_enable(dev);
986 dev_info(dev, "probed\n");
990 snd_soc_unregister_platform(dev);
995 static int rsnd_remove(struct platform_device *pdev)
997 struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
998 struct rsnd_dai *rdai;
1001 pm_runtime_disable(&pdev->dev);
1003 for_each_rsnd_dai(rdai, priv, i) {
1004 ret = rsnd_dai_call(rdai, &rdai->playback, remove);
1008 ret = rsnd_dai_call(rdai, &rdai->capture, remove);
1016 static struct platform_driver rsnd_driver = {
1018 .name = "rcar_sound",
1019 .of_match_table = rsnd_of_match,
1021 .probe = rsnd_probe,
1022 .remove = rsnd_remove,
1024 module_platform_driver(rsnd_driver);
1026 MODULE_LICENSE("GPL");
1027 MODULE_DESCRIPTION("Renesas R-Car audio driver");
1028 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
1029 MODULE_ALIAS("platform:rcar-pcm-audio");