• Arvid Norlander's avatar
    platform/x86: Battery charge mode in toshiba_acpi (internals) · 89655fbb
    Arvid Norlander authored
    This commit adds the internal functions to control the Toshiba laptop.
    
    Unlike for example ThinkPads where this control is granular here it is
    just off/on. When off it charges to 100%. When on it charges to about 80%.
    
    Controlling this setting is done via HCI register 0x00ba. Setting to value
    1 will result in limiting the charing to 80% of the battery capacity,
    while setting it to 0 will allow charging to 100%.
    
    Reading the current state is a bit weird, and needs a 1 set in the last
    position of the query for whatever reason. In addition, the read may
    return 0x8d20 (Data not available) rarely, so a retry mechanism is needed.
    
    According to the Windows program used to control the feature the setting
    will not take effect until the battery has been discharged to around 50%.
    However, in my testing it takes effect as soon as the charge drops below
    80%. On Windows Toshiba branded this feature as "Eco charging".
    Signed-off-by: default avatarArvid Norlander <lkml@vorpal.se>
    Link: https://lore.kernel.org/r/20220902180037.1728546-2-lkml@vorpal.seReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    89655fbb
toshiba_acpi.c 84.5 KB