public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: mediatek: mt8188-geralt: enable touchpad
@ 2026-05-04  7:28 Icenowy Zheng
  2026-05-04  9:41 ` Chen-Yu Tsai
  0 siblings, 1 reply; 3+ messages in thread
From: Icenowy Zheng @ 2026-05-04  7:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	Icenowy Zheng

Despite the Ciri device's touchpad is on the detachable keyboard, the
I2C HID device seen by Linux is emulated by ChromeOS EC and always
present regardless of the presence of physical touchpad.

Enable the device in the device tree.

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
---
 .../boot/dts/mediatek/mt8188-geralt.dtsi      | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
index 8e423504ec052..8f801454bf84c 100644
--- a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
@@ -460,6 +460,18 @@ &i2c4 {
 	pinctrl-0 = <&i2c4_pins>;
 	clock-frequency = <400000>;
 	status = "okay";
+
+	/* The touchpad HID device is emulated by EC so it's always present */
+	touchpad: touchpad@56 {
+		compatible = "hid-over-i2c";
+		reg = <0x56>;
+		hid-descr-addr = <0x0001>;
+		interrupt-parent = <&pio>;
+		interrupts = <148 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&touchpad_int>;
+		wakeup-source;
+	};
 };
 
 &i2c5 {
@@ -1131,6 +1143,14 @@ pins-bus {
 		};
 	};
 
+	touchpad_int: touchpad-int-pins {
+		pins-ec-ap-touchpad-int-odl {
+			pinmux = <PINMUX_GPIO148__FUNC_B_GPIO148>;
+			input-enable;
+			bias-disable;
+		};
+	};
+
 	uart0_pins: uart0-pins {
 		pins-bus {
 			pinmux = <PINMUX_GPIO31__FUNC_O_UTXD0>,
-- 
2.52.0



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

* Re: [PATCH] arm64: dts: mediatek: mt8188-geralt: enable touchpad
  2026-05-04  7:28 [PATCH] arm64: dts: mediatek: mt8188-geralt: enable touchpad Icenowy Zheng
@ 2026-05-04  9:41 ` Chen-Yu Tsai
  2026-05-04 13:46   ` Icenowy Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Chen-Yu Tsai @ 2026-05-04  9:41 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Mon, May 4, 2026 at 3:28 PM Icenowy Zheng <zhengxingda@iscas.ac.cn> wrote:
>
> Despite the Ciri device's touchpad is on the detachable keyboard, the
> I2C HID device seen by Linux is emulated by ChromeOS EC and always
> present regardless of the presence of physical touchpad.

AFAIK it is actually an I2C HID device on the detachable keyboard.
The I2C bus is "tunneled" across the EC-EC connection. And if you
detach the keyboard, the I2C device will stop responding.

We have some downstream trickery to deal with this:

    https://crrev.com/c/6040044
    https://crrev.com/c/6040045

It basically involves registering the I2C device when the keyboard is
attached, and removing it when it is detached. We haven't gotten around
to upstreaming it though. I talked to Krzysztof about this design last
year, and I believe it was at least acceptable from DT point of view.

So this patch is somewhat incorrect, in that the trackpad should be
disabled by default, and its status should be toggled at runtime based
on the detachable keyboard events.

Otherwise if you boot the system without the keyboard, the driver will
probably fail to read the HID descriptor.


ChenYu

> Enable the device in the device tree.
>
> Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> ---
>  .../boot/dts/mediatek/mt8188-geralt.dtsi      | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> index 8e423504ec052..8f801454bf84c 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> @@ -460,6 +460,18 @@ &i2c4 {
>         pinctrl-0 = <&i2c4_pins>;
>         clock-frequency = <400000>;
>         status = "okay";
> +
> +       /* The touchpad HID device is emulated by EC so it's always present */
> +       touchpad: touchpad@56 {
> +               compatible = "hid-over-i2c";
> +               reg = <0x56>;
> +               hid-descr-addr = <0x0001>;
> +               interrupt-parent = <&pio>;
> +               interrupts = <148 IRQ_TYPE_LEVEL_LOW>;
> +               pinctrl-names = "default";
> +               pinctrl-0 = <&touchpad_int>;
> +               wakeup-source;
> +       };
>  };
>
>  &i2c5 {
> @@ -1131,6 +1143,14 @@ pins-bus {
>                 };
>         };
>
> +       touchpad_int: touchpad-int-pins {
> +               pins-ec-ap-touchpad-int-odl {
> +                       pinmux = <PINMUX_GPIO148__FUNC_B_GPIO148>;
> +                       input-enable;
> +                       bias-disable;
> +               };
> +       };
> +
>         uart0_pins: uart0-pins {
>                 pins-bus {
>                         pinmux = <PINMUX_GPIO31__FUNC_O_UTXD0>,
> --
> 2.52.0
>
>


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

* Re: [PATCH] arm64: dts: mediatek: mt8188-geralt: enable touchpad
  2026-05-04  9:41 ` Chen-Yu Tsai
@ 2026-05-04 13:46   ` Icenowy Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Icenowy Zheng @ 2026-05-04 13:46 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

在 2026-05-04一的 17:41 +0800,Chen-Yu Tsai写道:
> On Mon, May 4, 2026 at 3:28 PM Icenowy Zheng
> <zhengxingda@iscas.ac.cn> wrote:
> > 
> > Despite the Ciri device's touchpad is on the detachable keyboard,
> > the
> > I2C HID device seen by Linux is emulated by ChromeOS EC and always
> > present regardless of the presence of physical touchpad.
> 
> AFAIK it is actually an I2C HID device on the detachable keyboard.
> The I2C bus is "tunneled" across the EC-EC connection. And if you
> detach the keyboard, the I2C device will stop responding.

No, it looks that when the keyboard isn't attached, the I2C HID
descriptor can still be retrieved successfully. Its device ID is even
assigned in the ChromeOS EC device (and a TODO remains there, with a
placeholder 0x5099 gets shipped) [1].

[1]
https://github.com/coreboot/chrome-ec/blob/main/zephyr/program/geralt/i2c.dtsi#L161

> 
> We have some downstream trickery to deal with this:
> 
>     https://crrev.com/c/6040044
>     https://crrev.com/c/6040045
> 
> It basically involves registering the I2C device when the keyboard is
> attached, and removing it when it is detached. We haven't gotten
> around
> to upstreaming it though. I talked to Krzysztof about this design
> last
> year, and I believe it was at least acceptable from DT point of view.
> 
> So this patch is somewhat incorrect, in that the trackpad should be
> disabled by default, and its status should be toggled at runtime
> based
> on the detachable keyboard events.
> 
> Otherwise if you boot the system without the keyboard, the driver
> will
> probably fail to read the HID descriptor.

This doesn't happen on my device. When I boot w/o a keyboard attached,
a `hid-over-i2c 18D1:50FF` device still appears, and after I attach the
keyboard it correctly delivers trackpad events.

Thanks,
Icenowy

> 
> 
> ChenYu
> 
> > Enable the device in the device tree.
> > 
> > Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> > ---
> >  .../boot/dts/mediatek/mt8188-geralt.dtsi      | 20
> > +++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> > b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> > index 8e423504ec052..8f801454bf84c 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> > +++ b/arch/arm64/boot/dts/mediatek/mt8188-geralt.dtsi
> > @@ -460,6 +460,18 @@ &i2c4 {
> >         pinctrl-0 = <&i2c4_pins>;
> >         clock-frequency = <400000>;
> >         status = "okay";
> > +
> > +       /* The touchpad HID device is emulated by EC so it's always
> > present */
> > +       touchpad: touchpad@56 {
> > +               compatible = "hid-over-i2c";
> > +               reg = <0x56>;
> > +               hid-descr-addr = <0x0001>;
> > +               interrupt-parent = <&pio>;
> > +               interrupts = <148 IRQ_TYPE_LEVEL_LOW>;
> > +               pinctrl-names = "default";
> > +               pinctrl-0 = <&touchpad_int>;
> > +               wakeup-source;
> > +       };
> >  };
> > 
> >  &i2c5 {
> > @@ -1131,6 +1143,14 @@ pins-bus {
> >                 };
> >         };
> > 
> > +       touchpad_int: touchpad-int-pins {
> > +               pins-ec-ap-touchpad-int-odl {
> > +                       pinmux = <PINMUX_GPIO148__FUNC_B_GPIO148>;
> > +                       input-enable;
> > +                       bias-disable;
> > +               };
> > +       };
> > +
> >         uart0_pins: uart0-pins {
> >                 pins-bus {
> >                         pinmux = <PINMUX_GPIO31__FUNC_O_UTXD0>,
> > --
> > 2.52.0
> > 
> > 

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

end of thread, other threads:[~2026-05-04 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04  7:28 [PATCH] arm64: dts: mediatek: mt8188-geralt: enable touchpad Icenowy Zheng
2026-05-04  9:41 ` Chen-Yu Tsai
2026-05-04 13:46   ` Icenowy Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox