Message ID | 20211221031638.3499920-1-peng.fan@oss.nxp.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
Series | clk: bulk: export of_clk_bulk_get_all | expand |
Quoting Peng Fan (OSS) (2021-12-20 19:16:38) > From: Peng Fan <peng.fan@nxp.com> > > There are cases that need to get the bulk clks of a device_node which not > has device created, so export of_clk_bulk_get_all to let consumers could > use it. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > > V1: > An example here, mediamix node has clocks property, but it will not Sorry I don't get the example. What does a DT snippet have to do with modular kernel code? What specific kernel module is calling this API? > have device of it, so we need of_X api to get the clks. > src: src@0x30390000 { > compatible = "fsl,imx[X]-src"; > reg = <0x30390000 0x10000>; > > slice { Is this upstream? > #address-cells = <1>; > #size-cells = <0>; > > mediamix: slice@2400 { > reg = <IMX93_POWER_DOMAIN_MEDIAMIX>; > #power-domain-cells = <0>;
> Subject: Re: [PATCH] clk: bulk: export of_clk_bulk_get_all > > Quoting Peng Fan (OSS) (2021-12-20 19:16:38) > > From: Peng Fan <peng.fan@nxp.com> > > > > There are cases that need to get the bulk clks of a device_node which > > not has device created, so export of_clk_bulk_get_all to let consumers > > could use it. > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > > > V1: > > An example here, mediamix node has clocks property, but it will > > not > > Sorry I don't get the example. What does a DT snippet have to do with > modular kernel code? What specific kernel module is calling this API? > > > have device of it, so we need of_X api to get the clks. > > src: src@0x30390000 { > > compatible = "fsl,imx[X]-src"; > > reg = <0x30390000 0x10000>; > > > > slice { > > Is this upstream? Not posted to community yet. I'll post that patch to show the usage. Thanks, Peng. > > > #address-cells = <1>; > > #size-cells = <0>; > > > > mediamix: slice@2400 { > > reg = <IMX93_POWER_DOMAIN_MEDIAMIX>; > > #power-domain-cells = <0>;
diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index e9e16425c739..6dd7aac0b84c 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -43,8 +43,8 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, return ret; } -static int __must_check of_clk_bulk_get_all(struct device_node *np, - struct clk_bulk_data **clks) +int __must_check of_clk_bulk_get_all(struct device_node *np, + struct clk_bulk_data **clks) { struct clk_bulk_data *clk_bulk; int num_clks; @@ -68,6 +68,7 @@ static int __must_check of_clk_bulk_get_all(struct device_node *np, return num_clks; } +EXPORT_SYMBOL_GPL(of_clk_bulk_get_all); void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) { diff --git a/include/linux/clk.h b/include/linux/clk.h index 266e8de3cb51..c49c7918d6ef 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -372,6 +372,18 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, int __must_check clk_bulk_get_all(struct device *dev, struct clk_bulk_data **clks); +/** + * of_clk_bulk_get_all - lookup and obtain all available references to clock + * producer. + * @np: device node for clock "consumer" + * @clks: pointer to the clk_bulk_data table of consumer + * + * Same with clk_bulk_get_all except the first parameter use device node + * pointer. + */ +int __must_check of_clk_bulk_get_all(struct device_node *np, + struct clk_bulk_data **clks); + /** * clk_bulk_get_optional - lookup and obtain a number of references to clock producer * @dev: device for clock "consumer" @@ -808,6 +820,12 @@ static inline int __must_check clk_bulk_get_all(struct device *dev, return 0; } +static inline int __must_check of_clk_bulk_get_all(struct device *dev, + struct clk_bulk_data **clks) +{ + return 0; +} + static inline struct clk *devm_clk_get(struct device *dev, const char *id) { return NULL;