23 #include <linux/kernel.h>
24 #include <linux/slab.h>
52 static int max77686_clk_prepare(
struct clk_hw *
hw)
57 max77686 = get_max77686_clk(hw);
67 static void max77686_clk_unprepare(
struct clk_hw *hw)
71 max77686 = get_max77686_clk(hw);
79 static int max77686_clk_is_enabled(
struct clk_hw *hw)
85 max77686 = get_max77686_clk(hw);
95 return val & max77686->
mask;
98 static struct clk_ops max77686_clk_ops = {
99 .prepare = max77686_clk_prepare,
100 .unprepare = max77686_clk_unprepare,
101 .is_enabled = max77686_clk_is_enabled,
107 .ops = &max77686_clk_ops,
108 .flags = CLK_IS_ROOT,
112 .ops = &max77686_clk_ops,
113 .flags = CLK_IS_ROOT,
116 .name =
"32khz_pmic",
117 .ops = &max77686_clk_ops,
118 .flags = CLK_IS_ROOT,
122 static int max77686_clk_register(
struct device *
dev,
126 struct clk_hw *hw = &max77686->
hw;
135 if (IS_ERR(max77686->
lookup))
138 max77686->
lookup->con_id = hw->init->name;
139 max77686->
lookup->clk = clk;
154 if (IS_ERR(max77686_clks))
160 if (IS_ERR(max77686_clks[i]))
166 max77686_clks[
i]->
mask = 1 <<
i;
167 max77686_clks[
i]->
hw.init = &max77686_clks_init[
i];
169 ret = max77686_clk_register(&pdev->
dev, max77686_clks[i]);
173 dev_err(&pdev->
dev,
"Fail to register CLK_AP\n");
177 dev_err(&pdev->
dev,
"Fail to register CLK_CP\n");
181 dev_err(&pdev->
dev,
"Fail to register CLK_PMIC\n");
187 platform_set_drvdata(pdev, max77686_clks);
204 struct max77686_clk **max77686_clks = platform_get_drvdata(pdev);
209 kfree(max77686_clks[i]->hw.clk);
215 {
"max77686-clk", 0},
222 .name =
"max77686-clk",
225 .probe = max77686_clk_probe,
227 .id_table = max77686_clk_id,
230 static int __init max77686_clk_init(
void)
236 static void __init max77686_clk_cleanup(
void)