Skip to content

Commit e4c5ef6

Browse files
xdarklightbebarino
authored andcommitted
clk: meson: regmap: switch to determine_rate for the dividers
This increases the maxmium supported frequency on 32-bit systems from 2^31 (signed long as used by clk_ops.round_rate, maximum value: approx. 2.14GHz) to 2^32 (unsigned long as used by clk_ops.determine_rate, maximum value: approx. 4.29GHz). On Meson8/8b/8m2 the HDMI PLL and it's OD (post-dividers) are capable of running at up to 2.97GHz. So switch the divider implementation in clk-regmap to clk_ops.determine_rate to support these higher frequencies on 32-bit systems. Reviewed-by: Jerome Brunet <[email protected]> Signed-off-by: Martin Blumenstingl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent db400ac commit e4c5ef6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/clk/meson/clk-regmap.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ static unsigned long clk_regmap_div_recalc_rate(struct clk_hw *hw,
7575
div->width);
7676
}
7777

78-
static long clk_regmap_div_round_rate(struct clk_hw *hw, unsigned long rate,
79-
unsigned long *prate)
78+
static int clk_regmap_div_determine_rate(struct clk_hw *hw,
79+
struct clk_rate_request *req)
8080
{
8181
struct clk_regmap *clk = to_clk_regmap(hw);
8282
struct clk_regmap_div_data *div = clk_get_regmap_div_data(clk);
@@ -87,18 +87,17 @@ static long clk_regmap_div_round_rate(struct clk_hw *hw, unsigned long rate,
8787
if (div->flags & CLK_DIVIDER_READ_ONLY) {
8888
ret = regmap_read(clk->map, div->offset, &val);
8989
if (ret)
90-
/* Gives a hint that something is wrong */
91-
return 0;
90+
return ret;
9291

9392
val >>= div->shift;
9493
val &= clk_div_mask(div->width);
9594

96-
return divider_ro_round_rate(hw, rate, prate, div->table,
97-
div->width, div->flags, val);
95+
return divider_ro_determine_rate(hw, req, div->table,
96+
div->width, div->flags, val);
9897
}
9998

100-
return divider_round_rate(hw, rate, prate, div->table, div->width,
101-
div->flags);
99+
return divider_determine_rate(hw, req, div->table, div->width,
100+
div->flags);
102101
}
103102

104103
static int clk_regmap_div_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -123,14 +122,14 @@ static int clk_regmap_div_set_rate(struct clk_hw *hw, unsigned long rate,
123122

124123
const struct clk_ops clk_regmap_divider_ops = {
125124
.recalc_rate = clk_regmap_div_recalc_rate,
126-
.round_rate = clk_regmap_div_round_rate,
125+
.determine_rate = clk_regmap_div_determine_rate,
127126
.set_rate = clk_regmap_div_set_rate,
128127
};
129128
EXPORT_SYMBOL_GPL(clk_regmap_divider_ops);
130129

131130
const struct clk_ops clk_regmap_divider_ro_ops = {
132131
.recalc_rate = clk_regmap_div_recalc_rate,
133-
.round_rate = clk_regmap_div_round_rate,
132+
.determine_rate = clk_regmap_div_determine_rate,
134133
};
135134
EXPORT_SYMBOL_GPL(clk_regmap_divider_ro_ops);
136135

0 commit comments

Comments
 (0)