diff mbox series

[RFC,06/11] clk: imx: Add helpers for passing the device as argument

Message ID 1583226206-19758-7-git-send-email-abel.vesa@nxp.com (mailing list archive)
State New, archived
Headers show
Series Add generic MFD i.MX mix and audiomix support | expand

Commit Message

Abel Vesa March 3, 2020, 9:03 a.m. UTC
All the imx clocks that need to be registered by the audiomix need to pass
on the device so that the runtime PM support could work properly.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/clk/imx/clk.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Peng Fan March 13, 2020, 7:58 a.m. UTC | #1
> Subject: [RFC 06/11] clk: imx: Add helpers for passing the device as argument
> 
> All the imx clocks that need to be registered by the audiomix need to pass on
> the device so that the runtime PM support could work properly.
> 
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> ---
>  drivers/clk/imx/clk.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index
> cb28f06..42960a9 100644
> --- a/drivers/clk/imx/clk.h
> +++ b/drivers/clk/imx/clk.h
> @@ -321,6 +321,13 @@ static inline struct clk_hw *imx_clk_hw_gate(const
> char *name, const char *paren
>  				    shift, 0, &imx_ccm_lock);
>  }
> 
> +static inline struct clk_hw *imx_dev_clk_hw_gate(struct device *dev, const
> char *name,
> +						const char *parent, void __iomem *reg, u8 shift)
> {
> +	return clk_hw_register_gate(dev, name, parent, CLK_SET_RATE_PARENT,
> reg,
> +				    shift, 0, &imx_ccm_lock);
> +}
> +
>  static inline struct clk_hw *imx_clk_hw_gate_dis(const char *name, const
> char *parent,
>  		void __iomem *reg, u8 shift)
>  {
> @@ -422,6 +429,15 @@ static inline struct clk_hw *imx_clk_hw_mux(const
> char *name, void __iomem *reg,
>  			width, 0, &imx_ccm_lock);
>  }
> 
> +static inline struct clk_hw *imx_dev_clk_hw_mux(struct device *dev, const
> char *name,
> +                        void __iomem *reg, u8 shift, u8 width,
> +                        const char * const *parents, int num_parents)
> {
> +        return clk_hw_register_mux(dev, name, parents, num_parents,
> +                        CLK_SET_RATE_NO_REPARENT |
> CLK_SET_PARENT_GATE,
> +                        reg, shift, width, 0, &imx_ccm_lock); }
> +
>  static inline struct clk *imx_clk_mux2(const char *name, void __iomem
> *reg,
>  			u8 shift, u8 width, const char * const *parents,
>  			int num_parents)
> @@ -484,6 +500,19 @@ static inline struct clk_hw
> *imx_clk_hw_mux_flags(const char *name,
>  				   reg, shift, width, 0, &imx_ccm_lock);  }
> 
> +static inline struct clk_hw *imx_dev_clk_hw_mux_flags(struct device *dev,
> +						  const char *name,
> +						  void __iomem *reg, u8 shift,
> +						  u8 width,
> +						  const char * const *parents,
> +						  int num_parents,
> +						  unsigned long flags)
> +{
> +	return clk_hw_register_mux(dev, name, parents, num_parents,
> +				   flags | CLK_SET_RATE_NO_REPARENT,
> +				   reg, shift, width, 0, &imx_ccm_lock); }
> +
>  struct clk_hw *imx_clk_hw_cpu(const char *name, const char
> *parent_name,
>  		struct clk *div, struct clk *mux, struct clk *pll,
>  		struct clk *step);
> --
> 2.7.4
Stephen Boyd March 21, 2020, 12:46 a.m. UTC | #2
Quoting Abel Vesa (2020-03-03 01:03:21)
> All the imx clocks that need to be registered by the audiomix need to pass
> on the device so that the runtime PM support could work properly.
> 
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
diff mbox series

Patch

diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index cb28f06..42960a9 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -321,6 +321,13 @@  static inline struct clk_hw *imx_clk_hw_gate(const char *name, const char *paren
 				    shift, 0, &imx_ccm_lock);
 }
 
+static inline struct clk_hw *imx_dev_clk_hw_gate(struct device *dev, const char *name,
+						const char *parent, void __iomem *reg, u8 shift)
+{
+	return clk_hw_register_gate(dev, name, parent, CLK_SET_RATE_PARENT, reg,
+				    shift, 0, &imx_ccm_lock);
+}
+
 static inline struct clk_hw *imx_clk_hw_gate_dis(const char *name, const char *parent,
 		void __iomem *reg, u8 shift)
 {
@@ -422,6 +429,15 @@  static inline struct clk_hw *imx_clk_hw_mux(const char *name, void __iomem *reg,
 			width, 0, &imx_ccm_lock);
 }
 
+static inline struct clk_hw *imx_dev_clk_hw_mux(struct device *dev, const char *name,
+                        void __iomem *reg, u8 shift, u8 width,
+                        const char * const *parents, int num_parents)
+{
+        return clk_hw_register_mux(dev, name, parents, num_parents,
+                        CLK_SET_RATE_NO_REPARENT | CLK_SET_PARENT_GATE,
+                        reg, shift, width, 0, &imx_ccm_lock);
+}
+
 static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg,
 			u8 shift, u8 width, const char * const *parents,
 			int num_parents)
@@ -484,6 +500,19 @@  static inline struct clk_hw *imx_clk_hw_mux_flags(const char *name,
 				   reg, shift, width, 0, &imx_ccm_lock);
 }
 
+static inline struct clk_hw *imx_dev_clk_hw_mux_flags(struct device *dev,
+						  const char *name,
+						  void __iomem *reg, u8 shift,
+						  u8 width,
+						  const char * const *parents,
+						  int num_parents,
+						  unsigned long flags)
+{
+	return clk_hw_register_mux(dev, name, parents, num_parents,
+				   flags | CLK_SET_RATE_NO_REPARENT,
+				   reg, shift, width, 0, &imx_ccm_lock);
+}
+
 struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
 		struct clk *div, struct clk *mux, struct clk *pll,
 		struct clk *step);