Skip to content

Commit

Permalink
clk: rockchip: expose rockchip_clk_set_lookup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Reichel authored and Heiko Stuebner committed Jan 9, 2025
1 parent 33af962 commit fe0fb66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/clk/rockchip/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
clk_fractional_divider_general_approximation(hw, rate, parent_rate, m, n);
}

static void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx,
struct clk *clk, unsigned int id)
{
ctx->clk_data.clks[id] = clk;
}

static struct clk *rockchip_clk_register_frac_branch(
struct rockchip_clk_provider *ctx, const char *name,
const char *const *parent_names, u8 num_parents,
Expand Down Expand Up @@ -292,7 +286,7 @@ static struct clk *rockchip_clk_register_frac_branch(
return mux_clk;
}

rockchip_clk_add_lookup(ctx, mux_clk, child->id);
rockchip_clk_set_lookup(ctx, mux_clk, child->id);

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

rockchip_clk_add_lookup(ctx, clk, list->id);
rockchip_clk_set_lookup(ctx, clk, list->id);
}
}
EXPORT_SYMBOL_GPL(rockchip_clk_register_plls);
Expand Down Expand Up @@ -614,7 +608,7 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
continue;
}

rockchip_clk_add_lookup(ctx, clk, list->id);
rockchip_clk_set_lookup(ctx, clk, list->id);
}
}
EXPORT_SYMBOL_GPL(rockchip_clk_register_branches);
Expand All @@ -638,7 +632,7 @@ void rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx,
return;
}

rockchip_clk_add_lookup(ctx, clk, lookup_id);
rockchip_clk_set_lookup(ctx, clk, lookup_id);
}
EXPORT_SYMBOL_GPL(rockchip_clk_register_armclk);

Expand Down
12 changes: 12 additions & 0 deletions drivers/clk/rockchip/clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,18 @@ struct rockchip_clk_branch {
#define SGRF_GATE(_id, cname, pname) \
FACTOR(_id, cname, pname, 0, 1, 1)

static inline struct clk *rockchip_clk_get_lookup(struct rockchip_clk_provider *ctx,
unsigned int id)
{
return ctx->clk_data.clks[id];
}

static inline void rockchip_clk_set_lookup(struct rockchip_clk_provider *ctx,
struct clk *clk, unsigned int id)
{
ctx->clk_data.clks[id] = clk;
}

struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
void __iomem *base, unsigned long nr_clks);
struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np,
Expand Down

0 comments on commit fe0fb66

Please sign in to comment.