mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
input: touchscreen: mxt: refine power on/off flow
Refine driver's power on/off flow and make regulators' state to be proper in all scenes. Change-Id: I5d26c3134dfbdc53037fe4aac16739b24c0c183b Signed-off-by: Fei Mao <feim1@codeaurora.org>
This commit is contained in:
parent
37cdb7af00
commit
d35c6d58eb
1 changed files with 10 additions and 2 deletions
|
|
@ -378,6 +378,7 @@ struct mxt_data {
|
|||
enum mxt_suspend_mode suspend_mode;
|
||||
|
||||
bool use_regulator;
|
||||
bool poweron;
|
||||
struct regulator *reg_vdd;
|
||||
struct regulator *reg_avdd;
|
||||
struct regulator *reg_xvdd;
|
||||
|
|
@ -458,7 +459,7 @@ static int mxt_wait_for_completion(struct mxt_data *data,
|
|||
if (ret < 0) {
|
||||
return ret;
|
||||
} else if (ret == 0) {
|
||||
dev_err(dev, "Wait for completion timed out.\n");
|
||||
dev_dbg(dev, "Wait for completion timed out.\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1983,7 +1984,7 @@ static int mxt_regulator_enable(struct mxt_data *data)
|
|||
{
|
||||
int error;
|
||||
|
||||
if (!data->use_regulator)
|
||||
if (!data->use_regulator || data->poweron)
|
||||
return 0;
|
||||
|
||||
gpiod_set_value(data->reset_gpio, 0);
|
||||
|
|
@ -2015,6 +2016,7 @@ static int mxt_regulator_enable(struct mxt_data *data)
|
|||
gpiod_set_value(data->reset_gpio, 1);
|
||||
mxt_wait_for_completion(data, &data->bl_completion, MXT_POWERON_DELAY);
|
||||
|
||||
data->poweron = true;
|
||||
return 0;
|
||||
|
||||
err_dis_avdd:
|
||||
|
|
@ -2026,10 +2028,15 @@ err_dis_vdd:
|
|||
|
||||
static void mxt_regulator_disable(struct mxt_data *data)
|
||||
{
|
||||
if (!data->poweron)
|
||||
return;
|
||||
|
||||
regulator_disable(data->reg_vdd);
|
||||
regulator_disable(data->reg_avdd);
|
||||
if (!IS_ERR(data->reg_xvdd))
|
||||
regulator_disable(data->reg_xvdd);
|
||||
|
||||
data->poweron = false;
|
||||
}
|
||||
|
||||
static int mxt_regulator_configure(struct mxt_data *data, bool state)
|
||||
|
|
@ -2994,6 +3001,7 @@ static int mxt_configure_objects(struct mxt_data *data,
|
|||
dev_warn(dev, "No touch object detected\n");
|
||||
}
|
||||
|
||||
disable_irq(data->irq);
|
||||
mxt_debug_init(data);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue