Skip to content

Commit d0c5e7d

Browse files
z3ntudtor
authored andcommitted
Input: ili210x - add ili2120 support
This adds support for the Ilitek ili2120 touchscreen found in the Fairphone 2 smartphone. Signed-off-by: Luca Weiss <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent fbd1ec0 commit d0c5e7d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
Ilitek ILI210x/ILI2117/ILI251x touchscreen controller
1+
Ilitek ILI210x/ILI2117/ILI2120/ILI251x touchscreen controller
22

33
Required properties:
44
- compatible:
55
ilitek,ili210x for ILI210x
66
ilitek,ili2117 for ILI2117
7+
ilitek,ili2120 for ILI2120
78
ilitek,ili251x for ILI251x
89

910
- reg: The I2C address of the device

drivers/input/touchscreen/ili210x.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,36 @@ static const struct ili2xxx_chip ili211x_chip = {
167167
.resolution = 2048,
168168
};
169169

170+
static bool ili212x_touchdata_to_coords(const u8 *touchdata,
171+
unsigned int finger,
172+
unsigned int *x, unsigned int *y)
173+
{
174+
u16 val;
175+
176+
val = get_unaligned_be16(touchdata + 3 + (finger * 5) + 0);
177+
if (!(val & BIT(15))) /* Touch indication */
178+
return false;
179+
180+
*x = val & 0x3fff;
181+
*y = get_unaligned_be16(touchdata + 3 + (finger * 5) + 2);
182+
183+
return true;
184+
}
185+
186+
static bool ili212x_check_continue_polling(const u8 *data, bool touch)
187+
{
188+
return touch;
189+
}
190+
191+
static const struct ili2xxx_chip ili212x_chip = {
192+
.read_reg = ili210x_read_reg,
193+
.get_touch_data = ili210x_read_touch_data,
194+
.parse_touch_data = ili212x_touchdata_to_coords,
195+
.continue_polling = ili212x_check_continue_polling,
196+
.max_touches = 10,
197+
.has_calibrate_reg = true,
198+
};
199+
170200
static int ili251x_read_reg(struct i2c_client *client,
171201
u8 reg, void *buf, size_t len)
172202
{
@@ -447,6 +477,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
447477
static const struct i2c_device_id ili210x_i2c_id[] = {
448478
{ "ili210x", (long)&ili210x_chip },
449479
{ "ili2117", (long)&ili211x_chip },
480+
{ "ili2120", (long)&ili212x_chip },
450481
{ "ili251x", (long)&ili251x_chip },
451482
{ }
452483
};
@@ -455,6 +486,7 @@ MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id);
455486
static const struct of_device_id ili210x_dt_ids[] = {
456487
{ .compatible = "ilitek,ili210x", .data = &ili210x_chip },
457488
{ .compatible = "ilitek,ili2117", .data = &ili211x_chip },
489+
{ .compatible = "ilitek,ili2120", .data = &ili212x_chip },
458490
{ .compatible = "ilitek,ili251x", .data = &ili251x_chip },
459491
{ }
460492
};

0 commit comments

Comments
 (0)