From: Ard Biesheuvel <ardb+git@google.com>
To: linux-i2c@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
stable@vger.kernel.org, Andi Shyti <andi.shyti@kernel.org>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] i2c/synquacer: Deal with optional PCLK correctly
Date: Thu, 12 Sep 2024 12:46:31 +0200 [thread overview]
Message-ID: <20240912104630.1868285-2-ardb+git@google.com> (raw)
From: Ard Biesheuvel <ardb@kernel.org>
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: 55750148e559 ("i2c: synquacer: Fix an error handling path in synquacer_i2c_probe()")
Cc: <stable@vger.kernel.org>
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
https://lore.kernel.org/all/CAMj1kXFH+zB_YuUS+vaEpguhuVGLYbQw55VNDCxnBfSPe6b-nw@mail.gmail.com/T/#u
drivers/i2c/busses/i2c-synquacer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
index 4eccbcd0fbfc..bbb9062669e4 100644
--- a/drivers/i2c/busses/i2c-synquacer.c
+++ b/drivers/i2c/busses/i2c-synquacer.c
@@ -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)
--
2.46.0.662.g92d0881bb0-goog
next reply other threads:[~2024-09-12 10:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 10:46 Ard Biesheuvel [this message]
2024-09-12 17:10 ` [PATCH] i2c/synquacer: Deal with optional PCLK correctly Marion & Christophe JAILLET
2024-09-12 17:12 ` Ard Biesheuvel
2024-09-12 17:37 ` Christophe JAILLET
2024-09-20 9:03 ` Andi Shyti
2024-09-23 15:10 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240912104630.1868285-2-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=andi.shyti@kernel.org \
--cc=ardb@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=linux-i2c@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.