diff options
| author | Shantanu Jain <shjain@codeaurora.org> | 2016-10-19 19:04:29 +0530 |
|---|---|---|
| committer | Shantanu Jain <shjain@codeaurora.org> | 2016-10-25 16:49:09 +0530 |
| commit | 4a643cd13158da79ed6d23b4944f988fbe0816f5 (patch) | |
| tree | 962600d5100259be7dbbad0a745d761bbac7445e /drivers/input | |
| parent | 6d44e59f44a4c5929f594e6fd8de6e439a3c9cf3 (diff) | |
input: touchscreen: fix compilation errors for Goodix driver
Fix compilation errors for Goodix touch driver for msm-4.4
kernel after porting the driver. This includes replacing the
deprecated api(s) with proper ones and changing code for
proper compilation.
Change-Id: I2abd67a8ff647165ddedb385e80f8705d73d3100
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/touchscreen/gt9xx/goodix_tool.c | 45 | ||||
| -rw-r--r-- | drivers/input/touchscreen/gt9xx/gt9xx.c | 24 | ||||
| -rw-r--r-- | drivers/input/touchscreen/gt9xx/gt9xx.h | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/gt9xx/gt9xx_update.c | 10 |
4 files changed, 45 insertions, 35 deletions
diff --git a/drivers/input/touchscreen/gt9xx/goodix_tool.c b/drivers/input/touchscreen/gt9xx/goodix_tool.c index 99a29401b36f..1657f56558ce 100644 --- a/drivers/input/touchscreen/gt9xx/goodix_tool.c +++ b/drivers/input/touchscreen/gt9xx/goodix_tool.c @@ -236,14 +236,13 @@ static u8 relation(u8 src, u8 dst, u8 rlt) return ret; } -/******************************************************* +/* * Function: - * Comfirm function. + * Comfirm function. * Input: - * None. + * None. * Output: * Return write length. - ******************************************************* */ static u8 comfirm(void) { @@ -301,11 +300,11 @@ static s32 fill_update_info(char __user *user_buf, * Function: * Goodix tool write function. * Input: - * standard proc write function param. + * standard proc write function param. * Output: * Return write length. */ -static s32 goodix_tool_write(struct file *filp, const char __user *userbuf, +static ssize_t goodix_tool_write(struct file *filp, const char __user *userbuf, size_t count, loff_t *ppos) { s32 ret = 0; @@ -318,20 +317,22 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf, goto exit; } - dev_dbg(>_client->dev, "wr:0x%02x, flag:0x%02x, flag addr:0x%02x%02x, - flag val:0x%02x, flag rel:0x%02x,", cmd_headd.wr, - cmd_head.flag, cmd_head.flag_addr[0], - cmd_head.flag_addr[1], cmd_head.flag_val, - cmd_head.flag_relation); - dev_dbg(>_client->dev, "circle:%d, times:%d, retry:%d, delay:%d, - data len:%d, addr len:%d, addr:0x%02x%02x, write len: %d", - (s32)cmd_head.circle, (s32)cmd_head.times, (s32)cmd_head.retry, - (s32)cmd_head.delay, (s32)cmd_head.data_len, - (s32)cmd_head.addr_len, cmd_head.addr[0], cmd_head.addr[1], - (s32)count); + dev_dbg(>_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(>_client->dev, + "flag val:0x%02x, flag rel:0x%02x,\n", cmd_head.flag_val, + cmd_head.flag_relation); + dev_dbg(>_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(>_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(>_client->dev, "data len %d > data buff %d, rejected\n", + dev_err(>_client->dev, "data len %u > data buff %d, rejected\n", cmd_head.data_len, (data_length - GTP_ADDR_LENGTH)); ret = -EINVAL; goto exit; @@ -383,7 +384,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf, if (cmd_head.data_len > sizeof(ic_type)) { dev_err(>_client->dev, - "data len %d > data buff %d, rejected\n", + "data len %u > data buff %zu, rejected\n", cmd_head.data_len, sizeof(ic_type)); ret = -EINVAL; goto exit; @@ -445,7 +446,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf, show_len = 0; total_len = 0; if (cmd_head.data_len + 1 > data_length) { - dev_err(>_client->dev, "data len %d > data buff %d, rejected\n", + dev_err(>_client->dev, "data len %u > data buff %d, rejected\n", cmd_head.data_len + 1, data_length); ret = -EINVAL; goto exit; @@ -470,11 +471,11 @@ exit: * Function: * Goodix tool read function. * Input: - * standard proc read function param. + * standard proc read function param. * Output: * Return read length. */ -static s32 goodix_tool_read(struct file *file, char __user *user_buf, +static ssize_t goodix_tool_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { u16 data_len = 0; diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c index 043af6f493f5..ead935120624 100644 --- a/drivers/input/touchscreen/gt9xx/gt9xx.c +++ b/drivers/input/touchscreen/gt9xx/gt9xx.c @@ -48,6 +48,7 @@ #include <linux/module.h> #include <linux/input/mt.h> #include <linux/debugfs.h> +#include <linux/interrupt.h> #define GOODIX_DEV_NAME "Goodix-CTP" #define CFG_MAX_TOUCH_POINTS 5 @@ -65,6 +66,8 @@ #define RESET_DELAY_T3_US 200 /* T3: > 100us */ #define RESET_DELAY_T4 20 /* T4: > 5ms */ +#define SLEEP_DELAY_US 5000 +#define WAKE_UP_DELAY_US 5000 #define PHY_BUF_SIZE 32 #define PROP_NAME_SIZE 24 @@ -645,7 +648,7 @@ void gtp_reset_guitar(struct goodix_ts_data *ts, int ms) else gpio_direction_output(ts->pdata->irq_gpio, 0); - usleep(RESET_DELAY_T3_US); + usleep_range(RESET_DELAY_T3_US, RESET_DELAY_T3_US + 1); gpio_direction_output(ts->pdata->reset_gpio, 1); msleep(RESET_DELAY_T4); @@ -738,7 +741,7 @@ static u8 gtp_enter_sleep(struct goodix_ts_data *ts) } return 0; } - usleep(5000); + usleep_range(SLEEP_DELAY_US, SLEEP_DELAY_US + 1); while (retry++ < GTP_I2C_RETRY_5) { ret = gtp_i2c_write(ts->client, i2c_control_buf, 3); if (ret == 1) { @@ -807,7 +810,8 @@ err_retry: } else { ret = gpio_direction_output( ts->pdata->irq_gpio, 1); - usleep(5000); + usleep_range(WAKE_UP_DELAY_US, + WAKE_UP_DELAY_US + 1); } } ret = gtp_i2c_test(ts->client); @@ -854,7 +858,7 @@ static int gtp_init_panel(struct goodix_ts_data *ts) if (ts->pdata->driver_send_cfg) { for (i = 0; i < GOODIX_MAX_CFG_GROUP; i++) - dev_dbg(&client->dev, "Config Groups(%d) Lengths: %d", + dev_dbg(&client->dev, "Config Groups(%d) Lengths: %zu", i, ts->pdata->config_data_len[i]); ret = gtp_i2c_read_dbl_check(ts->client, 0x41E4, opr_buf, 1); @@ -1171,7 +1175,8 @@ static int gtp_request_irq(struct goodix_ts_data *ts) int ret; const u8 irq_table[] = GTP_IRQ_TAB; - GTP_DEBUG("INT trigger type:%x, irq=%d", ts->int_trigger_type, + dev_dbg(&ts->client->dev, "INT trigger type:%x, irq=%d", + ts->int_trigger_type, ts->client->irq); ret = request_threaded_irq(ts->client->irq, NULL, @@ -1273,7 +1278,7 @@ exit_free_inputdev: static int reg_set_optimum_mode_check(struct regulator *reg, int load_uA) { return (regulator_count_voltages(reg) > 0) ? - regulator_set_optimum_mode(reg, load_uA) : 0; + regulator_set_load(reg, load_uA) : 0; } /** @@ -1818,7 +1823,7 @@ static int goodix_parse_dt(struct device *dev, u32 temp_val, num_buttons; u32 button_map[MAX_BUTTONS]; char prop_name[PROP_NAME_SIZE]; - int i, read_cfg_num; + int i, read_cfg_num, temp; rc = goodix_ts_get_dt_coords(dev, "goodix,panel-coords", pdata); if (rc && (rc != -EINVAL)) @@ -1900,14 +1905,15 @@ static int goodix_parse_dt(struct device *dev, read_cfg_num = 0; for (i = 0; i < GOODIX_MAX_CFG_GROUP; i++) { + temp = 0; snprintf(prop_name, sizeof(prop_name), "goodix,cfg-data%d", i); - prop = of_find_property(np, prop_name, - &pdata->config_data_len[i]); + prop = of_find_property(np, prop_name, &temp); if (!prop || !prop->value) { pdata->config_data_len[i] = 0; pdata->config_data[i] = NULL; continue; } + pdata->config_data_len[i] = temp; pdata->config_data[i] = devm_kzalloc(dev, GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH, GFP_KERNEL); diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.h b/drivers/input/touchscreen/gt9xx/gt9xx.h index 7acb5dcc3051..1e85e2fce276 100644 --- a/drivers/input/touchscreen/gt9xx/gt9xx.h +++ b/drivers/input/touchscreen/gt9xx/gt9xx.h @@ -75,6 +75,7 @@ struct goodix_ts_data { 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; diff --git a/drivers/input/touchscreen/gt9xx/gt9xx_update.c b/drivers/input/touchscreen/gt9xx/gt9xx_update.c index a91256c576e3..6bc243492272 100644 --- a/drivers/input/touchscreen/gt9xx/gt9xx_update.c +++ b/drivers/input/touchscreen/gt9xx/gt9xx_update.c @@ -67,6 +67,8 @@ #define FAIL 0 #define SUCCESS 1 +#define RESET_DELAY_US 20000 + struct st_fw_head { u8 hw_info[4]; /* hardware info */ u8 pid[8]; /* product id */ @@ -390,7 +392,7 @@ s32 gup_enter_update_mode(struct i2c_client *client) /* step1:RST output low last at least 2ms */ gpio_direction_output(ts->pdata->reset_gpio, 0); - usleep(20000); + usleep_range(RESET_DELAY_US, RESET_DELAY_US + 1); /* step2:select I2C slave addr,INT:0--0xBA;1--0x28. */ gpio_direction_output(ts->pdata->irq_gpio, @@ -565,8 +567,8 @@ static s8 gup_update_config(struct i2c_client *client, !memcmp(&pid[GTP_ADDR_LENGTH], "960", 3)) { chip_cfg_len = 228; } - pr_debug("config file ASCII len:%d", cfg->size); - pr_debug("need config binary len:%d", chip_cfg_len); + pr_debug("config file ASCII len: %zu", cfg->size); + pr_debug("need config binary len: %u", chip_cfg_len); if ((cfg->size + 5) < chip_cfg_len * 5) { pr_err("Config length error"); return -EINVAL; @@ -643,7 +645,7 @@ static s32 gup_get_firmware_file(struct i2c_client *client, return -EEXIST; } - dev_dbg(&client->dev, "Config File: %s size=%d", path, fw->size); + dev_dbg(&client->dev, "Config File: %s size: %zu", path, fw->size); msg->fw_data = devm_kzalloc(&client->dev, fw->size, GFP_KERNEL); if (!msg->fw_data) { |
