All of lore.kernel.org
 help / color / mirror / Atom feed
* thinkpad_acpi: Battery quirk for Thinkpad 11e (4th gen)
@ 2019-02-24 14:58 Ken Milmore
  2019-02-26 16:04 ` Jouke Witteveen
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Milmore @ 2019-02-24 14:58 UTC (permalink / raw)
  To: linux-kernel, Jouke Witteveen, Henrique de Moraes Holschuh

I recently acquired a Thinkpad 11e 4th gen (Type 20HV, BIOS version
R0KET36W, EC program R0KHT18W). I've put Debian Buster on it, with the
4.19 kernel, which gives the following errors in dmesg:

  ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as error
  thinkpad_acpi: Error probing battery 2
  battery: error in extension, unloading: ThinkPad Battery Extension

I wanted to try using the battery charging thresholds, so I added an
entry to the battery quirk table in thinkpad_acpi.c (patch given below),
which allows the battery extension to load successfully.

Setting charge thresholds seems to basically work, but one thing worth
mentioning is that charge_start_threshold and charge_stop_threshold
appear to be tied together; AFAICT setting one also sets the other to
the same value. The battery does seem to start charging whenever it
falls below the common threshold, I have it set at 80% and it has kept
the battery floating around 79%.

Battery status is reported correctly when charging or discharging; when
charging has been suppressed because the battery level is above the
threshold, then the status is reported as "Unknown".

diff -uprN linux-source-4.19~/drivers/platform/x86/thinkpad_acpi.c linux-source-4.19/drivers/platform/x86/thinkpad_acpi.c
--- linux-source-4.19~/drivers/platform/x86/thinkpad_acpi.c	2019-02-24 13:27:29.341331227 +0000
+++ linux-source-4.19/drivers/platform/x86/thinkpad_acpi.c	2019-02-24 13:09:28.710982438 +0000
@@ -9619,6 +9619,7 @@ static const struct tpacpi_quirk battery
 	TPACPI_Q_LNV3('R', '0', 'B', true), /* Thinkpad 11e gen 3 */
 	TPACPI_Q_LNV3('R', '0', 'C', true), /* Thinkpad 13 */
 	TPACPI_Q_LNV3('R', '0', 'J', true), /* Thinkpad 13 gen 2 */
+	TPACPI_Q_LNV3('R', '0', 'K', true), /* Thinkpad 11e gen 4 */
 };
 
 static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: thinkpad_acpi: Battery quirk for Thinkpad 11e (4th gen)
  2019-02-24 14:58 thinkpad_acpi: Battery quirk for Thinkpad 11e (4th gen) Ken Milmore
@ 2019-02-26 16:04 ` Jouke Witteveen
  0 siblings, 0 replies; 2+ messages in thread
From: Jouke Witteveen @ 2019-02-26 16:04 UTC (permalink / raw)
  To: Ken Milmore; +Cc: linux-kernel, Henrique de Moraes Holschuh

On Sun, Feb 24, 2019 at 3:58 PM Ken Milmore <ken.milmore@gmail.com> wrote:
> Setting charge thresholds seems to basically work, but one thing worth
> mentioning is that charge_start_threshold and charge_stop_threshold
> appear to be tied together; AFAICT setting one also sets the other to
> the same value. The battery does seem to start charging whenever it
> falls below the common threshold, I have it set at 80% and it has kept
> the battery floating around 79%.

I observe the same behavior on my Thinkpad 13. Maybe there is a bug in
the driver, but it could also be a bug in the firmware.

> diff -uprN linux-source-4.19~/drivers/platform/x86/thinkpad_acpi.c linux-source-4.19/drivers/platform/x86/thinkpad_acpi.c
> --- linux-source-4.19~/drivers/platform/x86/thinkpad_acpi.c     2019-02-24 13:27:29.341331227 +0000
> +++ linux-source-4.19/drivers/platform/x86/thinkpad_acpi.c      2019-02-24 13:09:28.710982438 +0000
> @@ -9619,6 +9619,7 @@ static const struct tpacpi_quirk battery
>         TPACPI_Q_LNV3('R', '0', 'B', true), /* Thinkpad 11e gen 3 */
>         TPACPI_Q_LNV3('R', '0', 'C', true), /* Thinkpad 13 */
>         TPACPI_Q_LNV3('R', '0', 'J', true), /* Thinkpad 13 gen 2 */
> +       TPACPI_Q_LNV3('R', '0', 'K', true), /* Thinkpad 11e gen 4 */

Personally, I would add the line below the 11e gen 3.

>  };
>
>  static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-26 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-24 14:58 thinkpad_acpi: Battery quirk for Thinkpad 11e (4th gen) Ken Milmore
2019-02-26 16:04 ` Jouke Witteveen

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.