aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/samsung/clk-exynos-audss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/samsung/clk-exynos-audss.c')
-rw-r--r--drivers/clk/samsung/clk-exynos-audss.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c
index f2c2ccce49bb..454b02ae486a 100644
--- a/drivers/clk/samsung/clk-exynos-audss.c
+++ b/drivers/clk/samsung/clk-exynos-audss.c
@@ -82,6 +82,26 @@ static const struct of_device_id exynos_audss_clk_of_match[] = {
82 {}, 82 {},
83}; 83};
84 84
85static void exynos_audss_clk_teardown(void)
86{
87 int i;
88
89 for (i = EXYNOS_MOUT_AUDSS; i < EXYNOS_DOUT_SRP; i++) {
90 if (!IS_ERR(clk_table[i]))
91 clk_unregister_mux(clk_table[i]);
92 }
93
94 for (; i < EXYNOS_SRP_CLK; i++) {
95 if (!IS_ERR(clk_table[i]))
96 clk_unregister_divider(clk_table[i]);
97 }
98
99 for (; i < clk_data.clk_num; i++) {
100 if (!IS_ERR(clk_table[i]))
101 clk_unregister_gate(clk_table[i]);
102 }
103}
104
85/* register exynos_audss clocks */ 105/* register exynos_audss clocks */
86static int exynos_audss_clk_probe(struct platform_device *pdev) 106static int exynos_audss_clk_probe(struct platform_device *pdev)
87{ 107{
@@ -219,10 +239,7 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
219 return 0; 239 return 0;
220 240
221unregister: 241unregister:
222 for (i = 0; i < clk_data.clk_num; i++) { 242 exynos_audss_clk_teardown();
223 if (!IS_ERR(clk_table[i]))
224 clk_unregister(clk_table[i]);
225 }
226 243
227 if (!IS_ERR(epll)) 244 if (!IS_ERR(epll))
228 clk_disable_unprepare(epll); 245 clk_disable_unprepare(epll);
@@ -232,18 +249,13 @@ unregister:
232 249
233static int exynos_audss_clk_remove(struct platform_device *pdev) 250static int exynos_audss_clk_remove(struct platform_device *pdev)
234{ 251{
235 int i;
236
237#ifdef CONFIG_PM_SLEEP 252#ifdef CONFIG_PM_SLEEP
238 unregister_syscore_ops(&exynos_audss_clk_syscore_ops); 253 unregister_syscore_ops(&exynos_audss_clk_syscore_ops);
239#endif 254#endif
240 255
241 of_clk_del_provider(pdev->dev.of_node); 256 of_clk_del_provider(pdev->dev.of_node);
242 257
243 for (i = 0; i < clk_data.clk_num; i++) { 258 exynos_audss_clk_teardown();
244 if (!IS_ERR(clk_table[i]))
245 clk_unregister(clk_table[i]);
246 }
247 259
248 if (!IS_ERR(epll)) 260 if (!IS_ERR(epll))
249 clk_disable_unprepare(epll); 261 clk_disable_unprepare(epll);