[PATCH 46/51] Input: atmel_mxt_ts - Initialize power config before and after downloading cfg

From: Nick Dyer
Date: Thu Jun 27 2013 - 08:53:06 EST


If the power configuration is zero then the configuration download may fail to
work properly, so initialize T7 before config download. The downloaded
configuration may reset the T7 power configuration so it must be
re-initialized afterwards.

Signed-off-by: Nick Dyer <nick.dyer@xxxxxxxxxxx>
Acked-by: Benson Leung <bleung@xxxxxxxxxxxx>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index b4ecd1d..5ab3861 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1226,6 +1226,8 @@ static int mxt_check_retrigen(struct mxt_data *data)
return 0;
}

+static int mxt_init_t7_power_cfg(struct mxt_data *data);
+
/*
* mxt_check_reg_init - download configuration to chip
*
@@ -1485,6 +1487,9 @@ static int mxt_check_reg_init(struct mxt_data *data)

dev_info(dev, "Config written\n");

+ /* T7 config may have changed */
+ mxt_init_t7_power_cfg(data);
+
release_mem:
kfree(config_mem);
release:
@@ -1883,17 +1888,17 @@ retry_bootloader:
if (error)
goto err_free_object_table;

- /* Check register init values */
- error = mxt_check_reg_init(data);
+ error = mxt_init_t7_power_cfg(data);
if (error) {
- dev_err(&client->dev, "Error %d initialising configuration\n",
- error);
+ dev_err(&client->dev, "Failed to initialize power cfg\n");
goto err_free_object_table;
}

- error = mxt_init_t7_power_cfg(data);
+ /* Check register init values */
+ error = mxt_check_reg_init(data);
if (error) {
- dev_err(&client->dev, "Failed to initialize power cfg\n");
+ dev_err(&client->dev, "Error %d initialising configuration\n",
+ error);
goto err_free_object_table;
}

--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/