Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58e3a0a8 authored by Chun Zhang's avatar Chun Zhang Committed by Stephen Boyd
Browse files

input: atmel_mxt: Add touch controller state check to enable IRQ



Touch controller requires enabling IRQ from suspend to wake.
Unpaired enable-disable will cause issues from kernel.

CRs-Fixed: 523607
Change-Id: Ia44e440a2ad05cd60b685714a15828916ca81e7e
Signed-off-by: default avatarChun Zhang <chunz@codeaurora.org>
parent a1417ab8
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ struct mxt_data {
	const char *fw_name;
	bool no_force_update;
	bool lpm_support;
	bool regs_enabled;
	bool dev_sleep;

#if defined(CONFIG_SECURE_TOUCH)
	atomic_t st_enabled;
@@ -2207,11 +2207,6 @@ static int mxt_power_on(struct mxt_data *data, bool on)
	if (on == false)
		goto power_off;

	if (data->regs_enabled) {
		dev_dbg(&data->client->dev, "regs are already enabled\n");
		return 0;
	}

	rc = reg_set_optimum_mode_check(data->vcc_ana, MXT_ACTIVE_LOAD_UA);
	if (rc < 0) {
		dev_err(&data->client->dev,
@@ -2260,8 +2255,6 @@ static int mxt_power_on(struct mxt_data *data, bool on)
		}
	}

	data->regs_enabled = true;

	msleep(130);

	return 0;
@@ -2282,12 +2275,6 @@ error_reg_en_vcc_ana:
	return rc;

power_off:

	if (!data->regs_enabled) {
		dev_dbg(&data->client->dev, "regs are already disabled\n");
		return 0;
	}

	reg_set_optimum_mode_check(data->vcc_ana, 0);
	regulator_disable(data->vcc_ana);
	if (data->pdata->digital_pwr_regulator) {
@@ -2299,8 +2286,6 @@ power_off:
		regulator_disable(data->vcc_i2c);
	}

	data->regs_enabled = false;

	msleep(50);
	return 0;
}
@@ -2500,6 +2485,11 @@ static int mxt_suspend(struct device *dev)
	struct input_dev *input_dev = data->input_dev;
	int error;

	if (data->dev_sleep) {
		dev_dbg(dev, "Device already in sleep\n");
		return 0;
	}

	disable_irq(data->irq);

	mutex_lock(&input_dev->mutex);
@@ -2530,6 +2520,7 @@ static int mxt_suspend(struct device *dev)
		}
	}

	data->dev_sleep = true;
	return 0;
}

@@ -2540,6 +2531,11 @@ static int mxt_resume(struct device *dev)
	struct input_dev *input_dev = data->input_dev;
	int error;

	if (!data->dev_sleep) {
		dev_dbg(dev, "Device already in resume\n");
		return 0;
	}

	/* put regulators back in active power mode */
	if (data->lpm_support) {
		error = mxt_regulator_lpm(data, false);
@@ -2583,6 +2579,7 @@ static int mxt_resume(struct device *dev)

	enable_irq(data->irq);

	data->dev_sleep = false;
	return 0;
}

@@ -2969,6 +2966,7 @@ static int mxt_probe(struct i2c_client *client,
	data->pdata = pdata;
	data->no_force_update = pdata->no_force_update;
	data->lpm_support = !pdata->no_lpm_support;
	data->dev_sleep = false;

	__set_bit(EV_ABS, input_dev->evbit);
	__set_bit(EV_KEY, input_dev->evbit);