Patch works great on a T470s. Stepping is smooth now. No ill effects.

Thanks,

Tracey

On Sun, Oct 13, 2019 at 09:37:53PM -0500, joshua stein wrote:
> Newer ThinkPads have ACPI goo to allow acpivout to control screen 
> backlight, so don't take over ws_[gs]et_param from it.  This allows 
> for 100 levels of backlight control rather than the 10 or 15 that 
> are supported through acpithinkpad using its proprietary ACPI or 
> CMOS interfaces.
> 
> You can see the difference with and without this patch by doing:
> 
>     xbacklight -set 1 -steps 100
>     xbacklight -set 100 -steps 100
> 
> Apparently this will also be needed for newer AMD ThinkPads that use 
> radeondrm.
> 
> "Newer" here is being defined as anything not reporting version 1 
> (THINKPAD_HKEY_VERSION1) of the ThinkPad ACPI interface.
> 
> For responding to hardware brightness keys, you'll want to test with 
> the acpivout patch I posted since otherwise the keys will be 
> adjusting the backlight by 1% each time, and it may seem like it's 
> not doing anything.  That patch makes it properly adjust by 5% each 
> time (but you still get fine-grained changes through wsconsctl or 
> xbacklight).
> 
> 
> Index: sys/dev/acpi/acpithinkpad.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v
> retrieving revision 1.66
> diff -u -p -u -p -r1.66 acpithinkpad.c
> --- sys/dev/acpi/acpithinkpad.c       13 Oct 2019 10:56:31 -0000      1.66
> +++ sys/dev/acpi/acpithinkpad.c       14 Oct 2019 02:28:57 -0000
> @@ -320,8 +320,10 @@ thinkpad_attach(struct device *parent, s
>               wskbd_set_backlight = thinkpad_set_kbd_backlight;
>       }
>  
> -     if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "PBLG",
> -         0, NULL, &sc->sc_brightness) == 0) {
> +     /* On version 2 and newer, let *drm or acpivout control brightness */
> +     if (sc->sc_hkey_version == THINKPAD_HKEY_VERSION1 &&
> +         (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "PBLG",
> +         0, NULL, &sc->sc_brightness) == 0)) {
>               ws_get_param = thinkpad_get_param;
>               ws_set_param = thinkpad_set_param;
>       }

-- 

Tracey Emery

Reply via email to