dt-bindings: input: sitronix-st1232: add compatible string for ST1633
Subsystems (3)
PATCH v2 1/2 dt-bindings: input: sitronix-st1232: add compatible string for ST1633
From: Martin Kepplinger <[email protected]>
The st1232 driver gains support for the ST1633 controller too; update the bindings doc accordingly.
--- .../bindings/input/touchscreen/sitronix-st1232.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt +4 -2
@@ -1,7 +1,9 @@ -* Sitronix st1232 touchscreen controller +* Sitronix st1232 or st1633 touchscreen controller Required properties: -- compatible: must be "sitronix,st1232" +- compatible: must contain one of + * "sitronix,st1232" + * "sitronix,st1633" - reg: I2C address of the chip - interrupts: interrupt to which the chip is connected
Signature · 1 line
2.20.1
PATCH v2 2/2 Input: st1232 - add support for st1633
From: Martin Kepplinger <[email protected]>
Add support for the Sitronix ST1633 touchscreen controller to the st1232 driver. A protocol spec can be found here:
www.ampdisplay.com/documents/pdf/AM-320480B6TZQW-TC0H.pdf
---
while this works, I'm not totally convinced by how the i2c path of probe looks. what do you say?
thanks!
revision history
----------------
v2: use device_get_match_data(), invent an internal "have_z" bool property
v1: initial idea for the change
drivers/input/touchscreen/Kconfig | 6 +- drivers/input/touchscreen/st1232.c | 126 ++++++++++++++++++++++------- 2 files changed, 98 insertions(+), 34 deletions(-)
drivers/input/touchscreen/Kconfig +3 -3
@@ -1168,11 +1168,11 @@ config TOUCHSCREEN_SIS_I2C module will be called sis_i2c. config TOUCHSCREEN_ST1232 - tristate "Sitronix ST1232 touchscreen controllers" + tristate "Sitronix ST1232 or ST1633 touchscreen controllers" depends on I2C help - Say Y here if you want to support Sitronix ST1232 - touchscreen controller. + Say Y here if you want to support the Sitronix ST1232 + or ST1633 touchscreen controller. If unsure, say N.
drivers/input/touchscreen/st1232.c +95 -31
216 lines not on this page · raw message
Signature · 1 line
2.20.1
Dmitry Torokhov
maintainerRe: [PATCH v2 2/2] Input: st1232 - add support for st1633
Hi Martin,
Quoted 11 lines · Martin Kepplinger
From: Martin Kepplinger <[email protected]>
Add support for the Sitronix ST1633 touchscreen controller to the st1232 driver. A protocol spec can be found here:
www.ampdisplay.com/documents/pdf/AM-320480B6TZQW-TC0H.pdfSigned-off-by Martin Kepplinger <[email protected]>---
while this works, I'm not totally convinced by how the i2c path of probe looks. what do you say?
Not quite what I had in mind. See below...
Quoted 9 lines
static int st1232_ts_probe(struct
i2c_client*client,drivers/input/touchscreen/st1232.c +3
-0const struct i2c_device_id *id) {struct st1232_ts_data *ts; +struct st1232_ts_finger *finger;struct input_dev *input_dev;int error; +const struct st_chip_info *match =NULL ; +
drivers/input/touchscreen/st1232.c static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron) · line 194
Quoted 10 lines
drivers/input/touchscreen/st1232.c +10
-0+if (dev_fwnode (&client->dev)) + match =device_get_match_data (&client->dev); +else if (id && id->driver_data == st1232) + match = &st1232_chip_info; +else if (id && id->driver_data == st1633) + match = &st1633_chip_info; +if (!match) { +dev_err (&client->dev,"unknown device model\n" ); +return -ENODEV ; + }
If you do:
static const struct i2c_device_id st1232_ts_id[] = {
{ ST1232_TS_NAME, (unsigned long)&st1232_chip_info },
{ ST1633_TS_NAME, (unsigned long)&st1633_chip_info },
{ }
};Then you can do:
match = device_get_match_data(&client->dev);
if (!match && id)
match = (const void *)id->driver_data;
if (!match) {
dev_err(&client->dev, "unknown device model\n");
return -ENODEV;
}Thanks.
Signature · 1 line
Dmitry