diff options
-rw-r--r-- | sound/soc/sh/rcar/core.c | 53 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 7 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 23 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 3 |
4 files changed, 49 insertions, 37 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 1b536d140e49..9b9e898d0df3 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -203,27 +203,6 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io) | |||
203 | return !!io->substream; | 203 | return !!io->substream; |
204 | } | 204 | } |
205 | 205 | ||
206 | void rsnd_set_slot(struct rsnd_dai *rdai, | ||
207 | int slots, int num) | ||
208 | { | ||
209 | rdai->slots = slots; | ||
210 | rdai->slots_num = num; | ||
211 | } | ||
212 | |||
213 | int rsnd_get_slot(struct rsnd_dai_stream *io) | ||
214 | { | ||
215 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | ||
216 | |||
217 | return rdai->slots; | ||
218 | } | ||
219 | |||
220 | int rsnd_get_slot_num(struct rsnd_dai_stream *io) | ||
221 | { | ||
222 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | ||
223 | |||
224 | return rdai->slots_num; | ||
225 | } | ||
226 | |||
227 | int rsnd_runtime_channel_original(struct rsnd_dai_stream *io) | 206 | int rsnd_runtime_channel_original(struct rsnd_dai_stream *io) |
228 | { | 207 | { |
229 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 208 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
@@ -248,13 +227,14 @@ int rsnd_runtime_channel_after_ctu(struct rsnd_dai_stream *io) | |||
248 | 227 | ||
249 | int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io) | 228 | int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io) |
250 | { | 229 | { |
230 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | ||
251 | int chan = rsnd_io_is_play(io) ? | 231 | int chan = rsnd_io_is_play(io) ? |
252 | rsnd_runtime_channel_after_ctu(io) : | 232 | rsnd_runtime_channel_after_ctu(io) : |
253 | rsnd_runtime_channel_original(io); | 233 | rsnd_runtime_channel_original(io); |
254 | 234 | ||
255 | /* Use Multi SSI */ | 235 | /* Use Multi SSI */ |
256 | if (rsnd_runtime_is_ssi_multi(io)) | 236 | if (rsnd_runtime_is_ssi_multi(io)) |
257 | chan /= rsnd_get_slot_num(io); | 237 | chan /= rsnd_rdai_ssi_lane_get(rdai); |
258 | 238 | ||
259 | /* TDM Extend Mode needs 8ch */ | 239 | /* TDM Extend Mode needs 8ch */ |
260 | if (chan == 6) | 240 | if (chan == 6) |
@@ -265,12 +245,13 @@ int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io) | |||
265 | 245 | ||
266 | int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io) | 246 | int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io) |
267 | { | 247 | { |
268 | int slots = rsnd_get_slot_num(io); | 248 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
249 | int lane = rsnd_rdai_ssi_lane_get(rdai); | ||
269 | int chan = rsnd_io_is_play(io) ? | 250 | int chan = rsnd_io_is_play(io) ? |
270 | rsnd_runtime_channel_after_ctu(io) : | 251 | rsnd_runtime_channel_after_ctu(io) : |
271 | rsnd_runtime_channel_original(io); | 252 | rsnd_runtime_channel_original(io); |
272 | 253 | ||
273 | return (chan >= 6) && (slots > 1); | 254 | return (chan > 2) && (lane > 1); |
274 | } | 255 | } |
275 | 256 | ||
276 | int rsnd_runtime_is_ssi_tdm(struct rsnd_dai_stream *io) | 257 | int rsnd_runtime_is_ssi_tdm(struct rsnd_dai_stream *io) |
@@ -549,6 +530,24 @@ static void rsnd_dai_disconnect(struct rsnd_mod *mod, | |||
549 | io->mod[type] = NULL; | 530 | io->mod[type] = NULL; |
550 | } | 531 | } |
551 | 532 | ||
533 | int rsnd_rdai_channels_ctrl(struct rsnd_dai *rdai, | ||
534 | int max_channels) | ||
535 | { | ||
536 | if (max_channels > 0) | ||
537 | rdai->max_channels = max_channels; | ||
538 | |||
539 | return rdai->max_channels; | ||
540 | } | ||
541 | |||
542 | int rsnd_rdai_ssi_lane_ctrl(struct rsnd_dai *rdai, | ||
543 | int ssi_lane) | ||
544 | { | ||
545 | if (ssi_lane > 0) | ||
546 | rdai->ssi_lane = ssi_lane; | ||
547 | |||
548 | return rdai->ssi_lane; | ||
549 | } | ||
550 | |||
552 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id) | 551 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id) |
553 | { | 552 | { |
554 | if ((id < 0) || (id >= rsnd_rdai_nr(priv))) | 553 | if ((id < 0) || (id >= rsnd_rdai_nr(priv))) |
@@ -726,7 +725,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, | |||
726 | switch (slots) { | 725 | switch (slots) { |
727 | case 6: | 726 | case 6: |
728 | /* TDM Extend Mode */ | 727 | /* TDM Extend Mode */ |
729 | rsnd_set_slot(rdai, slots, 1); | 728 | rsnd_rdai_channels_set(rdai, slots); |
729 | rsnd_rdai_ssi_lane_set(rdai, 1); | ||
730 | break; | 730 | break; |
731 | default: | 731 | default: |
732 | dev_err(dev, "unsupported TDM slots (%d)\n", slots); | 732 | dev_err(dev, "unsupported TDM slots (%d)\n", slots); |
@@ -879,7 +879,8 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv, | |||
879 | 879 | ||
880 | rdai->playback.rdai = rdai; | 880 | rdai->playback.rdai = rdai; |
881 | rdai->capture.rdai = rdai; | 881 | rdai->capture.rdai = rdai; |
882 | rsnd_set_slot(rdai, 2, 1); /* default */ | 882 | rsnd_rdai_channels_set(rdai, 2); /* default 2ch */ |
883 | rsnd_rdai_ssi_lane_set(rdai, 1); /* default 1lane */ | ||
883 | 884 | ||
884 | for (io_i = 0;; io_i++) { | 885 | for (io_i = 0;; io_i++) { |
885 | playback = of_parse_phandle(dai_np, "playback", io_i); | 886 | playback = of_parse_phandle(dai_np, "playback", io_i); |
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 75af6e742328..99d2d9459e75 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c | |||
@@ -249,8 +249,9 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
249 | struct snd_soc_pcm_runtime *rtd) | 249 | struct snd_soc_pcm_runtime *rtd) |
250 | { | 250 | { |
251 | struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); | 251 | struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); |
252 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | ||
252 | int is_play = rsnd_io_is_play(io); | 253 | int is_play = rsnd_io_is_play(io); |
253 | int slots = rsnd_get_slot(io); | 254 | int channels = rsnd_rdai_channels_get(rdai); |
254 | int ret; | 255 | int ret; |
255 | 256 | ||
256 | /* Volume */ | 257 | /* Volume */ |
@@ -259,7 +260,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
259 | "DVC Out Playback Volume" : "DVC In Capture Volume", | 260 | "DVC Out Playback Volume" : "DVC In Capture Volume", |
260 | rsnd_kctrl_accept_anytime, | 261 | rsnd_kctrl_accept_anytime, |
261 | rsnd_dvc_volume_update, | 262 | rsnd_dvc_volume_update, |
262 | &dvc->volume, slots, | 263 | &dvc->volume, channels, |
263 | 0x00800000 - 1); | 264 | 0x00800000 - 1); |
264 | if (ret < 0) | 265 | if (ret < 0) |
265 | return ret; | 266 | return ret; |
@@ -270,7 +271,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
270 | "DVC Out Mute Switch" : "DVC In Mute Switch", | 271 | "DVC Out Mute Switch" : "DVC In Mute Switch", |
271 | rsnd_kctrl_accept_anytime, | 272 | rsnd_kctrl_accept_anytime, |
272 | rsnd_dvc_volume_update, | 273 | rsnd_dvc_volume_update, |
273 | &dvc->mute, slots, | 274 | &dvc->mute, channels, |
274 | 1); | 275 | 1); |
275 | if (ret < 0) | 276 | if (ret < 0) |
276 | return ret; | 277 | return ret; |
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index ac4d50d118d1..47162bdf1abc 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -399,11 +399,6 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, | |||
399 | struct device_node *playback, | 399 | struct device_node *playback, |
400 | struct device_node *capture); | 400 | struct device_node *capture); |
401 | 401 | ||
402 | void rsnd_set_slot(struct rsnd_dai *rdai, | ||
403 | int slots, int slots_total); | ||
404 | int rsnd_get_slot(struct rsnd_dai_stream *io); | ||
405 | int rsnd_get_slot_num(struct rsnd_dai_stream *io); | ||
406 | |||
407 | int rsnd_runtime_channel_original(struct rsnd_dai_stream *io); | 402 | int rsnd_runtime_channel_original(struct rsnd_dai_stream *io); |
408 | int rsnd_runtime_channel_after_ctu(struct rsnd_dai_stream *io); | 403 | int rsnd_runtime_channel_after_ctu(struct rsnd_dai_stream *io); |
409 | int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io); | 404 | int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io); |
@@ -455,8 +450,8 @@ struct rsnd_dai { | |||
455 | struct rsnd_dai_stream capture; | 450 | struct rsnd_dai_stream capture; |
456 | struct rsnd_priv *priv; | 451 | struct rsnd_priv *priv; |
457 | 452 | ||
458 | int slots; | 453 | int max_channels; /* 2ch - 16ch */ |
459 | int slots_num; | 454 | int ssi_lane; /* 1lane - 4lane */ |
460 | 455 | ||
461 | unsigned int clk_master:1; | 456 | unsigned int clk_master:1; |
462 | unsigned int bit_clk_inv:1; | 457 | unsigned int bit_clk_inv:1; |
@@ -476,6 +471,20 @@ struct rsnd_dai { | |||
476 | 471 | ||
477 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); | 472 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); |
478 | 473 | ||
474 | #define rsnd_rdai_channels_set(rdai, max_channels) \ | ||
475 | rsnd_rdai_channels_ctrl(rdai, max_channels) | ||
476 | #define rsnd_rdai_channels_get(rdai) \ | ||
477 | rsnd_rdai_channels_ctrl(rdai, 0) | ||
478 | int rsnd_rdai_channels_ctrl(struct rsnd_dai *rdai, | ||
479 | int max_channels); | ||
480 | |||
481 | #define rsnd_rdai_ssi_lane_set(rdai, ssi_lane) \ | ||
482 | rsnd_rdai_ssi_lane_ctrl(rdai, ssi_lane) | ||
483 | #define rsnd_rdai_ssi_lane_get(rdai) \ | ||
484 | rsnd_rdai_ssi_lane_ctrl(rdai, 0) | ||
485 | int rsnd_rdai_ssi_lane_ctrl(struct rsnd_dai *rdai, | ||
486 | int ssi_lane); | ||
487 | |||
479 | void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io); | 488 | void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io); |
480 | int rsnd_dai_connect(struct rsnd_mod *mod, | 489 | int rsnd_dai_connect(struct rsnd_mod *mod, |
481 | struct rsnd_dai_stream *io, | 490 | struct rsnd_dai_stream *io, |
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index f7df3b5e2985..6450095eb547 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -897,7 +897,8 @@ static void rsnd_ssi_connect(struct rsnd_mod *mod, | |||
897 | type = types[i]; | 897 | type = types[i]; |
898 | if (!rsnd_io_to_mod(io, type)) { | 898 | if (!rsnd_io_to_mod(io, type)) { |
899 | rsnd_dai_connect(mod, io, type); | 899 | rsnd_dai_connect(mod, io, type); |
900 | rsnd_set_slot(rdai, 2 * (i + 1), (i + 1)); | 900 | rsnd_rdai_channels_set(rdai, (i + 1) * 2); |
901 | rsnd_rdai_ssi_lane_set(rdai, (i + 1)); | ||
901 | return; | 902 | return; |
902 | } | 903 | } |
903 | } | 904 | } |