Debian – Connect to i2c touchpad (in Device Tree) from Linux userspace

armdebiankernellinuxtouchpad

I'm trying to talk to a touchpad/trackpad listed in my laptop's device tree. The touchpad doesn't show up at all in /dev/ like my USB mouse does. I'm using a ASUS C201 Chromebook (codename veyron speedy) running Debian 9, mainline kernel, and by all accounts the touchpad is supposed to work, but I can't even see it in /dev/. I'm trying to figure out if Debian is even seeing it.

Here's the relevant portion of the device tree for this computer:

            trackpad {

                    trackpad-int {
                            rockchip,pins = <0x7 0x3 0x0 0x6a>;
                            linux,phandle = <0x31>;
                            phandle = <0x31>;
                    };
            };

Here's the output from cat /sys/kernel/debug/gpio:

gpiochip0: GPIOs 0-23, parent: platform/pinctrl, gpio0:
 gpio-5   (                    |Power               ) in  hi    
 gpio-6   (                    |Lid                 ) in  hi    
 gpio-8   (                    |gpio-charger        ) in  lo    
 gpio-11  (                    |vcc5_host1          ) out hi    
 gpio-12  (                    |vcc5_host2          ) out hi    
 gpio-13  (                    |?                   ) out lo    

gpiochip1: GPIOs 24-55, parent: platform/pinctrl, gpio1:

gpiochip2: GPIOs 56-87, parent: platform/pinctrl, gpio2:
 gpio-65  (                    |reset               ) in  lo    
 gpio-68  (                    |backlight_regulator ) out hi    
 gpio-69  (                    |vcc18_lcd           ) out hi    

gpiochip3: GPIOs 88-119, parent: platform/pinctrl, gpio3:

gpiochip4: GPIOs 120-151, parent: platform/pinctrl, gpio4:
 gpio-148 (                    |reset               ) in  lo    

gpiochip5: GPIOs 152-183, parent: platform/pinctrl, gpio5:
 gpio-171 (                    |vcc50_hdmi          ) out hi    

gpiochip6: GPIOs 184-215, parent: platform/pinctrl, gpio6:

gpiochip7: GPIOs 216-247, parent: platform/pinctrl, gpio7:
 gpio-218 (                    |enable              ) out hi    
 gpio-221 (                    |cd                  ) in  hi    
 gpio-230 (                    |panel_regulator     ) out hi    
 gpio-237 (                    |vcc_5v              ) out hi    

gpiochip8: GPIOs 248-263, parent: platform/pinctrl, gpio8:

Is one of these GPIOs the touchpad listed in the dtb?

Best Answer

The full declaration in rk3288-veyron-chromebook.dtsi is

&i2c4 {
    trackpad@15 {
        compatible = "elan,ekth3000";
        reg = <0x15>;
        interrupt-parent = <&gpio7>;
        interrupts = <RK_PA3 IRQ_TYPE_EDGE_FALLING>;
        pinctrl-names = "default";
        pinctrl-0 = <&trackpad_int>;
        vcc-supply = <&vcc33_io>;
        wakeup-source;
    };
};

Looking at the included file rk3288-veyron.dtsi, there is

&i2c4 {
    status = "okay";

    clock-frequency = <400000>;
    i2c-scl-falling-time-ns = <50>;         /* 11ns measured */
    i2c-scl-rising-time-ns = <300>;         /* 225ns measured */
};

and further at rk3288.dtsi

i2c4: i2c@ff160000 {
        compatible = "rockchip,rk3288-i2c";
        reg = <0x0 0xff160000 0x0 0x1000>;
        interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
        #address-cells = <1>;
        #size-cells = <0>;
        clock-names = "i2c";
        clocks = <&cru PCLK_I2C4>;
        pinctrl-names = "default";
        pinctrl-0 = <&i2c4_xfer>;
        status = "disabled";
};

So this looks very much like the I2C interface is not a GPIO interface, but uses a dedicated range of registers in the rockchip.

Have you tried looking for I2C busses in /sys/bus resp. /sys/class?

Related Question