platform/x86: x86-android-tablets: Use LP8557 in direct mode on both the Yoga 830...
authorHans de Goede <hdegoede@redhat.com>
Sat, 1 Apr 2023 15:07:35 +0000 (17:07 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 6 Apr 2023 10:59:25 +0000 (12:59 +0200)
commit01862d01cb36ad36233939c07d6438a2f83dcd46
tree3d6fbbaef12cf427741fbaa249a41e6effc4c058
parent3e9adae9336f1d530f342e5d5fbfc7d349f25b95
platform/x86: x86-android-tablets: Use LP8557 in direct mode on both the Yoga 830 and the 1050

Both the Lenovo Yoga Tablet 2 830 and 1050 models use an TI LP8557 LED
backlight controller. On the 1050 the LP8557's PWM input is connected to
the PMIC's PWM output and everything works fine with the defaults
programmed into the LP8557 by the BIOS.

But on the 830 the LP8557's PWM input is connected to a PWM output coming
from the LCD panel's controller. The Android code has a hack in the i915
driver to write the non-standard DSI reg 0x9f with the desired backlight
level to set the duty-cycle of the LCD's PWM output.

To avoid having to have a similar hack in the mainline kernel the LP8557
entry in lenovo_yoga_tab2_830_1050_i2c_clients instead just programs the
LP8557 to directly set the level, ignoring the PWM input.

So far we have only been instantiating the LP8557 i2c_client for direct
backlight control on the 830 model. But we want hide/disable the
intel_backlight interface on the 830 model to avoid having 2 backlight
interfaces for the same LCD panel.

And the 830 and 1050 share the same DMI strings. So this will hide the
intel_backlight interface on the 1050 model too.

To avoid this causing problems make the backlight handling consistent
between the 2 models and always directly use the LP8557.

This also simplifies the code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230401150737.597417-1-hdegoede@redhat.com
drivers/platform/x86/x86-android-tablets/lenovo.c
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h