aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/siu_dai.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-09-17 06:30:18 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-09-19 11:04:35 -0400
commitc6834dd2d20fe607d0a4a98e78a68614e4079492 (patch)
treeade635b16b6269d68de5dfcd65747f4e75980cb3 /sound/soc/sh/siu_dai.c
parent7d25d64441a8ce9fb8c0e1c889badb14d8af9370 (diff)
ASoC: fix SIU driver breakage, occurred during the multi-component transition
This patch fixes multiple bugs and a typo, occurred during the multi- component transition. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh/siu_dai.c')
-rw-r--r--sound/soc/sh/siu_dai.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
index 827940a8e248..af53b64d8af2 100644
--- a/sound/soc/sh/siu_dai.c
+++ b/sound/soc/sh/siu_dai.c
@@ -71,8 +71,7 @@ struct port_flag {
71 struct format_flag capture; 71 struct format_flag capture;
72}; 72};
73 73
74struct siu_info *siu_i2s_data = NULL; 74struct siu_info *siu_i2s_data;
75EXPORT_SYMBOL_GPL(siu_i2s_data);
76 75
77static struct port_flag siu_flags[SIU_PORT_NUM] = { 76static struct port_flag siu_flags[SIU_PORT_NUM] = {
78 [SIU_PORT_A] = { 77 [SIU_PORT_A] = {
@@ -113,7 +112,7 @@ static void siu_dai_start(struct siu_port *port_info)
113 dev_dbg(port_info->pcm->card->dev, "%s\n", __func__); 112 dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
114 113
115 /* Turn on SIU clock */ 114 /* Turn on SIU clock */
116 pm_runtime_get_sync(port_info->pcm->card->dev); 115 pm_runtime_get_sync(info->dev);
117 116
118 /* Issue software reset to siu */ 117 /* Issue software reset to siu */
119 siu_write32(base + SIU_SRCTL, 0); 118 siu_write32(base + SIU_SRCTL, 0);
@@ -160,7 +159,7 @@ static void siu_dai_stop(struct siu_port *port_info)
160 siu_write32(base + SIU_SRCTL, 0); 159 siu_write32(base + SIU_SRCTL, 0);
161 160
162 /* Turn off SIU clock */ 161 /* Turn off SIU clock */
163 pm_runtime_put_sync(port_info->pcm->card->dev); 162 pm_runtime_put_sync(info->dev);
164} 163}
165 164
166static void siu_dai_spbAselect(struct siu_port *port_info) 165static void siu_dai_spbAselect(struct siu_port *port_info)
@@ -675,20 +674,36 @@ static int siu_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
675 } 674 }
676 675
677 siu_clk = clk_get(dai->dev, siu_name); 676 siu_clk = clk_get(dai->dev, siu_name);
678 if (IS_ERR(siu_clk)) 677 if (IS_ERR(siu_clk)) {
678 dev_err(dai->dev, "%s: cannot get a SIU clock: %ld\n", __func__,
679 PTR_ERR(siu_clk));
679 return PTR_ERR(siu_clk); 680 return PTR_ERR(siu_clk);
681 }
680 682
681 parent_clk = clk_get(dai->dev, parent_name); 683 parent_clk = clk_get(dai->dev, parent_name);
682 if (!IS_ERR(parent_clk)) { 684 if (IS_ERR(parent_clk)) {
683 ret = clk_set_parent(siu_clk, parent_clk); 685 ret = PTR_ERR(parent_clk);
684 if (!ret) 686 dev_err(dai->dev, "cannot get a SIU clock parent: %d\n", ret);
685 clk_set_rate(siu_clk, freq); 687 goto epclkget;
686 clk_put(parent_clk); 688 }
689
690 ret = clk_set_parent(siu_clk, parent_clk);
691 if (ret < 0) {
692 dev_err(dai->dev, "cannot reparent the SIU clock: %d\n", ret);
693 goto eclksetp;
687 } 694 }
688 695
696 ret = clk_set_rate(siu_clk, freq);
697 if (ret < 0)
698 dev_err(dai->dev, "cannot set SIU clock rate: %d\n", ret);
699
700 /* TODO: when clkdev gets reference counting we'll move these to siu_dai_shutdown() */
701eclksetp:
702 clk_put(parent_clk);
703epclkget:
689 clk_put(siu_clk); 704 clk_put(siu_clk);
690 705
691 return 0; 706 return ret;
692} 707}
693 708
694static struct snd_soc_dai_ops siu_dai_ops = { 709static struct snd_soc_dai_ops siu_dai_ops = {
@@ -700,7 +715,7 @@ static struct snd_soc_dai_ops siu_dai_ops = {
700}; 715};
701 716
702static struct snd_soc_dai_driver siu_i2s_dai = { 717static struct snd_soc_dai_driver siu_i2s_dai = {
703 .name = "sui-i2s-dai", 718 .name = "siu-i2s-dai",
704 .playback = { 719 .playback = {
705 .channels_min = 2, 720 .channels_min = 2,
706 .channels_max = 2, 721 .channels_max = 2,
@@ -727,6 +742,7 @@ static int __devinit siu_probe(struct platform_device *pdev)
727 if (!info) 742 if (!info)
728 return -ENOMEM; 743 return -ENOMEM;
729 siu_i2s_data = info; 744 siu_i2s_data = info;
745 info->dev = &pdev->dev;
730 746
731 ret = request_firmware(&fw_entry, "siu_spb.bin", &pdev->dev); 747 ret = request_firmware(&fw_entry, "siu_spb.bin", &pdev->dev);
732 if (ret) 748 if (ret)
@@ -828,6 +844,7 @@ static int __devexit siu_remove(struct platform_device *pdev)
828 844
829static struct platform_driver siu_driver = { 845static struct platform_driver siu_driver = {
830 .driver = { 846 .driver = {
847 .owner = THIS_MODULE,
831 .name = "siu-pcm-audio", 848 .name = "siu-pcm-audio",
832 }, 849 },
833 .probe = siu_probe, 850 .probe = siu_probe,