platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment
@ 2023-04-16 21:28 Hans de Goede
  2023-04-16 21:28 ` [PATCH 2/4] platform/x86: x86-android-tablets: Add Wacom digitizer info for Lenovo Yoga Book Hans de Goede
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-16 21:28 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

After recent i2c-hid-of changes, the i2c-hid-of driver could be used
for the Yoga Book HiDeep touchscreen comment instead of the native hideep
driver. Update the comment to reflect this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/x86-android-tablets/lenovo.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index a571dcd11544..b5dd74bf9e8c 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -41,10 +41,13 @@ static struct lp855x_platform_data lenovo_lp8557_pdata = {
 /* 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
- * the reset GPIO. "hideep,force-native-protocol" resets it to native mode.
+ * The HiDeep IST940E touchscreen comes up in I2C-HID mode. The native protocol
+ * reports ABS_MT_PRESSURE and ABS_MT_TOUCH_MAJOR which are not reported in HID
+ * mode, so using native mode is preferred.
+ * It could alternatively be used in HID mode by changing the properties to:
+ *	PROPERTY_ENTRY_U32("hid-descr-addr", 0x0020),
+ *	PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 120),
+ * and changing board_info.type to "hid-over-i2c".
  */
 static const struct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1200),
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] platform/x86: x86-android-tablets: Add Wacom digitizer info for Lenovo Yoga Book
  2023-04-16 21:28 [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
@ 2023-04-16 21:28 ` Hans de Goede
  2023-04-16 21:28 ` [PATCH 3/4] platform/x86: x86-android-tablets: Add "yogabook-touch-kbd-digitizer-switch" pdev " Hans de Goede
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-16 21:28 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

The Lenovo Yoga Book has a wacom digitizer in its keyboard half,
add the necessary info to instantiate an i2c_client for the digitizer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 .../platform/x86/x86-android-tablets/lenovo.c | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index b5dd74bf9e8c..438de8b92dc6 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -40,6 +40,16 @@ static struct lp855x_platform_data lenovo_lp8557_pdata = {
 
 /* Lenovo Yoga Book X90F / X90L's Android factory img has everything hardcoded */
 
+static const struct property_entry lenovo_yb1_x90_wacom_props[] = {
+	PROPERTY_ENTRY_U32("hid-descr-addr", 0x0001),
+	PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 150),
+	{ }
+};
+
+static const struct software_node lenovo_yb1_x90_wacom_node = {
+	.properties = lenovo_yb1_x90_wacom_props,
+};
+
 /*
  * The HiDeep IST940E touchscreen comes up in I2C-HID mode. The native protocol
  * reports ABS_MT_PRESSURE and ABS_MT_TOUCH_MAJOR which are not reported in HID
@@ -86,6 +96,22 @@ static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst
 			.trigger = ACPI_EDGE_SENSITIVE,
 			.polarity = ACPI_ACTIVE_LOW,
 		},
+	}, {
+		/* Wacom Digitizer in keyboard half */
+		.board_info = {
+			.type = "hid-over-i2c",
+			.addr = 0x09,
+			.dev_name = "wacom",
+			.swnode = &lenovo_yb1_x90_wacom_node,
+		},
+		.adapter_path = "\\_SB_.PCI0.I2C4",
+		.irq_data = {
+			.type = X86_ACPI_IRQ_TYPE_GPIOINT,
+			.chip = "INT33FF:01",
+			.index = 49,
+			.trigger = ACPI_LEVEL_SENSITIVE,
+			.polarity = ACPI_ACTIVE_LOW,
+		},
 	}, {
 		/* LP8557 Backlight controller */
 		.board_info = {
@@ -131,9 +157,18 @@ static struct gpiod_lookup_table lenovo_yb1_x90_hideep_gpios = {
 	},
 };
 
+static struct gpiod_lookup_table lenovo_yb1_x90_wacom_gpios = {
+	.dev_id = "i2c-wacom",
+	.table = {
+		GPIO_LOOKUP("INT33FF:00", 82, "reset", GPIO_ACTIVE_LOW),
+		{ }
+	},
+};
+
 static struct gpiod_lookup_table * const lenovo_yb1_x90_gpios[] = {
 	&lenovo_yb1_x90_hideep_gpios,
 	&lenovo_yb1_x90_goodix_gpios,
+	&lenovo_yb1_x90_wacom_gpios,
 	NULL
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] platform/x86: x86-android-tablets: Add "yogabook-touch-kbd-digitizer-switch" pdev for Lenovo Yoga Book
  2023-04-16 21:28 [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
  2023-04-16 21:28 ` [PATCH 2/4] platform/x86: x86-android-tablets: Add Wacom digitizer info for Lenovo Yoga Book Hans de Goede
@ 2023-04-16 21:28 ` Hans de Goede
  2023-04-16 21:28 ` [PATCH 4/4] platform/x86: x86-android-tablets: Add accelerometer support for Yoga Tablet 2 1050/830 series Hans de Goede
  2023-04-17 10:25 ` [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-16 21:28 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

Add a "yogabook-touch-kbd-digitizer-switch" platform-device, for
the lenovo-yogabook driver to bind to, to the x86_dev_info for
the Lenovo Yoga Book 1 Android models (yb1-x90f/l).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/x86-android-tablets/lenovo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 438de8b92dc6..cf1629970f98 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -140,6 +140,13 @@ static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst
 	},
 };
 
+static const struct platform_device_info lenovo_yb1_x90_pdevs[] __initconst = {
+	{
+		.name = "yogabook-touch-kbd-digitizer-switch",
+		.id = PLATFORM_DEVID_NONE,
+	},
+};
+
 static struct gpiod_lookup_table lenovo_yb1_x90_goodix_gpios = {
 	.dev_id = "i2c-goodix_ts",
 	.table = {
@@ -194,6 +201,8 @@ static int __init lenovo_yb1_x90_init(void)
 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),
+	.pdev_info = lenovo_yb1_x90_pdevs,
+	.pdev_count = ARRAY_SIZE(lenovo_yb1_x90_pdevs),
 	.gpiod_lookup_tables = lenovo_yb1_x90_gpios,
 	.init = lenovo_yb1_x90_init,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] platform/x86: x86-android-tablets: Add accelerometer support for Yoga Tablet 2 1050/830 series
  2023-04-16 21:28 [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
  2023-04-16 21:28 ` [PATCH 2/4] platform/x86: x86-android-tablets: Add Wacom digitizer info for Lenovo Yoga Book Hans de Goede
  2023-04-16 21:28 ` [PATCH 3/4] platform/x86: x86-android-tablets: Add "yogabook-touch-kbd-digitizer-switch" pdev " Hans de Goede
@ 2023-04-16 21:28 ` Hans de Goede
  2023-04-17 10:25 ` [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-16 21:28 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

The Yoga Tablet 2 1050/830 series have a LSM303DA accelerometer +
magnetometer (IMU), add this to the list of i2c_clients to
instantiate on these models.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 .../platform/x86/x86-android-tablets/lenovo.c | 32 ++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index cf1629970f98..65cfccaa2894 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -255,8 +255,19 @@ 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 const struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[] __initconst = {
+static struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[] __initdata = {
 	{
+		/*
+		 * This must be the first entry because lenovo_yoga_tab2_830_1050_init()
+		 * may update its swnode. LSM303DA accelerometer + magnetometer.
+		 */
+		.board_info = {
+			.type = "lsm303d",
+			.addr = 0x1d,
+			.dev_name = "lsm303d",
+		},
+		.adapter_path = "\\_SB_.I2C5",
+	}, {
 		/* bq24292i battery charger */
 		.board_info = {
 			.type = "bq24190",
@@ -357,7 +368,24 @@ const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
  * The Lenovo Yoga Tablet 2 830 and 1050 (8" vs 10") versions use the same
  * 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.
+ * And requiring the accelerometer to have a mount-matrix set to correct for
+ * the 90° rotation of the LCD vs the frame.
  */
+static const char * const lenovo_yoga_tab2_830_lms303d_mount_matrix[] = {
+	"0", "1", "0",
+	"-1", "0", "0",
+	"0", "0", "1"
+};
+
+static const struct property_entry lenovo_yoga_tab2_830_lms303d_props[] = {
+	PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", lenovo_yoga_tab2_830_lms303d_mount_matrix),
+	{ }
+};
+
+static const struct software_node lenovo_yoga_tab2_830_lms303d_node = {
+	.properties = lenovo_yoga_tab2_830_lms303d_props,
+};
+
 static int __init lenovo_yoga_tab2_830_1050_init_touchscreen(void)
 {
 	struct gpio_desc *gpiod;
@@ -375,6 +403,8 @@ static int __init lenovo_yoga_tab2_830_1050_init_touchscreen(void)
 		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_i2c_clients[0].board_info.swnode =
+			&lenovo_yoga_tab2_830_lms303d_node;
 	}
 
 	return 0;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment
  2023-04-16 21:28 [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
                   ` (2 preceding siblings ...)
  2023-04-16 21:28 ` [PATCH 4/4] platform/x86: x86-android-tablets: Add accelerometer support for Yoga Tablet 2 1050/830 series Hans de Goede
@ 2023-04-17 10:25 ` Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-04-17 10:25 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: platform-driver-x86

Hi,

On 4/16/23 23:28, Hans de Goede wrote:
> After recent i2c-hid-of changes, the i2c-hid-of driver could be used
> for the Yoga Book HiDeep touchscreen comment instead of the native hideep
> driver. Update the comment to reflect this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I've added this series to my review-hans (soon to be for-next)
branch now.

Regards,

Hans




> ---
>  drivers/platform/x86/x86-android-tablets/lenovo.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
> index a571dcd11544..b5dd74bf9e8c 100644
> --- a/drivers/platform/x86/x86-android-tablets/lenovo.c
> +++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
> @@ -41,10 +41,13 @@ static struct lp855x_platform_data lenovo_lp8557_pdata = {
>  /* 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
> - * the reset GPIO. "hideep,force-native-protocol" resets it to native mode.
> + * The HiDeep IST940E touchscreen comes up in I2C-HID mode. The native protocol
> + * reports ABS_MT_PRESSURE and ABS_MT_TOUCH_MAJOR which are not reported in HID
> + * mode, so using native mode is preferred.
> + * It could alternatively be used in HID mode by changing the properties to:
> + *	PROPERTY_ENTRY_U32("hid-descr-addr", 0x0020),
> + *	PROPERTY_ENTRY_U32("post-reset-deassert-delay-ms", 120),
> + * and changing board_info.type to "hid-over-i2c".
>   */
>  static const struct property_entry lenovo_yb1_x90_hideep_ts_props[] = {
>  	PROPERTY_ENTRY_U32("touchscreen-size-x", 1200),


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-17 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16 21:28 [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede
2023-04-16 21:28 ` [PATCH 2/4] platform/x86: x86-android-tablets: Add Wacom digitizer info for Lenovo Yoga Book Hans de Goede
2023-04-16 21:28 ` [PATCH 3/4] platform/x86: x86-android-tablets: Add "yogabook-touch-kbd-digitizer-switch" pdev " Hans de Goede
2023-04-16 21:28 ` [PATCH 4/4] platform/x86: x86-android-tablets: Add accelerometer support for Yoga Tablet 2 1050/830 series Hans de Goede
2023-04-17 10:25 ` [PATCH 1/4] platform/x86: x86-android-tablets: Update Yoga Book HiDeep touchscreen comment Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).