Pablo Stebler has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after the first command ......................................................................
ec/hp/kbc1126: Wait a longer time after the first command
This prevents the fans from running at full speed on ProBook 6360b and EliteBook 8470p (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb --- M src/ec/hp/kbc1126/ec.c 1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/1
diff --git a/src/ec/hp/kbc1126/ec.c b/src/ec/hp/kbc1126/ec.c index 5c11fed..ff47649 100644 --- a/src/ec/hp/kbc1126/ec.c +++ b/src/ec/hp/kbc1126/ec.c @@ -115,6 +115,13 @@ struct ec_hp_kbc1126_config *conf = dev->chip_info; ec_setports(conf->ec_data_port, conf->ec_cmd_port); kbc1126_kbdled(conf->ec_ctrl_reg, 0); + + /* The EC needs additional time to process the first command on a cold + boot. */ + int timeout = 0x17ff; + while ((inb(conf->ec_cmd_port) & KBD_IBF) && --timeout) + udelay(10); + if (kbc1126_thermalinit(conf->ec_ctrl_reg, conf->ec_fan_ctrl_value) < 0) printk(BIOS_DEBUG, "KBC1126: error when initializing fan control.\n"); }
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#2).
Change subject: ec/hp/kbc1126: Wait a longer time after the first command ......................................................................
ec/hp/kbc1126: Wait a longer time after the first command
This prevents the fans from running at full speed on ProBook 6360b and EliteBook 8470p (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after the first command ......................................................................
Patch Set 2:
(3 comments)
https://review.coreboot.org/c/coreboot/+/44750/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/2//COMMIT_MSG@10 PS2, Line 10: EliteBook 8470p (because the fan control command was not sent). How did you determine the timeout value? Trail and error?
https://review.coreboot.org/c/coreboot/+/44750/2/src/ec/hp/kbc1126/ec.c File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/2/src/ec/hp/kbc1126/ec.c@121 PS2, Line 121: int timeout = 0x17ff; Please add a comment how many ms this is.
https://review.coreboot.org/c/coreboot/+/44750/2/src/ec/hp/kbc1126/ec.c@123 PS2, Line 123: udelay(10); Please use the stopwatch framework, and print he actual time spent.
Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after the first command ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44750/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/2//COMMIT_MSG@10 PS2, Line 10: EliteBook 8470p (because the fan control command was not sent).
How did you determine the timeout value? Trail and error?
I tried a few times and took twice the maximum time I got, rounded up to some power of two.
Iru Cai (vimacs) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after the first command ......................................................................
Patch Set 2:
From my testing on my ProBook 640 G1 (which is using an MEC1322 EC but with the same EC interface), I suggest setting a bigger timeout (I'd like to change it from 0x7ff to 0x10000) in send_kbd_command() and send_kbd_data(), because it can still fail after the first command.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#3).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This prevents the fans from running at full speed on ProBook 6360b and EliteBook 8470p (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/3
Iru Cai (vimacs) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 3: Code-Review+1
Attention is currently required from: Paul Menzel, Pablo Stebler. Iru Cai (vimacs) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 4:
(3 comments)
Patchset:
PS4: The latest patch set only changes two constant values and don't have these code. I think we can merge this first.
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/7c42d76c_f521f3c6 PS2, Line 121: int timeout = 0x17ff;
Please add a comment how many ms this is.
Ack
https://review.coreboot.org/c/coreboot/+/44750/comment/33a87f2f_8de7c43c PS2, Line 123: udelay(10);
Please use the stopwatch framework, and print he actual time spent.
Ack
Attention is currently required from: Paul Menzel, Pablo Stebler, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 4: Code-Review+1
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/comment/02a2d2c4_0880bc88 PS4, Line 9: prevents fixes
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/61cf34dc_b5277a53 PS4, Line 27: timeout = 0x10000; The timeout is now 32 times larger, and about 655 ms. How long does it need to be?
Attention is currently required from: Paul Menzel, Pablo Stebler, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 4:
(1 comment)
Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/comment/da20e212_854eaf74 PS4, Line 9: from If using `fixes` then drop this `from` too
Attention is currently required from: Paul Menzel, Pablo Stebler, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 4:
(1 comment)
Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/comment/477e857f_d17528dd PS4, Line 9: from
If using `fixes` then drop this `from` too
Or even replace it with `always`
(these are style suggestions)
Attention is currently required from: Paul Menzel, Pablo Stebler, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#5).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan running at full speed on ProBook 6360b, EliteBook 8470p and ProBook 640 G1 (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/5
Attention is currently required from: Paul Menzel, Pablo Stebler, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#6).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b, EliteBook 8470p and ProBook 640 G1 (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/6
Attention is currently required from: Paul Menzel, Angel Pons, Iru Cai (vimacs). Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 6:
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/44750/comment/1bef682c_442c99c0 PS4, Line 9: prevents
fixes
Done
https://review.coreboot.org/c/coreboot/+/44750/comment/dcaa1d35_03ee39de PS4, Line 9: from
Or even replace it with `always` […]
Done
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 6: Code-Review+1
(1 comment)
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/53767c62_e746ac80 PS4, Line 27: timeout = 0x10000;
The timeout is now 32 times larger, and about 655 ms. […]
After chatting on IRC, I wonder if making this a Kconfig option would make more sense. It would be useful to document that different laptops with different ECs need different timeouts.
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#7).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b and EliteBook 8470p, because the fan control command was not sent.
The timeout has been made a Kconfig option to allow evenhigher values for other boards such as the ProBook 640 G1 (not merged yet), and as a way to document the needed timeout.
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/Kconfig M src/ec/hp/kbc1126/ec.c 2 files changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/7
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#8).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b and EliteBook 8470p, because the fan control command was not sent.
The timeout has been made a Kconfig option to allow even higher values for other boards such as the ProBook 640 G1 (not merged yet), and as a way to document the needed timeout.
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/Kconfig M src/ec/hp/kbc1126/ec.c 2 files changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/8
Attention is currently required from: Paul Menzel, Angel Pons, Iru Cai (vimacs). Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 8:
(1 comment)
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/09d39b5a_06a91085 PS4, Line 27: timeout = 0x10000;
After chatting on IRC, I wonder if making this a Kconfig option would make more sense. […]
Done
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 8: Code-Review+2
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 8:
(2 comments)
Patchset:
PS8: I think a Kconfig is overkill here. The code calling the affected function doesn't look like it has a clue how to handle a timeout. Only if we know how to handle a timeout gracefully, it should be tight. If not and if the hardware (or other firmware component) is known to stall sometimes, it should be a trade-off between function and useability: Not too short of course, but not too long either so it wouldn't be noticed. However, if hardware (or the other firmware component) is know to always finish and we lose something by timing out early, the timeout should be high, really high. Even if we set it to 10s it wouldn't matter if it only takes >100ms once in a decade.
File src/ec/hp/kbc1126/Kconfig:
https://review.coreboot.org/c/coreboot/+/44750/comment/8045367e_70349512 PS8, Line 14: int "Maximum waiting time in ms after sending a command to the EC" Why does this need a prompt? Generally, those encourage downstream solutions, e.g. somebody writes a guide ("Set his to ...") instead of fixing coreboot.
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 8: Code-Review+1
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#9).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b, EliteBook 8470p and ProBook 640 G1 (because the fan control command was not sent).
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/9
Attention is currently required from: Nico Huber, Paul Menzel, Iru Cai (vimacs). Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 9:
(1 comment)
File src/ec/hp/kbc1126/Kconfig:
https://review.coreboot.org/c/coreboot/+/44750/comment/b1bb66a4_65506a4a PS8, Line 14: int "Maximum waiting time in ms after sending a command to the EC"
Why does this need a prompt? Generally, those encourage downstream solutions, […]
Done
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9: So this is a case where we (usually) never have to time out?
Attention is currently required from: Nico Huber, Paul Menzel, Iru Cai (vimacs). Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9:
So this is a case where we (usually) never have to time out?
Indeed, since timing out will break EC-controlled functions
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 9:
(2 comments)
Patchset:
PS9: Sorry for the confusion, I did not mean to say "use 10s and ignore everything Angel said". 10s was just an exaggerated example to make a point :)
To rephrase, I think there are three sorts of timeouts.
a) when we know how to handle it, b) when we don't know how to handle it and hardware may stall indefinitely, and c) when we don't know how to handle it and we have never seen hardware stalling indefinitely.
If we assume c) (we can be sure for your device but for earlier ports, we'll assume that), that assumption should be documented in the commit message.
I don't know how long your hardware takes. If it's in the order of magnitude of 100ms, maybe just use 1s. That should be enough to make people look into the log what is taking so long, without causing much pain.
Also, please mention the times you observed in the commit message (maybe along with your EC firmware version, which probably matters more than the hardware).
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/a808e99c_62d9750b PS9, Line 27: 0x100000 Please use decimal numbers for times.
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Hello build bot (Jenkins), Angel Pons, Iru Cai (vimacs),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44750
to look at the new patch set (#10).
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b, EliteBook 8470p and ProBook 640 G1 (because the fan control command was not sent).
On the ProBook 6360b, the EC needs about 30 ms to process the first command on a cold boot, but other models such as the ProBook 640 G1 need more time.
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/44750/10
Attention is currently required from: Nico Huber, Paul Menzel, Iru Cai (vimacs). Pablo Stebler has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 10:
(1 comment)
File src/ec/hp/kbc1126/ec.c:
https://review.coreboot.org/c/coreboot/+/44750/comment/f7f4fa2a_3a1e2097 PS9, Line 27: 0x100000
Please use decimal numbers for times.
Done
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 10: Code-Review+1
Attention is currently required from: Pablo Stebler, Paul Menzel, Iru Cai (vimacs). Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
Patch Set 10: Code-Review+2
Nico Huber has submitted this change. ( https://review.coreboot.org/c/coreboot/+/44750 )
Change subject: ec/hp/kbc1126: Wait a longer time after sending ......................................................................
ec/hp/kbc1126: Wait a longer time after sending
This fixes the fan always running at full speed on ProBook 6360b, EliteBook 8470p and ProBook 640 G1 (because the fan control command was not sent).
On the ProBook 6360b, the EC needs about 30 ms to process the first command on a cold boot, but other models such as the ProBook 640 G1 need more time.
Change-Id: I8623af75c062d6aa69d4412e0627d426c69019fb Signed-off-by: Pablo Stebler pablo@stebler.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/44750 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M src/ec/hp/kbc1126/ec.c 1 file changed, 2 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/src/ec/hp/kbc1126/ec.c b/src/ec/hp/kbc1126/ec.c index 5c11fed..8035b94 100644 --- a/src/ec/hp/kbc1126/ec.c +++ b/src/ec/hp/kbc1126/ec.c @@ -24,7 +24,7 @@ { int timeout;
- timeout = 0x7ff; + timeout = 100000; /* 1 second */ while ((inb(ec_cmd_port) & KBD_IBF) && --timeout) { udelay(10); if ((timeout & 0xff) == 0) @@ -44,7 +44,7 @@ { int timeout;
- timeout = 0x7ff; + timeout = 100000; /* 1 second */ while ((inb(ec_cmd_port) & KBD_IBF) && --timeout) { /* wait for IBF = 0 */ udelay(10); if ((timeout & 0xff) == 0)