diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-03-17 22:29:55 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-21 14:14:56 -0400 |
commit | 90e8e50fce3585d6f9902701de08389b027dadc6 (patch) | |
tree | 67971cdae1de6d546e530d05ba3964f553cf9c24 /sound/soc/sh/rcar/ssi.c | |
parent | ba9c949f797aa3af56303445812a452144c61c35 (diff) |
ASoC: rsnd: add DeviceTree support
Support for loading the Renesas R-Car sound driver via DeviceTree.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/sh/rcar/ssi.c')
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 633b23d209b9..4b7e20603dd7 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -588,7 +588,61 @@ static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *s | |||
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | |||
592 | static void rsnd_of_parse_ssi(struct platform_device *pdev, | ||
593 | const struct rsnd_of_data *of_data, | ||
594 | struct rsnd_priv *priv) | ||
595 | { | ||
596 | struct device_node *node; | ||
597 | struct device_node *np; | ||
598 | struct rsnd_ssi_platform_info *ssi_info; | ||
599 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | ||
600 | struct device *dev = &pdev->dev; | ||
601 | int nr, i; | ||
602 | |||
603 | if (!of_data) | ||
604 | return; | ||
605 | |||
606 | node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi"); | ||
607 | if (!node) | ||
608 | return; | ||
609 | |||
610 | nr = of_get_child_count(node); | ||
611 | if (!nr) | ||
612 | return; | ||
613 | |||
614 | ssi_info = devm_kzalloc(dev, | ||
615 | sizeof(struct rsnd_ssi_platform_info) * nr, | ||
616 | GFP_KERNEL); | ||
617 | if (!ssi_info) { | ||
618 | dev_err(dev, "ssi info allocation error\n"); | ||
619 | return; | ||
620 | } | ||
621 | |||
622 | info->ssi_info = ssi_info; | ||
623 | info->ssi_info_nr = nr; | ||
624 | |||
625 | i = -1; | ||
626 | for_each_child_of_node(node, np) { | ||
627 | i++; | ||
628 | |||
629 | ssi_info = info->ssi_info + i; | ||
630 | |||
631 | /* | ||
632 | * pin settings | ||
633 | */ | ||
634 | if (of_get_property(np, "shared-pin", NULL)) | ||
635 | ssi_info->flags |= RSND_SSI_CLK_PIN_SHARE; | ||
636 | |||
637 | /* | ||
638 | * irq | ||
639 | */ | ||
640 | ssi_info->pio_irq = irq_of_parse_and_map(np, 0); | ||
641 | } | ||
642 | } | ||
643 | |||
591 | int rsnd_ssi_probe(struct platform_device *pdev, | 644 | int rsnd_ssi_probe(struct platform_device *pdev, |
645 | const struct rsnd_of_data *of_data, | ||
592 | struct rsnd_priv *priv) | 646 | struct rsnd_priv *priv) |
593 | { | 647 | { |
594 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | 648 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); |
@@ -600,6 +654,8 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
600 | char name[RSND_SSI_NAME_SIZE]; | 654 | char name[RSND_SSI_NAME_SIZE]; |
601 | int i, nr; | 655 | int i, nr; |
602 | 656 | ||
657 | rsnd_of_parse_ssi(pdev, of_data, priv); | ||
658 | |||
603 | /* | 659 | /* |
604 | * init SSI | 660 | * init SSI |
605 | */ | 661 | */ |