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

clk: rockchip: expose rockchip_clk_set_lookup

Move rockchip_clk_add_lookup to clk.h, so that it can be used
by sub-devices with their own driver. These might also have to
do a lookup, so rename the function to rockchip_clk_set_lookup
and add a matching rockchip_clk_get_lookup.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20241211165957.94922-4-sebastian.reichel@collabora.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>

authored by

Sebastian Reichel and committed by
Heiko Stuebner
fe0fb667 33af9624

+16 -10
+4 -10
drivers/clk/rockchip/clk.c
··· 197 197 clk_fractional_divider_general_approximation(hw, rate, parent_rate, m, n); 198 198 } 199 199 200 - static void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx, 201 - struct clk *clk, unsigned int id) 202 - { 203 - ctx->clk_data.clks[id] = clk; 204 - } 205 - 206 200 static struct clk *rockchip_clk_register_frac_branch( 207 201 struct rockchip_clk_provider *ctx, const char *name, 208 202 const char *const *parent_names, u8 num_parents, ··· 286 292 return mux_clk; 287 293 } 288 294 289 - rockchip_clk_add_lookup(ctx, mux_clk, child->id); 295 + rockchip_clk_set_lookup(ctx, mux_clk, child->id); 290 296 291 297 /* notifier on the fraction divider to catch rate changes */ 292 298 if (frac->mux_frac_idx >= 0) { ··· 446 452 continue; 447 453 } 448 454 449 - rockchip_clk_add_lookup(ctx, clk, list->id); 455 + rockchip_clk_set_lookup(ctx, clk, list->id); 450 456 } 451 457 } 452 458 EXPORT_SYMBOL_GPL(rockchip_clk_register_plls); ··· 608 614 continue; 609 615 } 610 616 611 - rockchip_clk_add_lookup(ctx, clk, list->id); 617 + rockchip_clk_set_lookup(ctx, clk, list->id); 612 618 } 613 619 } 614 620 EXPORT_SYMBOL_GPL(rockchip_clk_register_branches); ··· 632 638 return; 633 639 } 634 640 635 - rockchip_clk_add_lookup(ctx, clk, lookup_id); 641 + rockchip_clk_set_lookup(ctx, clk, lookup_id); 636 642 } 637 643 EXPORT_SYMBOL_GPL(rockchip_clk_register_armclk); 638 644
+12
drivers/clk/rockchip/clk.h
··· 1022 1022 #define SGRF_GATE(_id, cname, pname) \ 1023 1023 FACTOR(_id, cname, pname, 0, 1, 1) 1024 1024 1025 + static inline struct clk *rockchip_clk_get_lookup(struct rockchip_clk_provider *ctx, 1026 + unsigned int id) 1027 + { 1028 + return ctx->clk_data.clks[id]; 1029 + } 1030 + 1031 + static inline void rockchip_clk_set_lookup(struct rockchip_clk_provider *ctx, 1032 + struct clk *clk, unsigned int id) 1033 + { 1034 + ctx->clk_data.clks[id] = clk; 1035 + } 1036 + 1025 1037 struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, 1026 1038 void __iomem *base, unsigned long nr_clks); 1027 1039 struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np,