clk: imx: lpcg: allow lpcg clk to take device pointer

Used to support runtime pm.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
This commit is contained in:
Dong Aisheng 2020-07-29 16:00:16 +08:00 committed by Shawn Guo
parent d5f1e6a2bb
commit a4bfc85ccf
2 changed files with 24 additions and 8 deletions

View File

@ -81,9 +81,9 @@ static const struct clk_ops clk_lpcg_scu_ops = {
.disable = clk_lpcg_scu_disable, .disable = clk_lpcg_scu_disable,
}; };
struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name, struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
unsigned long flags, void __iomem *reg, const char *parent_name, unsigned long flags,
u8 bit_idx, bool hw_gate) void __iomem *reg, u8 bit_idx, bool hw_gate)
{ {
struct clk_lpcg_scu *clk; struct clk_lpcg_scu *clk;
struct clk_init_data init; struct clk_init_data init;
@ -107,7 +107,7 @@ struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name,
clk->hw.init = &init; clk->hw.init = &init;
hw = &clk->hw; hw = &clk->hw;
ret = clk_hw_register(NULL, hw); ret = clk_hw_register(dev, hw);
if (ret) { if (ret) {
kfree(clk); kfree(clk);
hw = ERR_PTR(ret); hw = ERR_PTR(ret);

View File

@ -25,6 +25,11 @@ struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
void imx_clk_scu_unregister(void); void imx_clk_scu_unregister(void);
struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
void __iomem *reg, u8 bit_idx, bool hw_gate);
void imx_clk_lpcg_scu_unregister(struct clk_hw *hw);
static inline struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id, static inline struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id,
u8 clk_type, u8 clk_cells) u8 clk_type, u8 clk_cells)
{ {
@ -44,8 +49,19 @@ static inline struct clk_hw *imx_clk_scu2(const char *name, const char * const *
return __imx_clk_scu(NULL, name, parents, num_parents, rsrc_id, clk_type); return __imx_clk_scu(NULL, name, parents, num_parents, rsrc_id, clk_type);
} }
struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name, static inline struct clk_hw *imx_clk_lpcg_scu_dev(struct device *dev, const char *name,
unsigned long flags, void __iomem *reg, const char *parent_name, unsigned long flags,
u8 bit_idx, bool hw_gate); void __iomem *reg, u8 bit_idx, bool hw_gate)
void imx_clk_lpcg_scu_unregister(struct clk_hw *hw); {
return __imx_clk_lpcg_scu(dev, name, parent_name, flags, reg,
bit_idx, hw_gate);
}
static inline struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name,
unsigned long flags, void __iomem *reg,
u8 bit_idx, bool hw_gate)
{
return __imx_clk_lpcg_scu(NULL, name, parent_name, flags, reg,
bit_idx, hw_gate);
}
#endif #endif