Skip to content

Commit

Permalink
clk: meson: axg-audio: setup regmap max_register based on the SoC
Browse files Browse the repository at this point in the history
The register region of axg-audio tends to grow with the addition of
new supported SoC. Mapping slightly more has not been causing problem
so far but it is not viable to continue like this long term.

Setup the max register based on what is necessary on the related SoC.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240719093934.3985139-3-jbrunet@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
  • Loading branch information
Jerome Brunet committed Jul 29, 2024
1 parent cbf4d39 commit dd8ab39
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/clk/meson/axg-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,11 +1726,10 @@ static const struct reset_control_ops axg_audio_rstc_ops = {
.status = axg_audio_reset_status,
};

static const struct regmap_config axg_audio_regmap_cfg = {
static struct regmap_config axg_audio_regmap_cfg = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
.max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
};

struct audioclk_data {
Expand All @@ -1739,6 +1738,7 @@ struct audioclk_data {
struct meson_clk_hw_data hw_clks;
unsigned int reset_offset;
unsigned int reset_num;
unsigned int max_register;
};

static int axg_audio_clkc_probe(struct platform_device *pdev)
Expand All @@ -1760,6 +1760,7 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);

axg_audio_regmap_cfg.max_register = data->max_register;
map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
if (IS_ERR(map)) {
dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
Expand Down Expand Up @@ -1828,6 +1829,7 @@ static const struct audioclk_data axg_audioclk_data = {
.hws = axg_audio_hw_clks,
.num = ARRAY_SIZE(axg_audio_hw_clks),
},
.max_register = AUDIO_CLK_PDMIN_CTRL1,
};

static const struct audioclk_data g12a_audioclk_data = {
Expand All @@ -1839,6 +1841,7 @@ static const struct audioclk_data g12a_audioclk_data = {
},
.reset_offset = AUDIO_SW_RESET,
.reset_num = 26,
.max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
};

static const struct audioclk_data sm1_audioclk_data = {
Expand All @@ -1850,6 +1853,7 @@ static const struct audioclk_data sm1_audioclk_data = {
},
.reset_offset = AUDIO_SM1_SW_RESET0,
.reset_num = 39,
.max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
};

static const struct of_device_id clkc_match_table[] = {
Expand Down

0 comments on commit dd8ab39

Please sign in to comment.