Input: tsc2007: Add device tree support.
Subsystems (5)
PATCH v4 1/4 Input: tsc2007: Add device tree support.
---
ChangeLog v2->v4:
- The x-plate-ohms property was renamed to ti,x-plate-ohms.
- multilines strings were avoided.
- shorten the message related to the lack of ti,x-plate-ohms in the dts.
- whitespace fix in tsc2007_get_pendown_state_dt(struct tsc2007 *ts)
- (ts->gpio < 0) replaced by !gpio_is_valid(ts->gpio)
- devm_kzalloc is now used instead of kzalloc, and some minor code change was made because of that.
--- .../bindings/input/touchscreen/tsc2007.txt | 44 +++++ drivers/input/touchscreen/tsc2007.c | 201 +++++++++++++++----- 2 files changed, 200 insertions(+), 45 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt new file +44 -0
@@ -0,0 +1,44 @@ +* Texas Instruments tsc2007 touchscreen controller + +Required properties: +- compatible: must be "ti,tsc2007". +- reg: I2C address of the chip. +- pinctrl-0: Should specify pin control groups used for this controller + (see pinctrl bindings[0]). +- pinctrl-names: Should contain only one value - "default" + (see pinctrl bindings[0]). +- interrupt-parent: the phandle for the interrupt controller + (see interrupt binding[1]). +- interrupts: interrupt to which the chip is connected + (see interrupt binding[1]). +- ti,x-plate-ohms: X-plate resistance in ohms. + +Optional properties: +- gpios: the interrupt gpio the chip is connected to (trough the penirq pin) + (see GPIO binding[2] for more details). +- max-rt: maximum pressure. +- fuzzy: specifies the fuzz value that is used to filter noise from the event + stream. +- poll-period: how much time to wait(in millisecond) before reading again the + values from the tsc2007. + +[0]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt +[1]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +[2]: Documentation/devicetree/bindings/gpio/gpio.txt + +Example: + &i2c1 { + /* ... */ + tsc2007 at 49 { + compatible = "ti,tsc2007"; + reg = <0x49>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_tsc2007_1>; + interrupt-parent = <&gpio4>; + interrupts = <0x0 0x8>; + gpios = <&gpio4 0 0>; + ti,x-plate-ohms = <180>; + }; + + /* ... */ + };
drivers/input/touchscreen/tsc2007.c +156 -45
315 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 2/4 ARM: dts: cpuimx51 Add touchscreen support.
---
ChangeLog v2->v4:
- This patch was splitted, only the part enabling the audio was kept. Part of the rest has already been submited, and the remaining parts will be submited later, because they depend on changes touching other subsystems.
- The x-plate-ohms property was renamed to ti,x-plate-ohms.
- The tsc2007 label was added for consistency.
--- arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi +11 -0
@@ -42,6 +42,17 @@ compatible = "nxp,pcf8563"; reg = <0x51>; }; + + tsc2007: tsc2007 at 49 { + compatible = "ti,tsc2007"; + reg = <0x49>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_tsc2007_1>; + interrupt-parent = <&gpio4>; + interrupts = <0x0 0x8>; + gpios = <&gpio4 0 0>; + ti,x-plate-ohms = <180>; + }; }; &iomuxc {
Signature · 1 line
1.7.9.5
PATCH v4 3/4 ARM: dts: cpuimx35 Add touchscreen support.
In reply to Denis Carikli---
ChangeLog v2->v4:
- This patch was splitted, only the part enabling the audio was kept. Part of the rest has already been submited, and the remaining parts will be submited later, because they depend on changes touching other subsystems.
- The x-plate-ohms property was renamed to ti,x-plate-ohms.
--- arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi +11 -0
@@ -41,6 +41,17 @@ compatible = "nxp,pcf8563"; reg = <0x51>; }; + + tsc2007: tsc2007 at 48 { + compatible = "ti,tsc2007"; + reg = <0x48>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_tsc2007_1>; + interrupt-parent = <&gpio3>; + interrupts = <0x2 0x8>; + gpios = <&gpio3 2 0>; + ti,x-plate-ohms = <180>; + }; }; &iomuxc {
Signature · 1 line
1.7.9.5
PATCH v4 4/4 ARM: imx_v6_v7_defconfig: Enable tsc2007 support.
In reply to Denis CarikliThe eukrea cpuimx35 and cpuimx51 have a tsc2007 touchscreen controller,
so we turn it on.
---
ChangeLog v2->v4:
- This patch was splitted, only the part enabling the audio was kept. Part of the rest has already been submited, and the remaining parts will be submited later, because they depend on changes touching other subsystems.
--- arch/arm/configs/imx_v6_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/imx_v6_v7_defconfig +1 -0
@@ -130,6 +130,7 @@ CONFIG_MOUSE_PS2_ELANTECH=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_EGALAX=y CONFIG_TOUCHSCREEN_MC13783=y +CONFIG_TOUCHSCREEN_TSC2007=y CONFIG_INPUT_MISC=y CONFIG_INPUT_MMA8450=y CONFIG_SERIO_SERPORT=m
Signature · 1 line
1.7.9.5
Dmitry Torokhov
maintainerPATCH v4 1/4 Input: tsc2007: Add device tree support.
In reply to Denis CarikliHi Denis,
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;
Instead of special casing "if (ts->of)" all over the place why don't you set up the device structure as:
if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;
and be done with it?
Thanks.
Signature · 1 line
Dmitry
PATCH v4 1/4 Input: tsc2007: Add device tree support.
Hi,
Quoted 11 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;Instead of special casing "if (
ts->of)" all over the place why don't you set up the device structure as:
Quoted 5 lines
if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;and be done with it?
I also thought about that, but the existing function does not have any parameters, while the DT version of get_pendown_state() requires to get the GPIO passed to it somehow.
Lothar Wa?mann
Signature · 9 lines
___________________________________________________________ Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Gesch?ftsf?hrer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info at karo-electronics.de ___________________________________________________________
Dmitry Torokhov
maintainerPATCH v4 1/4 Input: tsc2007: Add device tree support.
Quoted 13 lines · Lothar Wa?mann
Hi,
Quoted 11 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;Instead of special casing "if (
ts->of)" all over the place why don't you set up the device structure as:
Quoted 8 lines
Quoted 5 lines
if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;and be done with it?
I also thought about that, but the existing function does not have any parameters, while the DT version of
get_pendown_state()requires to get the GPIO passed to it somehow.
You can always have tsc2007_get_pendown_state_platform() wrapping the call. Or we just go and fix board code.
Thanks.
Signature · 1 line
Dmitry
PATCH v4 1/4 Input: tsc2007: Add device tree support.
Hi,
Quoted 17 lines · Lothar Wa?mann
Quoted 16 lines
Hi,
Quoted 14 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;Instead of special casing "if (
ts->of)" all over the place why don't you set up the device structure as:if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
and be done with it?
I also thought about that, but the existing function does not have any parameters, while the DT version of
get_pendown_state()requires to get the GPIO passed to it somehow.You can always have
tsc2007_get_pendown_state_platform()wrapping the
Yes, but how would you pass the GPIO number to the get_pendown_state_dt() function? Global variables are just ugly.
Quoted 2 lines
call. Or we just go and fix board code.
That's IMO a better option, but not easy to achieve without breaking anything. The in-kernel platforms would be easy to fix, but there may be external users that still use the old hook, so you can't just remove it or change its semantics.
Lothar Wa?mann
Signature · 9 lines
___________________________________________________________ Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Gesch?ftsf?hrer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info at karo-electronics.de ___________________________________________________________
Dmitry Torokhov
maintainerPATCH v4 1/4 Input: tsc2007: Add device tree support.
Quoted 21 lines · Lothar Wa?mann
Hi,
Quoted 19 lines · Lothar Wa?mann
Quoted 18 lines
Hi,
Quoted 16 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;Instead of special casing "if (
ts->of)" all over the place why don't you set up the device structure as:if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;and be done with it?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I also thought about that, but the existing function does not have any parameters, while the DT version of
get_pendown_state()requires to get the GPIO passed to it somehow.You can always have
tsc2007_get_pendown_state_platform()wrapping theYes, but how would you pass the GPIO number to the
get_pendown_state_dt()function? Global variables are just ugly.
You'd have
get_pendown_state_dt(struct tsc *)
get_pendown_state_platform(struct tsc *)
{
return ts->get_platform_pendown_state();
}and youd'd have
struct tsc {
...
bool (*get_pendown_state)(struct tsc);
bool (*get_platform_pendown_state)(void);Quoted 7 lines
Quoted 3 lines
call. Or we just go and fix board code.
That's IMO a better option, but not easy to achieve without breaking anything. The in-kernel platforms would be easy to fix, but there may be external users that still use the old hook, so you can't just remove it or change its semantics.
Sure can - they are out of tree after all.
Thanks.
Signature · 1 line
Dmitry
PATCH v4 1/4 Input: tsc2007: Add device tree support.
In reply to Dmitry TorokhovQuoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Lothar Wa?mann
Hi,
Quoted 14 lines · Denis Carikli
drivers/input/touchscreen/tsc2007.c static bool tsc2007_is_pen_down(struct tsc2007 *ts) · line 179
Quoted 6 lines
drivers/input/touchscreen/tsc2007.c +3
-0+if (ts->of) +return tsc2007_get_pendown_state_dt (ts); +if (!ts->get_pendown_state)return true;Instead of special casing "if (
ts->of)" all over the place why don't you set up the device structure as:if (<configuring_tsc2007_form_dt>) ts->get_pendown_state = tsc2007_get_pendown_state_dt;
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
and be done with it?
I also thought about that, but the existing function does not have any parameters, while the DT version of
get_pendown_state()requires to get the GPIO passed to it somehow.You can always have
tsc2007_get_pendown_state_platform()wrapping the call. Or we just go and fix board code.
I used to have a patch which did exactly that but never got around to submitting it. Essentially what it did was add a void * parameter to the .get_pendown_state() and .clear_penirq() callbacks, along with a new .callback_data field that the driver could set. At the same time there was some code to unify code for boards that merely use a simple GPIO as pendown.
I'm attaching what I think is the latest version. I no longer have access to the hardware so I can't test this, but perhaps it can serve as an example of how this could work. Sorry this isn't in the form of a proper patch.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tsc2007.patch
Type: text/x-diff
Size: 9863 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.sig>