Skip to content

Commit

Permalink
i2c: synquacer: Deal with optional PCLK correctly
Browse files Browse the repository at this point in the history
ACPI boot does not provide clocks and regulators, but instead, provides
the PCLK rate directly, and enables the clock in firmware. So deal
gracefully with this.

Fixes: 5575014 ("i2c: synquacer: Fix an error handling path in synquacer_i2c_probe()")
Cc: stable@vger.kernel.org # v6.10+
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
  • Loading branch information
ardbiesheuvel authored and Andi Shyti committed Sep 24, 2024
1 parent 5d69d5a commit f2990f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/i2c/busses/i2c-synquacer.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,13 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
device_property_read_u32(&pdev->dev, "socionext,pclk-rate",
&i2c->pclkrate);

pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
pclk = devm_clk_get_optional_enabled(&pdev->dev, "pclk");
if (IS_ERR(pclk))
return dev_err_probe(&pdev->dev, PTR_ERR(pclk),
"failed to get and enable clock\n");

i2c->pclkrate = clk_get_rate(pclk);
if (pclk)
i2c->pclkrate = clk_get_rate(pclk);

if (i2c->pclkrate < SYNQUACER_I2C_MIN_CLK_RATE ||
i2c->pclkrate > SYNQUACER_I2C_MAX_CLK_RATE)
Expand Down

0 comments on commit f2990f8

Please sign in to comment.