Merge "input: touchscreen: remove gt9xx goodix touch driver"

This commit is contained in:
Linux Build Service Account 2017-03-13 11:49:58 -07:00 committed by Gerrit - the friendly Code Review server
commit b09bf7ca5d
9 changed files with 0 additions and 5090 deletions

View file

@ -1,104 +0,0 @@
Goodix GT9xx series touch controller
The Goodix GT9xx series touch controller is connected to the host processor via
I2C. The controller generates interrupts when the user touches the panel. The
host controller is expected to read the touch coordinates over I2C and pass
the coordinates to the rest of the system.
Required properties:
- compatible : Should be "goodix,gt9xx"
- reg : I2C slave address of the device.
- interrupt-parent : Parent of interrupt.
- interrupts : Configuration of touch panel controller interrupt
GPIO.
- goodix,product-id : Product identification of the controller.
- interrupt-gpios : Interrupt gpio which is to provide interrupts to
host, same as "interrupts" node.
- reset-gpios : Reset gpio to control the reset of chip.
- goodix,display-coords : Display coordinates in pixels. It is a four
tuple consisting of min x, min y, max x and
max y values.
Optional properties:
- avdd-supply : Power supply needed to power up the device, this is
for fixed voltage external regulator.
- vdd-supply : Power supply needed to power up the device, when use
external regulator, do not add this property.
- vcc-i2c-supply : Power source required to power up i2c bus.
GT9xx series can provide 1.8V from internal
LDO, add this properties base on hardware
design.
- goodix,panel-coords : Panel coordinates for the chip in pixels.
It is a four tuple consisting of min x,
min y, max x and max y values.
- goodix,i2c-pull-up : To specify pull up is required.
- goodix,force-update : To specify force update is allowed.
- goodix,enable-power-off : Power off touchscreen during suspend.
- goodix,button-map : Button map of key codes. The number of key codes
depend on panel.
- goodix,cfg-data0 : Touch screen controller config data group 0. Ask vendor
to provide that.
Driver supports maximum six config groups. If more than one
groups are defined, driver will select config group depending
on hardware configuration. If only config group 0 is defined,
it will be used for all hardware configurations.
Touch screen controller will use its onchip default config data
if this property is not present.
- goodix,cfg-data1 : Touch screen controller config data group 1. Ask vendor
to provide that.
- goodix,cfg-data2 : Touch screen controller config data group 2. Ask vendor
to provide that.
- goodix,cfg-data3 : Touch screen controller config data group 3. Ask vendor
to provide that.
- goodix,cfg-data4 : Touch screen controller config data group 4. Ask vendor
to provide that.
- goodix,cfg-data5 : Touch screen controller config data group 5. Ask vendor
to provide that.
- goodix,fw-name : Touch screen controller firmware file name.
- goodix,slide-wakeup : To specify slide-wakeup property is enabled or not.
- goodix,dbl-clk-wakeup : To specify dbl-clk-wakeup property is enabled or not.
- goodix,change-x2y : To specify change-x2y property is enabled or not.
- goodix,driver-send-cfg : To specify driver-send-cfg property is enabled or not.
- goodix,have-touch-key : To specify have-touch-key property is enabled or not.
- goodix,with-pen : To specify with-pen property is enabled or not.
Example:
i2c@f9927000 {
goodix@5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
interrupt-parent = <&msmgpio>;
interrupts = <17 0x2008>;
reset-gpios = <&msmgpio 16 0x00>;
interrupt-gpios = <&msmgpio 17 0x00>;
avdd-supply = <&tp_power>;
goodix,panel-coords = <0 0 720 1200>;
goodix,display-coords = <0 0 720 1080>;
goodix,button-map= <158 102 139>;
goodix,product-id = "915";
goodix,cfg-data0 = [
41 D0 02 00 05 0A 05 01 01 08
12 58 50 41 03 05 00 00 00 00
00 00 00 00 00 00 00 8C 2E 0E
28 24 73 13 00 00 00 83 03 1D
40 02 00 00 00 03 64 32 00 00
00 1A 38 94 C0 02 00 00 00 04
9E 1C 00 8D 20 00 7A 26 00 6D
2C 00 60 34 00 60 10 38 68 00
F0 50 35 FF FF 27 00 00 00 00
00 01 1B 14 0C 14 00 00 01 00
00 00 00 00 00 00 00 00 00 00
00 00 02 04 06 08 0A 0C 0E 10
12 14 16 18 1A 1C FF FF FF FF
FF FF FF FF FF FF FF FF FF FF
FF FF 00 02 04 06 08 0A 0C 0F
10 12 13 14 16 18 1C 1D 1E 1F
20 21 22 24 26 28 29 2A FF FF
FF FF FF FF FF FF FF 22 22 22
22 22 22 FF 07 01];
goodix,fw_name = "gtp_fw.bin";
goodix,have-touch-key;
goodix,driver-send-cfg;
};
};

View file

@ -1206,18 +1206,6 @@ config TOUCHSCREEN_IT7260_I2C
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called it7258_ts_i2c. module will be called it7258_ts_i2c.
config TOUCHSCREEN_GT9XX
bool "Goodix touchpanel GT9xx series"
depends on I2C
help
Say Y here if you have a Goodix GT9xx touchscreen.
Gt9xx controllers are multi touch controllers which can
report 5 touches at a time.
If unsure, say N.
source "drivers/input/touchscreen/gt9xx/Kconfig"
config TOUCHSCREEN_ST config TOUCHSCREEN_ST
bool "STMicroelectronics Touchscreen Driver" bool "STMicroelectronics Touchscreen Driver"
depends on I2C depends on I2C

View file

@ -98,5 +98,4 @@ obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o
obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o
obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xx/
obj-$(CONFIG_TOUCHSCREEN_ST) += st/ obj-$(CONFIG_TOUCHSCREEN_ST) += st/

View file

@ -1,51 +0,0 @@
#
# Goodix GT9xx Touchscreen driver
#
config GT9XX_TOUCHPANEL_DRIVER
tristate "Goodix GT9xx touchpanel driver"
depends on TOUCHSCREEN_GT9XX
default n
help
This is the main file for touchpanel driver for Goodix GT9xx
touchscreens.
Say Y here if you have a Goodix GT9xx touchscreen connected
to your system.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called gt9xx.
config GT9XX_TOUCHPANEL_UPDATE
tristate "Goodix GT9xx touchpanel auto update support"
depends on GT9XX_TOUCHPANEL_DRIVER
default n
help
This enables support for firmware update for Goodix GT9xx
touchscreens.
Say Y here if you have a Goodix GT9xx touchscreen connected
to your system.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called gt9xx_update.
config GT9XX_TOUCHPANEL_DEBUG
tristate "Goodix GT9xx Tools for debuging"
depends on GT9XX_TOUCHPANEL_DRIVER
default n
help
This is application debug interface support for Goodix GT9xx
touchscreens.
Say Y here if you want to have a Android app debug interface
to your system.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called gt9xx_tool.

View file

@ -1,8 +0,0 @@
#gt915 touchpanel driver
obj-$(CONFIG_GT9XX_TOUCHPANEL_DRIVER) += gt9xx.o
#gt915 update file
obj-$(CONFIG_GT9XX_TOUCHPANEL_UPDATE) += gt9xx_update.o
#debug tool
obj-$(CONFIG_GT9XX_TOUCHPANEL_DEBUG) += goodix_tool.o

View file

@ -1,600 +0,0 @@
/* drivers/input/touchscreen/goodix_tool.c
*
* 2010 - 2012 Goodix Technology.
* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
*
* 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.
*
* This program is distributed in the hope that it will be a reference
* to you, when you are integrating the GOODiX's CTP IC into your system,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* Version:1.6
* V1.0:2012/05/01,create file.
* V1.2:2012/06/08,modify some warning.
* V1.4:2012/08/28,modified to support GT9XX
* V1.6:new proc name
*/
#include "gt9xx.h"
#include <linux/mutex.h>
#include <linux/proc_fs.h>
#include <linux/debugfs.h>
#define DATA_LENGTH_UINT 512
#define CMD_HEAD_LENGTH (sizeof(struct st_cmd_head))
static char procname[20] = {0};
struct st_cmd_head {
u8 wr; /* write read flag 0:R 1:W 2:PID 3: */
u8 flag; /* 0:no need flag/int 1: need flag 2:need int */
u8 flag_addr[2];/* flag address */
u8 flag_val; /* flag val */
u8 flag_relation; /* flag_val:flag 0:not equal 1:equal 2:> 3:< */
u16 circle; /* polling cycle */
u8 times; /* plling times */
u8 retry; /* I2C retry times */
u16 delay; /* delay before read or after write */
u16 data_len; /* data length */
u8 addr_len; /* address length */
u8 addr[2]; /* address */
u8 res[3]; /* reserved */
} __packed;
static struct st_cmd_head cmd_head;
static u8 *cmd_data;
static struct i2c_client *gt_client;
static struct proc_dir_entry *goodix_proc_entry;
static struct mutex lock;
static s32 (*tool_i2c_read)(u8 *, u16);
static s32 (*tool_i2c_write)(u8 *, u16);
s32 data_length;
s8 ic_type[16] = {0};
static void tool_set_proc_name(char *procname)
{
char *months[12] = {"Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
char date[20] = {0};
char month[4] = {0};
int i = 0, n_month = 1, n_day = 0, n_year = 0, ret;
ret = sscanf(date, "%s %d %d", month, &n_day, &n_year);
if (!ret)
return;
for (i = 0; i < 12; ++i) {
if (!memcmp(months[i], month, 3)) {
n_month = i+1;
break;
}
}
snprintf(procname, 20, "gmnode%04d%02d%02d", n_year, n_month, n_day);
}
static s32 tool_i2c_read_no_extra(u8 *buf, u16 len)
{
s32 ret = -1;
u8 i = 0;
struct i2c_msg msgs[2] = {
{
.flags = !I2C_M_RD,
.addr = gt_client->addr,
.len = cmd_head.addr_len,
.buf = &buf[0],
},
{
.flags = I2C_M_RD,
.addr = gt_client->addr,
.len = len,
.buf = &buf[GTP_ADDR_LENGTH],
},
};
for (i = 0; i < cmd_head.retry; i++) {
ret = i2c_transfer(gt_client->adapter, msgs, 2);
if (ret > 0)
break;
}
if (i == cmd_head.retry) {
dev_err(&gt_client->dev, "I2C read retry limit over\n");
ret = -EIO;
}
return ret;
}
static s32 tool_i2c_write_no_extra(u8 *buf, u16 len)
{
s32 ret = -1;
u8 i = 0;
struct i2c_msg msg = {
.flags = !I2C_M_RD,
.addr = gt_client->addr,
.len = len,
.buf = buf,
};
for (i = 0; i < cmd_head.retry; i++) {
ret = i2c_transfer(gt_client->adapter, &msg, 1);
if (ret > 0)
break;
}
if (i == cmd_head.retry) {
dev_err(&gt_client->dev, "I2C write retry limit over\n");
ret = -EIO;
}
return ret;
}
static s32 tool_i2c_read_with_extra(u8 *buf, u16 len)
{
s32 ret = -1;
u8 pre[2] = {0x0f, 0xff};
u8 end[2] = {0x80, 0x00};
tool_i2c_write_no_extra(pre, 2);
ret = tool_i2c_read_no_extra(buf, len);
tool_i2c_write_no_extra(end, 2);
return ret;
}
static s32 tool_i2c_write_with_extra(u8 *buf, u16 len)
{
s32 ret = -1;
u8 pre[2] = {0x0f, 0xff};
u8 end[2] = {0x80, 0x00};
tool_i2c_write_no_extra(pre, 2);
ret = tool_i2c_write_no_extra(buf, len);
tool_i2c_write_no_extra(end, 2);
return ret;
}
static void register_i2c_func(void)
{
if (strcmp(ic_type, "GT8110") && strcmp(ic_type, "GT8105")
&& strcmp(ic_type, "GT801") && strcmp(ic_type, "GT800")
&& strcmp(ic_type, "GT801PLUS") && strcmp(ic_type, "GT811")
&& strcmp(ic_type, "GTxxx")) {
tool_i2c_read = tool_i2c_read_with_extra;
tool_i2c_write = tool_i2c_write_with_extra;
pr_debug("I2C function: with pre and end cmd\n");
} else {
tool_i2c_read = tool_i2c_read_no_extra;
tool_i2c_write = tool_i2c_write_no_extra;
pr_info("I2C function: without pre and end cmd\n");
}
}
static void unregister_i2c_func(void)
{
tool_i2c_read = NULL;
tool_i2c_write = NULL;
pr_info("I2C function: unregister i2c transfer function\n");
}
void uninit_wr_node(void)
{
cmd_data = NULL;
unregister_i2c_func();
proc_remove(goodix_proc_entry);
}
static u8 relation(u8 src, u8 dst, u8 rlt)
{
u8 ret = 0;
switch (rlt) {
case 0:
ret = (src != dst) ? true : false;
break;
case 1:
ret = (src == dst) ? true : false;
pr_debug("equal:src:0x%02x dst:0x%02x ret:%d\n",
src, dst, (s32)ret);
break;
case 2:
ret = (src > dst) ? true : false;
break;
case 3:
ret = (src < dst) ? true : false;
break;
case 4:
ret = (src & dst) ? true : false;
break;
case 5:
ret = (!(src | dst)) ? true : false;
break;
default:
ret = false;
break;
}
return ret;
}
/*
* Function:
* Comfirm function.
* Input:
* None.
* Output:
* Return write length.
*/
static u8 comfirm(void)
{
s32 i = 0;
u8 buf[32];
memcpy(buf, cmd_head.flag_addr, cmd_head.addr_len);
for (i = 0; i < cmd_head.times; i++) {
if (tool_i2c_read(buf, 1) <= 0) {
dev_err(&gt_client->dev, "Read flag data failed");
return FAIL;
}
if (true == relation(buf[GTP_ADDR_LENGTH], cmd_head.flag_val,
cmd_head.flag_relation)) {
pr_debug("value at flag addr:0x%02x\n",
buf[GTP_ADDR_LENGTH]);
pr_debug("flag value:0x%02x\n", cmd_head.flag_val);
break;
}
msleep(cmd_head.circle);
}
if (i >= cmd_head.times) {
dev_err(&gt_client->dev, "Didn't get the flag to continue");
return FAIL;
}
return SUCCESS;
}
#ifdef CONFIG_GT9XX_TOUCHPANEL_UPDATE
static s32 fill_update_info(char __user *user_buf,
size_t count, loff_t *ppos)
{
u8 buf[4];
buf[0] = show_len >> 8;
buf[1] = show_len & 0xff;
buf[2] = total_len >> 8;
buf[3] = total_len & 0xff;
return simple_read_from_buffer(user_buf, count, ppos,
buf, sizeof(buf));
}
#else
static s32 fill_update_info(char __user *user_buf,
size_t count, loff_t *ppos)
{
return -ENODEV;
}
#endif
/*
* Function:
* Goodix tool write function.
* Input:
* standard proc write function param.
* Output:
* Return write length.
*/
static ssize_t goodix_tool_write(struct file *filp, const char __user *userbuf,
size_t count, loff_t *ppos)
{
s32 ret = 0;
mutex_lock(&lock);
ret = copy_from_user(&cmd_head, userbuf, CMD_HEAD_LENGTH);
if (ret) {
dev_err(&gt_client->dev, "copy_from_user failed");
ret = -EFAULT;
goto exit;
}
dev_dbg(&gt_client->dev,
"wr: 0x%02x, flag:0x%02x, flag addr:0x%02x%02x\n", cmd_head.wr,
cmd_head.flag, cmd_head.flag_addr[0], cmd_head.flag_addr[1]);
dev_dbg(&gt_client->dev,
"flag val:0x%02x, flag rel:0x%02x,\n", cmd_head.flag_val,
cmd_head.flag_relation);
dev_dbg(&gt_client->dev, "circle:%u, times:%u, retry:%u, delay:%u\n",
(s32) cmd_head.circle, (s32) cmd_head.times,
(s32) cmd_head.retry, (s32)cmd_head.delay);
dev_dbg(&gt_client->dev,
"data len:%u, addr len:%u, addr:0x%02x%02x, write len: %u\n",
(s32)cmd_head.data_len, (s32)cmd_head.addr_len,
cmd_head.addr[0], cmd_head.addr[1], (s32)count);
if (cmd_head.data_len > (data_length - GTP_ADDR_LENGTH)) {
dev_err(&gt_client->dev, "data len %u > data buff %d, rejected\n",
cmd_head.data_len, (data_length - GTP_ADDR_LENGTH));
ret = -EINVAL;
goto exit;
}
if (cmd_head.wr == GTP_RW_WRITE) {
ret = copy_from_user(&cmd_data[GTP_ADDR_LENGTH],
&userbuf[CMD_HEAD_LENGTH], cmd_head.data_len);
if (ret) {
dev_err(&gt_client->dev, "copy_from_user failed");
ret = -EFAULT;
goto exit;
}
memcpy(&cmd_data[GTP_ADDR_LENGTH - cmd_head.addr_len],
cmd_head.addr, cmd_head.addr_len);
if (cmd_head.flag == GTP_NEED_FLAG) {
if (comfirm() == FAIL) {
dev_err(&gt_client->dev, "Confirm fail");
ret = -EINVAL;
goto exit;
}
} else if (cmd_head.flag == GTP_NEED_INTERRUPT) {
/* Need interrupt! */
}
if (tool_i2c_write(
&cmd_data[GTP_ADDR_LENGTH - cmd_head.addr_len],
cmd_head.data_len + cmd_head.addr_len) <= 0) {
dev_err(&gt_client->dev, "Write data failed");
ret = -EIO;
goto exit;
}
if (cmd_head.delay)
msleep(cmd_head.delay);
ret = cmd_head.data_len + CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_WRITE_IC_TYPE) { /* Write ic type */
ret = copy_from_user(&cmd_data[0],
&userbuf[CMD_HEAD_LENGTH],
cmd_head.data_len);
if (ret) {
dev_err(&gt_client->dev, "copy_from_user failed");
ret = -EFAULT;
goto exit;
}
if (cmd_head.data_len > sizeof(ic_type)) {
dev_err(&gt_client->dev,
"data len %u > data buff %zu, rejected\n",
cmd_head.data_len, sizeof(ic_type));
ret = -EINVAL;
goto exit;
}
memcpy(ic_type, cmd_data, cmd_head.data_len);
register_i2c_func();
ret = cmd_head.data_len + CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_NO_WRITE) {
ret = cmd_head.data_len + CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_DISABLE_IRQ) { /* disable irq! */
gtp_irq_disable(i2c_get_clientdata(gt_client));
#if GTP_ESD_PROTECT
gtp_esd_switch(gt_client, SWITCH_OFF);
#endif
ret = CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_ENABLE_IRQ) { /* enable irq! */
gtp_irq_enable(i2c_get_clientdata(gt_client));
#if GTP_ESD_PROTECT
gtp_esd_switch(gt_client, SWITCH_ON);
#endif
ret = CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_CHECK_RAWDIFF_MODE) {
struct goodix_ts_data *ts = i2c_get_clientdata(gt_client);
ret = copy_from_user(&cmd_data[GTP_ADDR_LENGTH],
&userbuf[CMD_HEAD_LENGTH], cmd_head.data_len);
if (ret) {
dev_err(&gt_client->dev, "copy_from_user failed");
goto exit;
}
if (cmd_data[GTP_ADDR_LENGTH]) {
pr_debug("gtp enter rawdiff\n");
ts->gtp_rawdiff_mode = true;
} else {
ts->gtp_rawdiff_mode = false;
pr_debug("gtp leave rawdiff\n");
}
ret = CMD_HEAD_LENGTH;
goto exit;
} else if (cmd_head.wr == GTP_RW_ENTER_UPDATE_MODE) {
/* Enter update mode! */
if (gup_enter_update_mode(gt_client) == FAIL) {
ret = -EBUSY;
goto exit;
}
} else if (cmd_head.wr == GTP_RW_LEAVE_UPDATE_MODE) {
/* Leave update mode! */
gup_leave_update_mode(gt_client);
} else if (cmd_head.wr == GTP_RW_UPDATE_FW) {
/* Update firmware! */
show_len = 0;
total_len = 0;
if (cmd_head.data_len + 1 > data_length) {
dev_err(&gt_client->dev, "data len %u > data buff %d, rejected\n",
cmd_head.data_len + 1, data_length);
ret = -EINVAL;
goto exit;
}
memset(cmd_data, 0, cmd_head.data_len + 1);
memcpy(cmd_data, &userbuf[CMD_HEAD_LENGTH],
cmd_head.data_len);
if (gup_update_proc((void *)cmd_data) == FAIL) {
ret = -EBUSY;
goto exit;
}
}
ret = CMD_HEAD_LENGTH;
exit:
memset(&cmd_head, 0, sizeof(cmd_head));
cmd_head.wr = 0xFF;
mutex_unlock(&lock);
return ret;
}
/*
* Function:
* Goodix tool read function.
* Input:
* standard proc read function param.
* Output:
* Return read length.
*/
static ssize_t goodix_tool_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
u16 data_len = 0;
s32 ret;
u8 buf[32];
mutex_lock(&lock);
if (cmd_head.wr & 0x1) {
dev_err(&gt_client->dev, "command head wrong\n");
ret = -EINVAL;
goto exit;
}
switch (cmd_head.wr) {
case GTP_RW_READ:
if (cmd_head.flag == GTP_NEED_FLAG) {
if (comfirm() == FAIL) {
dev_err(&gt_client->dev, "Confirm fail");
ret = -EINVAL;
goto exit;
}
} else if (cmd_head.flag == GTP_NEED_INTERRUPT) {
/* Need interrupt! */
}
memcpy(cmd_data, cmd_head.addr, cmd_head.addr_len);
pr_debug("[CMD HEAD DATA] ADDR:0x%02x%02x.\n", cmd_data[0],
cmd_data[1]);
pr_debug("[CMD HEAD ADDR] ADDR:0x%02x%02x.\n", cmd_head.addr[0],
cmd_head.addr[1]);
if (cmd_head.delay)
msleep(cmd_head.delay);
data_len = cmd_head.data_len;
if (data_len <= 0 || (data_len > data_length)) {
dev_err(&gt_client->dev, "Invalid data length %d\n",
data_len);
ret = -EINVAL;
goto exit;
}
if (data_len > count)
data_len = count;
if (tool_i2c_read(cmd_data, data_len) <= 0) {
dev_err(&gt_client->dev, "Read data failed\n");
ret = -EIO;
goto exit;
}
ret = simple_read_from_buffer(user_buf, count, ppos,
&cmd_data[GTP_ADDR_LENGTH], data_len);
break;
case GTP_RW_FILL_INFO:
ret = fill_update_info(user_buf, count, ppos);
break;
case GTP_RW_READ_VERSION:
/* Read driver version */
data_len = scnprintf(buf, sizeof(buf), "%s\n",
GTP_DRIVER_VERSION);
ret = simple_read_from_buffer(user_buf, count, ppos,
buf, data_len);
break;
default:
ret = -EINVAL;
break;
}
exit:
mutex_unlock(&lock);
return ret;
}
static const struct file_operations goodix_proc_fops = {
.write = goodix_tool_write,
.read = goodix_tool_read,
.open = simple_open,
.owner = THIS_MODULE,
};
s32 init_wr_node(struct i2c_client *client)
{
u8 i;
gt_client = client;
memset(&cmd_head, 0, sizeof(cmd_head));
cmd_data = NULL;
i = GTP_I2C_RETRY_5;
while ((!cmd_data) && i) {
cmd_data = devm_kzalloc(&client->dev,
i * DATA_LENGTH_UINT, GFP_KERNEL);
if (cmd_data)
break;
i--;
}
if (i) {
data_length = i * DATA_LENGTH_UINT;
dev_dbg(&client->dev, "Applied memory size:%d", data_length);
}
cmd_head.addr_len = 2;
cmd_head.retry = GTP_I2C_RETRY_5;
register_i2c_func();
mutex_init(&lock);
tool_set_proc_name(procname);
goodix_proc_entry = proc_create(procname,
S_IWUSR | S_IWGRP | S_IRUSR | S_IRGRP,
goodix_proc_entry,
&goodix_proc_fops);
if (goodix_proc_entry == NULL) {
dev_err(&client->dev, "Couldn't create proc entry");
return FAIL;
}
return SUCCESS;
}

File diff suppressed because it is too large Load diff

View file

@ -1,220 +0,0 @@
/* drivers/input/touchscreen/gt9xx.h
*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* 2010 - 2013 Goodix Technology.
*
* 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.
*
* This program is distributed in the hope that it will be a reference
* to you, when you are integrating the GOODiX's CTP IC into your system,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*/
#ifndef _GOODIX_GT9XX_H_
#define _GOODIX_GT9XX_H_
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/uaccess.h>
#if defined(CONFIG_FB)
#include <linux/notifier.h>
#include <linux/fb.h>
#elif defined(CONFIG_HAS_EARLYSUSPEND)
#include <linux/earlysuspend.h>
#define GOODIX_SUSPEND_LEVEL 1
#endif
#define MAX_BUTTONS 4
#define GOODIX_MAX_CFG_GROUP 6
#define GTP_FW_NAME_MAXSIZE 50
struct goodix_ts_platform_data {
int irq_gpio;
u32 irq_gpio_flags;
int reset_gpio;
u32 reset_gpio_flags;
const char *product_id;
const char *fw_name;
u32 x_max;
u32 y_max;
u32 x_min;
u32 y_min;
u32 panel_minx;
u32 panel_miny;
u32 panel_maxx;
u32 panel_maxy;
bool force_update;
bool i2c_pull_up;
bool enable_power_off;
size_t config_data_len[GOODIX_MAX_CFG_GROUP];
u8 *config_data[GOODIX_MAX_CFG_GROUP];
u32 button_map[MAX_BUTTONS];
u8 num_button;
bool have_touch_key;
bool driver_send_cfg;
bool change_x2y;
bool with_pen;
bool slide_wakeup;
bool dbl_clk_wakeup;
};
struct goodix_ts_data {
spinlock_t irq_lock;
struct i2c_client *client;
struct input_dev *input_dev;
struct goodix_ts_platform_data *pdata;
struct hrtimer timer;
struct workqueue_struct *goodix_wq;
struct work_struct work;
char fw_name[GTP_FW_NAME_MAXSIZE];
struct delayed_work goodix_update_work;
s32 irq_is_disabled;
s32 use_irq;
u16 abs_x_max;
u16 abs_y_max;
u16 addr;
u8 max_touch_num;
u8 int_trigger_type;
u8 green_wake_mode;
u8 chip_type;
u8 *config_data;
u8 enter_update;
u8 gtp_is_suspend;
u8 gtp_rawdiff_mode;
u8 gtp_cfg_len;
u8 fixed_cfg;
u8 esd_running;
u8 fw_error;
bool power_on;
struct mutex lock;
bool fw_loading;
bool force_update;
struct regulator *avdd;
struct regulator *vdd;
struct regulator *vcc_i2c;
#if defined(CONFIG_FB)
struct notifier_block fb_notif;
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
#endif
struct dentry *debug_base;
};
extern u16 show_len;
extern u16 total_len;
/***************************PART1:ON/OFF define*******************************/
#define GTP_CUSTOM_CFG 0
#define GTP_ESD_PROTECT 0
#define GTP_IRQ_TAB {\
IRQ_TYPE_EDGE_RISING,\
IRQ_TYPE_EDGE_FALLING,\
IRQ_TYPE_LEVEL_LOW,\
IRQ_TYPE_LEVEL_HIGH\
}
#define GTP_IRQ_TAB_RISING 0
#define GTP_IRQ_TAB_FALLING 1
#if GTP_CUSTOM_CFG
#define GTP_MAX_HEIGHT 800
#define GTP_MAX_WIDTH 480
#define GTP_INT_TRIGGER GTP_IRQ_TAB_RISING
#else
#define GTP_MAX_HEIGHT 4096
#define GTP_MAX_WIDTH 4096
#define GTP_INT_TRIGGER GTP_IRQ_TAB_FALLING
#endif
#define GTP_PRODUCT_ID_MAXSIZE 5
#define GTP_PRODUCT_ID_BUFFER_MAXSIZE 6
#define GTP_FW_VERSION_BUFFER_MAXSIZE 4
#define GTP_MAX_TOUCH 5
#define GTP_ESD_CHECK_CIRCLE 2000 /* jiffy: ms */
/***************************PART3:OTHER define*********************************/
#define GTP_DRIVER_VERSION "V1.8.1<2013/09/01>"
#define GTP_I2C_NAME "Goodix-TS"
#define GTP_POLL_TIME 10 /* jiffy: ms*/
#define GTP_ADDR_LENGTH 2
#define GTP_CONFIG_MIN_LENGTH 186
#define GTP_CONFIG_MAX_LENGTH 240
#define FAIL 0
#define SUCCESS 1
#define SWITCH_OFF 0
#define SWITCH_ON 1
/* Registers define */
#define GTP_READ_COOR_ADDR 0x814E
#define GTP_REG_SLEEP 0x8040
#define GTP_REG_SENSOR_ID 0x814A
#define GTP_REG_CONFIG_DATA 0x8047
#define GTP_REG_FW_VERSION 0x8144
#define GTP_REG_PRODUCT_ID 0x8140
#define GTP_I2C_RETRY_3 3
#define GTP_I2C_RETRY_5 5
#define GTP_I2C_RETRY_10 10
#define RESOLUTION_LOC 3
#define TRIGGER_LOC 8
/* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
#define GTP_I2C_ADDRESS_HIGH 0x14
#define GTP_I2C_ADDRESS_LOW 0x5D
#define GTP_VALID_ADDR_START 0x8040
#define GTP_VALID_ADDR_END 0x8177
/* GTP CM_HEAD RW flags */
#define GTP_RW_READ 0
#define GTP_RW_WRITE 1
#define GTP_RW_READ_IC_TYPE 2
#define GTP_RW_WRITE_IC_TYPE 3
#define GTP_RW_FILL_INFO 4
#define GTP_RW_NO_WRITE 5
#define GTP_RW_READ_ERROR 6
#define GTP_RW_DISABLE_IRQ 7
#define GTP_RW_READ_VERSION 8
#define GTP_RW_ENABLE_IRQ 9
#define GTP_RW_ENTER_UPDATE_MODE 11
#define GTP_RW_LEAVE_UPDATE_MODE 13
#define GTP_RW_UPDATE_FW 15
#define GTP_RW_CHECK_RAWDIFF_MODE 17
/* GTP need flag or interrupt */
#define GTP_NO_NEED 0
#define GTP_NEED_FLAG 1
#define GTP_NEED_INTERRUPT 2
/*****************************End of Part III********************************/
void gtp_esd_switch(struct i2c_client *client, int on);
int gtp_i2c_read_dbl_check(struct i2c_client *client, u16 addr,
u8 *rxbuf, int len);
int gtp_send_cfg(struct goodix_ts_data *ts);
void gtp_reset_guitar(struct goodix_ts_data *ts, int ms);
void gtp_irq_disable(struct goodix_ts_data *ts);
void gtp_irq_enable(struct goodix_ts_data *ts);
#ifdef CONFIG_GT9XX_TOUCHPANEL_DEBUG
s32 init_wr_node(struct i2c_client *client);
void uninit_wr_node(void);
#endif
u8 gup_init_update_proc(struct goodix_ts_data *ts);
s32 gup_enter_update_mode(struct i2c_client *client);
void gup_leave_update_mode(struct i2c_client *client);
s32 gup_update_proc(void *dir);
extern struct i2c_client *i2c_connect_client;
#endif /* _GOODIX_GT9XX_H_ */

File diff suppressed because it is too large Load diff