Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1242420
| From | Irina Tirdea <irina.tirdea@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v8 1/9] Input: goodix - use actual config length for each device type |
| Date | 2015-10-08 16:30 +0200 |
| Message-ID | <qhkmL-67a-43@gated-at.bofh.it> (permalink) |
| References | <qhkmJ-67a-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Each of the Goodix devices supported by this driver has a fixed size for
the configuration information registers. The size varies depending on the
device and is specified in the datasheet.
Use the proper configuration length as specified in the datasheet for
each device model, so we do not read more than the actual size of the
configuration registers.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Bastien Nocera <hadess@hadess.net>
---
drivers/input/touchscreen/goodix.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 4d113c9..56d0330 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -36,6 +36,7 @@ struct goodix_ts_data {
unsigned int max_touch_num;
unsigned int int_trigger_type;
bool rotated_screen;
+ int cfg_len;
};
#define GOODIX_MAX_HEIGHT 4096
@@ -45,6 +46,8 @@ struct goodix_ts_data {
#define GOODIX_MAX_CONTACTS 10
#define GOODIX_CONFIG_MAX_LENGTH 240
+#define GOODIX_CONFIG_911_LENGTH 186
+#define GOODIX_CONFIG_967_LENGTH 228
/* Register defines */
#define GOODIX_READ_COOR_ADDR 0x814E
@@ -115,6 +118,23 @@ static int goodix_i2c_read(struct i2c_client *client,
return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
}
+static int goodix_get_cfg_len(u16 id)
+{
+ switch (id) {
+ case 911:
+ case 9271:
+ case 9110:
+ case 927:
+ case 928:
+ return GOODIX_CONFIG_911_LENGTH;
+ case 912:
+ case 967:
+ return GOODIX_CONFIG_967_LENGTH;
+ default:
+ return GOODIX_CONFIG_MAX_LENGTH;
+ }
+}
+
static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
{
int touch_num;
@@ -230,8 +250,7 @@ static void goodix_read_config(struct goodix_ts_data *ts)
int error;
error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
- config,
- GOODIX_CONFIG_MAX_LENGTH);
+ config, ts->cfg_len);
if (error) {
dev_warn(&ts->client->dev,
"Error reading config (%d), using defaults\n",
@@ -398,6 +417,8 @@ static int goodix_ts_probe(struct i2c_client *client,
return error;
}
+ ts->cfg_len = goodix_get_cfg_len(id_info);
+
goodix_read_config(ts);
error = goodix_request_input_dev(ts, version_info, id_info);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v8 0/9] Goodix touchscreen enhancements Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 8/9] Input: goodix - add runtime power management support Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 9/9] Input: goodix - sort includes using inverse Xmas tree order Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 4/9] Input: goodix - add power management support Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 1/9] Input: goodix - use actual config length for each device type Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 7/9] Input: goodix - add sysfs interface to dump config Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 5/9] Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
[PATCH v8 3/9] Input: goodix - write configuration data to device Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:30 +0200
Re: [PATCH v8 0/9] Goodix touchscreen enhancements Arnd Bergmann <arnd@arndb.de> - 2015-10-08 16:40 +0200
RE: [PATCH v8 0/9] Goodix touchscreen enhancements "Tirdea, Irina" <irina.tirdea@intel.com> - 2015-10-09 13:10 +0200
Re: [PATCH v8 0/9] Goodix touchscreen enhancements Arnd Bergmann <arnd@arndb.de> - 2015-10-09 14:00 +0200
[PATCH v8 2/9] Input: goodix - reset device at init Irina Tirdea <irina.tirdea@intel.com> - 2015-10-08 16:40 +0200
Re: [PATCH v8 2/9] Input: goodix - reset device at init Bastien Nocera <hadess@hadess.net> - 2015-10-09 16:30 +0200
Re: [PATCH v8 2/9] Input: goodix - reset device at init kbuild test robot <lkp@intel.com> - 2015-10-11 01:40 +0200
Re: [PATCH v8 0/9] Goodix touchscreen enhancements Bastien Nocera <hadess@hadess.net> - 2015-10-09 16:30 +0200
Re: [PATCH v8 0/9] Goodix touchscreen enhancements Aleksei Mamlin <mamlinav@gmail.com> - 2015-10-09 18:10 +0200
csiph-web