touchscreen: stmpe-ts: enable module autoload
Subsystems (3)
PATCH 1/1 touchscreen: stmpe-ts: enable module autoload
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/touchscreen/stmpe-ts.c +1 -0
@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );
Signature · 1 line
2.4.1
Dmitry Torokhov
maintainerHi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0
drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );
Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Thanks.
Signature · 1 line
Dmitry
Am 22.05.2015 um 01:06 schrieb Dmitry Torokhov:
Quoted 28 lines
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Quoted 2 lines
Thanks.
The STMPE610 in my case is used on a small touchscreen for the Raspberry Pi and touchscreen controller as well as display controller are connected via SPI + a few GPIOs to the RPI.
The display controller is supported by the fbtft driver and the drivers for the respective display controllers have similar aliases. see e.g. drivers/staging/fbtft/fb_hx8353d.c
MODULE_ALIAS("spi:hx8353d");MODULE_ALIAS("platform:hx8353d");
Kernel module stmpe_ts is autoloaded only when it's found at enumerating the devices connected to SPI.
Below is the relevant part from the DT overlay.
Heiner
fragment@2 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
pitft: pitft@0{
compatible = "himax,hx8357d";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pitft_pins>;
spi-max-frequency = <32000000>;
rotate = <90>;
fps = <25>;
bgr;
buswidth = <8>;
dc-gpios = <&gpio 25 0>;
debug = <0>;
};
pitft_ts@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "st,stmpe610";
reg = <1>;
spi-max-frequency = <500000>;
irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */
interrupts = <24 2>; /* high-to-low edge triggered */
interrupt-parent = <&gpio>;
interrupt-controller;
stmpe_touchscreen {
compatible = "st,stmpe-ts";
st,sample-time = <4>;
st,mod-12b = <1>;
st,ref-sel = <0>;
st,adc-freq = <2>;
st,ave-ctrl = <3>;
st,touch-det-delay = <4>;
st,settling = <2>;
st,fraction-z = <7>;
st,i-drive = <0>;
};
stmpe_gpio: stmpe_gpio {
#gpio-cells = <2>;
compatible = "st,stmpe-gpio";
/*
* only GPIO2 is wired/available
* and it is wired to the backlight
*/
st,norequest-mask = <0x7b>;
};
};
};Dmitry Torokhov
maintainerQuoted 35 lines · Heiner Kallweit
Am 22.05.2015 um 01:06 schrieb Dmitry Torokhov:
Quoted 28 lines
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Quoted 2 lines
Thanks.
The STMPE610 in my case is used on a small touchscreen for the Raspberry Pi and touchscreen controller as well as display controller are connected via SPI + a few GPIOs to the RPI.
Quoted 6 lines
The display controller is supported by the fbtft driver and the drivers for the respective display controllers have similar aliases. see e.g.
drivers/staging/fbtft/fb_hx8353d.c
MODULE_ALIAS("spi:hx8353d");MODULE_ALIAS("platform:hx8353d");
I understand why both platform and spi aliases are needed forfb_hx8353d: FBTFT_REGISTER_DRIVER macro does register 2 separate drivers, one SPI and another platform, and so needs both aliases. You still have not explained why we need SPI alias for stmpe-ts which is MFD cell represented by a platform device/driver no matter what bus is used to connect stmpe itself, I2C or SPI.
What is the modalias on the stmpe-ts device in sysfs?
Thanks.
Signature · 1 line
Dmitry
Am 22.05.2015 um 20:29 schrieb Dmitry Torokhov:
Quoted 50 lines · Heiner Kallweit
Quoted 35 lines
Am 22.05.2015 um 01:06 schrieb Dmitry Torokhov:
Quoted 28 lines
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Quoted 2 lines
Thanks.
The STMPE610 in my case is used on a small touchscreen for the Raspberry Pi and touchscreen controller as well as display controller are connected via SPI + a few GPIOs to the RPI.
Quoted 6 lines
The display controller is supported by the fbtft driver and the drivers for the respective display controllers have similar aliases. see e.g.
drivers/staging/fbtft/fb_hx8353d.c
MODULE_ALIAS("spi:hx8353d");MODULE_ALIAS("platform:hx8353d");I understand why both platform and spi aliases are needed for
fb_hx8353d:FBTFT_REGISTER_DRIVERmacro does register 2 separate drivers, one SPI and another platform, and so needs both aliases. You still have not explained why we need SPI alias for stmpe-ts which is MFD cell represented by a platform device/driver no matter what bus is used to connect stmpe itself, I2C or SPI.
Quoted 4 lines
What is the modalias on the stmpe-ts device in sysfs?
Thanks.
These are the stmpe-related entries under /sys/devices:
./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-gpio ./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-ts
stmpe-ts/modalias is:
of:Nstmpe_touchscreenT<NULL>Cst,stmpe-ts
I also tried setting the of_match_table element of the driver struct to "st,stmpe-ts". But this didn't work help.
Only defining this spi alias enables autoload for whatever reason.
Heiner
Dmitry Torokhov
maintainerQuoted 55 lines · Heiner Kallweit
Am 22.05.2015 um 20:29 schrieb Dmitry Torokhov:
Quoted 50 lines · Heiner Kallweit
Quoted 35 lines
Am 22.05.2015 um 01:06 schrieb Dmitry Torokhov:
Quoted 28 lines
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Quoted 2 lines
Thanks.
The STMPE610 in my case is used on a small touchscreen for the Raspberry Pi and touchscreen controller as well as display controller are connected via SPI + a few GPIOs to the RPI.
Quoted 6 lines
The display controller is supported by the fbtft driver and the drivers for the respective display controllers have similar aliases. see e.g.
drivers/staging/fbtft/fb_hx8353d.c
MODULE_ALIAS("spi:hx8353d");MODULE_ALIAS("platform:hx8353d");I understand why both platform and spi aliases are needed for
fb_hx8353d:FBTFT_REGISTER_DRIVERmacro does register 2 separate drivers, one SPI and another platform, and so needs both aliases. You still have not explained why we need SPI alias for stmpe-ts which is MFD cell represented by a platform device/driver no matter what bus is used to connect stmpe itself, I2C or SPI.Quoted 4 lines
What is the modalias on the stmpe-ts device in sysfs?
Thanks.
Quoted 7 lines
These are the stmpe-related entries under
/sys/devices:./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-gpio ./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-ts
stmpe-ts/modalias is:
of:Nstmpe_touchscreenT<NULL>Cst,stmpe-ts
OK, that explains it. Does the patch below help?
Thanks.
Signature · 17 lines
Dmitry Input: stmpe-ts - fix automatic module loading From: Dmitry Torokhov <[email protected]> When STMPE is instantiated via device tree individual MFD cells rae formed with OF modaliases, not platform modaliases, and so we need to add OF device table to the driver if we want it to load automatically: of:Nstmpe_touchscreenT<NULL>Cst,stmpe-ts Reported-by: Heiner Kallweit <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/touchscreen/stmpe-ts.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/input/touchscreen/stmpe-ts.c +10 -2
@@ -383,13 +383,21 @@ static int stmpe_ts_remove(struct platform_device *pdev)static struct platform_driver stmpe_ts_driver = { .driver = { - .name =STMPE_TS_NAME , - }, + .name =STMPE_TS_NAME , + }, .probe = stmpe_input_probe, .remove = stmpe_ts_remove, };module_platform_driver (stmpe_ts_driver); +#ifdef CONFIG_OF +static const struct of_device_id stmpe_ts_ids[] = { + { .compatible ="st,stmpe-ts" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, stmpe_ts_ids); +#endif +MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" );
Am 22.05.2015 um 22:17 schrieb Dmitry Torokhov:
Quoted 61 lines · Heiner Kallweit
Quoted 60 lines
Am 22.05.2015 um 20:29 schrieb Dmitry Torokhov:
Quoted 50 lines · Heiner Kallweit
Quoted 35 lines
Am 22.05.2015 um 01:06 schrieb Dmitry Torokhov:
Quoted 28 lines
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
Even with poper DT config the module didn't autoload. That's fixed by this additional alias.
Tested successfully with a STMPE610-based Adafruit PITFT Plus 3.5" on RPI2 under Arch Linux ARM (kernel 3.18.13).
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 1 + 1 file changed, 1 insertion(+)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c module_platform_driver(stmpe_ts_driver); · line 397
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c +1
-0@@ -393,4 +393,5 @@ module_platform_driver(stmpe_ts_driver);MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("spi:" STMPE_TS_NAME );MODULE_ALIAS ("platform:" STMPE_TS_NAME );Bit this is not an SPI driver, it is a platform driver for a MFD cell. Why does adding SPI alias help?
Quoted 2 lines
Thanks.
The STMPE610 in my case is used on a small touchscreen for the Raspberry Pi and touchscreen controller as well as display controller are connected via SPI + a few GPIOs to the RPI.
Quoted 6 lines
The display controller is supported by the fbtft driver and the drivers for the respective display controllers have similar aliases. see e.g.
drivers/staging/fbtft/fb_hx8353d.c
MODULE_ALIAS("spi:hx8353d");MODULE_ALIAS("platform:hx8353d");I understand why both platform and spi aliases are needed for
fb_hx8353d:FBTFT_REGISTER_DRIVERmacro does register 2 separate drivers, one SPI and another platform, and so needs both aliases. You still have not explained why we need SPI alias for stmpe-ts which is MFD cell represented by a platform device/driver no matter what bus is used to connect stmpe itself, I2C or SPI.Quoted 4 lines
What is the modalias on the stmpe-ts device in sysfs?
Thanks.
These are the stmpe-related entries under
/sys/devices:./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-gpio ./soc/3f204000.spi/spi_master/spi0/spi0.1/stmpe-ts
Quoted 7 lines
Quoted 2 lines
stmpe-ts/modalias is:
of:Nstmpe_touchscreenT<NULL>Cst,stmpe-tsOK, that explains it. Does the patch below help?
Thanks.
Yes, with your patch autoloading works. Thanks.