Second STMPE811 as touchscreen on Colibri i.MX6


I am trying to modify the OE kernel to work with two STMPE811 chips to have two independent touchscreen interfaces. Is it possible somehow easily or I have to modify the drivers at low level?

When I was trying to simply add definition to a device tree it caused errors with the touchscreen interface file (sysfs: cannot create duplicate filename ‘/bus/platform/devices/stmpe-ts’). I solved it like that I modified the drivers/mfd/stmpe.c where I added new stmpe_ts_cell in which was changed the interface name. It is creating two files stmpe-ts and stmpe-ts1 in /sys/bus/platform/devices/ folder. How do I tell the kernel to register the stmpe-ts1 as touch screen device similar to stmpe-ts?

Is also necessary to modify the touchscreen.rules?

My patch is attached here.

Thank you for any advice


I can make the driver use instances by providing a properly named alias in the device tree.

--- a/arch/arm/boot/dts/imx6qdl-apalis-eval.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis-eval.dtsi
@@ -26,6 +26,9 @@
                mmc0 = &usdhc3; /* eMMC */
                mmc1 = &usdhc1; /* MMC1 8bit slot */
                mmc2 = &usdhc2; /* SD1  4bit slot */
+               stmpe-i2c0 = &stmpe811_1;
+               stmpe-i2c1 = &stmpe811_2;
        aliases {
@@ -194,6 +197,58 @@
+       /* STMPE811 touch screen controller */
+       stmpe811_2: stmpe811@41 {
+               compatible = "st,stmpe811";


--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -449,7 +449,7 @@
        /* STMPE811 touch screen controller */
-       stmpe811@41 {
+       stmpe811_1: stmpe811@41 {
                compatible = "st,stmpe811";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_touch_int>;


Hi Max,
thank you for a quick and correct answer. I can confirm that your solution is working, but I don’t understand it. Can you please explain it to me? Or share any materials where is this described so I don’t bother you with this kind questions?


This line does it:

It gets an ID from the alias name (the suffix after stmpe-i2c) and will use that to get unique name for the individual driver instances.
Without the alias all instances get the same name resulting in name clashes later on.

At least for this driver this feature is not documented here.
So I had to read the driver code to find the answer.