Skip to contentSkip to conversation

platform/x86: x86-android-tablets: Use LP8557 in direct mode on both the Yoga 830 and the 1050

PATCH In review Hans de Goede 2 participants 5 messages Apr 1, 2023 – Apr 6, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 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.

---
 .../platform/x86/x86-android-tablets/lenovo.c | 29 ++++---------------
 .../x86-android-tablets/x86-android-tablets.h |  3 +-
 2 files changed, 7 insertions(+), 25 deletions(-)
drivers/platform/x86/x86-android-tablets/lenovo.c +6 -23
index 0baad9970820..d9d6dccc53c8 100644
@@ -162,9 +162,9 @@ static struct gpiod_lookup_table * const lenovo_yoga_tab2_830_1050_gpios[] = {
 static int __init lenovo_yoga_tab2_830_1050_init(void);
 static void lenovo_yoga_tab2_830_1050_exit(void);
 
-struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initdata = {
+const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
 	.i2c_client_info = lenovo_yoga_tab2_830_1050_i2c_clients,
-	/* i2c_client_count gets set by lenovo_yoga_tab2_830_1050_init() */
+	.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients),
 	.pdev_info = int3496_pdevs,
 	.pdev_count = 1,
 	.gpio_button = &lenovo_yoga_tab2_830_1050_lid,
@@ -177,23 +177,10 @@ struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initdata = {
 
 /*
  * The Lenovo Yoga Tablet 2 830 and 1050 (8" vs 10") versions use the same
- * mainboard, but they need some different treatment related to the display:
- * 1. The 830 uses a portrait LCD panel with a landscape touchscreen, requiring
- *    the touchscreen driver to adjust the touch-coords to match the LCD.
- * 2. Both 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. This means that
- *    the LP8557 i2c_client should only be instantiated on the 830.
+ * mainboard, but the 830 uses a portrait LCD panel with a landscape touchscreen,
+ * requiring the touchscreen driver to adjust the touch-coords to match the LCD.
  */
-static int __init lenovo_yoga_tab2_830_1050_init_display(void)
+static int __init lenovo_yoga_tab2_830_1050_init_touchscreen(void)
 {
 	struct gpio_desc *gpiod;
 	int ret;
@@ -206,14 +193,10 @@ static int __init lenovo_yoga_tab2_830_1050_init_display(void)
 	ret = gpiod_get_value_cansleep(gpiod);
 	if (ret) {
 		pr_info("detected Lenovo Yoga Tablet 2 1050F/L\n");
-		lenovo_yoga_tab2_830_1050_info.i2c_client_count =
-			ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients) - 1;
 	} else {
 		pr_info("detected Lenovo Yoga Tablet 2 830F/L\n");
 		lenovo_yoga_tab2_830_1050_rmi_pdata.sensor_pdata.axis_align.swap_axes = true;
 		lenovo_yoga_tab2_830_1050_rmi_pdata.sensor_pdata.axis_align.flip_y = true;
-		lenovo_yoga_tab2_830_1050_info.i2c_client_count =
-			ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients);
 	}
 
 	return 0;
@@ -281,7 +264,7 @@ static int __init lenovo_yoga_tab2_830_1050_init(void)
 {
 	int ret;
 
-	ret = lenovo_yoga_tab2_830_1050_init_display();
+	ret = lenovo_yoga_tab2_830_1050_init_touchscreen();
 	if (ret)
 		return ret;
 
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -2
index cf8566b3fd9c..c2b490519324 100644
@@ -95,8 +95,7 @@ extern const struct x86_dev_info asus_tf103c_info;
 extern const struct x86_dev_info chuwi_hi8_info;
 extern const struct x86_dev_info czc_p10t;
 extern const struct x86_dev_info lenovo_yogabook_x91_info;
-/* Not const as this gets modified by its init callback */
-extern struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
+extern const struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
 extern const struct x86_dev_info lenovo_yt3_info;
 extern const struct x86_dev_info medion_lifetab_s10346_info;
 extern const struct x86_dev_info nextbook_ares8_info;
Signature · 1 line
2.39.1
#1 lore raw

PATCH 2/3 platform/x86: x86-android-tablets: Share lp855x_platform_data between different models

Various Lenovo models use a TI LP8557 LED backlight controller and the necessary platform_data is the same for the different models.

Currently there are 2 identical copies and the upcoming support for the Lenovo Yoga Book X90F/L would add a 3th identical copy.

Move to sharing the lp855x_platform_data between different models to avoid this duplication.

---
 .../platform/x86/x86-android-tablets/lenovo.c | 37 ++++++++-----------
 1 file changed, 16 insertions(+), 21 deletions(-)
drivers/platform/x86/x86-android-tablets/lenovo.c +16 -21
index d9d6dccc53c8..5d217cbbde30 100644
@@ -24,6 +24,20 @@
 #include "shared-psy-info.h"
 #include "x86-android-tablets.h"
 
+/*
+ * Various Lenovo models use a TI LP8557 LED backlight controller with its PWM
+ * input connected to a PWM output coming from the LCD panel's controller.
+ * The Android kernels have a hack in the i915 driver to write a non-standard
+ * panel specific DSI register 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_lp8557_pdata = {
+	.device_control = 0x86,
+	.initial_brightness = 128,
+};
+
 /* Lenovo Yoga Book X91F/L Windows tablet needs manual instantiation of the fg client */
 static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __initconst = {
 	{
@@ -72,11 +86,6 @@ static struct x86_gpio_button lenovo_yoga_tab2_830_1050_lid = {
 /* This gets filled by lenovo_yoga_tab2_830_1050_init() */
 static struct rmi_device_platform_data lenovo_yoga_tab2_830_1050_rmi_pdata = { };
 
-static struct lp855x_platform_data lenovo_yoga_tab2_830_1050_lp8557_pdata = {
-	.device_control = 0x86,
-	.initial_brightness = 128,
-};
-
 static const struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[] __initconst = {
 	{
 		/* bq24292i battery charger */
@@ -125,7 +134,7 @@ static const struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[]
 			.type = "lp8557",
 			.addr = 0x2c,
 			.dev_name = "lp8557",
-			.platform_data = &lenovo_yoga_tab2_830_1050_lp8557_pdata,
+			.platform_data = &lenovo_lp8557_pdata,
 		},
 		.adapter_path = "\\_SB_.I2C3",
 	},
@@ -343,20 +352,6 @@ 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 */
@@ -414,7 +409,7 @@ static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[] __initconst = {
 			.type = "lp8557",
 			.addr = 0x2c,
 			.dev_name = "lp8557",
-			.platform_data = &lenovo_yt3_lp8557_pdata,
+			.platform_data = &lenovo_lp8557_pdata,
 		},
 		.adapter_path = "\\_SB_.PCI0.I2C1",
 	}
Signature · 1 line
2.39.1
#2 lore raw

PATCH 3/3 platform/x86: x86-android-tablets: Add Lenovo Yoga Book X90F/L data

In reply to Hans de Goede

The Lenovo Yoga Book X90F/L is a x86 ACPI tablet which ships with Android x86 as factory OS. Its DSDT contains a bunch of I2C devices which are not actually there, causing various resource conflicts. Enumeration of these is skipped through the acpi_quirk_skip_i2c_client_enumeration().

Add support for manually instantiating the I2C + other devices which are actually present on this tablet by adding the necessary device info to the x86-android-tablets module.

---
 .../platform/x86/x86-android-tablets/dmi.c    |   9 ++
 .../platform/x86/x86-android-tablets/lenovo.c | 122 ++++++++++++++++++
 .../x86-android-tablets/x86-android-tablets.h |   1 +
 3 files changed, 132 insertions(+)
drivers/platform/x86/x86-android-tablets/dmi.c +9 -0
index 6ea47af1b480..23e640b7003d 100644
@@ -76,6 +76,15 @@ const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
 		},
 		.driver_data = (void *)&czc_p10t,
 	},
+	{
+		/* Lenovo Yoga Book X90F / X90L */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
+		},
+		.driver_data = (void *)&lenovo_yogabook_x90_info,
+	},
 	{
 		/* Lenovo Yoga Book X91F / X91L */
 		.matches = {
drivers/platform/x86/x86-android-tablets/lenovo.c +122 -0

128 lines not on this page · raw message

drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -0
index c2b490519324..b6802d75dbdd 100644
@@ -94,6 +94,7 @@ extern const struct x86_dev_info asus_me176c_info;
 extern const struct x86_dev_info asus_tf103c_info;
 extern const struct x86_dev_info chuwi_hi8_info;
 extern const struct x86_dev_info czc_p10t;
+extern const struct x86_dev_info lenovo_yogabook_x90_info;
 extern const struct x86_dev_info lenovo_yogabook_x91_info;
 extern const struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
 extern const struct x86_dev_info lenovo_yt3_info;
Signature · 1 line
2.39.1
Reviewed-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] platform/x86: x86-android-tablets: Add Lenovo Yoga Book X90F/L data

Quoted 42 lines · Hans de Goede

The Lenovo Yoga Book X90F/L is a x86 ACPI tablet which ships with Android x86 as factory OS. Its DSDT contains a bunch of I2C devices which are not actually there, causing various resource conflicts. Enumeration of these is skipped through the acpi_quirk_skip_i2c_client_enumeration().

Add support for manually instantiating the I2C + other devices which are actually present on this tablet by adding the necessary device info to the x86-android-tablets module.

---
 .../platform/x86/x86-android-tablets/dmi.c    |   9 ++
 .../platform/x86/x86-android-tablets/lenovo.c | 122 ++++++++++++++++++
 .../x86-android-tablets/x86-android-tablets.h |   1 +
 3 files changed, 132 insertions(+)
drivers/platform/x86/x86-android-tablets/dmi.c +9 -0
index 6ea47af1b480..23e640b7003d 100644
@@ -76,6 +76,15 @@ const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
                },
                .driver_data = (void *)&czc_p10t,
        },
+       {
+               /* Lenovo Yoga Book X90F / X90L */
+               .matches = {
+                       DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
+               },
+               .driver_data = (void *)&lenovo_yogabook_x90_info,
+       },
        {
                /* Lenovo Yoga Book X91F / X91L */
                .matches = {
drivers/platform/x86/x86-android-tablets/lenovo.c +0 -0
index 5d217cbbde30..d53928504c09 100644

drivers/platform/x86/x86-android-tablets/lenovo.c static struct lp855x_platform_data lenovo_lp8557_pdata = { · line 46

Quoted 9 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +6 -0
@@ -38,6 +38,128 @@ static struct lp855x_platform_data lenovo_lp8557_pdata = {
        .initial_brightness = 128,
 };
 
+/* Lenovo Yoga Book X90F / X90L's Android factory img has everything hardcoded */
+
+/*
+ * The HiDeep IST940E touchscreen comes up in HID mode and could alternatively
+ * be used in I2C-HID mode (I2C-HID descriptor reg 0x0020) if i2c-hid-of.c is
+ * modified to use generic (non of) device-properties and thought to deal with

non-OF

Quoted 16 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +16 -0
+ * the reset GPIO. "hideep,force-native-protocol" resets it to native mode.
+ */
+static const struct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
+       PROPERTY_ENTRY_U32("touchscreen-size-x", 1200),
+       PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
+       PROPERTY_ENTRY_U32("touchscreen-max-pressure", 16384),
+       PROPERTY_ENTRY_BOOL("hideep,force-native-protocol"),
+       { }
+};
+
+static const struct software_node lenovo_yb1_x90_hideep_ts_node = {
+       .properties = lenovo_yb1_x90_hideep_ts_props,
+};
+
+static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
+       {

drivers/platform/x86/x86-android-tablets/lenovo.c static struct lp855x_platform_data lenovo_lp8557_pdata = { · line 72

Quoted 10 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +10 -0
+               /* BQ27542 fuel-gauge */
+               .board_info = {
+                       .type = "bq27542",
+                       .addr = 0x55,
+                       .dev_name = "bq27542",
+                       .swnode = &fg_bq25890_supply_node,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C1",
+       }, {
+               /* Goodix Touchscreen in keyboard half*/

Missing space before */.

Quoted 98 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +90 -0
+               .board_info = {
+                       .type = "GDIX1001:00",
+                       .addr = 0x14,
+                       .dev_name = "goodix_ts",
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C2",
+               .irq_data = {
+                       .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+                       .chip = "INT33FF:01",
+                       .index = 56,
+                       .trigger = ACPI_EDGE_SENSITIVE,
+                       .polarity = ACPI_ACTIVE_LOW,
+               },
+       }, {
+               /* LP8557 Backlight controller */
+               .board_info = {
+                       .type = "lp8557",
+                       .addr = 0x2c,
+                       .dev_name = "lp8557",
+                       .platform_data = &lenovo_lp8557_pdata,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C4",
+       }, {
+               /* HiDeep IST940E Touchscreen in display half */
+               .board_info = {
+                       .type = "hideep_ts",
+                       .addr = 0x6c,
+                       .dev_name = "hideep_ts",
+                       .swnode = &lenovo_yb1_x90_hideep_ts_node,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C6",
+               .irq_data = {
+                       .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+                       .chip = "INT33FF:03",
+                       .index = 77,
+                       .trigger = ACPI_LEVEL_SENSITIVE,
+                       .polarity = ACPI_ACTIVE_LOW,
+               },
+       },
+};
+
+static struct gpiod_lookup_table lenovo_yb1_x90_goodix_gpios = {
+       .dev_id = "i2c-goodix_ts",
+       .table = {
+               GPIO_LOOKUP("INT33FF:01", 53, "reset", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("INT33FF:01", 56, "irq", GPIO_ACTIVE_HIGH),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
+       .dev_id = "i2c-hideep_ts",
+       .table = {
+               GPIO_LOOKUP("INT33FF:00", 7, "reset", GPIO_ACTIVE_LOW),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
+       &lenovo_yb1_x90_hideep_gpios,
+       &lenovo_yb1_x90_goodix_gpios,
+       NULL
+};
+
+static int __init lenovo_yb1_x90_init(void)
+{
+       /* Enable the regulators used by the touchscreens */
+
+       /* Vprog3B 3.0V used by the goodix touchscreen in the keyboard half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9b, 0x02, 0xff);
+
+       /* Vprog4D 3.0V used by the HiDeep touchscreen in the display half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9f, 0x02, 0xff);
+
+       /* Vprog5A 1.8V used by the HiDeep touchscreen in the display half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa0, 0x02, 0xff);
+
+       /* Vprog5B 1.8V used by the goodix touchscreen in the keyboard half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa1, 0x02, 0xff);
+
+       return 0;
+}
+
+const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
+       .i2c_client_info = lenovo_yb1_x90_i2c_clients,
+       .i2c_client_count = ARRAY_SIZE(lenovo_yb1_x90_i2c_clients),
+       .gpiod_lookup_tables = lenovo_yb1_x90_gpios,
+       .init = lenovo_yb1_x90_init,
+};
+
 /* Lenovo Yoga Book X91F/L Windows tablet needs manual instantiation of the fg client */
 static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __initconst = {
        {
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +0 -0
index c2b490519324..b6802d75dbdd 100644

drivers/platform/x86/x86-android-tablets/x86-android-tablets.h extern const struct x86_dev_info asus_me176c_info; · line 100

Quoted 7 lines
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -0
@@ -94,6 +94,7 @@ extern const struct x86_dev_info asus_me176c_info;
 extern const struct x86_dev_info asus_tf103c_info;
 extern const struct x86_dev_info chuwi_hi8_info;
 extern const struct x86_dev_info czc_p10t;
+extern const struct x86_dev_info lenovo_yogabook_x90_info;
 extern const struct x86_dev_info lenovo_yogabook_x91_info;
 extern const struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
 extern const struct x86_dev_info lenovo_yt3_info;

For the entire series

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Re: [PATCH 3/3] platform/x86: x86-android-tablets: Add Lenovo Yoga Book X90F/L data

Hi,

Quoted 191 lines · Andy Shevchenko
Quoted 42 lines · Hans de Goede

The Lenovo Yoga Book X90F/L is a x86 ACPI tablet which ships with Android x86 as factory OS. Its DSDT contains a bunch of I2C devices which are not actually there, causing various resource conflicts. Enumeration of these is skipped through the acpi_quirk_skip_i2c_client_enumeration().

Add support for manually instantiating the I2C + other devices which are actually present on this tablet by adding the necessary device info to the x86-android-tablets module.

---
 .../platform/x86/x86-android-tablets/dmi.c    |   9 ++
 .../platform/x86/x86-android-tablets/lenovo.c | 122 ++++++++++++++++++
 .../x86-android-tablets/x86-android-tablets.h |   1 +
 3 files changed, 132 insertions(+)
drivers/platform/x86/x86-android-tablets/dmi.c +9 -0
index 6ea47af1b480..23e640b7003d 100644
@@ -76,6 +76,15 @@ const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
                },
                .driver_data = (void *)&czc_p10t,
        },
+       {
+               /* Lenovo Yoga Book X90F / X90L */
+               .matches = {
+                       DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
+               },
+               .driver_data = (void *)&lenovo_yogabook_x90_info,
+       },
        {
                /* Lenovo Yoga Book X91F / X91L */
                .matches = {
drivers/platform/x86/x86-android-tablets/lenovo.c +0 -0
index 5d217cbbde30..d53928504c09 100644

drivers/platform/x86/x86-android-tablets/lenovo.c static struct lp855x_platform_data lenovo_lp8557_pdata = { · line 46

Quoted 9 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +6 -0
@@ -38,6 +38,128 @@ static struct lp855x_platform_data lenovo_lp8557_pdata = {
        .initial_brightness = 128,
 };
 
+/* Lenovo Yoga Book X90F / X90L's Android factory img has everything hardcoded */
+
+/*
+ * The HiDeep IST940E touchscreen comes up in HID mode and could alternatively
+ * be used in I2C-HID mode (I2C-HID descriptor reg 0x0020) if i2c-hid-of.c is
+ * modified to use generic (non of) device-properties and thought to deal with

non-OF

Quoted 16 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +16 -0
+ * the reset GPIO. "hideep,force-native-protocol" resets it to native mode.
+ */
+static const struct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
+       PROPERTY_ENTRY_U32("touchscreen-size-x", 1200),
+       PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
+       PROPERTY_ENTRY_U32("touchscreen-max-pressure", 16384),
+       PROPERTY_ENTRY_BOOL("hideep,force-native-protocol"),
+       { }
+};
+
+static const struct software_node lenovo_yb1_x90_hideep_ts_node = {
+       .properties = lenovo_yb1_x90_hideep_ts_props,
+};
+
+static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
+       {

drivers/platform/x86/x86-android-tablets/lenovo.c static struct lp855x_platform_data lenovo_lp8557_pdata = { · line 72

Quoted 10 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +10 -0
+               /* BQ27542 fuel-gauge */
+               .board_info = {
+                       .type = "bq27542",
+                       .addr = 0x55,
+                       .dev_name = "bq27542",
+                       .swnode = &fg_bq25890_supply_node,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C1",
+       }, {
+               /* Goodix Touchscreen in keyboard half*/

Missing space before */.

Quoted 98 lines
drivers/platform/x86/x86-android-tablets/lenovo.c +90 -0
+               .board_info = {
+                       .type = "GDIX1001:00",
+                       .addr = 0x14,
+                       .dev_name = "goodix_ts",
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C2",
+               .irq_data = {
+                       .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+                       .chip = "INT33FF:01",
+                       .index = 56,
+                       .trigger = ACPI_EDGE_SENSITIVE,
+                       .polarity = ACPI_ACTIVE_LOW,
+               },
+       }, {
+               /* LP8557 Backlight controller */
+               .board_info = {
+                       .type = "lp8557",
+                       .addr = 0x2c,
+                       .dev_name = "lp8557",
+                       .platform_data = &lenovo_lp8557_pdata,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C4",
+       }, {
+               /* HiDeep IST940E Touchscreen in display half */
+               .board_info = {
+                       .type = "hideep_ts",
+                       .addr = 0x6c,
+                       .dev_name = "hideep_ts",
+                       .swnode = &lenovo_yb1_x90_hideep_ts_node,
+               },
+               .adapter_path = "\\_SB_.PCI0.I2C6",
+               .irq_data = {
+                       .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+                       .chip = "INT33FF:03",
+                       .index = 77,
+                       .trigger = ACPI_LEVEL_SENSITIVE,
+                       .polarity = ACPI_ACTIVE_LOW,
+               },
+       },
+};
+
+static struct gpiod_lookup_table lenovo_yb1_x90_goodix_gpios = {
+       .dev_id = "i2c-goodix_ts",
+       .table = {
+               GPIO_LOOKUP("INT33FF:01", 53, "reset", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("INT33FF:01", 56, "irq", GPIO_ACTIVE_HIGH),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
+       .dev_id = "i2c-hideep_ts",
+       .table = {
+               GPIO_LOOKUP("INT33FF:00", 7, "reset", GPIO_ACTIVE_LOW),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
+       &lenovo_yb1_x90_hideep_gpios,
+       &lenovo_yb1_x90_goodix_gpios,
+       NULL
+};
+
+static int __init lenovo_yb1_x90_init(void)
+{
+       /* Enable the regulators used by the touchscreens */
+
+       /* Vprog3B 3.0V used by the goodix touchscreen in the keyboard half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9b, 0x02, 0xff);
+
+       /* Vprog4D 3.0V used by the HiDeep touchscreen in the display half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0x9f, 0x02, 0xff);
+
+       /* Vprog5A 1.8V used by the HiDeep touchscreen in the display half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa0, 0x02, 0xff);
+
+       /* Vprog5B 1.8V used by the goodix touchscreen in the keyboard half */
+       intel_soc_pmic_exec_mipi_pmic_seq_element(0x6e, 0xa1, 0x02, 0xff);
+
+       return 0;
+}
+
+const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
+       .i2c_client_info = lenovo_yb1_x90_i2c_clients,
+       .i2c_client_count = ARRAY_SIZE(lenovo_yb1_x90_i2c_clients),
+       .gpiod_lookup_tables = lenovo_yb1_x90_gpios,
+       .init = lenovo_yb1_x90_init,
+};
+
 /* Lenovo Yoga Book X91F/L Windows tablet needs manual instantiation of the fg client */
 static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __initconst = {
        {
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +0 -0
index c2b490519324..b6802d75dbdd 100644

drivers/platform/x86/x86-android-tablets/x86-android-tablets.h extern const struct x86_dev_info asus_me176c_info; · line 100

Quoted 7 lines
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -0
@@ -94,6 +94,7 @@ extern const struct x86_dev_info asus_me176c_info;
 extern const struct x86_dev_info asus_tf103c_info;
 extern const struct x86_dev_info chuwi_hi8_info;
 extern const struct x86_dev_info czc_p10t;
+extern const struct x86_dev_info lenovo_yogabook_x90_info;
 extern const struct x86_dev_info lenovo_yogabook_x91_info;
 extern const struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
 extern const struct x86_dev_info lenovo_yt3_info;

For the entire series

Quoted 1 line

Thanks, I've added this to my review-hans branch now, with the 2 suggested comment fixes squashed in.

Regards,

Hans