diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c2412-i2s.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index 709adef9d043..4a861cfa52c5 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -65,26 +65,20 @@ static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { | |||
65 | 65 | ||
66 | static struct s3c_i2sv2_info s3c2412_i2s; | 66 | static struct s3c_i2sv2_info s3c2412_i2s; |
67 | 67 | ||
68 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | 68 | static int s3c2412_i2s_probe(struct snd_soc_dai *dai) |
69 | { | ||
70 | return cpu_dai->private_data; | ||
71 | } | ||
72 | |||
73 | static int s3c2412_i2s_probe(struct platform_device *pdev, | ||
74 | struct snd_soc_dai *dai) | ||
75 | { | 69 | { |
76 | int ret; | 70 | int ret; |
77 | 71 | ||
78 | pr_debug("Entered %s\n", __func__); | 72 | pr_debug("Entered %s\n", __func__); |
79 | 73 | ||
80 | ret = s3c_i2sv2_probe(pdev, dai, &s3c2412_i2s, S3C2410_PA_IIS); | 74 | ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); |
81 | if (ret) | 75 | if (ret) |
82 | return ret; | 76 | return ret; |
83 | 77 | ||
84 | s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; | 78 | s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; |
85 | s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; | 79 | s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; |
86 | 80 | ||
87 | s3c2412_i2s.iis_cclk = clk_get(&pdev->dev, "i2sclk"); | 81 | s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk"); |
88 | if (s3c2412_i2s.iis_cclk == NULL) { | 82 | if (s3c2412_i2s.iis_cclk == NULL) { |
89 | pr_err("failed to get i2sclk clock\n"); | 83 | pr_err("failed to get i2sclk clock\n"); |
90 | iounmap(s3c2412_i2s.regs); | 84 | iounmap(s3c2412_i2s.regs); |
@@ -108,11 +102,20 @@ static int s3c2412_i2s_probe(struct platform_device *pdev, | |||
108 | return 0; | 102 | return 0; |
109 | } | 103 | } |
110 | 104 | ||
105 | static int s3c2412_i2s_remove(struct snd_soc_dai *dai) | ||
106 | { | ||
107 | clk_disable(s3c2412_i2s.iis_cclk); | ||
108 | clk_put(s3c2412_i2s.iis_cclk); | ||
109 | iounmap(s3c2412_i2s.regs); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
111 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | 114 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, |
112 | struct snd_pcm_hw_params *params, | 115 | struct snd_pcm_hw_params *params, |
113 | struct snd_soc_dai *cpu_dai) | 116 | struct snd_soc_dai *cpu_dai) |
114 | { | 117 | { |
115 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | 118 | struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); |
116 | struct s3c_dma_params *dma_data; | 119 | struct s3c_dma_params *dma_data; |
117 | u32 iismod; | 120 | u32 iismod; |
118 | 121 | ||
@@ -152,10 +155,9 @@ static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { | |||
152 | .hw_params = s3c2412_i2s_hw_params, | 155 | .hw_params = s3c2412_i2s_hw_params, |
153 | }; | 156 | }; |
154 | 157 | ||
155 | struct snd_soc_dai s3c2412_i2s_dai = { | 158 | static struct snd_soc_dai_driver s3c2412_i2s_dai = { |
156 | .name = "s3c2412-i2s", | ||
157 | .id = 0, | ||
158 | .probe = s3c2412_i2s_probe, | 159 | .probe = s3c2412_i2s_probe, |
160 | .remove = s3c2412_i2s_remove, | ||
159 | .playback = { | 161 | .playback = { |
160 | .channels_min = 2, | 162 | .channels_min = 2, |
161 | .channels_max = 2, | 163 | .channels_max = 2, |
@@ -170,17 +172,36 @@ struct snd_soc_dai s3c2412_i2s_dai = { | |||
170 | }, | 172 | }, |
171 | .ops = &s3c2412_i2s_dai_ops, | 173 | .ops = &s3c2412_i2s_dai_ops, |
172 | }; | 174 | }; |
173 | EXPORT_SYMBOL_GPL(s3c2412_i2s_dai); | 175 | |
176 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) | ||
177 | { | ||
178 | return snd_soc_register_dai(&pdev->dev, &s3c2412_i2s_dai); | ||
179 | } | ||
180 | |||
181 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) | ||
182 | { | ||
183 | snd_soc_unregister_dai(&pdev->dev); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static struct platform_driver s3c2412_iis_driver = { | ||
188 | .probe = s3c2412_iis_dev_probe, | ||
189 | .remove = s3c2412_iis_dev_remove, | ||
190 | .driver = { | ||
191 | .name = "s3c2412-iis", | ||
192 | .owner = THIS_MODULE, | ||
193 | }, | ||
194 | }; | ||
174 | 195 | ||
175 | static int __init s3c2412_i2s_init(void) | 196 | static int __init s3c2412_i2s_init(void) |
176 | { | 197 | { |
177 | return s3c_i2sv2_register_dai(&s3c2412_i2s_dai); | 198 | return platform_driver_register(&s3c2412_iis_driver); |
178 | } | 199 | } |
179 | module_init(s3c2412_i2s_init); | 200 | module_init(s3c2412_i2s_init); |
180 | 201 | ||
181 | static void __exit s3c2412_i2s_exit(void) | 202 | static void __exit s3c2412_i2s_exit(void) |
182 | { | 203 | { |
183 | snd_soc_unregister_dai(&s3c2412_i2s_dai); | 204 | platform_driver_unregister(&s3c2412_iis_driver); |
184 | } | 205 | } |
185 | module_exit(s3c2412_i2s_exit); | 206 | module_exit(s3c2412_i2s_exit); |
186 | 207 | ||
@@ -188,3 +209,4 @@ module_exit(s3c2412_i2s_exit); | |||
188 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 209 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
189 | MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); | 210 | MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); |
190 | MODULE_LICENSE("GPL"); | 211 | MODULE_LICENSE("GPL"); |
212 | MODULE_ALIAS("platform:s3c2412-iis"); | ||