1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car SRU/SCU/SSIU/SSI support
5 // Copyright (C) 2013 Renesas Solutions Corp.
6 // Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
9 // Kuninori Morimoto <morimoto.kuninori@renesas.com>
12 * Renesas R-Car sound device structure
16 * SRU : Sound Routing Unit
17 * - SRC : Sampling Rate Converter
19 * - CTU : Channel Count Conversion Unit
21 * - DVC : Digital Volume and Mute Function
22 * - SSI : Serial Sound Interface
26 * SCU : Sampling Rate Converter Unit
27 * - SRC : Sampling Rate Converter
29 * - CTU : Channel Count Conversion Unit
31 * - DVC : Digital Volume and Mute Function
32 * SSIU : Serial Sound Interface Unit
33 * - SSI : Serial Sound Interface
41 * | ** this depends on Gen1/Gen2
45 * | ** these depend on data path
46 * | ** gen and platform data control it
50 * | +- playback -> [mod] -> [mod] -> [mod] -> ...
53 * | +- capture -> [mod] -> [mod] -> [mod] -> ...
57 * | +- playback -> [mod] -> [mod] -> [mod] -> ...
60 * | +- capture -> [mod] -> [mod] -> [mod] -> ...
63 * | ** these control ssi
72 * | ** these control src
82 * for_each_rsnd_dai(xx, priv, xx)
83 * rdai[0] => rdai[1] => rdai[2] => ...
85 * for_each_rsnd_mod(xx, rdai, xx)
86 * [mod] => [mod] => [mod] => ...
88 * rsnd_dai_call(xxx, fn )
89 * [mod]->fn() -> [mod]->fn() -> [mod]->fn()...
94 * you can enable below define if you don't need
95 * DAI status debug message when debugging
96 * see rsnd_dbg_dai_call()
98 * #define RSND_DEBUG_NO_DAI_CALL 1
101 #include <linux/pm_runtime.h>
104 #define RSND_RATES SNDRV_PCM_RATE_8000_192000
105 #define RSND_FMTS (SNDRV_PCM_FMTBIT_S8 |\
106 SNDRV_PCM_FMTBIT_S16_LE |\
107 SNDRV_PCM_FMTBIT_S24_LE)
109 static const struct of_device_id rsnd_of_match[] = {
110 { .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 },
111 { .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 },
112 { .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN3 },
113 /* Special Handling */
114 { .compatible = "renesas,rcar_sound-r8a77990", .data = (void *)(RSND_GEN3 | RSND_SOC_E) },
117 MODULE_DEVICE_TABLE(of, rsnd_of_match);
122 void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type)
124 if (mod->type != type) {
125 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
126 struct device *dev = rsnd_priv_to_dev(priv);
128 dev_warn(dev, "%s is not your expected module\n",
133 struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
134 struct rsnd_mod *mod)
136 if (!mod || !mod->ops || !mod->ops->dma_req)
139 return mod->ops->dma_req(io, mod);
142 #define MOD_NAME_NUM 5
143 #define MOD_NAME_SIZE 16
144 char *rsnd_mod_name(struct rsnd_mod *mod)
146 static char names[MOD_NAME_NUM][MOD_NAME_SIZE];
148 char *name = names[num];
151 if (num >= MOD_NAME_NUM)
155 * Let's use same char to avoid pointlessness memory
156 * Thus, rsnd_mod_name() should be used immediately
159 if ((mod)->ops->id_sub) {
160 snprintf(name, MOD_NAME_SIZE, "%s[%d%d]",
163 rsnd_mod_id_sub(mod));
165 snprintf(name, MOD_NAME_SIZE, "%s[%d]",
173 u32 *rsnd_mod_get_status(struct rsnd_mod *mod,
174 struct rsnd_dai_stream *io,
175 enum rsnd_mod_type type)
180 int rsnd_mod_id_raw(struct rsnd_mod *mod)
185 int rsnd_mod_id(struct rsnd_mod *mod)
188 return (mod)->ops->id(mod);
190 return rsnd_mod_id_raw(mod);
193 int rsnd_mod_id_sub(struct rsnd_mod *mod)
195 if ((mod)->ops->id_sub)
196 return (mod)->ops->id_sub(mod);
201 int rsnd_mod_init(struct rsnd_priv *priv,
202 struct rsnd_mod *mod,
203 struct rsnd_mod_ops *ops,
205 enum rsnd_mod_type type,
208 int ret = clk_prepare(clk);
222 void rsnd_mod_quit(struct rsnd_mod *mod)
224 clk_unprepare(mod->clk);
228 void rsnd_mod_interrupt(struct rsnd_mod *mod,
229 void (*callback)(struct rsnd_mod *mod,
230 struct rsnd_dai_stream *io))
232 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
233 struct rsnd_dai_stream *io;
234 struct rsnd_dai *rdai;
237 for_each_rsnd_dai(rdai, priv, i) {
238 io = &rdai->playback;
239 if (mod == io->mod[mod->type])
243 if (mod == io->mod[mod->type])
248 int rsnd_io_is_working(struct rsnd_dai_stream *io)
250 /* see rsnd_dai_stream_init/quit() */
252 return snd_pcm_running(io->substream);
257 int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io,
258 struct snd_pcm_hw_params *params)
260 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
263 * params will be added when refine
265 * __rsnd_soc_hw_rule_rate()
266 * __rsnd_soc_hw_rule_channels()
269 return params_channels(params);
271 return runtime->channels;
274 int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,
275 struct snd_pcm_hw_params *params)
277 int chan = rsnd_runtime_channel_original_with_params(io, params);
278 struct rsnd_mod *ctu_mod = rsnd_io_to_mod_ctu(io);
281 u32 converted_chan = rsnd_io_converted_chan(io);
286 * converted_chan will be used for CTU,
288 * User shouldn't use CTU with TDM Split mode.
290 if (rsnd_runtime_is_tdm_split(io)) {
291 struct device *dev = rsnd_priv_to_dev(rsnd_io_to_priv(io));
293 dev_err(dev, "CTU and TDM Split should be used\n");
297 return converted_chan;
303 int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
304 struct snd_pcm_hw_params *params)
306 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
307 int chan = rsnd_io_is_play(io) ?
308 rsnd_runtime_channel_after_ctu_with_params(io, params) :
309 rsnd_runtime_channel_original_with_params(io, params);
312 if (rsnd_runtime_is_multi_ssi(io))
313 chan /= rsnd_rdai_ssi_lane_get(rdai);
315 /* TDM Extend Mode needs 8ch */
322 int rsnd_runtime_is_multi_ssi(struct rsnd_dai_stream *io)
324 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
325 int lane = rsnd_rdai_ssi_lane_get(rdai);
326 int chan = rsnd_io_is_play(io) ?
327 rsnd_runtime_channel_after_ctu(io) :
328 rsnd_runtime_channel_original(io);
330 return (chan > 2) && (lane > 1);
333 int rsnd_runtime_is_tdm(struct rsnd_dai_stream *io)
335 return rsnd_runtime_channel_for_ssi(io) >= 6;
338 int rsnd_runtime_is_tdm_split(struct rsnd_dai_stream *io)
340 return !!rsnd_flags_has(io, RSND_STREAM_TDM_SPLIT);
346 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
348 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
349 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
350 struct device *dev = rsnd_priv_to_dev(priv);
352 switch (snd_pcm_format_width(runtime->format)) {
361 dev_warn(dev, "not supported sample bits\n");
369 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
371 struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io);
372 struct rsnd_mod *target;
373 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
376 * *Hardware* L/R and *Software* L/R are inverted for 16bit data.
380 * We need to care about inversion timing to control
381 * Playback/Capture correctly.
382 * The point is [DVC] needs *Hardware* L/R, [MEM] needs *Software* L/R
384 * sL/R : software L/R
385 * hL/R : hardware L/R
386 * (*) : conversion timing
389 * sL/R (*) hL/R hL/R hL/R hL/R hL/R
390 * [MEM] -> [SRC] -> [DVC] -> [CMD] -> [SSIU] -> [SSI] -> codec
393 * hL/R hL/R hL/R hL/R hL/R (*) sL/R
394 * codec -> [SSI] -> [SSIU] -> [SRC] -> [DVC] -> [CMD] -> [MEM]
396 if (rsnd_io_is_play(io)) {
397 struct rsnd_mod *src = rsnd_io_to_mod_src(io);
399 target = src ? src : ssiu;
401 struct rsnd_mod *cmd = rsnd_io_to_mod_cmd(io);
403 target = cmd ? cmd : ssiu;
406 /* Non target mod or non 16bit needs normal DALIGN */
407 if ((snd_pcm_format_width(runtime->format) != 16) ||
410 /* Target mod needs inverted DALIGN when 16bit */
415 u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod)
417 enum rsnd_mod_type playback_mods[] = {
422 enum rsnd_mod_type capture_mods[] = {
427 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
428 struct rsnd_mod *tmod = NULL;
429 enum rsnd_mod_type *mods =
430 rsnd_io_is_play(io) ?
431 playback_mods : capture_mods;
435 * This is needed for 24bit data
436 * We need to shift 8bit
438 * Linux 24bit data is located as 0x00******
439 * HW 24bit data is located as 0x******00
442 if (snd_pcm_format_width(runtime->format) != 24)
445 for (i = 0; i < ARRAY_SIZE(playback_mods); i++) {
446 tmod = rsnd_io_to_mod(io, mods[i]);
454 if (rsnd_io_is_play(io))
455 return (0 << 20) | /* shift to Left */
456 (8 << 16); /* 8bit */
458 return (1 << 20) | /* shift to Right */
459 (8 << 16); /* 8bit */
465 struct rsnd_mod *rsnd_mod_next(int *iterator,
466 struct rsnd_dai_stream *io,
467 enum rsnd_mod_type *array,
470 struct rsnd_mod *mod;
471 enum rsnd_mod_type type;
472 int max = array ? array_size : RSND_MOD_MAX;
474 for (; *iterator < max; (*iterator)++) {
475 type = (array) ? array[*iterator] : *iterator;
476 mod = rsnd_io_to_mod(io, type);
484 static enum rsnd_mod_type rsnd_mod_sequence[][RSND_MOD_MAX] = {
518 static int rsnd_status_update(u32 *status,
519 int shift, int add, int timing)
521 u32 mask = 0xF << shift;
522 u8 val = (*status >> shift) & 0xF;
523 u8 next_val = (val + add) & 0xF;
524 int func_call = (val == timing);
526 if (next_val == 0xF) /* underflow case */
529 *status = (*status & ~mask) + (next_val << shift);
534 #define rsnd_dai_call(fn, io, param...) \
536 struct device *dev = rsnd_priv_to_dev(rsnd_io_to_priv(io)); \
537 struct rsnd_mod *mod; \
538 int is_play = rsnd_io_is_play(io); \
540 enum rsnd_mod_type *types = rsnd_mod_sequence[is_play]; \
541 for_each_rsnd_mod_arrays(i, mod, io, types, RSND_MOD_MAX) { \
543 u32 *status = mod->ops->get_status(mod, io, types[i]); \
544 int func_call = rsnd_status_update(status, \
545 __rsnd_mod_shift_##fn, \
546 __rsnd_mod_add_##fn, \
547 __rsnd_mod_call_##fn); \
548 rsnd_dbg_dai_call(dev, "%s\t0x%08x %s\n", \
549 rsnd_mod_name(mod), *status, \
550 (func_call && (mod)->ops->fn) ? #fn : ""); \
551 if (func_call && (mod)->ops->fn) \
552 tmp = (mod)->ops->fn(mod, io, param); \
553 if (tmp && (tmp != -EPROBE_DEFER)) \
554 dev_err(dev, "%s : %s error %d\n", \
555 rsnd_mod_name(mod), #fn, tmp); \
561 int rsnd_dai_connect(struct rsnd_mod *mod,
562 struct rsnd_dai_stream *io,
563 enum rsnd_mod_type type)
565 struct rsnd_priv *priv;
571 if (io->mod[type] == mod)
577 priv = rsnd_mod_to_priv(mod);
578 dev = rsnd_priv_to_dev(priv);
582 dev_dbg(dev, "%s is connected to io (%s)\n",
584 rsnd_io_is_play(io) ? "Playback" : "Capture");
589 static void rsnd_dai_disconnect(struct rsnd_mod *mod,
590 struct rsnd_dai_stream *io,
591 enum rsnd_mod_type type)
593 io->mod[type] = NULL;
596 int rsnd_rdai_channels_ctrl(struct rsnd_dai *rdai,
599 if (max_channels > 0)
600 rdai->max_channels = max_channels;
602 return rdai->max_channels;
605 int rsnd_rdai_ssi_lane_ctrl(struct rsnd_dai *rdai,
609 rdai->ssi_lane = ssi_lane;
611 return rdai->ssi_lane;
614 int rsnd_rdai_width_ctrl(struct rsnd_dai *rdai, int width)
617 rdai->chan_width = width;
619 return rdai->chan_width;
622 struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id)
624 if ((id < 0) || (id >= rsnd_rdai_nr(priv)))
627 return priv->rdai + id;
630 static struct snd_soc_dai_driver
631 *rsnd_daidrv_get(struct rsnd_priv *priv, int id)
633 if ((id < 0) || (id >= rsnd_rdai_nr(priv)))
636 return priv->daidrv + id;
639 #define rsnd_dai_to_priv(dai) snd_soc_dai_get_drvdata(dai)
640 static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
642 struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
644 return rsnd_rdai_get(priv, dai->id);
648 * rsnd_soc_dai functions
650 void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io)
652 struct snd_pcm_substream *substream = io->substream;
655 * this function should be called...
657 * - if rsnd_dai_pointer_update() returns true
658 * - without spin lock
661 snd_pcm_period_elapsed(substream);
664 static void rsnd_dai_stream_init(struct rsnd_dai_stream *io,
665 struct snd_pcm_substream *substream)
667 io->substream = substream;
670 static void rsnd_dai_stream_quit(struct rsnd_dai_stream *io)
672 io->substream = NULL;
676 struct snd_soc_dai *rsnd_substream_to_dai(struct snd_pcm_substream *substream)
678 struct snd_soc_pcm_runtime *rtd = substream->private_data;
684 struct rsnd_dai_stream *rsnd_rdai_to_io(struct rsnd_dai *rdai,
685 struct snd_pcm_substream *substream)
687 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
688 return &rdai->playback;
690 return &rdai->capture;
693 static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
694 struct snd_soc_dai *dai)
696 struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
697 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
698 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
702 spin_lock_irqsave(&priv->lock, flags);
705 case SNDRV_PCM_TRIGGER_START:
706 case SNDRV_PCM_TRIGGER_RESUME:
707 ret = rsnd_dai_call(init, io, priv);
709 goto dai_trigger_end;
711 ret = rsnd_dai_call(start, io, priv);
713 goto dai_trigger_end;
715 ret = rsnd_dai_call(irq, io, priv, 1);
717 goto dai_trigger_end;
720 case SNDRV_PCM_TRIGGER_STOP:
721 case SNDRV_PCM_TRIGGER_SUSPEND:
722 ret = rsnd_dai_call(irq, io, priv, 0);
724 ret |= rsnd_dai_call(stop, io, priv);
726 ret |= rsnd_dai_call(quit, io, priv);
734 spin_unlock_irqrestore(&priv->lock, flags);
739 static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
741 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
743 /* set master/slave audio interface */
744 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
745 case SND_SOC_DAIFMT_CBM_CFM:
746 rdai->clk_master = 0;
748 case SND_SOC_DAIFMT_CBS_CFS:
749 rdai->clk_master = 1; /* codec is slave, cpu is master */
756 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
757 case SND_SOC_DAIFMT_I2S:
759 rdai->data_alignment = 0;
760 rdai->frm_clk_inv = 0;
762 case SND_SOC_DAIFMT_LEFT_J:
763 case SND_SOC_DAIFMT_DSP_B:
765 rdai->data_alignment = 0;
766 rdai->frm_clk_inv = 1;
768 case SND_SOC_DAIFMT_RIGHT_J:
770 rdai->data_alignment = 1;
771 rdai->frm_clk_inv = 1;
773 case SND_SOC_DAIFMT_DSP_A:
775 rdai->data_alignment = 0;
776 rdai->frm_clk_inv = 1;
780 /* set clock inversion */
781 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
782 case SND_SOC_DAIFMT_NB_IF:
783 rdai->frm_clk_inv = !rdai->frm_clk_inv;
785 case SND_SOC_DAIFMT_IB_NF:
786 rdai->bit_clk_inv = !rdai->bit_clk_inv;
788 case SND_SOC_DAIFMT_IB_IF:
789 rdai->bit_clk_inv = !rdai->bit_clk_inv;
790 rdai->frm_clk_inv = !rdai->frm_clk_inv;
792 case SND_SOC_DAIFMT_NB_NF:
800 static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,
801 u32 tx_mask, u32 rx_mask,
802 int slots, int slot_width)
804 struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
805 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
806 struct device *dev = rsnd_priv_to_dev(priv);
808 switch (slot_width) {
823 /* TDM Extend Mode */
824 rsnd_rdai_channels_set(rdai, slots);
825 rsnd_rdai_ssi_lane_set(rdai, 1);
826 rsnd_rdai_width_set(rdai, slot_width);
829 dev_err(dev, "unsupported TDM slots (%d)\n", slots);
836 static unsigned int rsnd_soc_hw_channels_list[] = {
840 static unsigned int rsnd_soc_hw_rate_list[] = {
855 static int rsnd_soc_hw_rule(struct rsnd_dai *rdai,
856 unsigned int *list, int list_num,
857 struct snd_interval *baseline, struct snd_interval *iv)
859 struct snd_interval p;
863 snd_interval_any(&p);
867 for (i = 0; i < list_num; i++) {
869 if (!snd_interval_test(iv, list[i]))
872 rate = rsnd_ssi_clk_query(rdai,
873 baseline->min, list[i], NULL);
875 p.min = min(p.min, list[i]);
876 p.max = max(p.max, list[i]);
879 rate = rsnd_ssi_clk_query(rdai,
880 baseline->max, list[i], NULL);
882 p.min = min(p.min, list[i]);
883 p.max = max(p.max, list[i]);
887 return snd_interval_refine(iv, &p);
890 static int rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params,
891 struct snd_pcm_hw_rule *rule)
893 struct snd_interval *ic_ = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
894 struct snd_interval *ir = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
895 struct snd_interval ic;
896 struct rsnd_dai_stream *io = rule->private;
897 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
900 * possible sampling rate limitation is same as
901 * 2ch if it supports multi ssi
902 * and same as 8ch if TDM 6ch (see rsnd_ssi_config_init())
906 ic.max = rsnd_runtime_channel_for_ssi_with_params(io, params);
908 return rsnd_soc_hw_rule(rdai, rsnd_soc_hw_rate_list,
909 ARRAY_SIZE(rsnd_soc_hw_rate_list),
913 static int rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params,
914 struct snd_pcm_hw_rule *rule)
916 struct snd_interval *ic_ = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
917 struct snd_interval *ir = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
918 struct snd_interval ic;
919 struct rsnd_dai_stream *io = rule->private;
920 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
923 * possible sampling rate limitation is same as
924 * 2ch if it supports multi ssi
925 * and same as 8ch if TDM 6ch (see rsnd_ssi_config_init())
929 ic.max = rsnd_runtime_channel_for_ssi_with_params(io, params);
931 return rsnd_soc_hw_rule(rdai, rsnd_soc_hw_channels_list,
932 ARRAY_SIZE(rsnd_soc_hw_channels_list),
936 static const struct snd_pcm_hardware rsnd_pcm_hardware = {
937 .info = SNDRV_PCM_INFO_INTERLEAVED |
938 SNDRV_PCM_INFO_MMAP |
939 SNDRV_PCM_INFO_MMAP_VALID,
940 .buffer_bytes_max = 64 * 1024,
941 .period_bytes_min = 32,
942 .period_bytes_max = 8192,
948 static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream,
949 struct snd_soc_dai *dai)
951 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
952 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
953 struct snd_pcm_hw_constraint_list *constraint = &rdai->constraint;
954 struct snd_pcm_runtime *runtime = substream->runtime;
955 unsigned int max_channels = rsnd_rdai_channels_get(rdai);
958 rsnd_dai_stream_init(io, substream);
962 * It depends on Platform design
964 constraint->list = rsnd_soc_hw_channels_list;
965 constraint->count = 0;
966 constraint->mask = 0;
968 for (i = 0; i < ARRAY_SIZE(rsnd_soc_hw_channels_list); i++) {
969 if (rsnd_soc_hw_channels_list[i] > max_channels)
971 constraint->count = i + 1;
974 snd_soc_set_runtime_hwparams(substream, &rsnd_pcm_hardware);
976 snd_pcm_hw_constraint_list(runtime, 0,
977 SNDRV_PCM_HW_PARAM_CHANNELS, constraint);
979 snd_pcm_hw_constraint_integer(runtime,
980 SNDRV_PCM_HW_PARAM_PERIODS);
983 * Sampling Rate / Channel Limitation
984 * It depends on Clock Master Mode
986 if (rsnd_rdai_is_clk_master(rdai)) {
987 int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
989 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
990 rsnd_soc_hw_rule_rate,
991 is_play ? &rdai->playback : &rdai->capture,
992 SNDRV_PCM_HW_PARAM_CHANNELS, -1);
993 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
994 rsnd_soc_hw_rule_channels,
995 is_play ? &rdai->playback : &rdai->capture,
996 SNDRV_PCM_HW_PARAM_RATE, -1);
1002 static void rsnd_soc_dai_shutdown(struct snd_pcm_substream *substream,
1003 struct snd_soc_dai *dai)
1005 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1006 struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
1007 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
1010 * call rsnd_dai_call without spinlock
1012 rsnd_dai_call(cleanup, io, priv);
1014 rsnd_dai_stream_quit(io);
1017 static int rsnd_soc_dai_prepare(struct snd_pcm_substream *substream,
1018 struct snd_soc_dai *dai)
1020 struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
1021 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1022 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
1024 return rsnd_dai_call(prepare, io, priv);
1027 static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
1028 .startup = rsnd_soc_dai_startup,
1029 .shutdown = rsnd_soc_dai_shutdown,
1030 .trigger = rsnd_soc_dai_trigger,
1031 .set_fmt = rsnd_soc_dai_set_fmt,
1032 .set_tdm_slot = rsnd_soc_set_dai_tdm_slot,
1033 .prepare = rsnd_soc_dai_prepare,
1036 static void rsnd_parse_tdm_split_mode(struct rsnd_priv *priv,
1037 struct rsnd_dai_stream *io,
1038 struct device_node *dai_np)
1040 struct device *dev = rsnd_priv_to_dev(priv);
1041 struct device_node *ssiu_np = rsnd_ssiu_of_node(priv);
1042 struct device_node *np;
1043 int is_play = rsnd_io_is_play(io);
1050 * This driver assumes that it is TDM Split mode
1051 * if it includes ssiu node
1054 struct device_node *node = is_play ?
1055 of_parse_phandle(dai_np, "playback", i) :
1056 of_parse_phandle(dai_np, "capture", i);
1062 for_each_child_of_node(ssiu_np, np) {
1064 rsnd_flags_set(io, RSND_STREAM_TDM_SPLIT);
1065 dev_dbg(dev, "%s is part of TDM Split\n", io->name);
1073 static void rsnd_parse_connect_simple(struct rsnd_priv *priv,
1074 struct rsnd_dai_stream *io,
1075 struct device_node *dai_np)
1077 if (!rsnd_io_to_mod_ssi(io))
1080 rsnd_parse_tdm_split_mode(priv, io, dai_np);
1083 static void rsnd_parse_connect_graph(struct rsnd_priv *priv,
1084 struct rsnd_dai_stream *io,
1085 struct device_node *endpoint)
1087 struct device *dev = rsnd_priv_to_dev(priv);
1088 struct device_node *remote_node = of_graph_get_remote_port_parent(endpoint);
1090 if (!rsnd_io_to_mod_ssi(io))
1094 if (strstr(remote_node->full_name, "hdmi@fead0000")) {
1095 rsnd_flags_set(io, RSND_STREAM_HDMI0);
1096 dev_dbg(dev, "%s connected to HDMI0\n", io->name);
1100 if (strstr(remote_node->full_name, "hdmi@feae0000")) {
1101 rsnd_flags_set(io, RSND_STREAM_HDMI1);
1102 dev_dbg(dev, "%s connected to HDMI1\n", io->name);
1105 rsnd_parse_tdm_split_mode(priv, io, endpoint);
1108 void rsnd_parse_connect_common(struct rsnd_dai *rdai,
1109 struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
1110 struct device_node *node,
1111 struct device_node *playback,
1112 struct device_node *capture)
1114 struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
1115 struct device_node *np;
1116 struct rsnd_mod *mod;
1123 for_each_child_of_node(node, np) {
1124 mod = mod_get(priv, i);
1126 rsnd_dai_connect(mod, &rdai->playback, mod->type);
1128 rsnd_dai_connect(mod, &rdai->capture, mod->type);
1135 static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv,
1138 struct device *dev = rsnd_priv_to_dev(priv);
1139 struct device_node *np = dev->of_node;
1140 struct device_node *dai_node;
1141 struct device_node *ret;
1146 * parse both previous dai (= rcar_sound,dai), and
1147 * graph dai (= ports/port)
1149 dai_node = of_get_child_by_name(np, RSND_NODE_DAI);
1152 goto of_node_compatible;
1157 dai_node = of_graph_get_next_endpoint(np, NULL);
1166 of_node_put(dai_node);
1171 static void __rsnd_dai_probe(struct rsnd_priv *priv,
1172 struct device_node *dai_np,
1175 struct device_node *playback, *capture;
1176 struct rsnd_dai_stream *io_playback;
1177 struct rsnd_dai_stream *io_capture;
1178 struct snd_soc_dai_driver *drv;
1179 struct rsnd_dai *rdai;
1180 struct device *dev = rsnd_priv_to_dev(priv);
1183 rdai = rsnd_rdai_get(priv, dai_i);
1184 drv = rsnd_daidrv_get(priv, dai_i);
1185 io_playback = &rdai->playback;
1186 io_capture = &rdai->capture;
1188 snprintf(rdai->name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", dai_i);
1191 drv->name = rdai->name;
1192 drv->ops = &rsnd_soc_dai_ops;
1194 snprintf(io_playback->name, RSND_DAI_NAME_SIZE,
1195 "DAI%d Playback", dai_i);
1196 drv->playback.rates = RSND_RATES;
1197 drv->playback.formats = RSND_FMTS;
1198 drv->playback.channels_min = 2;
1199 drv->playback.channels_max = 8;
1200 drv->playback.stream_name = io_playback->name;
1202 snprintf(io_capture->name, RSND_DAI_NAME_SIZE,
1203 "DAI%d Capture", dai_i);
1204 drv->capture.rates = RSND_RATES;
1205 drv->capture.formats = RSND_FMTS;
1206 drv->capture.channels_min = 2;
1207 drv->capture.channels_max = 8;
1208 drv->capture.stream_name = io_capture->name;
1210 io_playback->rdai = rdai;
1211 io_capture->rdai = rdai;
1212 rsnd_rdai_channels_set(rdai, 2); /* default 2ch */
1213 rsnd_rdai_ssi_lane_set(rdai, 1); /* default 1lane */
1214 rsnd_rdai_width_set(rdai, 32); /* default 32bit width */
1216 for (io_i = 0;; io_i++) {
1217 playback = of_parse_phandle(dai_np, "playback", io_i);
1218 capture = of_parse_phandle(dai_np, "capture", io_i);
1220 if (!playback && !capture)
1223 rsnd_parse_connect_ssi(rdai, playback, capture);
1224 rsnd_parse_connect_ssiu(rdai, playback, capture);
1225 rsnd_parse_connect_src(rdai, playback, capture);
1226 rsnd_parse_connect_ctu(rdai, playback, capture);
1227 rsnd_parse_connect_mix(rdai, playback, capture);
1228 rsnd_parse_connect_dvc(rdai, playback, capture);
1230 of_node_put(playback);
1231 of_node_put(capture);
1234 if (rsnd_ssi_is_pin_sharing(io_capture) ||
1235 rsnd_ssi_is_pin_sharing(io_playback)) {
1236 /* should have symmetric_rates if pin sharing */
1237 drv->symmetric_rates = 1;
1240 dev_dbg(dev, "%s (%s/%s)\n", rdai->name,
1241 rsnd_io_to_mod_ssi(io_playback) ? "play" : " -- ",
1242 rsnd_io_to_mod_ssi(io_capture) ? "capture" : " -- ");
1245 static int rsnd_dai_probe(struct rsnd_priv *priv)
1247 struct device_node *dai_node;
1248 struct device_node *dai_np;
1249 struct snd_soc_dai_driver *rdrv;
1250 struct device *dev = rsnd_priv_to_dev(priv);
1251 struct rsnd_dai *rdai;
1256 dai_node = rsnd_dai_of_node(priv, &is_graph);
1258 nr = of_graph_get_endpoint_count(dai_node);
1260 nr = of_get_child_count(dai_node);
1265 rdrv = devm_kcalloc(dev, nr, sizeof(*rdrv), GFP_KERNEL);
1266 rdai = devm_kcalloc(dev, nr, sizeof(*rdai), GFP_KERNEL);
1271 priv->daidrv = rdrv;
1279 for_each_endpoint_of_node(dai_node, dai_np) {
1280 __rsnd_dai_probe(priv, dai_np, dai_i);
1281 if (rsnd_is_gen3(priv)) {
1282 struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
1284 rsnd_parse_connect_graph(priv, &rdai->playback, dai_np);
1285 rsnd_parse_connect_graph(priv, &rdai->capture, dai_np);
1290 for_each_child_of_node(dai_node, dai_np) {
1291 __rsnd_dai_probe(priv, dai_np, dai_i);
1292 if (rsnd_is_gen3(priv)) {
1293 struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
1295 rsnd_parse_connect_simple(priv, &rdai->playback, dai_np);
1296 rsnd_parse_connect_simple(priv, &rdai->capture, dai_np);
1308 static int rsnd_hw_params(struct snd_pcm_substream *substream,
1309 struct snd_pcm_hw_params *hw_params)
1311 struct snd_soc_dai *dai = rsnd_substream_to_dai(substream);
1312 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1313 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
1314 struct snd_soc_pcm_runtime *fe = substream->private_data;
1318 * rsnd assumes that it might be used under DPCM if user want to use
1319 * channel / rate convert. Then, rsnd should be FE.
1320 * And then, this function will be called *after* BE settings.
1321 * this means, each BE already has fixuped hw_params.
1323 * dpcm_fe_dai_hw_params()
1324 * dpcm_be_dai_hw_params()
1326 io->converted_rate = 0;
1327 io->converted_chan = 0;
1328 if (fe->dai_link->dynamic) {
1329 struct rsnd_priv *priv = rsnd_io_to_priv(io);
1330 struct device *dev = rsnd_priv_to_dev(priv);
1331 struct snd_soc_dpcm *dpcm;
1332 struct snd_pcm_hw_params *be_params;
1333 int stream = substream->stream;
1335 for_each_dpcm_be(fe, stream, dpcm) {
1336 be_params = &dpcm->hw_params;
1337 if (params_channels(hw_params) != params_channels(be_params))
1338 io->converted_chan = params_channels(be_params);
1339 if (params_rate(hw_params) != params_rate(be_params))
1340 io->converted_rate = params_rate(be_params);
1342 if (io->converted_chan)
1343 dev_dbg(dev, "convert channels = %d\n", io->converted_chan);
1344 if (io->converted_rate)
1345 dev_dbg(dev, "convert rate = %d\n", io->converted_rate);
1348 ret = rsnd_dai_call(hw_params, io, substream, hw_params);
1352 return snd_pcm_lib_malloc_pages(substream,
1353 params_buffer_bytes(hw_params));
1356 static snd_pcm_uframes_t rsnd_pointer(struct snd_pcm_substream *substream)
1358 struct snd_soc_dai *dai = rsnd_substream_to_dai(substream);
1359 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1360 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
1361 snd_pcm_uframes_t pointer = 0;
1363 rsnd_dai_call(pointer, io, &pointer);
1368 static const struct snd_pcm_ops rsnd_pcm_ops = {
1369 .ioctl = snd_pcm_lib_ioctl,
1370 .hw_params = rsnd_hw_params,
1371 .hw_free = snd_pcm_lib_free_pages,
1372 .pointer = rsnd_pointer,
1378 static int rsnd_kctrl_info(struct snd_kcontrol *kctrl,
1379 struct snd_ctl_elem_info *uinfo)
1381 struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
1384 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1385 uinfo->count = cfg->size;
1386 uinfo->value.enumerated.items = cfg->max;
1387 if (uinfo->value.enumerated.item >= cfg->max)
1388 uinfo->value.enumerated.item = cfg->max - 1;
1389 strlcpy(uinfo->value.enumerated.name,
1390 cfg->texts[uinfo->value.enumerated.item],
1391 sizeof(uinfo->value.enumerated.name));
1393 uinfo->count = cfg->size;
1394 uinfo->value.integer.min = 0;
1395 uinfo->value.integer.max = cfg->max;
1396 uinfo->type = (cfg->max == 1) ?
1397 SNDRV_CTL_ELEM_TYPE_BOOLEAN :
1398 SNDRV_CTL_ELEM_TYPE_INTEGER;
1404 static int rsnd_kctrl_get(struct snd_kcontrol *kctrl,
1405 struct snd_ctl_elem_value *uc)
1407 struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
1410 for (i = 0; i < cfg->size; i++)
1412 uc->value.enumerated.item[i] = cfg->val[i];
1414 uc->value.integer.value[i] = cfg->val[i];
1419 static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
1420 struct snd_ctl_elem_value *uc)
1422 struct rsnd_kctrl_cfg *cfg = snd_kcontrol_chip(kctrl);
1425 if (!cfg->accept(cfg->io))
1428 for (i = 0; i < cfg->size; i++) {
1430 change |= (uc->value.enumerated.item[i] != cfg->val[i]);
1431 cfg->val[i] = uc->value.enumerated.item[i];
1433 change |= (uc->value.integer.value[i] != cfg->val[i]);
1434 cfg->val[i] = uc->value.integer.value[i];
1438 if (change && cfg->update)
1439 cfg->update(cfg->io, cfg->mod);
1444 int rsnd_kctrl_accept_anytime(struct rsnd_dai_stream *io)
1449 int rsnd_kctrl_accept_runtime(struct rsnd_dai_stream *io)
1451 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
1452 struct rsnd_priv *priv = rsnd_io_to_priv(io);
1453 struct device *dev = rsnd_priv_to_dev(priv);
1456 dev_warn(dev, "Can't update kctrl when idle\n");
1463 struct rsnd_kctrl_cfg *rsnd_kctrl_init_m(struct rsnd_kctrl_cfg_m *cfg)
1465 cfg->cfg.val = cfg->val;
1470 struct rsnd_kctrl_cfg *rsnd_kctrl_init_s(struct rsnd_kctrl_cfg_s *cfg)
1472 cfg->cfg.val = &cfg->val;
1477 const char * const volume_ramp_rate[] = {
1478 "128 dB/1 step", /* 00000 */
1479 "64 dB/1 step", /* 00001 */
1480 "32 dB/1 step", /* 00010 */
1481 "16 dB/1 step", /* 00011 */
1482 "8 dB/1 step", /* 00100 */
1483 "4 dB/1 step", /* 00101 */
1484 "2 dB/1 step", /* 00110 */
1485 "1 dB/1 step", /* 00111 */
1486 "0.5 dB/1 step", /* 01000 */
1487 "0.25 dB/1 step", /* 01001 */
1488 "0.125 dB/1 step", /* 01010 = VOLUME_RAMP_MAX_MIX */
1489 "0.125 dB/2 steps", /* 01011 */
1490 "0.125 dB/4 steps", /* 01100 */
1491 "0.125 dB/8 steps", /* 01101 */
1492 "0.125 dB/16 steps", /* 01110 */
1493 "0.125 dB/32 steps", /* 01111 */
1494 "0.125 dB/64 steps", /* 10000 */
1495 "0.125 dB/128 steps", /* 10001 */
1496 "0.125 dB/256 steps", /* 10010 */
1497 "0.125 dB/512 steps", /* 10011 */
1498 "0.125 dB/1024 steps", /* 10100 */
1499 "0.125 dB/2048 steps", /* 10101 */
1500 "0.125 dB/4096 steps", /* 10110 */
1501 "0.125 dB/8192 steps", /* 10111 = VOLUME_RAMP_MAX_DVC */
1504 int rsnd_kctrl_new(struct rsnd_mod *mod,
1505 struct rsnd_dai_stream *io,
1506 struct snd_soc_pcm_runtime *rtd,
1507 const unsigned char *name,
1508 int (*accept)(struct rsnd_dai_stream *io),
1509 void (*update)(struct rsnd_dai_stream *io,
1510 struct rsnd_mod *mod),
1511 struct rsnd_kctrl_cfg *cfg,
1512 const char * const *texts,
1516 struct snd_card *card = rtd->card->snd_card;
1517 struct snd_kcontrol *kctrl;
1518 struct snd_kcontrol_new knew = {
1519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1521 .info = rsnd_kctrl_info,
1523 .get = rsnd_kctrl_get,
1524 .put = rsnd_kctrl_put,
1529 * 1) Avoid duplicate register for DVC with MIX case
1530 * 2) Allow duplicate register for MIX
1531 * 3) re-register if card was rebinded
1533 list_for_each_entry(kctrl, &card->controls, list) {
1534 struct rsnd_kctrl_cfg *c = kctrl->private_data;
1540 if (size > RSND_MAX_CHANNELS)
1543 kctrl = snd_ctl_new1(&knew, cfg);
1547 ret = snd_ctl_add(card, kctrl);
1554 cfg->accept = accept;
1555 cfg->update = update;
1568 #define PREALLOC_BUFFER (32 * 1024)
1569 #define PREALLOC_BUFFER_MAX (32 * 1024)
1571 static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd,
1572 struct rsnd_dai_stream *io,
1575 struct rsnd_priv *priv = rsnd_io_to_priv(io);
1576 struct device *dev = rsnd_priv_to_dev(priv);
1577 struct snd_pcm_substream *substream;
1580 * use Audio-DMAC dev if we can use IPMMU
1582 * rsnd_dmaen_attach()
1587 for (substream = rtd->pcm->streams[stream].substream;
1589 substream = substream->next) {
1590 snd_pcm_lib_preallocate_pages(substream,
1593 PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
1599 static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
1601 struct snd_soc_dai *dai = rtd->cpu_dai;
1602 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1605 ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd);
1609 ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd);
1613 ret = rsnd_preallocate_pages(rtd, &rdai->playback,
1614 SNDRV_PCM_STREAM_PLAYBACK);
1618 ret = rsnd_preallocate_pages(rtd, &rdai->capture,
1619 SNDRV_PCM_STREAM_CAPTURE);
1626 static const struct snd_soc_component_driver rsnd_soc_component = {
1627 .ops = &rsnd_pcm_ops,
1628 .pcm_new = rsnd_pcm_new,
1632 static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
1633 struct rsnd_dai_stream *io)
1637 ret = rsnd_dai_call(probe, io, priv);
1638 if (ret == -EAGAIN) {
1639 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
1640 struct rsnd_mod *mod;
1644 * Fallback to PIO mode
1648 * call "remove" for SSI/SRC/DVC
1649 * SSI will be switch to PIO mode if it was DMA mode
1652 * rsnd_ssi_fallback()
1654 rsnd_dai_call(remove, io, priv);
1657 * remove all mod from io
1658 * and, re connect ssi
1660 for_each_rsnd_mod(i, mod, io)
1661 rsnd_dai_disconnect(mod, io, i);
1662 rsnd_dai_connect(ssi_mod, io, RSND_MOD_SSI);
1667 rsnd_dai_call(fallback, io, priv);
1671 * DAI has SSI which is PIO mode only now.
1673 ret = rsnd_dai_call(probe, io, priv);
1682 static int rsnd_probe(struct platform_device *pdev)
1684 struct rsnd_priv *priv;
1685 struct device *dev = &pdev->dev;
1686 struct rsnd_dai *rdai;
1687 int (*probe_func[])(struct rsnd_priv *priv) = {
1705 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
1710 priv->flags = (unsigned long)of_device_get_match_data(dev);
1711 spin_lock_init(&priv->lock);
1716 for (i = 0; i < ARRAY_SIZE(probe_func); i++) {
1717 ret = probe_func[i](priv);
1722 for_each_rsnd_dai(rdai, priv, i) {
1723 ret = rsnd_rdai_continuance_probe(priv, &rdai->playback);
1725 goto exit_snd_probe;
1727 ret = rsnd_rdai_continuance_probe(priv, &rdai->capture);
1729 goto exit_snd_probe;
1732 dev_set_drvdata(dev, priv);
1737 ret = devm_snd_soc_register_component(dev, &rsnd_soc_component,
1738 priv->daidrv, rsnd_rdai_nr(priv));
1740 dev_err(dev, "cannot snd dai register\n");
1741 goto exit_snd_probe;
1744 pm_runtime_enable(dev);
1746 dev_info(dev, "probed\n");
1750 for_each_rsnd_dai(rdai, priv, i) {
1751 rsnd_dai_call(remove, &rdai->playback, priv);
1752 rsnd_dai_call(remove, &rdai->capture, priv);
1756 * adg is very special mod which can't use rsnd_dai_call(remove),
1757 * and it registers ADG clock on probe.
1758 * It should be unregister if probe failed.
1759 * Mainly it is assuming -EPROBE_DEFER case
1761 rsnd_adg_remove(priv);
1766 static int rsnd_remove(struct platform_device *pdev)
1768 struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
1769 struct rsnd_dai *rdai;
1770 void (*remove_func[])(struct rsnd_priv *priv) = {
1782 snd_soc_disconnect_sync(&pdev->dev);
1784 pm_runtime_disable(&pdev->dev);
1786 for_each_rsnd_dai(rdai, priv, i) {
1787 ret |= rsnd_dai_call(remove, &rdai->playback, priv);
1788 ret |= rsnd_dai_call(remove, &rdai->capture, priv);
1791 for (i = 0; i < ARRAY_SIZE(remove_func); i++)
1792 remove_func[i](priv);
1797 static int __maybe_unused rsnd_suspend(struct device *dev)
1799 struct rsnd_priv *priv = dev_get_drvdata(dev);
1801 rsnd_adg_clk_disable(priv);
1806 static int __maybe_unused rsnd_resume(struct device *dev)
1808 struct rsnd_priv *priv = dev_get_drvdata(dev);
1810 rsnd_adg_clk_enable(priv);
1815 static const struct dev_pm_ops rsnd_pm_ops = {
1816 SET_SYSTEM_SLEEP_PM_OPS(rsnd_suspend, rsnd_resume)
1819 static struct platform_driver rsnd_driver = {
1821 .name = "rcar_sound",
1823 .of_match_table = rsnd_of_match,
1825 .probe = rsnd_probe,
1826 .remove = rsnd_remove,
1828 module_platform_driver(rsnd_driver);
1830 MODULE_LICENSE("GPL v2");
1831 MODULE_DESCRIPTION("Renesas R-Car audio driver");
1832 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
1833 MODULE_ALIAS("platform:rcar-pcm-audio");