summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/x86-android-tablets
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-02-23 00:42:26 +0300
committerHans de Goede <hdegoede@redhat.com>2023-03-07 14:08:31 +0300
commit607fbac0fccba506b4f9e47994504121db776956 (patch)
treea1117086f32ec9d6d82633db417a13ed9e2824e2 /drivers/platform/x86/x86-android-tablets
parent9b1d2662b8c586eb10cb939c7ae2c25bb36d2b61 (diff)
downloadlinux-607fbac0fccba506b4f9e47994504121db776956.tar.xz
platform/x86: x86-android-tablets: Add backlight ctrl for Lenovo Yoga Tab 3 Pro YT3-X90F
The YT3 uses an TI LP8557 LED backlight controller, the LP8557's PWM input is connected to a PWM output coming from the LCD panel's controller. The Android kernel has a hack in the i915 driver to write the non-standard DSI reg 0x51 with the desired level to set the duty-cycle of the LCD's PWM. To avoid having to have a similar hack in the mainline kernel program instantiate an i2c-client for the LP8557 with platform-data to have the LP8557 to directly set the level (ignoring its PWM input), this allows backlight brightness control through a backlight device registered by the lp855x_bl driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230301092331.7038-13-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86/x86-android-tablets')
-rw-r--r--drivers/platform/x86/x86-android-tablets/lenovo.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 4ba4b1e8c7d0..e9eae09784ef 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -346,6 +346,20 @@ static const struct software_node lenovo_yt3_hideep_ts_node = {
.properties = lenovo_yt3_hideep_ts_props,
};
+/*
+ * The YT3 uses an TI LP8557 LED backlight controller, the LP8557's PWM input is
+ * connected to a PWM output coming from the LCD panel's controller. The Android
+ * kernel has a hack in the i915 driver to write the non-standard DSI reg 0x51
+ * with the desired level to set the duty-cycle of the LCD's PWM output.
+ *
+ * To avoid having to have a similar hack in the mainline kernel program the
+ * LP8557 to directly set the level and use the lp855x_bl driver for control.
+ */
+static struct lp855x_platform_data lenovo_yt3_lp8557_pdata = {
+ .device_control = 0x86,
+ .initial_brightness = 128,
+};
+
static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[] __initconst = {
{
/* bq27500 fuel-gauge for the flat lipo battery behind the screen */
@@ -397,6 +411,15 @@ static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[] __initconst = {
.trigger = ACPI_LEVEL_SENSITIVE,
.polarity = ACPI_ACTIVE_LOW,
},
+ }, {
+ /* LP8557 Backlight controller */
+ .board_info = {
+ .type = "lp8557",
+ .addr = 0x2c,
+ .dev_name = "lp8557",
+ .platform_data = &lenovo_yt3_lp8557_pdata,
+ },
+ .adapter_path = "\\_SB_.PCI0.I2C1",
}
};