atmel_mxt_ts patches, already signed-off
Subsystems (8)
cover atmel_mxt_ts patches, already signed-off
Hi Dimitry-
Here is a set of patches for atmel_mxt_ts that you've already signed-off. I've rebased them against the most recent mainline and made some very minor changes such as INIT_COMPLETION->reinit_completion.
thanks
Nick Dyer
PATCH 1/22 Input: atmel_mxt_ts - remove unnecessary platform data
It is not necessary to download these values to the maXTouch chip on every probe, since they are stored in NVRAM. It makes life difficult when tuning the device to keep them in sync with the config array/file, and requires a new kernel build for minor tweaks.
These parameters only represent a tiny subset of the available configuration options, tracking all of these options in platform data would be a endless task. In addition, different versions of maXTouch chips may have these values in different places or may not even have them at all.
Having these values also makes life more complex for device tree and other platforms where having to define a static configuration isn't helpful.
--- arch/arm/mach-s5pv210/mach-goni.c | 5 ---- drivers/input/touchscreen/atmel_mxt_ts.c | 50 ------------------------------- drivers/platform/chrome/chromeos_laptop.c | 10 ------- include/linux/i2c/atmel_mxt_ts.h | 6 +--- 4 files changed, 1 insertion(+), 70 deletions(-)
arch/arm/mach-s5pv210/mach-goni.c +0 -5
@@ -239,13 +239,8 @@ static void __init goni_radio_init(void)/* TSP */ static struct mxt_platform_data qt602240_platform_data = { - .x_line =17 , - .y_line =11 , .x_size =800 , .y_size =480 , - .blen =0x21 , - .threshold =0x28 , - .voltage =2800000 ,/* 2.8V */ .orient =MXT_DIAGONAL , .irqflags =IRQF_TRIGGER_FALLING , };
drivers/input/touchscreen/atmel_mxt_ts.c +0 -50
62 lines not on this page · raw message
drivers/platform/chrome/chromeos_laptop.c +0 -10
@@ -71,13 +71,8 @@ static struct i2c_board_info __initdata tsl2563_als_device = { };static struct mxt_platform_data atmel_224s_tp_platform_data = { - .x_line =18 , - .y_line =12 , .x_size =102 *20 , .y_size =68 *20 , - .blen =0x80 ,/* Gain setting is in upper 4 bits */ - .threshold =0x32 , - .voltage =0 ,/* 3.3V */ .orient =MXT_VERTICAL_FLIP , .irqflags =IRQF_TRIGGER_FALLING , .is_tp = true,
@@ -96,13 +91,8 @@ static struct i2c_board_info __initdata atmel_224s_tp_device = { };static struct mxt_platform_data atmel_1664s_platform_data = { - .x_line =32 , - .y_line =50 , .x_size =1700 , .y_size =2560 , - .blen =0x89 ,/* Gain setting is in upper 4 bits */ - .threshold =0x28 , - .voltage =0 ,/* 3.3V */ .orient =MXT_ROTATED_90_COUNTER , .irqflags =IRQF_TRIGGER_FALLING , .is_tp = false,
include/linux/i2c/atmel_mxt_ts.h +1 -5
@@ -33,14 +33,10 @@ struct mxt_platform_data {const u8 *config;size_t config_length; -unsigned int x_line; -unsigned int y_line;unsigned int x_size;unsigned int y_size; -unsigned int blen; -unsigned int threshold; -unsigned int voltage;unsigned char orient; +unsigned long irqflags;bool is_tp;const unsigned int key_map[MXT_NUM_GPIO ];
Signature · 1 line
1.8.3.2
PATCH 2/22 Input: atmel_mxt_ts - improve T19 GPIO keys handling
In reply to Nick Dyer * The mapping of the GPIO numbers into the T19 status byte varies between different maXTouch chips. Some have up to 7 GPIOs. Allowing a keycode array of up to 8 items is simpler and more generic. So replace #define with configurable number of keys which also allows the removal of is_tp.
* Rename platform data parameters to include "t19" to prevent confusion with T15 key array.
* Probe aborts early on when pdata is NULL, so no need to check.
* Move "int i" to beginning of function (mixed declarations and code)
* Use API calls rather than __set_bit()
* Remove unused dev variable.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 44 ++++++++++++------------------- drivers/platform/chrome/chromeos_laptop.c | 17 +++++++----- include/linux/i2c/atmel_mxt_ts.h | 7 ++--- 3 files changed, 30 insertions(+), 38 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +17 -27
@@ -180,12 +180,6 @@#define MXT_FWRESET_TIME 175/* msec */ -/* MXT_SPT_GPIOPWM_T19 field */ -#define MXT_GPIO0_MASK 0x04 -#define MXT_GPIO1_MASK 0x08 -#define MXT_GPIO2_MASK 0x10 -#define MXT_GPIO3_MASK 0x20 -/* Command to unlock bootloader */ #define MXT_UNLOCK_CMD_MSB 0xaa#define MXT_UNLOCK_CMD_LSB 0xdc
@@ -250,7 +244,6 @@ struct mxt_data {const struct mxt_platform_data *pdata;struct mxt_object *object_table;struct mxt_info info; -bool is_tp;unsigned int irq;unsigned int max_x;
@@ -515,15 +508,16 @@ static int mxt_write_object(struct mxt_data *data,static void mxt_input_button (struct mxt_data *data,struct mxt_message *message) {struct input_dev *input = data->input_dev; +const struct mxt_platform_data *pdata = data->pdata;bool button;int i;/* Active-low switch */ -for (i =0 ; i <MXT_NUM_GPIO ; i++) { -if (data->pdata->key_map[i] ==KEY_RESERVED ) +for (i =0 ; i < pdata->t19_num_keys; i++) { +if (pdata->t19_keymap[i] ==KEY_RESERVED )continue ; - button = !(message->message[0 ] &MXT_GPIO0_MASK << i); -input_report_key (input, data->pdata->key_map[i], button); + button = !(message->message[0 ] & (1 << i)); +input_report_key (input, pdata->t19_keymap[i], button); } }
@@ -1084,6 +1078,8 @@ static int mxt_probe(struct i2c_client *client,struct input_dev *input_dev;int error;unsigned int num_mt_slots; +unsigned int mt_flags =0 ; +int i;if (!pdata)return -EINVAL ;
@@ -1096,10 +1092,7 @@ static int mxt_probe(struct i2c_client *client, goto err_free_mem; } - data->is_tp = pdata && pdata->is_tp; - - input_dev->name = (data->is_tp) ?"Atmel maXTouch Touchpad" : -"Atmel maXTouch Touchscreen" ; + input_dev->name ="Atmel maXTouch Touchscreen" ;snprintf (data->phys,sizeof (data->phys),"i2c-%u-%04x/input0" , client->adapter->nr, client->addr);
@@ -1125,20 +1118,15 @@ static int mxt_probe(struct i2c_client *client,__set_bit (EV_KEY , input_dev->evbit);__set_bit (BTN_TOUCH , input_dev->keybit); -if (data->is_tp) { -int i; -__set_bit (INPUT_PROP_POINTER , input_dev->propbit); +if (pdata->t19_num_keys) {__set_bit (INPUT_PROP_BUTTONPAD , input_dev->propbit); -for (i =0 ; i <MXT_NUM_GPIO ; i++) -if (pdata->key_map[i] !=KEY_RESERVED ) -__set_bit (pdata->key_map[i], input_dev->keybit); +for (i =0 ; i < pdata->t19_num_keys; i++) +if (pdata->t19_keymap[i] !=KEY_RESERVED ) +input_set_capability (input_dev,EV_KEY , + pdata->t19_keymap[i]); -__set_bit (BTN_TOOL_FINGER , input_dev->keybit); -__set_bit (BTN_TOOL_DOUBLETAP , input_dev->keybit); -__set_bit (BTN_TOOL_TRIPLETAP , input_dev->keybit); -__set_bit (BTN_TOOL_QUADTAP , input_dev->keybit); -__set_bit (BTN_TOOL_QUINTTAP , input_dev->keybit); + mt_flags |=INPUT_MT_POINTER ;input_abs_set_res (input_dev,ABS_X ,MXT_PIXELS_PER_MM );input_abs_set_res (input_dev,ABS_Y ,MXT_PIXELS_PER_MM );
@@ -1146,6 +1134,8 @@ static int mxt_probe(struct i2c_client *client, MXT_PIXELS_PER_MM);input_abs_set_res (input_dev,ABS_MT_POSITION_Y ,MXT_PIXELS_PER_MM ); + + input_dev->name ="Atmel maXTouch Touchpad" ; }/* For single touch */
@@ -1158,7 +1148,7 @@ static int mxt_probe(struct i2c_client *client,/* For multi touch */ num_mt_slots = data->T9_reportid_max - data->T9_reportid_min +1 ; - error =input_mt_init_slots (input_dev, num_mt_slots,0 ); + error =input_mt_init_slots (input_dev, num_mt_slots, mt_flags);if (error) goto err_free_object; input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
drivers/platform/chrome/chromeos_laptop.c +11 -6
@@ -70,16 +70,22 @@ static struct i2c_board_info __initdata tsl2563_als_device = { I2C_BOARD_INFO("tsl2563", TAOS_ALS_I2C_ADDR), }; +static int mxt_t19_keys[] = { +KEY_RESERVED , +KEY_RESERVED , +KEY_RESERVED , +KEY_RESERVED , +KEY_RESERVED , +BTN_LEFT +}; +static struct mxt_platform_data atmel_224s_tp_platform_data = { .x_size =102 *20 , .y_size =68 *20 , .orient =MXT_VERTICAL_FLIP , .irqflags =IRQF_TRIGGER_FALLING , - .is_tp = true, - .key_map = {KEY_RESERVED , -KEY_RESERVED , -KEY_RESERVED , -BTN_LEFT }, + .t19_num_keys =ARRAY_SIZE (mxt_t19_keys), + .t19_keymap = mxt_t19_keys, .config =NULL , .config_length =0 , };
@@ -95,7 +101,6 @@ static struct mxt_platform_data atmel_1664s_platform_data = { .y_size = 2560, .orient = MXT_ROTATED_90_COUNTER, .irqflags = IRQF_TRIGGER_FALLING, - .is_tp = false, .config = NULL, .config_length = 0, };
include/linux/i2c/atmel_mxt_ts.h +2 -5
@@ -15,9 +15,6 @@#include <linux/types.h> -/* For key_map array */ -#define MXT_NUM_GPIO 4 -/* Orient */ #define MXT_NORMAL 0x0#define MXT_DIAGONAL 0x1
@@ -38,8 +35,8 @@ struct mxt_platform_data {unsigned char orient;unsigned long irqflags; -bool is_tp; - const unsigned int key_map[MXT_NUM_GPIO]; +u8 t19_num_keys; + const unsigned int *t19_keymap; };#endif /* __LINUX_ATMEL_MXT_TS_H */
Signature · 1 line
1.8.3.2
PATCH 3/22 Input: atmel_mxt_ts - return IRQ_NONE when interrupt handler fails
In reply to Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +1 -2
@@ -590,7 +590,7 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) do { if (mxt_read_message(data, &message)) { dev_err(dev, "Failed to read message\n"); - goto end; + return IRQ_NONE; } reportid = message.reportid;
@@ -617,7 +617,6 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)input_sync (data->input_dev); } -end:return IRQ_HANDLED ; }
Signature · 1 line
1.8.3.2
PATCH 4/22 Input: atmel_mxt_ts - define helper functions for size and instances
In reply to Nick DyerFrom: Daniel Kurtz <[email protected]>
These two object table entry fields are reported 1 less than their value. When used, however, we always want the actual size and instances.
To keep the object size and instances 1-byte fields, and thus preserve the object-table struct's 6-byte packed alignment, add some convenient accessor functions that do the +1 every time these fields are accessed.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 37 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +25 -12
@@ -2,6 +2,8 @@* Atmel maXTouch Touchscreen driver * * Copyright (C) 2010 Samsung Electronics Co.Ltd +* Copyright (C) 2012 Google, Inc. +* * Author: Joonyoung Shim <[email protected]> * * This program is free software; you can redistribute it and/or modify it
@@ -226,8 +228,8 @@ struct mxt_info {struct mxt_object {u8 type;u16 start_address; -u8 size;/* Size of each instance - 1 */ -u8 instances;/* Number of instances - 1 */ +u8 size_minus_one; +u8 instances_minus_one;u8 num_report_ids; } __packed;
@@ -256,6 +258,16 @@ struct mxt_data {u8 T19_reportid; }; +static size_t mxt_obj_size (const struct mxt_object *obj) +{ +return obj->size_minus_one +1 ; +} + +static size_t mxt_obj_instances (const struct mxt_object *obj) +{ +return obj->instances_minus_one +1 ; +} +static bool mxt_object_readable (unsigned int type) {switch (type) {
@@ -498,7 +510,7 @@ static int mxt_write_object(struct mxt_data *data,u16 reg; object =mxt_get_object (data, type); -if (!object || offset >= object->size +1 ) +if (!object || offset >=mxt_obj_size (object))return -EINVAL ; reg = object->start_address;
@@ -640,7 +652,7 @@ static int mxt_check_reg_init(struct mxt_data *data)if (!mxt_object_writable (object->type))continue ; - size = (object->size +1 ) * (object->instances +1 ); + size =mxt_obj_size (object) *mxt_obj_instances (object);if (index + size > pdata->config_length) {dev_err (dev,"Not enough config data!\n" );return -EINVAL ;
@@ -717,7 +729,7 @@ static int mxt_get_object_table(struct mxt_data *data)if (object->num_report_ids) { min_id = reportid; reportid += object->num_report_ids * - (object->instances +1 ); +mxt_obj_instances (object); max_id = reportid -1 ; }else { min_id =0 ;
@@ -725,9 +737,10 @@ static int mxt_get_object_table(struct mxt_data *data) }dev_dbg (&data->client->dev, -"Type %2d Start %3d Size %3d Instances %2d ReportIDs %3u : %3u\n" , - object->type, object->start_address, object->size +1 , - object->instances +1 , min_id, max_id); +"Type %2d Start %3d Size %3zd Instances %2zd ReportIDs %3u : %3u\n" , + object->type, object->start_address, +mxt_obj_size (object),mxt_obj_instances (object), + min_id, max_id);switch (object->type) {case MXT_GEN_COMMAND_T6 :
@@ -864,11 +877,11 @@ static ssize_t mxt_show_instance(char *buf, int count, {int i; -if (object->instances >0 ) +if (mxt_obj_instances (object) >1 ) count +=scnprintf (buf + count,PAGE_SIZE - count,"Instance %u\n" , instance); -for (i =0 ; i < object->size +1 ; i++) +for (i =0 ; i <mxt_obj_size (object); i++) count +=scnprintf (buf + count,PAGE_SIZE - count,"\t[%2u]: %02x (%d)\n" , i, val[i], val[i]); count +=scnprintf (buf + count,PAGE_SIZE - count,"\n" );
@@ -901,8 +914,8 @@ static ssize_t mxt_object_show(struct device *dev, count +=scnprintf (buf + count,PAGE_SIZE - count,"T%u:\n" , object->type); -for (j =0 ; j < object->instances +1 ; j++) { -u16 size = object->size +1 ; +for (j =0 ; j <mxt_obj_instances (object); j++) { +u16 size =mxt_obj_size (object);u16 addr = object->start_address + j * size; error =__mxt_read_reg (data->client, addr, size, obuf);
Signature · 1 line
1.8.3.2
PATCH 5/22 Input: atmel_mxt_ts - select FW_LOADER for firmware code
In reply to Nick Dyer--- drivers/input/touchscreen/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/input/touchscreen/Kconfig +1 -0
@@ -89,6 +89,7 @@ config TOUCHSCREEN_AD7879_SPI config TOUCHSCREEN_ATMEL_MXT tristate "Atmel mXT I2C Touchscreen" depends on I2C + select FW_LOADER help Say Y here if you have Atmel mXT series I2C touchscreen, such as AT42QT602240/ATMXT224, connected to your system.
Signature · 1 line
1.8.3.2
PATCH 6/22 Input: atmel_mxt_ts - wait for CHG assert in mxt_check_bootloader
In reply to Nick DyerFrom: Benson Leung <[email protected]>
The driver should not immediately read bootloader status when in Application Update Mode. The CHG line will assert when the device has made a state transition and is ready to report a new status via i2c.
This change adds a wait for completion in mxt_check_bootloader, and changes the mxt_interrupt handler to signal the completion.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 102 ++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 21 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +81 -21
@@ -14,6 +14,8 @@*/ #include <linux/module.h> +#include <linux/init.h> +#include <linux/completion.h> #include <linux/delay.h> #include <linux/firmware.h> #include <linux/i2c.h>
@@ -246,16 +248,19 @@ struct mxt_data {const struct mxt_platform_data *pdata;struct mxt_object *object_table;struct mxt_info info; -unsigned int irq;unsigned int max_x;unsigned int max_y; +bool in_bootloader;/* Cached parameters from object table */ u8 T6_reportid;u8 T9_reportid_min;u8 T9_reportid_max;u8 T19_reportid; + +/* for fw update in bootloader */ +struct completion bl_completion; };static size_t mxt_obj_size (const struct mxt_object *obj)
@@ -339,12 +344,50 @@ static void mxt_dump_message(struct device *dev, message->reportid, 7, message->message); } -static int mxt_check_bootloader (struct i2c_client *client, -unsigned int state) +static int mxt_wait_for_chg (struct mxt_data *data,unsigned int timeout_ms) { +struct device *dev = &data->client->dev; +struct completion *comp = &data->bl_completion; +unsigned long timeout =msecs_to_jiffies (timeout_ms); +long ret; + + ret =wait_for_completion_interruptible_timeout (comp, timeout); +if (ret <0 ) { +return ret; + }else if (ret ==0 ) { +dev_err (dev,"Wait for completion timed out.\n" ); +return -ETIMEDOUT ; + } +return 0 ; +} + +static int mxt_check_bootloader (struct mxt_data *data,unsigned int state) +{ +struct i2c_client *client = data->client;u8 val; +int ret; recheck: +if (state !=MXT_WAITING_BOOTLOAD_CMD ) { +/* +* In application update mode, the interrupt +* line signals state transitions. We must wait for the +* CHG assertion before reading the status byte. +* Once the status byte has been read, the line is deasserted. +*/ + ret =mxt_wait_for_chg (data,300 ); +if (ret) { +/* +* TODO: handle -ERESTARTSYS better by terminating +* fw update process before returning to userspace +* by writing length 0x000 to device (iff we are in +* WAITING_FRAME_DATA state). +*/ +dev_err (&client->dev,"Update wait error %d\n" , ret); +return ret; + } + } +if (i2c_master_recv (client, &val,1 ) !=1 ) {dev_err (&client->dev,"%s: i2c recv failed\n" , __func__);return -EIO ;
@@ -590,9 +633,8 @@ static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg)return (id >= data->T9_reportid_min && id <= data->T9_reportid_max); } -static irqreturn_t mxt_interrupt (int irq,void *dev_id) +static irqreturn_t mxt_process_messages_until_invalid (struct mxt_data *data) { -struct mxt_data *data = dev_id;struct mxt_message message;const u8 *payload = &message.message[0 ];struct device *dev = &data->client->dev;
@@ -632,6 +674,19 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } +static irqreturn_t mxt_interrupt (int irq,void *dev_id) +{ +struct mxt_data *data = dev_id; + +if (data->in_bootloader) { +/* bootloader state transition completion */ +complete (&data->bl_completion); +return IRQ_HANDLED ; + } + +return mxt_process_messages_until_invalid (data); +} +static int mxt_check_reg_init (struct mxt_data *data) {const struct mxt_platform_data *pdata = data->pdata;
@@ -947,6 +1002,8 @@ static int mxt_load_fw(struct device *dev, const char *fn) }/* Change to the bootloader mode */ + data->in_bootloader = true; +mxt_write_object (data,MXT_GEN_COMMAND_T6 ,MXT_COMMAND_RESET ,MXT_BOOT_VALUE );msleep (MXT_RESET_TIME );
@@ -957,18 +1014,19 @@ static int mxt_load_fw(struct device *dev, const char *fn)else client->addr =MXT_BOOT_HIGH ; - ret =mxt_check_bootloader (client,MXT_WAITING_BOOTLOAD_CMD ); +reinit_completion (&data->bl_completion); + + ret =mxt_check_bootloader (data,MXT_WAITING_BOOTLOAD_CMD );if (ret) - goto out; + goto disable_irq;/* Unlock bootloader */ mxt_unlock_bootloader (client);while (pos < fw->size) { - ret =mxt_check_bootloader (client, -MXT_WAITING_FRAME_DATA ); + ret =mxt_check_bootloader (data,MXT_WAITING_FRAME_DATA );if (ret) - goto out; + goto disable_irq; frame_size = ((*(fw->data + pos) <<8 ) | *(fw->data + pos +1 ));
@@ -980,17 +1038,19 @@ static int mxt_load_fw(struct device *dev, const char *fn)/* Write one frame to device */ mxt_fw_write (client, fw->data + pos, frame_size); - ret =mxt_check_bootloader (client, -MXT_FRAME_CRC_PASS ); + ret =mxt_check_bootloader (data,MXT_FRAME_CRC_PASS );if (ret) - goto out; + goto disable_irq; pos += frame_size;dev_dbg (dev,"Updated %d bytes / %zd bytes\n" , pos, fw->size); } -out: + data->in_bootloader = false; + +disable_irq: +disable_irq (data->irq);release_firmware (fw);/* Change to slave address of application */
@@ -1009,8 +1069,6 @@ static ssize_t mxt_update_fw_store(struct device *dev,struct mxt_data *data =dev_get_drvdata (dev);int error; -disable_irq (data->irq); - error =mxt_load_fw (dev,MXT_FW_NAME );if (error) {dev_err (dev,"The firmware update failed(%d)\n" , error);
@@ -1024,13 +1082,13 @@ static ssize_t mxt_update_fw_store(struct device *dev,mxt_free_object_table (data);mxt_initialize (data); - } -enable_irq (data->irq); +enable_irq (data->irq); - error =mxt_make_highchg (data); -if (error) -return error; + error =mxt_make_highchg (data); +if (error) +return error; + }return count; }
@@ -1120,6 +1178,8 @@ static int mxt_probe(struct i2c_client *client, data->pdata = pdata; data->irq = client->irq; +init_completion (&data->bl_completion); +mxt_calc_resolution (data); error =mxt_initialize (data);
Signature · 1 line
1.8.3.2
PATCH 7/22 Input: atmel_mxt_ts - wait for CHG after bootloader resets
In reply to Nick DyerFrom: Benson Leung <[email protected]>
Rather than msleep for MXT_RESET_TIME and MXT_FWRESET_TIME during the transition to bootloader mode and the transition back from app, wait for the CHG assert to indicate that the transition is done.
This change replaces the msleep with a wait for completion that the mxt_interrupt handler signals.
Also add CHG poll after last firmware frame - some bootloader versions will assert the interrupt line after the final frame, in testing this meant that the driver attempts to read the info block too early whilst the chip is still resetting.
This improves firmware update time as we no longer wait longer than necessary for each reset.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +15 -7
@@ -181,8 +181,8 @@#define MXT_BACKUP_VALUE 0x55#define MXT_BACKUP_TIME 50/* msec */ #define MXT_RESET_TIME 200/* msec */ - -#define MXT_FWRESET_TIME 175/* msec */ +#define MXT_FW_RESET_TIME 3000/* msec */ +#define MXT_FW_CHG_TIMEOUT 300/* msec */ /* Command to unlock bootloader */ #define MXT_UNLOCK_CMD_MSB 0xaa
@@ -375,7 +375,7 @@ recheck:* CHG assertion before reading the status byte. * Once the status byte has been read, the line is deasserted. */ - ret =mxt_wait_for_chg (data,300 ); + ret =mxt_wait_for_chg (data,MXT_FW_CHG_TIMEOUT );if (ret) {/* * TODO: handle -ERESTARTSYS better by terminating
@@ -1047,6 +1047,18 @@ static int mxt_load_fw(struct device *dev, const char *fn)dev_dbg (dev,"Updated %d bytes / %zd bytes\n" , pos, fw->size); } +/* Wait for flash. */ + ret =mxt_wait_for_chg (data,MXT_FW_RESET_TIME ); +if (ret) + goto disable_irq; + +/* +* Wait for device to reset. Some bootloader versions do not assert +* the CHG line after bootloading has finished, so ignore potential +* errors. +*/ +mxt_wait_for_chg (data,MXT_FW_RESET_TIME ); + data->in_bootloader = false; disable_irq:
@@ -1075,10 +1087,6 @@ static ssize_t mxt_update_fw_store(struct device *dev, count = error; }else {dev_dbg (dev,"The firmware update succeeded\n" ); - -/* Wait for reset */ -msleep (MXT_FWRESET_TIME ); -mxt_free_object_table (data);mxt_initialize (data);
Signature · 1 line
1.8.3.2
PATCH 8/22 Input: atmel_mxt_ts - make wait-after-reset period compatible with all chips
In reply to Nick DyerFrom: Iiro Valkonen <[email protected]>
The delay before the chip can be accessed after reset varies between different chips in maXTouch family. Waiting for an interrupt and a T6 status message with the RESET bit set is a better behaviour.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 109 ++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 22 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +87 -22
@@ -87,6 +87,9 @@#define MXT_COMMAND_REPORTALL 3#define MXT_COMMAND_DIAGNOSTIC 5 +/* Define for T6 status byte */ +#define MXT_T6_STATUS_RESET (1 << 7) +/* MXT_GEN_POWER_T7 field */ #define MXT_POWER_IDLEACQINT 0#define MXT_POWER_ACTVACQINT 1
@@ -178,9 +181,13 @@/* Define for MXT_GEN_COMMAND_T6 */ #define MXT_BOOT_VALUE 0xa5 +#define MXT_RESET_VALUE 0x01#define MXT_BACKUP_VALUE 0x55 + +/* Delay times */ #define MXT_BACKUP_TIME 50/* msec */ #define MXT_RESET_TIME 200/* msec */ +#define MXT_RESET_TIMEOUT 3000/* msec */ #define MXT_FW_RESET_TIME 3000/* msec */ #define MXT_FW_CHG_TIMEOUT 300/* msec */
@@ -255,12 +262,16 @@ struct mxt_data {/* Cached parameters from object table */ u8 T6_reportid; +u16 T6_address;u8 T9_reportid_min;u8 T9_reportid_max;u8 T19_reportid;/* for fw update in bootloader */ struct completion bl_completion; + +/* for reset handling */ +struct completion reset_completion; };static size_t mxt_obj_size (const struct mxt_object *obj)
@@ -344,10 +355,11 @@ static void mxt_dump_message(struct device *dev, message->reportid, 7, message->message); } -static int mxt_wait_for_chg (struct mxt_data *data,unsigned int timeout_ms) +static int mxt_wait_for_completion (struct mxt_data *data, +struct completion *comp, +unsigned int timeout_ms) {struct device *dev = &data->client->dev; -struct completion *comp = &data->bl_completion;unsigned long timeout =msecs_to_jiffies (timeout_ms);long ret;
@@ -375,7 +387,8 @@ recheck:* CHG assertion before reading the status byte. * Once the status byte has been read, the line is deasserted. */ - ret =mxt_wait_for_chg (data,MXT_FW_CHG_TIMEOUT ); + ret =mxt_wait_for_completion (data, &data->bl_completion, +MXT_FW_CHG_TIMEOUT );if (ret) {/* * TODO: handle -ERESTARTSYS better by terminating
@@ -654,6 +667,9 @@ static irqreturn_t mxt_process_messages_until_invalid(struct mxt_data *data)unsigned csum =mxt_extract_T6_csum (&payload[1 ]);dev_dbg (dev,"Status: %02x Config Checksum: %06x\n" , status, csum); + +if (status &MXT_T6_STATUS_RESET ) +complete (&data->reset_completion); }else if (mxt_is_T9_message (data, &message)) {int id = reportid - data->T9_reportid_min;mxt_input_touchevent (data, &message, id);
@@ -687,6 +703,59 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)return mxt_process_messages_until_invalid (data); } +static int mxt_t6_command (struct mxt_data *data,u16 cmd_offset, +u8 value,bool wait) +{ +u16 reg; +u8 command_register; +int timeout_counter =0 ; +int ret; + + reg = data->T6_address + cmd_offset; + + ret =mxt_write_reg (data->client, reg, value); +if (ret) +return ret; + +if (!wait) +return 0 ; + +do { +msleep (20 ); + ret =__mxt_read_reg (data->client, reg,1 , &command_register); +if (ret) +return ret; + }while (command_register !=0 && timeout_counter++ <=100 ); + +if (timeout_counter >100 ) { +dev_err (&data->client->dev,"Command failed!\n" ); +return -EIO ; + } + +return 0 ; +} + +static int mxt_soft_reset (struct mxt_data *data) +{ +struct device *dev = &data->client->dev; +int ret =0 ; + +dev_info (dev,"Resetting chip\n" ); + +reinit_completion (&data->reset_completion); + + ret =mxt_t6_command (data,MXT_COMMAND_RESET ,MXT_RESET_VALUE , false); +if (ret) +return ret; + + ret =mxt_wait_for_completion (data, &data->reset_completion, +MXT_RESET_TIMEOUT ); +if (ret) +return ret; + +return 0 ; +} +static int mxt_check_reg_init (struct mxt_data *data) {const struct mxt_platform_data *pdata = data->pdata;
@@ -800,6 +869,7 @@ static int mxt_get_object_table(struct mxt_data *data)switch (object->type) {case MXT_GEN_COMMAND_T6 : data->T6_reportid = min_id; + data->T6_address = object->start_address;break ;case MXT_TOUCH_MULTI_T9 : data->T9_reportid_min = min_id;
@@ -853,16 +923,10 @@ static int mxt_initialize(struct mxt_data *data)if (error) goto err_free_object_table; -/* Backup to memory */ -mxt_write_object (data,MXT_GEN_COMMAND_T6 , -MXT_COMMAND_BACKUPNV , -MXT_BACKUP_VALUE ); -msleep (MXT_BACKUP_TIME ); - -/* Soft reset */ -mxt_write_object (data,MXT_GEN_COMMAND_T6 , -MXT_COMMAND_RESET ,1 ); -msleep (MXT_RESET_TIME ); + error =mxt_t6_command (data,MXT_COMMAND_BACKUPNV , +MXT_BACKUP_VALUE , false); +if (!error) +mxt_soft_reset (data);/* Update matrix size at info struct */ error =mxt_read_reg (client,MXT_MATRIX_X_SIZE , &val);
@@ -1004,8 +1068,10 @@ static int mxt_load_fw(struct device *dev, const char *fn)/* Change to the bootloader mode */ data->in_bootloader = true; -mxt_write_object (data,MXT_GEN_COMMAND_T6 , -MXT_COMMAND_RESET ,MXT_BOOT_VALUE ); + ret =mxt_t6_command (data,MXT_COMMAND_RESET ,MXT_BOOT_VALUE , false); +if (ret) + goto release_firmware; +msleep (MXT_RESET_TIME );/* Change to slave address of bootloader */
@@ -1048,7 +1114,8 @@ static int mxt_load_fw(struct device *dev, const char *fn) }/* Wait for flash. */ - ret =mxt_wait_for_chg (data,MXT_FW_RESET_TIME ); + ret =mxt_wait_for_completion (data, &data->bl_completion, +MXT_FW_RESET_TIME );if (ret) goto disable_irq;
@@ -1057,12 +1124,13 @@ static int mxt_load_fw(struct device *dev, const char *fn)* the CHG line after bootloading has finished, so ignore potential * errors. */ -mxt_wait_for_chg (data,MXT_FW_RESET_TIME ); +mxt_wait_for_completion (data, &data->bl_completion,MXT_FW_RESET_TIME ); data->in_bootloader = false; disable_irq:disable_irq (data->irq); +release_firmware:release_firmware (fw);/* Change to slave address of application */
@@ -1187,6 +1255,7 @@ static int mxt_probe(struct i2c_client *client, data->irq = client->irq;init_completion (&data->bl_completion); +init_completion (&data->reset_completion);mxt_calc_resolution (data);
@@ -1314,11 +1383,7 @@ static int mxt_resume(struct device *dev)struct mxt_data *data =i2c_get_clientdata (client);struct input_dev *input_dev = data->input_dev; -/* Soft reset */ -mxt_write_object (data,MXT_GEN_COMMAND_T6 , -MXT_COMMAND_RESET ,1 ); - -msleep (MXT_RESET_TIME ); +mxt_soft_reset (data);mutex_lock (&input_dev->mutex);
Signature · 1 line
1.8.3.2
PATCH 9/22 Input: atmel_mxt_ts - improve error reporting and debug
In reply to Nick Dyer- Add error messages for probe errors
- Report type in invalid object type
- Tweak some other debug output messages
--- drivers/input/touchscreen/atmel_mxt_ts.c | 33 ++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +23 -10
@@ -420,7 +420,8 @@ recheck: }if (val != state) { -dev_err (&client->dev,"Unvalid bootloader mode state\n" ); +dev_err (&client->dev,"Invalid bootloader state %02X != %02X\n" , + val, state);return -EINVAL ; }
@@ -540,7 +541,7 @@ mxt_get_object(struct mxt_data *data, u8 type)return object; } -dev_err (&data->client->dev,"Invalid object type\n" ); +dev_err (&data->client->dev,"Invalid object type T%u\n" , type);return NULL ; }
@@ -861,7 +862,7 @@ static int mxt_get_object_table(struct mxt_data *data) }dev_dbg (&data->client->dev, -"Type %2d Start %3d Size %3zd Instances %2zd ReportIDs %3u : %3u\n" , +"T%u Start:%u Size:%zu Instances:%zu Report IDs:%u-%u\n" , object->type, object->start_address,mxt_obj_size (object),mxt_obj_instances (object), min_id, max_id);
@@ -915,13 +916,18 @@ static int mxt_initialize(struct mxt_data *data)/* Get object table information */ error =mxt_get_object_table (data); -if (error) +if (error) { +dev_err (&client->dev,"Error %d reading object table\n" , error); goto err_free_object_table; + }/* Check register init values */ error =mxt_check_reg_init (data); -if (error) +if (error) { +dev_err (&client->dev,"Error %d initializing configuration\n" , + error); goto err_free_object_table; + } error =mxt_t6_command (data,MXT_COMMAND_BACKUPNV ,MXT_BACKUP_VALUE , false);
@@ -940,12 +946,12 @@ static int mxt_initialize(struct mxt_data *data) info->matrix_ysize = val;dev_info (&client->dev, -"Family ID: %u Variant ID: %u Major.Minor.Build: %u.%u.%02X\n" , +"Family: %u Variant: %u Firmware V%u.%u.%02X\n" , info->family_id, info->variant_id, info->version >>4 , info->version &0xf , info->build);dev_info (&client->dev, -"Matrix X Size: %u Matrix Y Size: %u Object Num: %u\n" , +"Matrix X Size: %u Matrix Y Size: %u Objects: %u\n" , info->matrix_xsize, info->matrix_ysize, info->object_num);
@@ -1154,7 +1160,8 @@ static ssize_t mxt_update_fw_store(struct device *dev,dev_err (dev,"The firmware update failed(%d)\n" , error); count = error; }else { -dev_dbg (dev,"The firmware update succeeded\n" ); +dev_info (dev,"The firmware update succeeded\n" ); +mxt_free_object_table (data);mxt_initialize (data);
@@ -1325,12 +1332,18 @@ static int mxt_probe(struct i2c_client *client, goto err_free_irq; error =input_register_device (input_dev); -if (error) +if (error) { +dev_err (&client->dev,"Error %d registering input device\n" , + error); goto err_free_irq; + } error =sysfs_create_group (&client->dev.kobj, &mxt_attr_group); -if (error) +if (error) { +dev_err (&client->dev,"Failure %d creating sysfs group\n" , + error); goto err_unregister_device; + }return 0 ;
Signature · 1 line
1.8.3.2
PATCH 10/22 Input: atmel_mxt_ts - implement CRC check for configuration data
In reply to Nick DyerThe configuration is stored in NVRAM on the maXTouch chip. When the device is reset it reports a CRC of the stored configuration values. Therefore it isn't necessary to send the configuration on each probe - we can check the CRC matches and avoid a timeconsuming backup/reset cycle.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 60 +++++++++++++++++++++++++++----- include/linux/i2c/atmel_mxt_ts.h | 1 + 2 files changed, 53 insertions(+), 8 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +52 -8
@@ -188,6 +188,7 @@#define MXT_BACKUP_TIME 50/* msec */ #define MXT_RESET_TIME 200/* msec */ #define MXT_RESET_TIMEOUT 3000/* msec */ +#define MXT_CRC_TIMEOUT 1000/* msec */ #define MXT_FW_RESET_TIME 3000/* msec */ #define MXT_FW_CHG_TIMEOUT 300/* msec */
@@ -259,6 +260,7 @@ struct mxt_data {unsigned int max_x;unsigned int max_y;bool in_bootloader; +u32 config_crc;/* Cached parameters from object table */ u8 T6_reportid;
@@ -272,6 +274,9 @@ struct mxt_data {/* for reset handling */ struct completion reset_completion; + +/* for config update handling */ +struct completion crc_completion; };static size_t mxt_obj_size (const struct mxt_object *obj)
@@ -636,7 +641,7 @@ static void mxt_input_touchevent(struct mxt_data *data, } } -static unsigned mxt_extract_T6_csum (const u8 *csum) +static u16 mxt_extract_T6_csum (const u8 *csum) {return csum[0 ] | (csum[1 ] <<8 ) | (csum[2 ] <<16 ); }
@@ -654,6 +659,7 @@ static irqreturn_t mxt_process_messages_until_invalid(struct mxt_data *data)struct device *dev = &data->client->dev;u8 reportid;bool update_input = false; +u32 crc; do { if (mxt_read_message(data, &message)) {
@@ -665,9 +671,15 @@ static irqreturn_t mxt_process_messages_until_invalid(struct mxt_data *data)if (reportid == data->T6_reportid) {u8 status = payload[0 ]; -unsigned csum =mxt_extract_T6_csum (&payload[1 ]); + + crc =mxt_extract_T6_csum (&payload[1 ]); +if (crc != data->config_crc) { + data->config_crc = crc; +complete (&data->crc_completion); + } +dev_dbg (dev,"Status: %02x Config Checksum: %06x\n" , - status, csum); + status, data->config_crc);if (status &MXT_T6_STATUS_RESET )complete (&data->reset_completion);
@@ -757,6 +769,24 @@ static int mxt_soft_reset(struct mxt_data *data)return 0 ; } +static void mxt_update_crc (struct mxt_data *data,u8 cmd,u8 value) +{ +/* +* On failure, CRC is set to 0 and config will always be +* downloaded. +*/ + data->config_crc =0 ; +reinit_completion (&data->crc_completion); + +mxt_t6_command (data, cmd, value, true); + +/* +* Wait for crc message. On failure, CRC is set to 0 and config will +* always be downloaded. +*/ +mxt_wait_for_completion (data, &data->crc_completion,MXT_CRC_TIMEOUT ); +} +static int mxt_check_reg_init (struct mxt_data *data) {const struct mxt_platform_data *pdata = data->pdata;
@@ -771,6 +801,16 @@ static int mxt_check_reg_init(struct mxt_data *data)return 0 ; } +mxt_update_crc (data,MXT_COMMAND_REPORTALL ,1 ); + +if (data->config_crc == pdata->config_crc) { +dev_info (dev,"Config CRC 0x%06X: OK\n" , data->config_crc); +return 0 ; + } + +dev_info (dev,"Config CRC 0x%06X: does not match 0x%06X\n" , + data->config_crc, pdata->config_crc); +for (i =0 ; i < data->info.object_num; i++) { object = data->object_table + i;
@@ -790,6 +830,14 @@ static int mxt_check_reg_init(struct mxt_data *data) index += size; } +mxt_update_crc (data,MXT_COMMAND_BACKUPNV ,MXT_BACKUP_VALUE ); + + ret =mxt_soft_reset (data); +if (ret) +return ret; + +dev_info (dev,"Config successfully updated\n" ); +return 0 ; }
@@ -929,11 +977,6 @@ static int mxt_initialize(struct mxt_data *data) goto err_free_object_table; } - error =mxt_t6_command (data,MXT_COMMAND_BACKUPNV , -MXT_BACKUP_VALUE , false); -if (!error) -mxt_soft_reset (data); -/* Update matrix size at info struct */ error =mxt_read_reg (client,MXT_MATRIX_X_SIZE , &val);if (error)
@@ -1263,6 +1306,7 @@ static int mxt_probe(struct i2c_client *client,init_completion (&data->bl_completion);init_completion (&data->reset_completion); +init_completion (&data->crc_completion);mxt_calc_resolution (data);
include/linux/i2c/atmel_mxt_ts.h +1 -0
@@ -29,6 +29,7 @@struct mxt_platform_data {const u8 *config;size_t config_length; +u32 config_crc;unsigned int x_size;unsigned int y_size;
Signature · 1 line
1.8.3.2
PATCH 11/22 Input: atmel_mxt_ts - download device config using firmware loader
In reply to Nick DyerThe existing implementation which encodes the configuration as a binary blob in platform data is unsatisfactory since it requires a kernel recompile for the configuration to be changed, and it doesn't deal well with firmware changes that move values around on the chip.
Atmel define an ASCII format for the configuration which can be exported from their tools. This patch implements a parser for that format which loads the configuration via the firmware loader and sends it to the MXT chip.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 234 ++++++++++++++++++++++-------- drivers/platform/chrome/chromeos_laptop.c | 4 - include/linux/i2c/atmel_mxt_ts.h | 4 - 3 files changed, 176 insertions(+), 66 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +176 -58
@@ -35,8 +35,10 @@#define MXT_BOOT_LOW 0x24#define MXT_BOOT_HIGH 0x25 -/* Firmware */ +/* Firmware files */ #define MXT_FW_NAME "maxtouch.fw" +#define MXT_CFG_NAME "maxtouch.cfg" +#define MXT_CFG_MAGIC "OBP_RAW V1"/* Registers */ #define MXT_INFO 0x00
@@ -322,37 +324,6 @@ static bool mxt_object_readable(unsigned int type) } } -static bool mxt_object_writable (unsigned int type) -{ -switch (type) { -case MXT_GEN_COMMAND_T6 : -case MXT_GEN_POWER_T7 : -case MXT_GEN_ACQUIRE_T8 : -case MXT_TOUCH_MULTI_T9 : -case MXT_TOUCH_KEYARRAY_T15 : -case MXT_TOUCH_PROXIMITY_T23 : -case MXT_TOUCH_PROXKEY_T52 : -case MXT_PROCI_GRIPFACE_T20 : -case MXT_PROCG_NOISE_T22 : -case MXT_PROCI_ONETOUCH_T24 : -case MXT_PROCI_TWOTOUCH_T27 : -case MXT_PROCI_GRIP_T40 : -case MXT_PROCI_PALM_T41 : -case MXT_PROCI_TOUCHSUPPRESSION_T42 : -case MXT_PROCI_STYLUS_T47 : -case MXT_PROCG_NOISESUPPRESSION_T48 : -case MXT_SPT_COMMSCONFIG_T18 : -case MXT_SPT_GPIOPWM_T19 : -case MXT_SPT_SELFTEST_T25 : -case MXT_SPT_CTECONFIG_T28 : -case MXT_SPT_DIGITIZER_T43 : -case MXT_SPT_CTECONFIG_T46 : -return true; -default : -return false; - } -} -static void mxt_dump_message (struct device *dev,struct mxt_message *message) {
@@ -546,7 +517,7 @@ mxt_get_object(struct mxt_data *data, u8 type)return object; } -dev_err (&data->client->dev,"Invalid object type T%u\n" , type); +dev_warn (&data->client->dev,"Invalid object type T%u\n" , type);return NULL ; }
@@ -787,58 +758,205 @@ static void mxt_update_crc(struct mxt_data *data, u8 cmd, u8 value)mxt_wait_for_completion (data, &data->crc_completion,MXT_CRC_TIMEOUT ); } +/* +* mxt_check_reg_init - download configuration to chip +* +* Atmel Raw Config File Format +* +* The first four lines of the raw config file contain: +* 1) Version +* 2) Chip ID Information (first 7 bytes of device memory) +* 3) Chip Information Block 24-bit CRC Checksum +* 4) Chip Configuration 24-bit CRC Checksum +* +* The rest of the file consists of one line per object instance: +* <TYPE> <INSTANCE> <SIZE> <CONTENTS> +* +* <TYPE> - 2-byte object type as hex +* <INSTANCE> - 2-byte object instance number as hex +* <SIZE> - 2-byte object size as hex +* <CONTENTS> - array of <SIZE> 1-byte hex values +*/ static int mxt_check_reg_init (struct mxt_data *data) { -const struct mxt_platform_data *pdata = data->pdata; -struct mxt_object *object;struct device *dev = &data->client->dev; -int index =0 ; -int i, size; +struct mxt_info cfg_info; +struct mxt_object *object; +const struct firmware *cfg =NULL ;int ret; +int offset; +int pos; +int i; +u32 info_crc, config_crc; +unsigned int type, instance, size; +u8 val; +u16 reg; -if (!pdata->config) { -dev_dbg (dev,"No cfg data defined, skipping reg init\n" ); + ret =request_firmware (&cfg,MXT_CFG_NAME , dev); +if (ret <0 ) { +dev_err (dev,"Failure to request config file %s\n" , +MXT_CFG_NAME );return 0 ; }mxt_update_crc (data,MXT_COMMAND_REPORTALL ,1 ); -if (data->config_crc == pdata->config_crc) { -dev_info (dev,"Config CRC 0x%06X: OK\n" , data->config_crc); -return 0 ; +if (strncmp (cfg->data,MXT_CFG_MAGIC ,strlen (MXT_CFG_MAGIC ))) { +dev_err (dev,"Unrecognised config file\n" ); + ret = -EINVAL ; + goto release; } -dev_info (dev,"Config CRC 0x%06X: does not match 0x%06X\n" , - data->config_crc, pdata->config_crc); + pos =strlen (MXT_CFG_MAGIC ); + +/* Load information block and check */ +for (i =0 ; i <sizeof (struct mxt_info ); i++) { + ret =sscanf (cfg->data + pos,"%hhx%n" , + (unsigned char *)&cfg_info + i, + &offset); +if (ret !=1 ) { +dev_err (dev,"Bad format\n" ); + ret = -EINVAL ; + goto release; + } -for (i =0 ; i < data->info.object_num; i++) { - object = data->object_table + i; + pos += offset; + } + +if (cfg_info.family_id != data->info.family_id) { +dev_err (dev,"Family ID mismatch!\n" ); + ret = -EINVAL ; + goto release; + } + +if (cfg_info.variant_id != data->info.variant_id) { +dev_err (dev,"Variant ID mismatch!\n" ); + ret = -EINVAL ; + goto release; + } + +if (cfg_info.version != data->info.version) +dev_err (dev,"Warning: version mismatch!\n" ); + +if (cfg_info.build != data->info.build) +dev_err (dev,"Warning: build num mismatch!\n" ); + + ret =sscanf (cfg->data + pos,"%x%n" , &info_crc, &offset); +if (ret !=1 ) { +dev_err (dev,"Bad format: failed to parse Info CRC\n" ); + ret = -EINVAL ; + goto release; + } + pos += offset; + +/* Check config CRC */ + ret =sscanf (cfg->data + pos,"%x%n" , &config_crc, &offset); +if (ret !=1 ) { +dev_err (dev,"Bad format: failed to parse Config CRC\n" ); + ret = -EINVAL ; + goto release; + } + pos += offset; -if (!mxt_object_writable (object->type)) +if (data->config_crc == config_crc) { +dev_dbg (dev,"Config CRC 0x%06X: OK\n" , config_crc); + ret =0 ; + goto release; + } + +dev_info (dev,"Config CRC 0x%06X: does not match file 0x%06X\n" , + data->config_crc, config_crc); + +while (pos < cfg->size) { +/* Read type, instance, length */ + ret =sscanf (cfg->data + pos,"%x %x %x%n" , + &type, &instance, &size, &offset); +if (ret ==0 ) { +/* EOF */ + ret =1 ; + goto release; + }else if (ret !=3 ) { +dev_err (dev,"Bad format: failed to parse object\n" ); + ret = -EINVAL ; + goto release; + } + pos += offset; + + object =mxt_get_object (data, type); +if (!object) { +/* Skip object */ +for (i =0 ; i < size; i++) { + ret =sscanf (cfg->data + pos,"%hhx%n" , + &val, + &offset); + pos += offset; + }continue ; + } - size =mxt_obj_size (object) *mxt_obj_instances (object); -if (index + size > pdata->config_length) { -dev_err (dev,"Not enough config data!\n" ); -return -EINVAL ; +if (size >mxt_obj_size (object)) { +dev_err (dev,"Discarding %zu byte(s) in T%u\n" , + size -mxt_obj_size (object), type); } - ret =__mxt_write_reg (data->client, object->start_address, - size, &pdata->config[index]); -if (ret) -return ret; - index += size; +if (instance >=mxt_obj_instances (object)) { +dev_err (dev,"Object instances exceeded!\n" ); + ret = -EINVAL ; + goto release; + } + + reg = object->start_address +mxt_obj_size (object) * instance; + +for (i =0 ; i < size; i++) { + ret =sscanf (cfg->data + pos,"%hhx%n" , + &val, + &offset); +if (ret !=1 ) { +dev_err (dev,"Bad format in T%d\n" , type); + ret = -EINVAL ; + goto release; + } + pos += offset; + +if (i >mxt_obj_size (object)) +continue ; + + ret =mxt_write_reg (data->client, reg + i, val); +if (ret) + goto release; + + } + +/* +* If firmware is upgraded, new bytes may be added to end of +* objects. It is generally forward compatible to zero these +* bytes - previous behaviour will be retained. However +* this does invalidate the CRC and will force a config +* download every time until the configuration is updated. +*/ +if (size <mxt_obj_size (object)) { +dev_info (dev,"Zeroing %zu byte(s) in T%d\n" , +mxt_obj_size (object) - size, type); + +for (i = size +1 ; i <mxt_obj_size (object); i++) { + ret =mxt_write_reg (data->client, reg + i,0 ); +if (ret) + goto release; + } + } }mxt_update_crc (data,MXT_COMMAND_BACKUPNV ,MXT_BACKUP_VALUE ); ret =mxt_soft_reset (data);if (ret) -return ret; + goto release;dev_info (dev,"Config successfully updated\n" ); -return 0 ; +release: +release_firmware (cfg); +return ret; }static int mxt_make_highchg (struct mxt_data *data)
drivers/platform/chrome/chromeos_laptop.c +0 -4
@@ -86,8 +86,6 @@ static struct mxt_platform_data atmel_224s_tp_platform_data = { .irqflags = IRQF_TRIGGER_FALLING, .t19_num_keys = ARRAY_SIZE(mxt_t19_keys), .t19_keymap = mxt_t19_keys, - .config = NULL, - .config_length = 0, };static struct i2c_board_info __initdata atmel_224s_tp_device = {
@@ -101,8 +99,6 @@ static struct mxt_platform_data atmel_1664s_platform_data = { .y_size = 2560, .orient = MXT_ROTATED_90_COUNTER, .irqflags = IRQF_TRIGGER_FALLING, - .config = NULL, - .config_length = 0, };static struct i2c_board_info __initdata atmel_1664s_device = {
include/linux/i2c/atmel_mxt_ts.h +0 -4
@@ -27,10 +27,6 @@/* The platform data for the Atmel maXTouch touchscreen driver */ struct mxt_platform_data { -const u8 *config; -size_t config_length; -u32 config_crc; -unsigned int x_size;unsigned int y_size;unsigned char orient;
Signature · 1 line
1.8.3.2
PATCH 12/22 Input: atmel_mxt_ts - calculate and check CRC in config file
In reply to Nick DyerBy validating the checksum, we can identify if the configuration is corrupt. In addition, this patch writes the configuration in a short series of block writes rather than as many individual values.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 232 +++++++++++++++++++++++-------- 1 file changed, 177 insertions(+), 55 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +177 -55
@@ -52,6 +52,8 @@#define MXT_OBJECT_START 0x07#define MXT_OBJECT_SIZE 6 +#define MXT_INFO_CHECKSUM_SIZE 3 +#define MXT_MAX_BLOCK_WRITE 256/* Object types */ #define MXT_DEBUG_DIAGNOSTIC_T37 37
@@ -262,11 +264,14 @@ struct mxt_data {unsigned int max_x;unsigned int max_y;bool in_bootloader; +u16 mem_size;u32 config_crc; +u32 info_crc;/* Cached parameters from object table */ u8 T6_reportid;u16 T6_address; +u16 T7_address;u8 T9_reportid_min;u8 T9_reportid_max;u8 T19_reportid;
@@ -758,6 +763,45 @@ static void mxt_update_crc(struct mxt_data *data, u8 cmd, u8 value)mxt_wait_for_completion (data, &data->crc_completion,MXT_CRC_TIMEOUT ); } +static void mxt_calc_crc24 (u32 *crc,u8 firstbyte,u8 secondbyte) +{ +static const unsigned int crcpoly =0x80001B ; +u32 result; +u32 data_word; + + data_word = (secondbyte <<8 ) | firstbyte; + result = ((*crc <<1 ) ^ data_word); + +if (result &0x1000000 ) + result ^= crcpoly; + + *crc = result; +} + +static u32 mxt_calculate_crc (u8 *base,off_t start_off,off_t end_off) +{ +u32 crc =0 ; +u8 *ptr = base + start_off; +u8 *last_val = base + end_off -1 ; + +if (end_off < start_off) +return -EINVAL ; + +while (ptr < last_val) { +mxt_calc_crc24 (&crc, *ptr, *(ptr +1 )); + ptr +=2 ; + } + +/* if len is odd, fill the last byte with 0 */ +if (ptr == last_val) +mxt_calc_crc24 (&crc, *ptr,0 ); + +/* Mask to 24-bit */ + crc &=0x00FFFFFF ; + +return crc; +} +/* * mxt_check_reg_init - download configuration to chip *
@@ -785,9 +829,13 @@ static int mxt_check_reg_init(struct mxt_data *data)const struct firmware *cfg =NULL ;int ret;int offset; -int pos; +int data_pos; +int byte_offset;int i; -u32 info_crc, config_crc; +int cfg_start_ofs; +u32 info_crc, config_crc, calculated_crc; +u8 *config_mem; +size_t config_mem_size;unsigned int type, instance, size;u8 val;u16 reg;
@@ -807,11 +855,11 @@ static int mxt_check_reg_init(struct mxt_data *data) goto release; } - pos =strlen (MXT_CFG_MAGIC ); + data_pos =strlen (MXT_CFG_MAGIC );/* Load information block and check */ for (i =0 ; i <sizeof (struct mxt_info ); i++) { - ret =sscanf (cfg->data + pos,"%hhx%n" , + ret =sscanf (cfg->data + data_pos,"%hhx%n" , (unsigned char *)&cfg_info + i, &offset);if (ret !=1 ) {
@@ -820,7 +868,7 @@ static int mxt_check_reg_init(struct mxt_data *data) goto release; } - pos += offset; + data_pos += offset; }if (cfg_info.family_id != data->info.family_id) {
@@ -835,125 +883,188 @@ static int mxt_check_reg_init(struct mxt_data *data) goto release; } -if (cfg_info.version != data->info.version) -dev_err (dev,"Warning: version mismatch!\n" ); - -if (cfg_info.build != data->info.build) -dev_err (dev,"Warning: build num mismatch!\n" ); - - ret =sscanf (cfg->data + pos,"%x%n" , &info_crc, &offset); +/* Read CRCs */ + ret =sscanf (cfg->data + data_pos,"%x%n" , &info_crc, &offset);if (ret !=1 ) {dev_err (dev,"Bad format: failed to parse Info CRC\n" ); ret = -EINVAL ; goto release; } - pos += offset; + data_pos += offset; -/* Check config CRC */ - ret =sscanf (cfg->data + pos,"%x%n" , &config_crc, &offset); + ret =sscanf (cfg->data + data_pos,"%x%n" , &config_crc, &offset);if (ret !=1 ) {dev_err (dev,"Bad format: failed to parse Config CRC\n" ); ret = -EINVAL ; goto release; } - pos += offset; + data_pos += offset; -if (data->config_crc == config_crc) { -dev_dbg (dev,"Config CRC 0x%06X: OK\n" , config_crc); - ret =0 ; - goto release; +/* +* The Info Block CRC is calculated over mxt_info and the object +* table. If it does not match then we are trying to load the +* configuration from a different chip or firmware version, so +* the configuration CRC is invalid anyway. +*/ +if (info_crc == data->info_crc) { +if (config_crc ==0 || data->config_crc ==0 ) { +dev_info (dev,"CRC zero, attempting to apply config\n" ); + }else if (config_crc == data->config_crc) { +dev_dbg (dev,"Config CRC 0x%06X: OK\n" , + data->config_crc); + ret =0 ; + goto release; + }else { +dev_info (dev,"Config CRC 0x%06X: does not match file 0x%06X\n" , + data->config_crc, config_crc); + } + }else { +dev_warn (dev, +"Warning: Info CRC error - device=0x%06X file=0x%06X\n" , + data->info_crc, info_crc); } -dev_info (dev,"Config CRC 0x%06X: does not match file 0x%06X\n" , - data->config_crc, config_crc); +/* Malloc memory to store configuration */ + cfg_start_ofs =MXT_OBJECT_START + + data->info.object_num *sizeof (struct mxt_object ) + +MXT_INFO_CHECKSUM_SIZE ; + config_mem_size = data->mem_size - cfg_start_ofs; + config_mem =kzalloc (config_mem_size,GFP_KERNEL ); +if (!config_mem) { +dev_err (dev,"Failed to allocate memory\n" ); + ret = -ENOMEM ; + goto release; + } -while (pos < cfg->size) { +while (data_pos < cfg->size) {/* Read type, instance, length */ - ret =sscanf (cfg->data + pos,"%x %x %x%n" , + ret =sscanf (cfg->data + data_pos,"%x %x %x%n" , &type, &instance, &size, &offset);if (ret ==0 ) {/* EOF */ - ret =1 ; - goto release; +break ; }else if (ret !=3 ) {dev_err (dev,"Bad format: failed to parse object\n" ); ret = -EINVAL ; - goto release; + goto release_mem; } - pos += offset; + data_pos += offset; object =mxt_get_object (data, type);if (!object) {/* Skip object */ for (i =0 ; i < size; i++) { - ret =sscanf (cfg->data + pos,"%hhx%n" , + ret =sscanf (cfg->data + data_pos,"%hhx%n" , &val, &offset); - pos += offset; + data_pos += offset; }continue ; }if (size >mxt_obj_size (object)) { -dev_err (dev,"Discarding %zu byte(s) in T%u\n" , - size -mxt_obj_size (object), type); +/* +* Either we are in fallback mode due to wrong +* config or config from a later fw version, +* or the file is corrupt or hand-edited. +*/ +dev_warn (dev,"Discarding %zu byte(s) in T%u\n" , + size -mxt_obj_size (object), type); + }else if (mxt_obj_size (object) > size) { +/* +* If firmware is upgraded, new bytes may be added to +* end of objects. It is generally forward compatible +* to zero these bytes - previous behaviour will be +* retained. However this does invalidate the CRC and +* will force fallback mode until the configuration is +* updated. We warn here but do nothing else - the +* malloc has zeroed the entire configuration. +*/ +dev_warn (dev,"Zeroing %zu byte(s) in T%d\n" , +mxt_obj_size (object) - size, type); }if (instance >=mxt_obj_instances (object)) {dev_err (dev,"Object instances exceeded!\n" ); ret = -EINVAL ; - goto release; + goto release_mem; } reg = object->start_address +mxt_obj_size (object) * instance;for (i =0 ; i < size; i++) { - ret =sscanf (cfg->data + pos,"%hhx%n" , + ret =sscanf (cfg->data + data_pos,"%hhx%n" , &val, &offset);if (ret !=1 ) {dev_err (dev,"Bad format in T%d\n" , type); ret = -EINVAL ; - goto release; + goto release_mem; } - pos += offset; + data_pos += offset;if (i >mxt_obj_size (object))continue ; - ret =mxt_write_reg (data->client, reg + i, val); -if (ret) - goto release; + byte_offset = reg + i - cfg_start_ofs; +if ((byte_offset >=0 ) + && (byte_offset <= config_mem_size)) { + *(config_mem + byte_offset) = val; + }else { +dev_err (dev,"Bad object: reg:%d, T%d, ofs=%d\n" , + reg, object->type, byte_offset); + ret = -EINVAL ; + goto release_mem; + } } + } -/* -* If firmware is upgraded, new bytes may be added to end of -* objects. It is generally forward compatible to zero these -* bytes - previous behaviour will be retained. However -* this does invalidate the CRC and will force a config -* download every time until the configuration is updated. -*/ -if (size <mxt_obj_size (object)) { -dev_info (dev,"Zeroing %zu byte(s) in T%d\n" , -mxt_obj_size (object) - size, type); +/* Calculate crc of the received configs (not the raw config file) */ +if (data->T7_address < cfg_start_ofs) { +dev_err (dev,"Bad T7 address, T7addr = %x, config offset %x\n" , + data->T7_address, cfg_start_ofs); + ret =0 ; + goto release_mem; + } -for (i = size +1 ; i <mxt_obj_size (object); i++) { - ret =mxt_write_reg (data->client, reg + i,0 ); -if (ret) - goto release; - } + calculated_crc =mxt_calculate_crc (config_mem, + data->T7_address - cfg_start_ofs, + config_mem_size); + +if (config_crc >0 && (config_crc != calculated_crc)) +dev_warn (dev,"Config CRC error, calculated=%06X, file=%06X\n" , + calculated_crc, config_crc); + +/* Write configuration as blocks */ + byte_offset =0 ; +while (byte_offset < config_mem_size) { + size = config_mem_size - byte_offset; + +if (size >MXT_MAX_BLOCK_WRITE ) + size =MXT_MAX_BLOCK_WRITE ; + + ret =__mxt_write_reg (data->client, + cfg_start_ofs + byte_offset, + size, config_mem + byte_offset); +if (ret !=0 ) { +dev_err (dev,"Config write error, ret=%d\n" , ret); + goto release_mem; } + + byte_offset += size; }mxt_update_crc (data,MXT_COMMAND_BACKUPNV ,MXT_BACKUP_VALUE ); ret =mxt_soft_reset (data);if (ret) - goto release; + goto release_mem;dev_info (dev,"Config successfully updated\n" ); +release_mem: +kfree (config_mem); release:release_firmware (cfg);return ret;
@@ -1002,6 +1113,7 @@ static int mxt_get_object_table(struct mxt_data *data)int error;int i;u8 reportid; +u16 end_address; table_size = data->info.object_num *sizeof (struct mxt_object ); error = __mxt_read_reg(client, MXT_OBJECT_START, table_size,
@@ -1011,6 +1123,7 @@ static int mxt_get_object_table(struct mxt_data *data)/* Valid Report IDs start counting from 1 */ reportid =1 ; + data->mem_size =0 ;for (i =0 ; i < data->info.object_num; i++) {struct mxt_object *object = data->object_table + i;u8 min_id, max_id;
@@ -1038,6 +1151,9 @@ static int mxt_get_object_table(struct mxt_data *data) data->T6_reportid = min_id; data->T6_address = object->start_address;break ; +case MXT_GEN_POWER_T7 : + data->T7_address = object->start_address; +break ;case MXT_TOUCH_MULTI_T9 : data->T9_reportid_min = min_id; data->T9_reportid_max = max_id;
@@ -1046,6 +1162,12 @@ static int mxt_get_object_table(struct mxt_data *data) data->T19_reportid = min_id;break ; } + + end_address = object->start_address + +mxt_obj_size (object) *mxt_obj_instances (object) -1 ; + +if (end_address >= data->mem_size) + data->mem_size = end_address +1 ; }return 0 ;
Signature · 1 line
1.8.3.2
PATCH 13/22 Input: atmel_mxt_ts - add additional bootloader addresses
In reply to Nick DyerMove bootloaders reads/writes into separate functions. Instead of switching client->addr, define new field bootloader_addr in mxt_data. Implement lookup calculation for bootloader addresses.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 138 +++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 45 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +93 -45
@@ -29,12 +29,6 @@#define MXT_VER_21 21#define MXT_VER_22 22 -/* Slave addresses */ -#define MXT_APP_LOW 0x4a -#define MXT_APP_HIGH 0x4b -#define MXT_BOOT_LOW 0x24 -#define MXT_BOOT_HIGH 0x25 -/* Firmware files */ #define MXT_FW_NAME "maxtouch.fw"#define MXT_CFG_NAME "maxtouch.cfg"
@@ -267,6 +261,7 @@ struct mxt_data {u16 mem_size;u32 config_crc;u32 info_crc; +u8 bootloader_addr;/* Cached parameters from object table */ u8 T6_reportid;
@@ -354,9 +349,82 @@ static int mxt_wait_for_completion(struct mxt_data *data,return 0 ; } +static int mxt_bootloader_read (struct mxt_data *data, +u8 *val,unsigned int count) +{ +int ret; +struct i2c_msg msg; + + msg.addr = data->bootloader_addr; + msg.flags = data->client->flags &I2C_M_TEN ; + msg.flags |=I2C_M_RD ; + msg.len = count; + msg.buf = val; + + ret =i2c_transfer (data->client->adapter, &msg,1 ); + +if (ret ==1 ) { + ret =0 ; + }else { + ret = ret <0 ? ret : -EIO ; +dev_err (&data->client->dev,"%s: i2c recv failed (%d)\n" , + __func__, ret); + } + +return ret; +} + +static int mxt_bootloader_write (struct mxt_data *data, +const u8 *const val,unsigned int count) +{ +int ret; +struct i2c_msg msg; + + msg.addr = data->bootloader_addr; + msg.flags = data->client->flags &I2C_M_TEN ; + msg.len = count; + msg.buf = (u8 *)val; + + ret =i2c_transfer (data->client->adapter, &msg,1 ); +if (ret ==1 ) { + ret =0 ; + }else { + ret = ret <0 ? ret : -EIO ; +dev_err (&data->client->dev,"%s: i2c send failed (%d)\n" , + __func__, ret); + } + +return ret; +} + +static int mxt_lookup_bootloader_address (struct mxt_data *data) +{ +u8 appmode = data->client->addr; +u8 bootloader; + +switch (appmode) { +case 0x4a : +case 0x4b : +case 0x4c : +case 0x4d : +case 0x5a : +case 0x5b : + bootloader = appmode -0x26 ; +break ; +default : +dev_err (&data->client->dev, +"Appmode i2c address 0x%02x not found\n" , + appmode); +return -EINVAL ; + } + + data->bootloader_addr = bootloader; +return 0 ; +} +static int mxt_check_bootloader (struct mxt_data *data,unsigned int state) { -struct i2c_client *client = data->client; +struct device *dev = &data->client->dev;u8 val;int ret;
@@ -377,15 +445,14 @@ recheck:* by writing length 0x000 to device (iff we are in * WAITING_FRAME_DATA state). */ -dev_err (&client->dev,"Update wait error %d\n" , ret); +dev_err (dev,"Update wait error %d\n" , ret);return ret; } } -if (i2c_master_recv (client, &val,1 ) !=1 ) { -dev_err (&client->dev,"%s: i2c recv failed\n" , __func__); -return -EIO ; - } + ret =mxt_bootloader_read (data, &val,1 ); +if (ret) +return ret;switch (state) {case MXT_WAITING_BOOTLOAD_CMD :
@@ -401,7 +468,7 @@ recheck: }if (val != state) { -dev_err (&client->dev,"Invalid bootloader state %02X != %02X\n" , +dev_err (dev,"Invalid bootloader state %02X != %02X\n" , val, state);return -EINVAL ; }
@@ -409,28 +476,17 @@ recheck:return 0 ; } -static int mxt_unlock_bootloader (struct i2c_client *client) +static int mxt_unlock_bootloader (struct mxt_data *data) { +int ret;u8 buf[2 ]; buf[0 ] =MXT_UNLOCK_CMD_LSB ; buf[1 ] =MXT_UNLOCK_CMD_MSB ; -if (i2c_master_send (client, buf,2 ) !=2 ) { -dev_err (&client->dev,"%s: i2c send failed\n" , __func__); -return -EIO ; - } - -return 0 ; -} - -static int mxt_fw_write (struct i2c_client *client, -const u8 *data,unsigned int frame_size) -{ -if (i2c_master_send (client, data, frame_size) != frame_size) { -dev_err (&client->dev,"%s: i2c send failed\n" , __func__); -return -EIO ; - } + ret =mxt_bootloader_write (data, buf,2 ); +if (ret) +return ret;return 0 ; }
@@ -1342,7 +1398,6 @@ done:static int mxt_load_fw (struct device *dev,const char *fn) {struct mxt_data *data =dev_get_drvdata (dev); -struct i2c_client *client = data->client;const struct firmware *fw =NULL ;unsigned int frame_size;unsigned int pos =0 ;
@@ -1354,6 +1409,10 @@ static int mxt_load_fw(struct device *dev, const char *fn)return ret; } + ret =mxt_lookup_bootloader_address (data); +if (ret) + goto release_firmware; +/* Change to the bootloader mode */ data->in_bootloader = true;
@@ -1363,12 +1422,6 @@ static int mxt_load_fw(struct device *dev, const char *fn)msleep (MXT_RESET_TIME ); -/* Change to slave address of bootloader */ -if (client->addr ==MXT_APP_LOW ) - client->addr =MXT_BOOT_LOW ; -else - client->addr =MXT_BOOT_HIGH ; -reinit_completion (&data->bl_completion); ret =mxt_check_bootloader (data,MXT_WAITING_BOOTLOAD_CMD );
@@ -1376,7 +1429,7 @@ static int mxt_load_fw(struct device *dev, const char *fn) goto disable_irq;/* Unlock bootloader */ -mxt_unlock_bootloader (client); +mxt_unlock_bootloader (data);while (pos < fw->size) { ret =mxt_check_bootloader (data,MXT_WAITING_FRAME_DATA );
@@ -1391,7 +1444,9 @@ static int mxt_load_fw(struct device *dev, const char *fn) frame_size +=2 ;/* Write one frame to device */ -mxt_fw_write (client, fw->data + pos, frame_size); + ret =mxt_bootloader_write (data, fw->data + pos, frame_size); +if (ret) + goto disable_irq; ret =mxt_check_bootloader (data,MXT_FRAME_CRC_PASS );if (ret)
@@ -1421,13 +1476,6 @@ disable_irq:disable_irq (data->irq); release_firmware:release_firmware (fw); - -/* Change to slave address of application */ -if (client->addr ==MXT_BOOT_LOW ) - client->addr =MXT_APP_LOW ; -else - client->addr =MXT_APP_HIGH ; -return ret; }
Signature · 1 line
1.8.3.2
PATCH 14/22 Input: atmel_mxt_ts - read and report bootloader version
In reply to Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/input/touchscreen/atmel_mxt_ts.c +26 -0
@@ -202,6 +202,8 @@#define MXT_FRAME_CRC_PASS 0x04#define MXT_APP_CRC_FAIL 0x40/* valid 7 8 bit only */ #define MXT_BOOT_STATUS_MASK 0x3f +#define MXT_BOOT_EXTENDED_ID (1 << 5) +#define MXT_BOOT_ID_MASK 0x1f/* Touch status */ #define MXT_UNGRIP (1 << 0)
@@ -422,6 +424,27 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data)return 0 ; } +static u8 mxt_get_bootloader_version (struct mxt_data *data,u8 val) +{ +struct device *dev = &data->client->dev; +u8 buf[3 ]; + +if (val &MXT_BOOT_EXTENDED_ID ) { +if (mxt_bootloader_read (data, &buf[0 ],3 ) !=0 ) { +dev_err (dev,"%s: i2c failure\n" , __func__); +return -EIO ; + } + +dev_dbg (dev,"Bootloader ID:%d Version:%d\n" , buf[1 ], buf[2 ]); + +return buf[0 ]; + }else { +dev_dbg (dev,"Bootloader ID:%d\n" , val &MXT_BOOT_ID_MASK ); + +return val; + } +} +static int mxt_check_bootloader (struct mxt_data *data,unsigned int state) {struct device *dev = &data->client->dev;
@@ -454,6 +477,9 @@ recheck:if (ret)return ret; +if (state ==MXT_WAITING_BOOTLOAD_CMD ) + val =mxt_get_bootloader_version (data, val); +switch (state) {case MXT_WAITING_BOOTLOAD_CMD :case MXT_WAITING_FRAME_DATA :
Signature · 1 line
1.8.3.2
PATCH 15/22 Input: atmel_mxt_ts - implement bootloader frame retries
In reply to Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +20 -7
@@ -486,8 +486,12 @@ recheck: val &= ~MXT_BOOT_STATUS_MASK ;break ;case MXT_FRAME_CRC_PASS : -if (val ==MXT_FRAME_CRC_CHECK ) +if (val ==MXT_FRAME_CRC_CHECK ) { goto recheck; + }else if (val ==MXT_FRAME_CRC_FAIL ) { +dev_err (dev,"Bootloader CRC fail\n" ); +return -EINVAL ; + }break ;default :return -EINVAL ;
@@ -1427,6 +1431,7 @@ static int mxt_load_fw(struct device *dev, const char *fn)const struct firmware *fw =NULL ;unsigned int frame_size;unsigned int pos =0 ; +unsigned int retry =0 ;int ret; ret =request_firmware (&fw, fn, dev);
@@ -1464,9 +1469,7 @@ static int mxt_load_fw(struct device *dev, const char *fn) frame_size = ((*(fw->data + pos) <<8 ) | *(fw->data + pos +1 )); -/* We should add 2 at frame size as the the firmware data is not -* included the CRC bytes. -*/ +/* Take account of CRC bytes */ frame_size +=2 ;/* Write one frame to device */
@@ -1475,10 +1478,20 @@ static int mxt_load_fw(struct device *dev, const char *fn) goto disable_irq; ret =mxt_check_bootloader (data,MXT_FRAME_CRC_PASS ); -if (ret) - goto disable_irq; +if (ret) { + retry++; - pos += frame_size; +/* Back off by 20ms per retry */ +msleep (retry *20 ); + +if (retry >20 ) { +dev_err (dev,"Retry count exceeded\n" ); + goto disable_irq; + } + }else { + retry =0 ; + pos += frame_size; + }dev_dbg (dev,"Updated %d bytes / %zd bytes\n" , pos, fw->size); }
Signature · 1 line
1.8.3.2
PATCH 16/22 Input: atmel_mxt_ts - improve bootloader progress output
In reply to Nick DyerBy implementing a frame counter, print out fewer debug messages (the firmware may contain hundreds of frames).
--- drivers/input/touchscreen/atmel_mxt_ts.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/input/touchscreen/atmel_mxt_ts.c +7 -1
@@ -1432,6 +1432,7 @@ static int mxt_load_fw(struct device *dev, const char *fn)unsigned int frame_size;unsigned int pos =0 ;unsigned int retry =0 ; +unsigned int frame =0 ;int ret; ret =request_firmware (&fw, fn, dev);
@@ -1491,9 +1492,12 @@ static int mxt_load_fw(struct device *dev, const char *fn) }else { retry =0 ; pos += frame_size; + frame++; } -dev_dbg (dev,"Updated %d bytes / %zd bytes\n" , pos, fw->size); +if (frame %50 ==0 ) +dev_dbg (dev,"Sent %d frames, %d/%zd bytes\n" , + frame, pos, fw->size); }/* Wait for flash. */
@@ -1502,6 +1506,8 @@ static int mxt_load_fw(struct device *dev, const char *fn)if (ret) goto disable_irq; +dev_dbg (dev,"Sent %d frames, %d bytes\n" , frame, pos); +/* * Wait for device to reset. Some bootloader versions do not assert * the CHG line after bootloading has finished, so ignore potential
Signature · 1 line
1.8.3.2
PATCH 17/22 Input: atmel_mxt_ts - add check for incorrect firmware file format
In reply to Nick DyerAtmel supplies firmware files in ASCII HEX format (.enc) which must be converted before they can be loaded by kernel driver. Try to detect the error and print a friendly error message rather than feeding junk to the bootloader.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/input/touchscreen/atmel_mxt_ts.c +29 -0
@@ -1425,6 +1425,30 @@ done:return error ?: count; } +static int mxt_check_firmware_format (struct device *dev, +const struct firmware *fw) +{ +unsigned int pos =0 ; +char c; + +while (pos < fw->size) { + c = *(fw->data + pos); + +if (c <'0' || (c >'9' && c <'A' ) || c >'F' ) +return 0 ; + + pos++; + } + +/* +* To convert file try: +* xxd -r -p mXTXXX__APP_VX-X-XX.enc > maxtouch.fw +*/ +dev_err (dev,"Aborting: firmware file must be in binary format\n" ); + +return -EINVAL ; +} +static int mxt_load_fw (struct device *dev,const char *fn) {struct mxt_data *data =dev_get_drvdata (dev);
@@ -1441,6 +1465,11 @@ static int mxt_load_fw(struct device *dev, const char *fn)return ret; } +/* Check for incorrect enc file */ + ret =mxt_check_firmware_format (dev, fw); +if (ret) + goto release_firmware; + ret =mxt_lookup_bootloader_address (data);if (ret) goto release_firmware;
Signature · 1 line
1.8.3.2
PATCH 18/22 Input: atmel_mxt_ts - read screen config from chip
In reply to Nick DyerBy reading the touchscreen configuration from the settings that the maXTouch chip is actually using, we can remove some platform data.
The matrix size is not used for anything, and results in some rather confusing code to re-read it because it may change when configuration is downloaded, so don't print it out.
--- arch/arm/mach-s5pv210/mach-goni.c | 3 - drivers/input/touchscreen/atmel_mxt_ts.c | 136 ++++++++++++++---------------- drivers/platform/chrome/chromeos_laptop.c | 6 -- include/linux/i2c/atmel_mxt_ts.h | 14 --- 4 files changed, 65 insertions(+), 94 deletions(-)
arch/arm/mach-s5pv210/mach-goni.c +0 -3
@@ -239,9 +239,6 @@ static void __init goni_radio_init(void)/* TSP */ static struct mxt_platform_data qt602240_platform_data = { - .x_size =800 , - .y_size =480 , - .orient =MXT_DIAGONAL , .irqflags =IRQF_TRIGGER_FALLING , };
drivers/input/touchscreen/atmel_mxt_ts.c +65 -71
186 lines not on this page · raw message
drivers/platform/chrome/chromeos_laptop.c +0 -6
@@ -80,9 +80,6 @@ static int mxt_t19_keys[] = { };static struct mxt_platform_data atmel_224s_tp_platform_data = { - .x_size =102 *20 , - .y_size =68 *20 , - .orient =MXT_VERTICAL_FLIP , .irqflags =IRQF_TRIGGER_FALLING , .t19_num_keys =ARRAY_SIZE (mxt_t19_keys), .t19_keymap = mxt_t19_keys,
@@ -95,9 +92,6 @@ static struct i2c_board_info __initdata atmel_224s_tp_device = { };static struct mxt_platform_data atmel_1664s_platform_data = { - .x_size =1700 , - .y_size =2560 , - .orient =MXT_ROTATED_90_COUNTER , .irqflags =IRQF_TRIGGER_FALLING , };
include/linux/i2c/atmel_mxt_ts.h +0 -14
@@ -15,22 +15,8 @@#include <linux/types.h> -/* Orient */ -#define MXT_NORMAL 0x0 -#define MXT_DIAGONAL 0x1 -#define MXT_HORIZONTAL_FLIP 0x2 -#define MXT_ROTATED_90_COUNTER 0x3 -#define MXT_VERTICAL_FLIP 0x4 -#define MXT_ROTATED_90 0x5 -#define MXT_ROTATED_180 0x6 -#define MXT_DIAGONAL_COUNTER 0x7 -/* The platform data for the Atmel maXTouch touchscreen driver */ struct mxt_platform_data { -unsigned int x_size; -unsigned int y_size; -unsigned char orient; -unsigned long irqflags;u8 t19_num_keys;const unsigned int *t19_keymap;
Signature · 1 line
1.8.3.2
PATCH 19/22 Input: atmel_mxt_ts - use deep sleep mode when stopped
In reply to Nick DyerBy writing zero to both the active and idle cycle times the maXTouch device is put into a deep sleep mode when it consumes minimal power. It is unnecessary to change the configuration of any other objects (for example to disable T9 touchscreen).
It is counterproductive to reset the chip on resume, it will result in a long delay. However it is necessary to issue a calibrate command after the chip has spent any time in deep sleep.
This patch also deals with the situation where the power configuration is zero on probe, which would mean that the device never wakes up to execute commands.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 99 +++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 26 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +73 -26
@@ -89,9 +89,13 @@#define MXT_T6_STATUS_RESET (1 << 7)/* MXT_GEN_POWER_T7 field */ -#define MXT_POWER_IDLEACQINT 0 -#define MXT_POWER_ACTVACQINT 1 -#define MXT_POWER_ACTV2IDLETO 2 +struct t7_config { +u8 idle; +u8 active; +} __packed; + +#define MXT_POWER_CFG_RUN 0 +#define MXT_POWER_CFG_DEEPSLEEP 1/* MXT_GEN_ACQUIRE_T8 field */ #define MXT_ACQUIRE_CHRGTIME 0
@@ -103,7 +107,6 @@#define MXT_ACQUIRE_ATCHCALSTHR 7/* MXT_TOUCH_MULTI_T9 field */ -#define MXT_TOUCH_CTRL 0#define MXT_T9_ORIENT 9#define MXT_T9_RANGE 18
@@ -242,6 +245,7 @@ struct mxt_data {u32 config_crc;u32 info_crc;u8 bootloader_addr; +struct t7_config t7_cfg;/* Cached parameters from object table */ u8 T6_reportid;
@@ -600,20 +604,6 @@ static int mxt_read_message(struct mxt_data *data, sizeof(struct mxt_message), message); } -static int mxt_write_object (struct mxt_data *data, -u8 type,u8 offset,u8 val) -{ -struct mxt_object *object; -u16 reg; - - object =mxt_get_object (data, type); -if (!object || offset >=mxt_obj_size (object)) -return -EINVAL ; - - reg = object->start_address; -return mxt_write_reg (data->client, reg + offset, val); -} -static void mxt_input_button (struct mxt_data *data,struct mxt_message *message) {struct input_dev *input = data->input_dev;
@@ -1129,6 +1119,60 @@ release:return ret; } +static int mxt_set_t7_power_cfg (struct mxt_data *data,u8 sleep) +{ +struct device *dev = &data->client->dev; +int error; +struct t7_config *new_config; +struct t7_config deepsleep = { .active =0 , .idle =0 }; + +if (sleep ==MXT_POWER_CFG_DEEPSLEEP ) + new_config = &deepsleep; +else + new_config = &data->t7_cfg; + + error =__mxt_write_reg (data->client, data->T7_address, +sizeof (data->t7_cfg), new_config); +if (error) +return error; + +dev_dbg (dev,"Set T7 ACTV:%d IDLE:%d\n" , + new_config->active, new_config->idle); + +return 0 ; +} + +static int mxt_init_t7_power_cfg (struct mxt_data *data) +{ +struct device *dev = &data->client->dev; +int error; +bool retry = false; + +recheck: + error =__mxt_read_reg (data->client, data->T7_address, +sizeof (data->t7_cfg), &data->t7_cfg); +if (error) +return error; + +if (data->t7_cfg.active ==0 || data->t7_cfg.idle ==0 ) { +if (!retry) { +dev_dbg (dev,"T7 cfg zero, resetting\n" ); +mxt_soft_reset (data); + retry = true; + goto recheck; + }else { +dev_dbg (dev,"T7 cfg zero after reset, overriding\n" ); + data->t7_cfg.active =20 ; + data->t7_cfg.idle =100 ; +return mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); + } + } + +dev_dbg (dev,"Initialized power cfg: ACTV %d, IDLE %d\n" , + data->t7_cfg.active, data->t7_cfg.idle); +return 0 ; +} +static int mxt_make_highchg (struct mxt_data *data) {struct device *dev = &data->client->dev;
@@ -1323,6 +1367,12 @@ static int mxt_initialize(struct mxt_data *data) goto err_free_object_table; } + error =mxt_init_t7_power_cfg (data); +if (error) { +dev_err (&client->dev,"Failed to initialize power cfg\n" ); + goto err_free_object_table; + } + error =mxt_read_t9_resolution (data);if (error) {dev_err (&client->dev,"Failed to initialize T9 resolution\n" );
@@ -1596,16 +1646,15 @@ static const struct attribute_group mxt_attr_group = {static void mxt_start (struct mxt_data *data) { -/* Touch enable */ -mxt_write_object (data, -MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0x83 ); +mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); + +/* Recalibrate since chip has been in deep sleep */ +mxt_t6_command (data,MXT_COMMAND_CALIBRATE ,1 , false); }static void mxt_stop (struct mxt_data *data) { -/* Touch disable */ -mxt_write_object (data, -MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0 ); +mxt_set_t7_power_cfg (data,MXT_POWER_CFG_DEEPSLEEP ); }static int mxt_input_open (struct input_dev *dev)
@@ -1796,8 +1845,6 @@ static int mxt_resume(struct device *dev)struct mxt_data *data =i2c_get_clientdata (client);struct input_dev *input_dev = data->input_dev; -mxt_soft_reset (data); -mutex_lock (&input_dev->mutex);if (input_dev->users)
Signature · 1 line
1.8.3.2
PATCH 20/22 Input: atmel_mxt_ts - rename pressure to amplitude to match spec
In reply to Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +4 -4
@@ -629,7 +629,7 @@ static void mxt_input_touchevent(struct mxt_data *data,int x;int y;int area; -int pressure; +int amplitude; x = (message->message[1 ] <<4 ) | ((message->message[3 ] >>4 ) &0xf ); y = (message->message[2 ] <<4 ) | ((message->message[3 ] &0xf ));
@@ -639,7 +639,7 @@ static void mxt_input_touchevent(struct mxt_data *data, y = y >>2 ; area = message->message[4 ]; - pressure = message->message[5 ]; + amplitude = message->message[5 ]; dev_dbg(dev, "[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n",
@@ -652,7 +652,7 @@ static void mxt_input_touchevent(struct mxt_data *data, (status &MXT_AMP ) ?'A' :'.' , (status &MXT_SUPPRESS ) ?'S' :'.' , (status &MXT_UNGRIP ) ?'U' :'.' , - x, y, area, pressure); + x, y, area, amplitude);input_mt_slot (input_dev, id); input_mt_report_slot_state(input_dev, MT_TOOL_FINGER,
@@ -661,7 +661,7 @@ static void mxt_input_touchevent(struct mxt_data *data,if (status &MXT_DETECT ) {input_report_abs (input_dev,ABS_MT_POSITION_X , x);input_report_abs (input_dev,ABS_MT_POSITION_Y , y); -input_report_abs (input_dev,ABS_MT_PRESSURE , pressure); +input_report_abs (input_dev,ABS_MT_PRESSURE , amplitude);input_report_abs (input_dev,ABS_MT_TOUCH_MAJOR , area); } }
Signature · 1 line
1.8.3.2
PATCH 21/22 Input: atmel_mxt_ts - rename touchscreen defines to include T9
In reply to Nick DyerThis avoids confusion with the newer T100 touchscreen object.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +23 -23
@@ -110,13 +110,23 @@ struct t7_config {#define MXT_T9_ORIENT 9#define MXT_T9_RANGE 18 +/* MXT_TOUCH_MULTI_T9 status */ +#define MXT_T9_UNGRIP (1 << 0) +#define MXT_T9_SUPPRESS (1 << 1) +#define MXT_T9_AMP (1 << 2) +#define MXT_T9_VECTOR (1 << 3) +#define MXT_T9_MOVE (1 << 4) +#define MXT_T9_RELEASE (1 << 5) +#define MXT_T9_PRESS (1 << 6) +#define MXT_T9_DETECT (1 << 7) +struct t9_range {u16 x;u16 y; } __packed; -/* Touch orient bits */ -#define MXT_XY_SWITCH (1 << 0) +/* MXT_TOUCH_MULTI_T9 orient */ +#define MXT_T9_ORIENT_SWITCH (1 << 0)/* MXT_PROCI_GRIPFACE_T20 field */ #define MXT_GRIPFACE_CTRL 0
@@ -191,16 +201,6 @@ struct t9_range {#define MXT_BOOT_EXTENDED_ID (1 << 5)#define MXT_BOOT_ID_MASK 0x1f -/* Touch status */ -#define MXT_UNGRIP (1 << 0) -#define MXT_SUPPRESS (1 << 1) -#define MXT_AMP (1 << 2) -#define MXT_VECTOR (1 << 3) -#define MXT_MOVE (1 << 4) -#define MXT_RELEASE (1 << 5) -#define MXT_PRESS (1 << 6) -#define MXT_DETECT (1 << 7) -/* Touchscreen absolute values */ #define MXT_MAX_AREA 0xff
@@ -644,21 +644,21 @@ static void mxt_input_touchevent(struct mxt_data *data,dev_dbg (dev,"[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n" , id, - (status &MXT_DETECT ) ?'D' :'.' , - (status &MXT_PRESS ) ?'P' :'.' , - (status &MXT_RELEASE ) ?'R' :'.' , - (status &MXT_MOVE ) ?'M' :'.' , - (status &MXT_VECTOR ) ?'V' :'.' , - (status &MXT_AMP ) ?'A' :'.' , - (status &MXT_SUPPRESS ) ?'S' :'.' , - (status &MXT_UNGRIP ) ?'U' :'.' , + (status &MXT_T9_DETECT ) ?'D' :'.' , + (status &MXT_T9_PRESS ) ?'P' :'.' , + (status &MXT_T9_RELEASE ) ?'R' :'.' , + (status &MXT_T9_MOVE ) ?'M' :'.' , + (status &MXT_T9_VECTOR ) ?'V' :'.' , + (status &MXT_T9_AMP ) ?'A' :'.' , + (status &MXT_T9_SUPPRESS ) ?'S' :'.' , + (status &MXT_T9_UNGRIP ) ?'U' :'.' , x, y, area, amplitude);input_mt_slot (input_dev, id);input_mt_report_slot_state (input_dev,MT_TOOL_FINGER , - status &MXT_DETECT ); + status &MXT_T9_DETECT ); -if (status &MXT_DETECT ) { +if (status &MXT_T9_DETECT ) {input_report_abs (input_dev,ABS_MT_POSITION_X , x);input_report_abs (input_dev,ABS_MT_POSITION_Y , y);input_report_abs (input_dev,ABS_MT_PRESSURE , amplitude);
@@ -1320,7 +1320,7 @@ static int mxt_read_t9_resolution(struct mxt_data *data)if (range.y ==0 ) range.y =1023 ; -if (orient &MXT_XY_SWITCH ) { +if (orient &MXT_T9_ORIENT_SWITCH ) { data->max_x = range.y; data->max_y = range.x; }else {
Signature · 1 line
1.8.3.2
PATCH 22/22 Input: atmel_mxt_ts - handle multiple input reports in one message
In reply to Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 36 +++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +28 -8
@@ -620,6 +620,12 @@ static void mxt_input_button(struct mxt_data *data, struct mxt_message *message) } } +static void mxt_input_sync (struct input_dev *input_dev) +{ +input_mt_report_pointer_emulation (input_dev, false); +input_sync (input_dev); +} +static void mxt_input_touchevent (struct mxt_data *data,struct mxt_message *message,int id) {
@@ -633,10 +639,12 @@ static void mxt_input_touchevent(struct mxt_data *data, x = (message->message[1 ] <<4 ) | ((message->message[3 ] >>4 ) &0xf ); y = (message->message[2 ] <<4 ) | ((message->message[3 ] &0xf )); + +/* Handle 10/12 bit switching */ if (data->max_x <1024 ) - x = x >>2 ; + x >>=2 ;if (data->max_y <1024 ) - y = y >>2 ; + y >>=2 ; area = message->message[4 ]; amplitude = message->message[5 ];
@@ -655,14 +663,28 @@ static void mxt_input_touchevent(struct mxt_data *data, x, y, area, amplitude);input_mt_slot (input_dev, id); -input_mt_report_slot_state (input_dev,MT_TOOL_FINGER , - status &MXT_T9_DETECT );if (status &MXT_T9_DETECT ) { +/* +* Multiple bits may be set if the host is slow to read +* the status messages, indicating all the events that +* have happened. +*/ +if (status &MXT_T9_RELEASE ) { +input_mt_report_slot_state (input_dev, +MT_TOOL_FINGER ,0 ); +mxt_input_sync (input_dev); + } + +/* Touch active */ +input_mt_report_slot_state (input_dev,MT_TOOL_FINGER ,1 );input_report_abs (input_dev,ABS_MT_POSITION_X , x);input_report_abs (input_dev,ABS_MT_POSITION_Y , y);input_report_abs (input_dev,ABS_MT_PRESSURE , amplitude);input_report_abs (input_dev,ABS_MT_TOUCH_MAJOR , area); + }else { +/* Touch no longer active, close out slot */ +input_mt_report_slot_state (input_dev,MT_TOOL_FINGER ,0 ); } }
@@ -720,10 +742,8 @@ static irqreturn_t mxt_process_messages_until_invalid(struct mxt_data *data) } }while (reportid !=0xff ); -if (update_input) { -input_mt_report_pointer_emulation (data->input_dev, false); -input_sync (data->input_dev); - } +if (update_input) +mxt_input_sync (data->input_dev);return IRQ_HANDLED ; }
Signature · 1 line
1.8.3.2
Hi Dmitry-
Quoted 3 lines · Nick Dyer
Here is a set of patches for
atmel_mxt_tsthat you've already signed-off. I've rebased them against the most recent mainline and made some very minor changes such asINIT_COMPLETION->reinit_completion.
It would be useful to have some feedback about this patchset if you have time.
Nick
Dmitry Torokhov
maintainerHi NIck,
Quoted 9 lines · Nick Dyer
Hi Dmitry-
Quoted 3 lines · Nick Dyer
Here is a set of patches for
atmel_mxt_tsthat you've already signed-off. I've rebased them against the most recent mainline and made some very minor changes such asINIT_COMPLETION->reinit_completion.It would be useful to have some feedback about this patchset if you have time.
I applied majority of the patches, but dropped 11 (firmware loader) as it gives trouble in its current for when driver is compiled in and I also had to drop 12 and 19 because of reject dues to dropping 11.
Thanks.
Signature · 1 line
Dmitry