diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2012-06-28 15:08:13 +0200 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2012-06-29 15:58:04 +0200 |
commit | cf94bc09c89c923d339c68cf89360c02578ceee3 (patch) | |
tree | 28722fe5a388a47f2bee443f5702b0383873fe84 /drivers/input | |
parent | Input: atmel_mxt_ts - add variable length __mxt_write_reg (diff) | |
download | linux-cf94bc09c89c923d339c68cf89360c02578ceee3.tar.xz linux-cf94bc09c89c923d339c68cf89360c02578ceee3.zip |
Input: atmel_mxt_ts - optimize writing of object table entries
Write each object using a single bulk i2c write transfer.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index dd2577b796a4..99d5210c7ae8 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -655,7 +655,8 @@ static int mxt_check_reg_init(struct mxt_data *data) struct mxt_object *object; struct device *dev = &data->client->dev; int index = 0; - int i, j, config_offset; + int i, size; + int ret; if (!pdata->config) { dev_dbg(dev, "No cfg data defined, skipping reg init\n"); @@ -668,18 +669,17 @@ static int mxt_check_reg_init(struct mxt_data *data) if (!mxt_object_writable(object->type)) continue; - for (j = 0; - j < (object->size + 1) * (object->instances + 1); - j++) { - config_offset = index + j; - if (config_offset > pdata->config_length) { - dev_err(dev, "Not enough config data!\n"); - return -EINVAL; - } - mxt_write_object(data, object->type, j, - pdata->config[config_offset]); + size = (object->size + 1) * (object->instances + 1); + if (index + size > pdata->config_length) { + dev_err(dev, "Not enough config data!\n"); + return -EINVAL; } - index += (object->size + 1) * (object->instances + 1); + + ret = __mxt_write_reg(data->client, object->start_address, + size, &pdata->config[index]); + if (ret) + return ret; + index += size; } return 0; |