Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: mediatek: Register clock gate with device

Allow those clocks under a power domain to do the runtime pm operation
by forwarding the struct device pointer from clock provider.

Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
Link: https://lkml.kernel.org/r/1567414859-3244-2-git-send-email-weiyi.lu@mediatek.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Weiyi Lu and committed by
Stephen Boyd
e4c23e19 f9e55ac2

+23 -6
+3 -2
drivers/clk/mediatek/clk-gate.c
··· 150 150 int sta_ofs, 151 151 u8 bit, 152 152 const struct clk_ops *ops, 153 - unsigned long flags) 153 + unsigned long flags, 154 + struct device *dev) 154 155 { 155 156 struct mtk_clk_gate *cg; 156 157 struct clk *clk; ··· 175 174 176 175 cg->hw.init = &init; 177 176 178 - clk = clk_register(NULL, &cg->hw); 177 + clk = clk_register(dev, &cg->hw); 179 178 if (IS_ERR(clk)) 180 179 kfree(cg); 181 180
+2 -1
drivers/clk/mediatek/clk-gate.h
··· 40 40 int sta_ofs, 41 41 u8 bit, 42 42 const struct clk_ops *ops, 43 - unsigned long flags); 43 + unsigned long flags, 44 + struct device *dev); 44 45 45 46 #define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \ 46 47 _ops, _flags) { \
+13 -3
drivers/clk/mediatek/clk-mtk.c
··· 12 12 #include <linux/delay.h> 13 13 #include <linux/clkdev.h> 14 14 #include <linux/mfd/syscon.h> 15 + #include <linux/device.h> 15 16 16 17 #include "clk-mtk.h" 17 18 #include "clk-gate.h" ··· 94 93 } 95 94 } 96 95 97 - int mtk_clk_register_gates(struct device_node *node, 96 + int mtk_clk_register_gates_with_dev(struct device_node *node, 98 97 const struct mtk_gate *clks, 99 - int num, struct clk_onecell_data *clk_data) 98 + int num, struct clk_onecell_data *clk_data, 99 + struct device *dev) 100 100 { 101 101 int i; 102 102 struct clk *clk; ··· 124 122 gate->regs->set_ofs, 125 123 gate->regs->clr_ofs, 126 124 gate->regs->sta_ofs, 127 - gate->shift, gate->ops, gate->flags); 125 + gate->shift, gate->ops, gate->flags, dev); 128 126 129 127 if (IS_ERR(clk)) { 130 128 pr_err("Failed to register clk %s: %ld\n", ··· 136 134 } 137 135 138 136 return 0; 137 + } 138 + 139 + int mtk_clk_register_gates(struct device_node *node, 140 + const struct mtk_gate *clks, 141 + int num, struct clk_onecell_data *clk_data) 142 + { 143 + return mtk_clk_register_gates_with_dev(node, 144 + clks, num, clk_data, NULL); 139 145 } 140 146 141 147 struct clk *mtk_clk_register_composite(const struct mtk_composite *mc,
+5
drivers/clk/mediatek/clk-mtk.h
··· 169 169 const struct mtk_gate *clks, int num, 170 170 struct clk_onecell_data *clk_data); 171 171 172 + int mtk_clk_register_gates_with_dev(struct device_node *node, 173 + const struct mtk_gate *clks, 174 + int num, struct clk_onecell_data *clk_data, 175 + struct device *dev); 176 + 172 177 struct mtk_clk_divider { 173 178 int id; 174 179 const char *name;