Skip to content

Commit fe0fb66

Browse files
sremmind
authored andcommitted
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>
1 parent 33af962 commit fe0fb66

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

drivers/clk/rockchip/clk.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
197197
clk_fractional_divider_general_approximation(hw, rate, parent_rate, m, n);
198198
}
199199

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-
206200
static struct clk *rockchip_clk_register_frac_branch(
207201
struct rockchip_clk_provider *ctx, const char *name,
208202
const char *const *parent_names, u8 num_parents,
@@ -292,7 +286,7 @@ static struct clk *rockchip_clk_register_frac_branch(
292286
return mux_clk;
293287
}
294288

295-
rockchip_clk_add_lookup(ctx, mux_clk, child->id);
289+
rockchip_clk_set_lookup(ctx, mux_clk, child->id);
296290

297291
/* notifier on the fraction divider to catch rate changes */
298292
if (frac->mux_frac_idx >= 0) {
@@ -452,7 +446,7 @@ void rockchip_clk_register_plls(struct rockchip_clk_provider *ctx,
452446
continue;
453447
}
454448

455-
rockchip_clk_add_lookup(ctx, clk, list->id);
449+
rockchip_clk_set_lookup(ctx, clk, list->id);
456450
}
457451
}
458452
EXPORT_SYMBOL_GPL(rockchip_clk_register_plls);
@@ -614,7 +608,7 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
614608
continue;
615609
}
616610

617-
rockchip_clk_add_lookup(ctx, clk, list->id);
611+
rockchip_clk_set_lookup(ctx, clk, list->id);
618612
}
619613
}
620614
EXPORT_SYMBOL_GPL(rockchip_clk_register_branches);
@@ -638,7 +632,7 @@ void rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx,
638632
return;
639633
}
640634

641-
rockchip_clk_add_lookup(ctx, clk, lookup_id);
635+
rockchip_clk_set_lookup(ctx, clk, lookup_id);
642636
}
643637
EXPORT_SYMBOL_GPL(rockchip_clk_register_armclk);
644638

drivers/clk/rockchip/clk.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,18 @@ struct rockchip_clk_branch {
10221022
#define SGRF_GATE(_id, cname, pname) \
10231023
FACTOR(_id, cname, pname, 0, 1, 1)
10241024

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+
10251037
struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
10261038
void __iomem *base, unsigned long nr_clks);
10271039
struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np,

0 commit comments

Comments
 (0)