i2c: qcom-geni: restore tSCL with 32MHz I2C fast-mode
Subsystems (5)
PATCH 1/1 i2c: qcom-geni: restore tSCL with 32MHz I2C fast-mode
Commit cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL") allowed GENI to use 32MHz clock. This changed I2C timing, making the Yoga Slim 7x keyboard (ITE 048D:8987) unusable on all boots, and touchpad unusable on some boots, resulting in:
i2c_hid_of 1-003a: unexpected HID descriptor bcdVersion (0x0000) i2c_hid_of 1-002c: failed to fetch HID descriptor: -110
With this change, t_high_cnt 3 and clk_div 4 gave a tSCL of 375ns versus the previous default of 521ns, however the I2C spec has a minimum tSCL of 600ns.
Restore tSCL to the spec with t_high_cnt 5 giving a 625ns tSCL, verified on Lenovo Yoga Slim 7x X1E-80100.
--- drivers/i2c/busses/i2c-qcom-geni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +1 -1
@@ -193,7 +193,7 @@ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = {/* source_clock = 32 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { {I2C_MAX_STANDARD_MODE_FREQ ,12 ,9 ,10 ,26 }, - {I2C_MAX_FAST_MODE_FREQ ,4 ,3 ,9 ,19 }, + {I2C_MAX_FAST_MODE_FREQ ,4 ,5 ,9 ,19 }, {I2C_MAX_FAST_MODE_PLUS_FREQ ,2 ,3 ,5 ,15 }, {} };
Signature · 1 line
2.53.0
Mukesh Savaliya
maintainerThanks Daniel !
Quoted 8 lines · Daniel J Blueman
Commit
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") allowed GENI to use 32MHz clock. This changed I2C timing, making the Yoga Slim 7x keyboard (ITE 048D:8987) unusable on all boots, and touchpad unusable on some boots, resulting in:
i2c_hid_of1-003a: unexpected HID descriptor bcdVersion (0x0000)i2c_hid_of1-002c: failed to fetch HID descriptor: -110
Quoted 7 lines
With this change,
t_high_cnt3 andclk_div4 gave a tSCL of 375ns versus the previous default of 521ns, however the I2C spec has a minimum tSCL of 600ns.Restore tSCL to the spec with
t_high_cnt5 giving a 625ns tSCL, verified on Lenovo Yoga Slim 7x X1E-80100.
There might be a final count which i should get and update back.
Since this fix is working though not suggested per hardware guidance, should we consider as temporary fix and move ahead to prevent failing usecase ?
Any thought @andi ?
Quoted 12 lines
Fixes 506bb2ab0075 ("i2c: qcom-geni: Support systems with 32MHz serial engine clock")Cc <[email protected]>Signed-off-by Daniel J Blueman <[email protected]>--- drivers/i2c/busses/i2c-qcom-geni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-qcom-geni.c +0
-0
drivers/i2c/busses/i2c-qcom-geni.c static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = { · line 196
Quoted 5 lines
drivers/i2c/busses/i2c-qcom-geni.c +1
-1@@ -193,7 +193,7 @@ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = {/* source_clock = 32 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { {I2C_MAX_STANDARD_MODE_FREQ ,12 ,9 ,10 ,26 }, - {I2C_MAX_FAST_MODE_FREQ ,4 ,3 ,9 ,19 }, + {I2C_MAX_FAST_MODE_FREQ ,4 ,5 ,9 ,19 },
Exact change to come from hardware experts, till that i am hoping this revert should be fine.
Quoted 3 lines
drivers/i2c/busses/i2c-qcom-geni.c +0
-0{ I2C_MAX_FAST_MODE_PLUS_FREQ, 2, 3, 5, 15 }, {} };
Quoted 16 lines · Mukesh Savaliya
Thanks Daniel !
Quoted 12 lines · Daniel J Blueman
Commit
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") allowed GENI to use 32MHz clock. This changed I2C timing, making the Yoga Slim 7x keyboard (ITE 048D:8987) unusable on all boots, and touchpad unusable on some boots, resulting in:
i2c_hid_of1-003a: unexpected HID descriptor bcdVersion (0x0000)i2c_hid_of1-002c: failed to fetch HID descriptor: -110With this change,
t_high_cnt3 andclk_div4 gave a tSCL of 375ns versus the previous default of 521ns, however the I2C spec has a minimum tSCL of 600ns.
Quoted 8 lines
Quoted 3 lines
Restore tSCL to the spec with
t_high_cnt5 giving a 625ns tSCL, verified on Lenovo Yoga Slim 7x X1E-80100.There might be a final count which i should get and update back. Since this fix is working though not suggested per hardware guidance, should we consider as temporary fix and move ahead to prevent failing usecase ?
If you can get the final values into a patch for the next -rc instead of my fix here, that would be the minimal path for everyone. You or the hardware team can cross-check against the I2C standard as I did [1, p44].
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
Thanks,
Dan
-- [1] https://www.nxp.com/docs/en/user-guide/UM10204.pdf
Signature · 1 line
Daniel J Blueman
Mukesh Savaliya
maintainerThanks Dan !
Quoted 27 lines · Daniel J Blueman
Quoted 16 lines · Mukesh Savaliya
Thanks Daniel !
Quoted 12 lines · Daniel J Blueman
Commit
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") allowed GENI to use 32MHz clock. This changed I2C timing, making the Yoga Slim 7x keyboard (ITE 048D:8987) unusable on all boots, and touchpad unusable on some boots, resulting in:i2c_hid_of 1-003a: unexpected HID descriptor bcdVersion (0x0000) i2c_hid_of 1-002c: failed to fetch HID descriptor: -110With this change,
t_high_cnt3 andclk_div4 gave a tSCL of 375ns versus the previous default of 521ns, however the I2C spec has a minimum tSCL of 600ns.Quoted 8 lines
Quoted 3 lines
Restore tSCL to the spec with
t_high_cnt5 giving a 625ns tSCL, verified on Lenovo Yoga Slim 7x X1E-80100.There might be a final count which i should get and update back. Since this fix is working though not suggested per hardware guidance, should we consider as temporary fix and move ahead to prevent failing usecase ?
Quoted 5 lines
If you can get the final values into a patch for the next -rc instead of my fix here, that would be the minimal path for everyone. You or the hardware team can cross-check against the I2C standard as I did [1, p44].
Yes, Agree Dan ! That would be quick and fast way.
I am in discussion to get more details on correct configuration meeting the specs.
Quoted 4 lines
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
Agree, after having last change thought that would meet the spec.
Quoted 4 lines
Thanks,
Dan
Sasha Levin
maintainerQuoted 4 lines · Daniel J Blueman
Quoted 3 lines
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
For stable: cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL") has already shipped in 7.2.9, 6.18.55 and 6.12.112, and is queued for 6.6, 6.1, 5.15 and 5.10.
The 32 MHz clock map (506bb2ab0075, v6.13+) does not exist in 6.12.y and older. The backports there pick only the 19.2 MHz entry, so the Yoga Slim 7x / X1E80100 timing regression cannot occur on 6.12.y or older, and I'm keeping the 6.6 and older queues as they are.
7.2.y and 6.18.y do have the 32 MHz table and are affected. Once the fix lands in mainline, I'll pick it up for 7.2 and 6.18.
Signature · 2 lines
Thanks, Sasha
Quoted 9 lines · Sasha Levin
Quoted 4 lines · Daniel J Blueman
Quoted 3 lines
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
For stable:
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") has already shipped in 7.2.9, 6.18.55 and 6.12.112, and is queued for 6.6, 6.1, 5.15 and 5.10.
Quoted 7 lines
The 32 MHz clock map (
506bb2ab0075, v6.13+) does not exist in 6.12.y and older. The backports there pick only the 19.2 MHz entry, so the Yoga Slim 7x / X1E80100 timing regression cannot occur on 6.12.y or older, and I'm keeping the 6.6 and older queues as they are.7.2.y and 6.18.y do have the 32 MHz table and are affected. Once the fix lands in mainline, I'll pick it up for 7.2 and 6.18.
@Andi, @viken, and/or @Daniel:
Is the patch at the start of the thread or some improved version heading to mainline meanwhile? What Sasha wrote above is one reason why that would be good rather sooner than latter; another is a regression report[1] from Birk (now CCed) wo ran into the problem with mainline -- so it would be good to fix this before 7.3 is released, too.
Or is a revert the better option to achieve that?
Ciao, Thorsten
Mukesh Savaliya
maintainerHi Thorsten, Thanks !
Quoted 20 lines · Thorsten Leemhuis
Quoted 9 lines · Sasha Levin
Quoted 4 lines · Daniel J Blueman
Quoted 3 lines
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
For stable:
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") has already shipped in 7.2.9, 6.18.55 and 6.12.112, and is queued for 6.6, 6.1, 5.15 and 5.10.Quoted 7 lines
The 32 MHz clock map (
506bb2ab0075, v6.13+) does not exist in 6.12.y and older. The backports there pick only the 19.2 MHz entry, so the Yoga Slim 7x / X1E80100 timing regression cannot occur on 6.12.y or older, and I'm keeping the 6.6 and older queues as they are.7.2.y and 6.18.y do have the 32 MHz table and are affected. Once the fix lands in mainline, I'll pick it up for 7.2 and 6.18.
@Andi, @viken, and/or @Daniel:
Quoted 8 lines
Is the patch at the start of the thread or some improved version heading to mainline meanwhile? What Sasha wrote above is one reason why that would be good rather sooner than latter; another is a regression report[1] from Birk (now CCed) wo ran into the problem with mainline -- so it would be good to fix this before 7.3 is released, too.
Or is a revert the better option to achieve that?
This is in active discussion with hardware experts, but taking time to get specs compliant configuration values while it's being tested.
I see 7.3 release on 25th, so what max time we can have before reverting ?
I am trying to get values asap.
Quoted 4 lines
Ciao, Thorsten
Quoted 31 lines · Mukesh Savaliya
Quoted 30 lines · Thorsten Leemhuis
Quoted 17 lines · Sasha Levin
Quoted 4 lines · Daniel J Blueman
Quoted 3 lines
I would revert the original patch if there is hardware that uses the I2C 1MHz fast-mode, since the current timings aren't to spec, but also weren't before.
For stable:
cb97bf3d4f91("i2c: qcom-geni: Fix hardcoded clock index inSE_GENI_CLK_SEL") has already shipped in 7.2.9, 6.18.55 and 6.12.112, and is
queued for 6.6, 6.1, 5.15 and 5.10.The 32 MHz clock map (
506bb2ab0075, v6.13+) does not exist in 6.12.y and older.
The backports there pick only the 19.2 MHz entry, so the Yoga Slim 7x / X1E80100 timing regression cannot occur on 6.12.y or older, and I'm keeping the
6.6 and older queues as they are.Quoted 3 lines
7.2.y and 6.18.y do have the 32 MHz table and are affected. Once the fix lands
in mainline, I'll pick it up for 7.2 and 6.18.@Andi, @viken, and/or @Daniel:
Is the patch at the start of the thread or some improved version heading to mainline meanwhile? What Sasha wrote above is one reason why that would be good rather sooner than latter; another is a regression report[1] from Birk (now CCed) wo ran into the problem with mainline -- so it would be good to fix this before 7.3 is released, too.
Quoted 4 lines
Quoted 1 line
Or is a revert the better option to achieve that?
This is in active discussion with hardware experts, but taking time to get specs compliant configuration values while it's being tested.
That's how it is sometimes, but then it's likely best to go back to the know old state by reverting the culprit -- or is that a bad idea for some reason?
Quoted 1 line
I see 7.3 release on 25th, so what max time we can have before reverting ?
Not sure where you get this from, but 7.3 most likely will be released this Sunday, so four days from now. Given that this affects stable is should ideally be fixed quickly anyway. And the issue is know for a while, so it normally should be fixed already, as that's what Linus wants:
""But if it's a regression with a known commit that caused it, I think the rule of thumb [to fix it] should generally be "within a week", preferably before the next rc."""
Ciao, Thorsten
Quoted 3 lines · Thorsten Leemhuis
That's how it is sometimes, but then it's likely best to go back to the know old state by reverting the culprit -- or is that a bad idea for some reason?
Hi Thorsten,
One correction first. My report was from 7.2.9, and I had not booted mainline when I sent it. I have now, on the Yoga Slim 7x with v7.3-rc7 (a distribution config, no patches), and the keyboard and touchpad are dead at the disk passphrase prompt.
geni_i2c b80000.i2c: Bus proto err, noisy/unexpected start/stop i2c_hid_of 1-003a: failed to fetch HID descriptor: -5
Same kernel with only i2c-qcom-geni.ko swapped, one boot each.
v7.3-rc7 keyboard dead v7.3-rc7, cb97bf3d4f91 reverted keyboard works v7.3-rc7 with Daniel's patch keyboard works
The touchpad binds whenever the keyboard does. The I2C serial engine clocks read 32 MHz on plain rc7 and with Daniel's patch, and 19.2 MHz with the revert. In all three boots the touchscreen and the three PS8830 retimers on the other four buses work, and only b80000 fails.
Thanks,
Birk
Quoted 17 lines · Birk Skyum
Quoted 3 lines · Thorsten Leemhuis
That's how it is sometimes, but then it's likely best to go back to the know old state by reverting the culprit -- or is that a bad idea for some reason?
Hi Thorsten,
One correction first. My report was from 7.2.9, and I had not booted mainline when I sent it. I have now, on the Yoga Slim 7x with v7.3-rc7 (a distribution config, no patches), and the keyboard and touchpad are dead at the disk passphrase prompt.
geni_i2cb80000.i2c: Bus proto err, noisy/unexpected start/stopi2c_hid_of1-003a: failed to fetch HID descriptor: -5Same kernel with only i2c-qcom-geni.ko swapped, one boot each.
Quoted 8 lines
v7.3-rc7 keyboard dead v7.3-rc7, cb97bf3d4f91 reverted keyboard works v7.3-rc7 with Daniel's patch keyboard worksThe touchpad binds whenever the keyboard does. The I2C serial engine clocks read 32 MHz on plain rc7 and with Daniel's patch, and 19.2 MHz with the revert. In all three boots the touchscreen and the three PS8830 retimers on the other four buses work, and only b80000 fails.
Since the discussion still hasn't settled, please go ahead with a last-minute revert for 7.3 so that we don't get an utterly broken release.
Konrad
Sasha Levin
maintainerQuoted 3 lines · Daniel J Blueman
Quoted 2 lines
If you can get the final values into a patch for the next -rc instead of my fix here, that would be the minimal path for everyone.
Queued the mainline fix, "i2c: qcom-geni: Restore the source-clock selection policy", for 7.2 and 6.18, thanks.
Signature · 2 lines
Thanks, Sasha