aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/rcar/src.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sh/rcar/src.c')
-rw-r--r--sound/soc/sh/rcar/src.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index e3b078e7c3aa..200eda019bc7 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -10,6 +10,8 @@
10 */ 10 */
11#include "rsnd.h" 11#include "rsnd.h"
12 12
13#define SRC_NAME "src"
14
13struct rsnd_src { 15struct rsnd_src {
14 struct rsnd_src_platform_info *info; /* rcar_snd.h */ 16 struct rsnd_src_platform_info *info; /* rcar_snd.h */
15 struct rsnd_mod mod; 17 struct rsnd_mod mod;
@@ -268,10 +270,6 @@ static int rsnd_src_stop(struct rsnd_mod *mod,
268 return 0; 270 return 0;
269} 271}
270 272
271static struct rsnd_mod_ops rsnd_src_non_ops = {
272 .name = "src (non)",
273};
274
275/* 273/*
276 * Gen1 functions 274 * Gen1 functions
277 */ 275 */
@@ -393,6 +391,17 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
393 return 0; 391 return 0;
394} 392}
395 393
394static int rsnd_src_probe_gen1(struct rsnd_mod *mod,
395 struct rsnd_dai *rdai)
396{
397 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
398 struct device *dev = rsnd_priv_to_dev(priv);
399
400 dev_dbg(dev, "%s (Gen1) is probed\n", rsnd_mod_name(mod));
401
402 return 0;
403}
404
396static int rsnd_src_init_gen1(struct rsnd_mod *mod, 405static int rsnd_src_init_gen1(struct rsnd_mod *mod,
397 struct rsnd_dai *rdai) 406 struct rsnd_dai *rdai)
398{ 407{
@@ -438,7 +447,8 @@ static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
438} 447}
439 448
440static struct rsnd_mod_ops rsnd_src_gen1_ops = { 449static struct rsnd_mod_ops rsnd_src_gen1_ops = {
441 .name = "sru (gen1)", 450 .name = SRC_NAME,
451 .probe = rsnd_src_probe_gen1,
442 .init = rsnd_src_init_gen1, 452 .init = rsnd_src_init_gen1,
443 .quit = rsnd_src_quit, 453 .quit = rsnd_src_quit,
444 .start = rsnd_src_start_gen1, 454 .start = rsnd_src_start_gen1,
@@ -502,6 +512,8 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
502 if (ret < 0) 512 if (ret < 0)
503 dev_err(dev, "SRC DMA failed\n"); 513 dev_err(dev, "SRC DMA failed\n");
504 514
515 dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod));
516
505 return ret; 517 return ret;
506} 518}
507 519
@@ -562,7 +574,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
562} 574}
563 575
564static struct rsnd_mod_ops rsnd_src_gen2_ops = { 576static struct rsnd_mod_ops rsnd_src_gen2_ops = {
565 .name = "src (gen2)", 577 .name = SRC_NAME,
566 .probe = rsnd_src_probe_gen2, 578 .probe = rsnd_src_probe_gen2,
567 .remove = rsnd_src_remove_gen2, 579 .remove = rsnd_src_remove_gen2,
568 .init = rsnd_src_init_gen2, 580 .init = rsnd_src_init_gen2,
@@ -598,18 +610,21 @@ static void rsnd_of_parse_src(struct platform_device *pdev,
598 610
599 nr = of_get_child_count(src_node); 611 nr = of_get_child_count(src_node);
600 if (!nr) 612 if (!nr)
601 return; 613 goto rsnd_of_parse_src_end;
602 614
603 src_info = devm_kzalloc(dev, 615 src_info = devm_kzalloc(dev,
604 sizeof(struct rsnd_src_platform_info) * nr, 616 sizeof(struct rsnd_src_platform_info) * nr,
605 GFP_KERNEL); 617 GFP_KERNEL);
606 if (!src_info) { 618 if (!src_info) {
607 dev_err(dev, "src info allocation error\n"); 619 dev_err(dev, "src info allocation error\n");
608 return; 620 goto rsnd_of_parse_src_end;
609 } 621 }
610 622
611 info->src_info = src_info; 623 info->src_info = src_info;
612 info->src_info_nr = nr; 624 info->src_info_nr = nr;
625
626rsnd_of_parse_src_end:
627 of_node_put(src_node);
613} 628}
614 629
615int rsnd_src_probe(struct platform_device *pdev, 630int rsnd_src_probe(struct platform_device *pdev,
@@ -624,6 +639,16 @@ int rsnd_src_probe(struct platform_device *pdev,
624 char name[RSND_SRC_NAME_SIZE]; 639 char name[RSND_SRC_NAME_SIZE];
625 int i, nr; 640 int i, nr;
626 641
642 ops = NULL;
643 if (rsnd_is_gen1(priv))
644 ops = &rsnd_src_gen1_ops;
645 if (rsnd_is_gen2(priv))
646 ops = &rsnd_src_gen2_ops;
647 if (!ops) {
648 dev_err(dev, "unknown Generation\n");
649 return -EIO;
650 }
651
627 rsnd_of_parse_src(pdev, of_data, priv); 652 rsnd_of_parse_src(pdev, of_data, priv);
628 653
629 /* 654 /*
@@ -643,7 +668,8 @@ int rsnd_src_probe(struct platform_device *pdev,
643 priv->src = src; 668 priv->src = src;
644 669
645 for_each_rsnd_src(src, priv, i) { 670 for_each_rsnd_src(src, priv, i) {
646 snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i); 671 snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d",
672 SRC_NAME, i);
647 673
648 clk = devm_clk_get(dev, name); 674 clk = devm_clk_get(dev, name);
649 if (IS_ERR(clk)) 675 if (IS_ERR(clk))
@@ -652,12 +678,6 @@ int rsnd_src_probe(struct platform_device *pdev,
652 src->info = &info->src_info[i]; 678 src->info = &info->src_info[i];
653 src->clk = clk; 679 src->clk = clk;
654 680
655 ops = &rsnd_src_non_ops;
656 if (rsnd_is_gen1(priv))
657 ops = &rsnd_src_gen1_ops;
658 if (rsnd_is_gen2(priv))
659 ops = &rsnd_src_gen2_ops;
660
661 rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); 681 rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i);
662 682
663 dev_dbg(dev, "SRC%d probed\n", i); 683 dev_dbg(dev, "SRC%d probed\n", i);