* [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL"
@ 2026-10-14 13:08 Birk Skyum
2026-10-14 13:17 ` Konrad Dybcio
2026-10-14 22:33 ` Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: Birk Skyum @ 2026-10-14 13:08 UTC (permalink / raw)
To: Andi Shyti, Viken Dadhaniya, Mukesh Kumar Savaliya
Cc: Konrad Dybcio, Thorsten Leemhuis, Daniel J Blueman, Sasha Levin,
Bjorn Andersson, Manikanta Mylavarapu, linux-i2c, linux-arm-msm,
linux-kernel, stable, regressions
This reverts commit cb97bf3d4f91453b881acaf8e9f0cc47bb40b604.
With that commit the keyboard and touchpad of the Lenovo Yoga Slim 7x
(x1e80100) are dead, also at the disk passphrase prompt, on 7.2.9 and on
v7.3-rc7. The first transfer on their bus fails.
geni_i2c b80000.i2c: Bus proto err, noisy/unexpected start/stop
i2c_hid_of 1-003a: failed to fetch HID descriptor: -5
With the commit the I2C serial engine clocks read 32 MHz, without it
19.2 MHz. A fix for the 32 MHz fast-mode timing is still being
discussed, so go back to the previous behaviour for 7.3. This brings
back the hardcoded index 0 in SE_GENI_CLK_SEL.
On v7.3-rc7 with only i2c-qcom-geni.ko swapped, the keyboard is dead
without this revert and works with it.
Fixes: cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL")
Reported-by: Birk Skyum <birk.skyum@pm.me>
Closes: https://lore.kernel.org/r/179173732257.29426.7905170638383807320@pm.me
Link: https://lore.kernel.org/r/ae03e7a3-75f1-42df-b0e6-0e64358be647@oss.qualcomm.com
Cc: stable@vger.kernel.org
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
---
drivers/i2c/busses/i2c-qcom-geni.c | 38 ++++--------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index ed6495e..3a3c871 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -82,9 +82,6 @@ enum geni_i2c_err_code {
#define XFER_TIMEOUT HZ
#define RST_TIMEOUT HZ
-#define GENI_SE_CLK_32MHZ (32 * HZ_PER_MHZ)
-#define GENI_SE_CLK_19P2MHZ 19200000UL
-
struct geni_i2c_desc {
bool no_dma_support;
unsigned int tx_fifo_depth;
@@ -130,7 +127,6 @@ struct geni_i2c_dev {
spinlock_t lock;
u32 clk_freq_out;
const struct geni_i2c_clk_fld *clk_fld;
- u32 clk_idx;
void *dma_buf;
size_t xfer_len;
dma_addr_t dma_addr;
@@ -201,44 +197,19 @@ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = {
static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c)
{
const struct geni_i2c_clk_fld *itr;
- unsigned long res_freq;
- /*
- * Frequency counter tables are calibrated for a specific source
- * clock frequency and are not valid for any multiple of it
- * (e.g. 64 MHz, 128 MHz).
- * Use exact=true and verify res_freq matches req_freq literally
- * to reject harmonics: a 64 MHz clock that divides evenly to
- * 32 MHz would pass exact matching but produce double the intended
- * I2C frequency with these counter values.
- */
- if (!geni_se_clk_freq_match(&gi2c->se, GENI_SE_CLK_32MHZ,
- &gi2c->clk_idx, &res_freq, true) &&
- res_freq == GENI_SE_CLK_32MHZ) {
+ if (clk_get_rate(gi2c->se.clk) == 32 * HZ_PER_MHZ)
itr = geni_i2c_clk_map_32mhz;
- } else if (!geni_se_clk_freq_match(&gi2c->se, GENI_SE_CLK_19P2MHZ,
- &gi2c->clk_idx, &res_freq, true) &&
- res_freq == GENI_SE_CLK_19P2MHZ) {
+ else
itr = geni_i2c_clk_map_19p2mhz;
- } else {
- dev_err(gi2c->se.dev,
- "Unsupported SE source clock: must be exactly 32 MHz or 19.2 MHz\n");
- return -EINVAL;
- }
while (itr->clk_freq_out != 0) {
if (itr->clk_freq_out == gi2c->clk_freq_out) {
gi2c->clk_fld = itr;
- dev_dbg(gi2c->se.dev,
- "I2C clk selected: freq: %u Hz, clk_idx: %u\n",
- gi2c->clk_freq_out, gi2c->clk_idx);
return 0;
}
itr++;
}
-
- dev_err(gi2c->se.dev, "Unsupported I2C output frequency %u Hz\n", gi2c->clk_freq_out);
-
return -EINVAL;
}
@@ -248,7 +219,7 @@ static int qcom_geni_i2c_conf(struct geni_se *se, unsigned long freq)
const struct geni_i2c_clk_fld *itr = gi2c->clk_fld;
u32 val;
- writel_relaxed(gi2c->clk_idx, gi2c->se.base + SE_GENI_CLK_SEL);
+ writel_relaxed(0, gi2c->se.base + SE_GENI_CLK_SEL);
val = (itr->clk_div << CLK_DIV_SHFT) | SER_CLK_EN;
writel_relaxed(val, gi2c->se.base + GENI_SER_M_CLK_CFG);
@@ -1141,7 +1112,8 @@ static int geni_i2c_resources_init(struct geni_se *se)
ret = geni_i2c_clk_map_idx(gi2c);
if (ret)
- return ret;
+ return dev_err_probe(gi2c->se.dev, ret, "Invalid clk frequency %d Hz\n",
+ gi2c->clk_freq_out);
return geni_icc_set_bw_ab(&gi2c->se, GENI_DEFAULT_BW, GENI_DEFAULT_BW,
Bps_to_icc(gi2c->clk_freq_out));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL"
2026-10-14 13:08 [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL" Birk Skyum
@ 2026-10-14 13:17 ` Konrad Dybcio
2026-10-14 22:33 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2026-10-14 13:17 UTC (permalink / raw)
To: Birk Skyum, Andi Shyti, Viken Dadhaniya, Mukesh Kumar Savaliya
Cc: Thorsten Leemhuis, Daniel J Blueman, Sasha Levin,
Bjorn Andersson, Manikanta Mylavarapu, linux-i2c, linux-arm-msm,
linux-kernel, stable, regressions
On 10/14/26 3:08 PM, Birk Skyum wrote:
> This reverts commit cb97bf3d4f91453b881acaf8e9f0cc47bb40b604.
>
> With that commit the keyboard and touchpad of the Lenovo Yoga Slim 7x
> (x1e80100) are dead, also at the disk passphrase prompt, on 7.2.9 and on
> v7.3-rc7. The first transfer on their bus fails.
>
> geni_i2c b80000.i2c: Bus proto err, noisy/unexpected start/stop
> i2c_hid_of 1-003a: failed to fetch HID descriptor: -5
>
> With the commit the I2C serial engine clocks read 32 MHz, without it
> 19.2 MHz. A fix for the 32 MHz fast-mode timing is still being
> discussed, so go back to the previous behaviour for 7.3. This brings
> back the hardcoded index 0 in SE_GENI_CLK_SEL.
>
> On v7.3-rc7 with only i2c-qcom-geni.ko swapped, the keyboard is dead
> without this revert and works with it.
>
> Fixes: cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL")
> Reported-by: Birk Skyum <birk.skyum@pm.me>
(this looks funny because you're the author of the revert but
it's fine I suppose)
> Closes: https://lore.kernel.org/r/179173732257.29426.7905170638383807320@pm.me
> Link: https://lore.kernel.org/r/ae03e7a3-75f1-42df-b0e6-0e64358be647@oss.qualcomm.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Birk Skyum <birk.skyum@pm.me>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL"
2026-10-14 13:08 [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL" Birk Skyum
2026-10-14 13:17 ` Konrad Dybcio
@ 2026-10-14 22:33 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-10-14 22:33 UTC (permalink / raw)
To: Birk Skyum, Andi Shyti, Viken Dadhaniya, Mukesh Kumar Savaliya
Cc: Sasha Levin, Konrad Dybcio, Thorsten Leemhuis, Daniel J Blueman,
Bjorn Andersson, Manikanta Mylavarapu, linux-i2c, linux-arm-msm,
linux-kernel, stable, regressions
On Wed, Oct 14, 2026 at 01:08:08PM +0000, Birk Skyum wrote:
> This reverts commit cb97bf3d4f91453b881acaf8e9f0cc47bb40b604.
Thanks for the report and the bisection. I've dropped the backport of
cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL")
from the pending 6.6, 6.1, 5.15 and 5.10 queues.
7.2.y and 6.18.y will pick up the mainline revert or fix once it lands in
Linus's tree.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-14 22:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14 13:08 [PATCH] Revert "i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL" Birk Skyum
2026-10-14 13:17 ` Konrad Dybcio
2026-10-14 22:33 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®