/*
- Driver for ELAN eKTF2127 i2c touchscreen controller
- For this driver the layout of the Chipone icn8318 i2c
- touchscreencontroller is used.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- Author:
*/
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/input/mt.h>
#include <linux/input/touchscreen.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/delay.h>
/* Packet header defines (first byte of data send / received) */
#define EKTF2127_NOISE 0x40
#define EKTF2127_RESPONSE 0x52
#define EKTF2127_REQUEST 0x53
#define EKTF2127_HELLO 0x55
#define EKTF2127_REPORT 0x5d
#define EKTF2127_CALIB_DONE 0x66
/* Register defines (second byte of data send / received) */
#define EKTF2127_ENV_NOISY 0x41
#define EKTF2127_HEIGHT 0x60
#define EKTF2127_WIDTH 0x63
/* 2 bytes header + 5 * 3 bytes coordinates + 3 bytes pressure info + footer */
#define EKTF2127_TOUCH_REPORT_SIZE 21
#define EKTF2127_MAX_TOUCHES 5
struct ektf2127_ts {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *power_gpios;
struct touchscreen_properties prop;
};
static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count,
struct input_mt_pos *touches)
{
int index = 0;
int i;
for (i = 0; i < touch_count; i++) {