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

Commit a5bb7bce authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: sensor: fix data polling continues even resume fails"

parents b94f9b08 cca00cb0
Loading
Loading
Loading
Loading
+22 −17
Original line number Diff line number Diff line
@@ -673,15 +673,7 @@ static int lightsensor_enable(struct cm36283_info *lpi)
	unsigned int delay;

	mutex_lock(&als_enable_mutex);

	if (lpi->als_enable) {
		dev_err(&lpi->i2c_client->dev, "%s: already enabled\n",
			       __func__);
		ret = 0;
	} else {
	ret = control_and_report(lpi, CONTROL_ALS, 1, 0);
	}
	
	mutex_unlock(&als_enable_mutex);

	delay = atomic_read(&lpi->ls_poll_delay);
@@ -1975,27 +1967,40 @@ static int cm36283_suspend(struct device *dev)
	struct cm36283_info *lpi = lp_info;

	if (lpi->als_enable) {
		lightsensor_disable(lpi);
		if (lightsensor_disable(lpi))
			goto out;
		lpi->als_enable = 1;
	}
	cm36283_power_set(lpi, 0);
	if (cm36283_power_set(lpi, 0))
		goto out;

	return 0;

out:
	dev_err(&lpi->i2c_client->dev, "%s:failed during resume operation.\n",
			__func__);
	return -EIO;
}

static int cm36283_resume(struct device *dev)
{
	struct cm36283_info *lpi = lp_info;

	cm36283_power_set(lpi, 1);
	if (cm36283_power_set(lpi, 1))
		goto out;

	if (lpi->als_enable) {
		cm36283_setup(lpi);
		lightsensor_setup(lpi);
		psensor_setup(lpi);
		lightsensor_enable(lpi);
		ls_initial_cmd(lpi);
		psensor_initial_cmd(lpi);
		if (lightsensor_enable(lpi))
			goto out;
	}
	return 0;

out:
	dev_err(&lpi->i2c_client->dev, "%s:failed during resume operation.\n",
			__func__);
	return -EIO;
}
#endif