* [PATCH v2 0/3] platform/x86: Describe Yoga Book haptics and audio resources
@ 2026-08-27 23:16 Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-27 23:16 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Lenovo Yoga Book YB1-X91F/L firmware omits software properties for
its two DRV2604 haptic controllers and does not instantiate or map all
resources used by the RT5677 audio design.
Attach board software nodes describing the DRV2604 mode, waveform
library and enable GPIOs, instantiate the TS3A227E headset detector, and
add lookup entries for the codec GPIOs which control the second speaker
amplifier and headphone path.
Changes since v1:
- move the enable-GPIO mapping out of the generic drv260x driver and into
the Yoga Book board description, as requested by Dmitry;
- attach the software nodes to the existing ACPI-enumerated I2C devices,
reprobe devices which attempted to bind before the nodes were available,
and retain the device references until removal; and
- remove the dependency on the withdrawn optional-vbat Input change.
All three patches pass strict checkpatch, W=1 and sparse v0.6.5-rc1.
They were tested on a Lenovo Yoga Book YB1-X91L: both haptic devices bind
and work after suspend/resume, while speakers, microphone and headset
detection use the described audio resources successfully.
With Best Regards,
Maurizio Casciano
Maurizio Casciano (3):
platform/x86: x86-android-tablets: Describe Yoga Book haptics
platform/x86: x86-android-tablets: Add Yoga Book TS3A227E
platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs
.../platform/x86/x86-android-tablets/lenovo.c | 140 +++++++++++++++++-
1 file changed, 139 insertions(+), 1 deletion(-)
base-commit: 32e17ef088fc55858886738d0b904248e98b30e0
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics
2026-08-27 23:16 [PATCH v2 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
@ 2026-08-27 23:16 ` Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
2026-08-27 23:17 ` [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
2 siblings, 0 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-27 23:16 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
ACPI enumerates the Yoga Book YB1-X91F/L haptic controllers as
DRV2604:00 and DRV2604:01, but omits the properties used by drv260x to
identify their mode, waveform library and enable GPIO.
Register board software nodes and attach them to the existing I2C
devices. Describe the enable signals using their Cherryview GPIO
providers and pins from the firmware resource tables, keeping this
board-specific mapping out of the generic input driver. Hold device
references until removal, reprobe after adding properties to cover an
earlier built-in probe, and detach the nodes in reverse order.
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
Assisted-by: LLM sparse
---
.../platform/x86/x86-android-tablets/lenovo.c | 98 +++++++++++++++++++
1 file changed, 98 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 8d825e0b4661..a8c849ee03db 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -114,6 +114,41 @@ static const struct software_node lenovo_yb1_x90_hideep_ts_node = {
.properties = lenovo_yb1_x90_hideep_ts_props,
};
+static const struct property_entry lenovo_yb1_x91_drv2604_0_props[] = {
+ PROPERTY_ENTRY_U32("mode", 0), /* DRV260X_LRA_MODE */
+ PROPERTY_ENTRY_U32("library-sel", 0), /* DRV260X_LIB_EMPTY */
+ PROPERTY_ENTRY_GPIO("enable-gpios", &cherryview_gpiochip_nodes[0], 79,
+ GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct property_entry lenovo_yb1_x91_drv2604_1_props[] = {
+ PROPERTY_ENTRY_U32("mode", 0), /* DRV260X_LRA_MODE */
+ PROPERTY_ENTRY_U32("library-sel", 0), /* DRV260X_LIB_EMPTY */
+ PROPERTY_ENTRY_GPIO("enable-gpios", &cherryview_gpiochip_nodes[1], 47,
+ GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node lenovo_yb1_x91_drv2604_0_node = {
+ .properties = lenovo_yb1_x91_drv2604_0_props,
+};
+
+static const struct software_node lenovo_yb1_x91_drv2604_1_node = {
+ .properties = lenovo_yb1_x91_drv2604_1_props,
+};
+
+static const struct software_node *lenovo_yb1_x91_swnodes[] = {
+ &lenovo_yb1_x91_drv2604_0_node,
+ &lenovo_yb1_x91_drv2604_1_node,
+ NULL
+};
+
+static const struct software_node * const lenovo_yb1_x91_drv2604_nodes[] = {
+ &lenovo_yb1_x91_drv2604_0_node,
+ &lenovo_yb1_x91_drv2604_1_node,
+};
+
static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -283,9 +318,72 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
},
};
+#define YB1_X91_DRV2604_0_DEVICE "i2c-DRV2604:00"
+#define YB1_X91_DRV2604_1_DEVICE "i2c-DRV2604:01"
+
+static struct device *lenovo_yb1_x91_drv2604_devs[2];
+
+static void lenovo_yb1_x91_add_haptics_props(struct device *dev, int index,
+ const char *name)
+{
+ struct device *haptics_dev;
+ int ret;
+
+ haptics_dev = bus_find_device_by_name(&i2c_bus_type, NULL, name);
+ if (!haptics_dev) {
+ dev_warn(dev, "cannot find %s, haptics will be unavailable\n", name);
+ return;
+ }
+
+ ret = device_add_software_node(haptics_dev,
+ lenovo_yb1_x91_drv2604_nodes[index]);
+ if (ret) {
+ put_device(haptics_dev);
+ dev_warn(dev, "failed to add properties to %s: %d\n", name, ret);
+ return;
+ }
+
+ /* Apply the properties if a built-in driver already attempted to probe. */
+ ret = device_reprobe(haptics_dev);
+ if (ret)
+ dev_warn(dev, "failed to reprobe %s: %d\n", name, ret);
+
+ lenovo_yb1_x91_drv2604_devs[index] = haptics_dev;
+}
+
+static void lenovo_yb1_x91_remove_haptics_props(int index)
+{
+ struct device *haptics_dev = lenovo_yb1_x91_drv2604_devs[index];
+
+ if (!haptics_dev)
+ return;
+
+ device_remove_software_node(haptics_dev);
+ put_device(haptics_dev);
+ lenovo_yb1_x91_drv2604_devs[index] = NULL;
+}
+
+static int __init lenovo_yb1_x91_init(struct device *dev)
+{
+ lenovo_yb1_x91_add_haptics_props(dev, 0, YB1_X91_DRV2604_0_DEVICE);
+ lenovo_yb1_x91_add_haptics_props(dev, 1, YB1_X91_DRV2604_1_DEVICE);
+
+ return 0;
+}
+
+static void lenovo_yb1_x91_exit(void)
+{
+ lenovo_yb1_x91_remove_haptics_props(1);
+ lenovo_yb1_x91_remove_haptics_props(0);
+}
+
const struct x86_dev_info lenovo_yogabook_x91_info __initconst = {
.i2c_client_info = lenovo_yogabook_x91_i2c_clients,
.i2c_client_count = ARRAY_SIZE(lenovo_yogabook_x91_i2c_clients),
+ .swnode_group = lenovo_yb1_x91_swnodes,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
+ .init = lenovo_yb1_x91_init,
+ .exit = lenovo_yb1_x91_exit,
};
/* Lenovo Yoga Tablet 2 1050F/L's Android factory image has everything hardcoded */
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E
2026-08-27 23:16 [PATCH v2 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
@ 2026-08-27 23:16 ` Maurizio Casciano
2026-08-27 23:17 ` [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
2 siblings, 0 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-27 23:16 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Yoga Book YB1-X91F/L firmware describes the TS3A227E headset
detector as a secondary resource of the RT5677 codec rather than as an
independent I2C device. No client is therefore created for it.
Instantiate the device on I2C1 at address 0x3b, describe its GPIO
interrupt, and provide the mic-bias setting used by the Yoga Book
design. This lets the ASoC machine driver use jack and button detection.
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
Assisted-by: LLM sparse
---
.../platform/x86/x86-android-tablets/lenovo.c | 29 ++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index a8c849ee03db..88693b9a1b01 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -149,6 +149,16 @@ static const struct software_node * const lenovo_yb1_x91_drv2604_nodes[] = {
&lenovo_yb1_x91_drv2604_1_node,
};
+static const struct property_entry lenovo_yb1_ts3a227e_props[] = {
+ /* Value taken from the Lenovo Android kernel code drop. */
+ PROPERTY_ENTRY_U32("ti,micbias", 7),
+ { }
+};
+
+static const struct software_node lenovo_yb1_ts3a227e_node = {
+ .properties = lenovo_yb1_ts3a227e_props,
+};
+
static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -304,7 +314,7 @@ const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
.init = lenovo_yb1_x90_init,
};
-/* Lenovo Yoga Book X91F/L Windows tablet needs manual instantiation of the fuel-gauge client */
+/* Lenovo Yoga Book X91F/L Windows tablet needs extra platform descriptions. */
static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -315,6 +325,23 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
.swnode = &fg_bq25890_supply_node,
},
.adapter_path = "\\_SB_.PCI0.I2C1",
+ }, {
+ /* The jack-detection IC is described as a secondary RT5677 resource. */
+ .board_info = {
+ .type = "ts3a227e",
+ .addr = 0x3b,
+ .dev_name = "ts3a227e",
+ .swnode = &lenovo_yb1_ts3a227e_node,
+ },
+ .adapter_path = "\\_SB_.PCI0.I2C1",
+ .irq_data = {
+ .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+ .chip = "INT33FF:00",
+ .index = 77,
+ .trigger = ACPI_EDGE_SENSITIVE,
+ .polarity = ACPI_ACTIVE_LOW,
+ .con_id = "ts3a227e_irq",
+ },
},
};
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs
2026-08-27 23:16 [PATCH v2 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
@ 2026-08-27 23:17 ` Maurizio Casciano
2026-08-29 13:06 ` Dmitry Torokhov
2 siblings, 1 reply; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-27 23:17 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Yoga Book YB1-X91F/L uses two GPIOs provided by the RT5677 codec
itself. GPIO2 enables the second speaker amplifier and GPIO4 enables the
headphone path, but ACPI does not map either signal.
Add lookup entries for the codec device so the Yoga Book ASoC machine
driver can request both controls by function name. Register and remove
the table with the tablet description lifetime.
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
Assisted-by: LLM sparse
---
drivers/platform/x86/x86-android-tablets/lenovo.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 88693b9a1b01..8a69194a724e 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -345,6 +345,16 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
},
};
+static struct gpiod_lookup_table lenovo_yb1_x91_rt5677_gpios = {
+ .dev_id = "i2c-10EC5677:00",
+ .table = {
+ /* GPIO2 drives the second speaker amp; GPIO4 drives headphones. */
+ GPIO_LOOKUP("rt5677", 2, "speaker-enable2", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("rt5677", 4, "headphone-enable", GPIO_ACTIVE_HIGH),
+ { }
+ },
+};
+
#define YB1_X91_DRV2604_0_DEVICE "i2c-DRV2604:00"
#define YB1_X91_DRV2604_1_DEVICE "i2c-DRV2604:01"
@@ -392,6 +402,8 @@ static void lenovo_yb1_x91_remove_haptics_props(int index)
static int __init lenovo_yb1_x91_init(struct device *dev)
{
+ gpiod_add_lookup_table(&lenovo_yb1_x91_rt5677_gpios);
+
lenovo_yb1_x91_add_haptics_props(dev, 0, YB1_X91_DRV2604_0_DEVICE);
lenovo_yb1_x91_add_haptics_props(dev, 1, YB1_X91_DRV2604_1_DEVICE);
@@ -402,6 +414,7 @@ static void lenovo_yb1_x91_exit(void)
{
lenovo_yb1_x91_remove_haptics_props(1);
lenovo_yb1_x91_remove_haptics_props(0);
+ gpiod_remove_lookup_table(&lenovo_yb1_x91_rt5677_gpios);
}
const struct x86_dev_info lenovo_yogabook_x91_info __initconst = {
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs
2026-08-27 23:17 ` [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
@ 2026-08-29 13:06 ` Dmitry Torokhov
2026-08-29 22:57 ` [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2026-08-29 13:06 UTC (permalink / raw)
To: Maurizio Casciano
Cc: Hans de Goede, Ilpo Jarvinen, platform-driver-x86, linux-kernel
Hi Maurizio,
On Fri, Aug 28, 2026 at 01:17:00AM +0200, Maurizio Casciano wrote:
> The Yoga Book YB1-X91F/L uses two GPIOs provided by the RT5677 codec
> itself. GPIO2 enables the second speaker amplifier and GPIO4 enables the
> headphone path, but ACPI does not map either signal.
>
> Add lookup entries for the codec device so the Yoga Book ASoC machine
> driver can request both controls by function name. Register and remove
> the table with the tablet description lifetime.
>
> Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
> Assisted-by: LLM sparse
> ---
> drivers/platform/x86/x86-android-tablets/lenovo.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
> index 88693b9a1b01..8a69194a724e 100644
> --- a/drivers/platform/x86/x86-android-tablets/lenovo.c
> +++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
> @@ -345,6 +345,16 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
> },
> };
>
> +static struct gpiod_lookup_table lenovo_yb1_x91_rt5677_gpios = {
> + .dev_id = "i2c-10EC5677:00",
> + .table = {
> + /* GPIO2 drives the second speaker amp; GPIO4 drives headphones. */
> + GPIO_LOOKUP("rt5677", 2, "speaker-enable2", GPIO_ACTIVE_HIGH),
> + GPIO_LOOKUP("rt5677", 4, "headphone-enable", GPIO_ACTIVE_HIGH),
> + { }
> + },
> +};
> +
It would be better if we used software nodes here instead of lookup
tables.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources
2026-08-29 13:06 ` Dmitry Torokhov
@ 2026-08-29 22:57 ` Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-29 22:57 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Lenovo Yoga Book YB1-X91F/L firmware omits software properties for
its two DRV2604 haptic controllers and does not instantiate or map all
resources used by the RT5677 audio design.
Attach board software nodes describing the DRV2604 mode, waveform
library and enable GPIOs, instantiate the TS3A227E headset detector, and
attach software-node GPIO properties to the RT5677 codec for the second
speaker amplifier and headphone path.
Changes since v2:
- replace the RT5677 GPIO lookup table with GPIO properties on a
codec-attached software node, as suggested by Dmitry; and
- reprobe the codec after attaching the software node so its GPIO
provider is initialized with the new fwnode.
All three patches pass strict checkpatch. They were built and booted on
a Lenovo Yoga Book YB1-X91L. Both haptic devices played effects before
and after s2idle. From a fresh boot, the RT5677 GPIO consumers were
present, GPIO2 went high during speaker playback, GPIO4 went high during
headphone playback, and microphone capture succeeded.
With Best Regards,
Maurizio Casciano
Maurizio Casciano (3):
platform/x86: x86-android-tablets: Describe Yoga Book haptics
platform/x86: x86-android-tablets: Add Yoga Book TS3A227E
platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs
.../platform/x86/x86-android-tablets/lenovo.c | 188 +++++++++++++++++-
1 file changed, 187 insertions(+), 1 deletion(-)
base-commit: 32e17ef088fc55858886738d0b904248e98b30e0
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics
2026-08-29 22:57 ` [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
@ 2026-08-29 22:57 ` Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
2 siblings, 0 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-29 22:57 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
ACPI enumerates the Yoga Book YB1-X91F/L haptic controllers as
DRV2604:00 and DRV2604:01, but omits the properties used by drv260x to
identify their mode, waveform library and enable GPIO.
Register board software nodes and attach them to the existing I2C
devices. Describe the enable signals using their Cherryview GPIO
providers and pins from the firmware resource tables, keeping this
board-specific mapping out of the generic input driver. Hold device
references until removal, reprobe after adding properties to cover an
earlier built-in probe, and detach the nodes in reverse order.
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
Assisted-by: Codex:gpt-5.6-sol [sparse]
---
.../platform/x86/x86-android-tablets/lenovo.c | 98 +++++++++++++++++++
1 file changed, 98 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 8d825e0b4661..a8c849ee03db 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -114,6 +114,41 @@ static const struct software_node lenovo_yb1_x90_hideep_ts_node = {
.properties = lenovo_yb1_x90_hideep_ts_props,
};
+static const struct property_entry lenovo_yb1_x91_drv2604_0_props[] = {
+ PROPERTY_ENTRY_U32("mode", 0), /* DRV260X_LRA_MODE */
+ PROPERTY_ENTRY_U32("library-sel", 0), /* DRV260X_LIB_EMPTY */
+ PROPERTY_ENTRY_GPIO("enable-gpios", &cherryview_gpiochip_nodes[0], 79,
+ GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct property_entry lenovo_yb1_x91_drv2604_1_props[] = {
+ PROPERTY_ENTRY_U32("mode", 0), /* DRV260X_LRA_MODE */
+ PROPERTY_ENTRY_U32("library-sel", 0), /* DRV260X_LIB_EMPTY */
+ PROPERTY_ENTRY_GPIO("enable-gpios", &cherryview_gpiochip_nodes[1], 47,
+ GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node lenovo_yb1_x91_drv2604_0_node = {
+ .properties = lenovo_yb1_x91_drv2604_0_props,
+};
+
+static const struct software_node lenovo_yb1_x91_drv2604_1_node = {
+ .properties = lenovo_yb1_x91_drv2604_1_props,
+};
+
+static const struct software_node *lenovo_yb1_x91_swnodes[] = {
+ &lenovo_yb1_x91_drv2604_0_node,
+ &lenovo_yb1_x91_drv2604_1_node,
+ NULL
+};
+
+static const struct software_node * const lenovo_yb1_x91_drv2604_nodes[] = {
+ &lenovo_yb1_x91_drv2604_0_node,
+ &lenovo_yb1_x91_drv2604_1_node,
+};
+
static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -283,9 +318,72 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
},
};
+#define YB1_X91_DRV2604_0_DEVICE "i2c-DRV2604:00"
+#define YB1_X91_DRV2604_1_DEVICE "i2c-DRV2604:01"
+
+static struct device *lenovo_yb1_x91_drv2604_devs[2];
+
+static void lenovo_yb1_x91_add_haptics_props(struct device *dev, int index,
+ const char *name)
+{
+ struct device *haptics_dev;
+ int ret;
+
+ haptics_dev = bus_find_device_by_name(&i2c_bus_type, NULL, name);
+ if (!haptics_dev) {
+ dev_warn(dev, "cannot find %s, haptics will be unavailable\n", name);
+ return;
+ }
+
+ ret = device_add_software_node(haptics_dev,
+ lenovo_yb1_x91_drv2604_nodes[index]);
+ if (ret) {
+ put_device(haptics_dev);
+ dev_warn(dev, "failed to add properties to %s: %d\n", name, ret);
+ return;
+ }
+
+ /* Apply the properties if a built-in driver already attempted to probe. */
+ ret = device_reprobe(haptics_dev);
+ if (ret)
+ dev_warn(dev, "failed to reprobe %s: %d\n", name, ret);
+
+ lenovo_yb1_x91_drv2604_devs[index] = haptics_dev;
+}
+
+static void lenovo_yb1_x91_remove_haptics_props(int index)
+{
+ struct device *haptics_dev = lenovo_yb1_x91_drv2604_devs[index];
+
+ if (!haptics_dev)
+ return;
+
+ device_remove_software_node(haptics_dev);
+ put_device(haptics_dev);
+ lenovo_yb1_x91_drv2604_devs[index] = NULL;
+}
+
+static int __init lenovo_yb1_x91_init(struct device *dev)
+{
+ lenovo_yb1_x91_add_haptics_props(dev, 0, YB1_X91_DRV2604_0_DEVICE);
+ lenovo_yb1_x91_add_haptics_props(dev, 1, YB1_X91_DRV2604_1_DEVICE);
+
+ return 0;
+}
+
+static void lenovo_yb1_x91_exit(void)
+{
+ lenovo_yb1_x91_remove_haptics_props(1);
+ lenovo_yb1_x91_remove_haptics_props(0);
+}
+
const struct x86_dev_info lenovo_yogabook_x91_info __initconst = {
.i2c_client_info = lenovo_yogabook_x91_i2c_clients,
.i2c_client_count = ARRAY_SIZE(lenovo_yogabook_x91_i2c_clients),
+ .swnode_group = lenovo_yb1_x91_swnodes,
+ .gpiochip_type = X86_GPIOCHIP_CHERRYVIEW,
+ .init = lenovo_yb1_x91_init,
+ .exit = lenovo_yb1_x91_exit,
};
/* Lenovo Yoga Tablet 2 1050F/L's Android factory image has everything hardcoded */
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E
2026-08-29 22:57 ` [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
@ 2026-08-29 22:57 ` Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
2 siblings, 0 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-29 22:57 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Yoga Book YB1-X91F/L firmware describes the TS3A227E headset
detector as a secondary resource of the RT5677 codec rather than as an
independent I2C device. No client is therefore created for it.
Instantiate the device on I2C1 at address 0x3b, describe its GPIO
interrupt, and provide the mic-bias setting used by the Yoga Book
design. This lets the ASoC machine driver use jack and button detection.
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
Assisted-by: Codex:gpt-5.6-sol [sparse]
---
.../platform/x86/x86-android-tablets/lenovo.c | 29 ++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index a8c849ee03db..88693b9a1b01 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -149,6 +149,16 @@ static const struct software_node * const lenovo_yb1_x91_drv2604_nodes[] = {
&lenovo_yb1_x91_drv2604_1_node,
};
+static const struct property_entry lenovo_yb1_ts3a227e_props[] = {
+ /* Value taken from the Lenovo Android kernel code drop. */
+ PROPERTY_ENTRY_U32("ti,micbias", 7),
+ { }
+};
+
+static const struct software_node lenovo_yb1_ts3a227e_node = {
+ .properties = lenovo_yb1_ts3a227e_props,
+};
+
static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -304,7 +314,7 @@ const struct x86_dev_info lenovo_yogabook_x90_info __initconst = {
.init = lenovo_yb1_x90_init,
};
-/* Lenovo Yoga Book X91F/L Windows tablet needs manual instantiation of the fuel-gauge client */
+/* Lenovo Yoga Book X91F/L Windows tablet needs extra platform descriptions. */
static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __initconst = {
{
/* BQ27542 fuel-gauge */
@@ -315,6 +325,23 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
.swnode = &fg_bq25890_supply_node,
},
.adapter_path = "\\_SB_.PCI0.I2C1",
+ }, {
+ /* The jack-detection IC is described as a secondary RT5677 resource. */
+ .board_info = {
+ .type = "ts3a227e",
+ .addr = 0x3b,
+ .dev_name = "ts3a227e",
+ .swnode = &lenovo_yb1_ts3a227e_node,
+ },
+ .adapter_path = "\\_SB_.PCI0.I2C1",
+ .irq_data = {
+ .type = X86_ACPI_IRQ_TYPE_GPIOINT,
+ .chip = "INT33FF:00",
+ .index = 77,
+ .trigger = ACPI_EDGE_SENSITIVE,
+ .polarity = ACPI_ACTIVE_LOW,
+ .con_id = "ts3a227e_irq",
+ },
},
};
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs
2026-08-29 22:57 ` [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
@ 2026-08-29 22:57 ` Maurizio Casciano
2 siblings, 0 replies; 9+ messages in thread
From: Maurizio Casciano @ 2026-08-29 22:57 UTC (permalink / raw)
To: Hans de Goede
Cc: Ilpo Jarvinen, Dmitry Torokhov, platform-driver-x86,
linux-kernel, Maurizio Casciano
The Yoga Book YB1-X91F/L uses two GPIOs provided by the RT5677 codec
itself. GPIO2 enables the second speaker amplifier and GPIO4 enables the
headphone path, but ACPI does not map either signal.
Describe both controls with a software node attached to the codec
device. The same node identifies the RT5677 GPIO provider, allowing the
Yoga Book ASoC machine driver to request the controls by function name.
Reprobe the codec after adding the node so the provider is initialized
with the new fwnode before the machine driver requests the descriptors.
Attach and remove the node with the tablet description lifetime.
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/platform-driver-x86/apLZF6b3F39z6bUc@google.com/
Assisted-by: Codex:gpt-5.6-sol [sparse]
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
---
.../platform/x86/x86-android-tablets/lenovo.c | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 88693b9a1b01..1b7a95f23306 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -138,9 +138,26 @@ static const struct software_node lenovo_yb1_x91_drv2604_1_node = {
.properties = lenovo_yb1_x91_drv2604_1_props,
};
+static const struct software_node lenovo_yb1_x91_rt5677_node;
+
+static const struct property_entry lenovo_yb1_x91_rt5677_props[] = {
+ /* GPIO2 drives the second speaker amp; GPIO4 drives headphones. */
+ PROPERTY_ENTRY_GPIO("speaker-enable2-gpios",
+ &lenovo_yb1_x91_rt5677_node, 2, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("headphone-enable-gpios",
+ &lenovo_yb1_x91_rt5677_node, 4, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node lenovo_yb1_x91_rt5677_node = {
+ .name = "rt5677",
+ .properties = lenovo_yb1_x91_rt5677_props,
+};
+
static const struct software_node *lenovo_yb1_x91_swnodes[] = {
&lenovo_yb1_x91_drv2604_0_node,
&lenovo_yb1_x91_drv2604_1_node,
+ &lenovo_yb1_x91_rt5677_node,
NULL
};
@@ -345,11 +362,53 @@ static const struct x86_i2c_client_info lenovo_yogabook_x91_i2c_clients[] __init
},
};
+#define YB1_X91_RT5677_DEVICE "i2c-10EC5677:00"
#define YB1_X91_DRV2604_0_DEVICE "i2c-DRV2604:00"
#define YB1_X91_DRV2604_1_DEVICE "i2c-DRV2604:01"
+static struct device *lenovo_yb1_x91_rt5677_dev;
static struct device *lenovo_yb1_x91_drv2604_devs[2];
+static void lenovo_yb1_x91_add_audio_props(struct device *dev)
+{
+ struct device *codec_dev;
+ int ret;
+
+ codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
+ YB1_X91_RT5677_DEVICE);
+ if (!codec_dev) {
+ dev_warn(dev, "cannot find %s, audio will be unavailable\n",
+ YB1_X91_RT5677_DEVICE);
+ return;
+ }
+
+ ret = device_add_software_node(codec_dev, &lenovo_yb1_x91_rt5677_node);
+ if (ret) {
+ put_device(codec_dev);
+ dev_warn(dev, "failed to add properties to %s: %d\n",
+ YB1_X91_RT5677_DEVICE, ret);
+ return;
+ }
+
+ /* Ensure the codec GPIO provider is initialized with the new fwnode. */
+ ret = device_reprobe(codec_dev);
+ if (ret)
+ dev_warn(dev, "failed to reprobe %s: %d\n",
+ YB1_X91_RT5677_DEVICE, ret);
+
+ lenovo_yb1_x91_rt5677_dev = codec_dev;
+}
+
+static void lenovo_yb1_x91_remove_audio_props(void)
+{
+ if (!lenovo_yb1_x91_rt5677_dev)
+ return;
+
+ device_remove_software_node(lenovo_yb1_x91_rt5677_dev);
+ put_device(lenovo_yb1_x91_rt5677_dev);
+ lenovo_yb1_x91_rt5677_dev = NULL;
+}
+
static void lenovo_yb1_x91_add_haptics_props(struct device *dev, int index,
const char *name)
{
@@ -392,6 +451,7 @@ static void lenovo_yb1_x91_remove_haptics_props(int index)
static int __init lenovo_yb1_x91_init(struct device *dev)
{
+ lenovo_yb1_x91_add_audio_props(dev);
lenovo_yb1_x91_add_haptics_props(dev, 0, YB1_X91_DRV2604_0_DEVICE);
lenovo_yb1_x91_add_haptics_props(dev, 1, YB1_X91_DRV2604_1_DEVICE);
@@ -402,6 +462,7 @@ static void lenovo_yb1_x91_exit(void)
{
lenovo_yb1_x91_remove_haptics_props(1);
lenovo_yb1_x91_remove_haptics_props(0);
+ lenovo_yb1_x91_remove_audio_props();
}
const struct x86_dev_info lenovo_yogabook_x91_info __initconst = {
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-08-29 22:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-27 23:16 [PATCH v2 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
2026-08-27 23:17 ` [PATCH v2 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
2026-08-29 13:06 ` Dmitry Torokhov
2026-08-29 22:57 ` [PATCH v3 0/3] platform/x86: Describe Yoga Book haptics and audio resources Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 1/3] platform/x86: x86-android-tablets: Describe Yoga Book haptics Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 2/3] platform/x86: x86-android-tablets: Add Yoga Book TS3A227E Maurizio Casciano
2026-08-29 22:57 ` [PATCH v3 3/3] platform/x86: x86-android-tablets: Add Yoga Book audio GPIOs Maurizio Casciano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®