@@ -167,6 +167,36 @@ static const struct ili2xxx_chip ili211x_chip = {
167
167
.resolution = 2048 ,
168
168
};
169
169
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
+
170
200
static int ili251x_read_reg (struct i2c_client * client ,
171
201
u8 reg , void * buf , size_t len )
172
202
{
@@ -447,6 +477,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
447
477
static const struct i2c_device_id ili210x_i2c_id [] = {
448
478
{ "ili210x" , (long )& ili210x_chip },
449
479
{ "ili2117" , (long )& ili211x_chip },
480
+ { "ili2120" , (long )& ili212x_chip },
450
481
{ "ili251x" , (long )& ili251x_chip },
451
482
{ }
452
483
};
@@ -455,6 +486,7 @@ MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id);
455
486
static const struct of_device_id ili210x_dt_ids [] = {
456
487
{ .compatible = "ilitek,ili210x" , .data = & ili210x_chip },
457
488
{ .compatible = "ilitek,ili2117" , .data = & ili211x_chip },
489
+ { .compatible = "ilitek,ili2120" , .data = & ili212x_chip },
458
490
{ .compatible = "ilitek,ili251x" , .data = & ili251x_chip },
459
491
{ }
460
492
};
0 commit comments