iio: qcom-rradc: Disable continuous mode when read fails
Currently, when a channel is read in continuous mode and the read operation fails, RR_ADC would be left enabled in continuous mode. Disable the continuous mode in such cases so that the other read operations which doesn't need continuous mode can go through. Change-Id: I2bf257bd535e1e4a30e18b6257e584a5be96b69d Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org> Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
This commit is contained in:
parent
f1034d926e
commit
8c20990f43
1 changed files with 7 additions and 5 deletions
|
@ -793,7 +793,7 @@ static int rradc_check_status_ready_with_retry(struct rradc_chip *chip,
|
|||
static int rradc_read_channel_with_continuous_mode(struct rradc_chip *chip,
|
||||
struct rradc_chan_prop *prop, u8 *buf)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc = 0, ret = 0;
|
||||
u16 status = 0;
|
||||
|
||||
rc = rradc_enable_continuous_mode(chip);
|
||||
|
@ -806,23 +806,25 @@ static int rradc_read_channel_with_continuous_mode(struct rradc_chip *chip,
|
|||
rc = rradc_read(chip, status, buf, 1);
|
||||
if (rc < 0) {
|
||||
pr_err("status read failed:%d\n", rc);
|
||||
return rc;
|
||||
ret = rc;
|
||||
goto disable;
|
||||
}
|
||||
|
||||
rc = rradc_check_status_ready_with_retry(chip, prop,
|
||||
buf, status);
|
||||
if (rc < 0) {
|
||||
pr_err("Status read failed:%d\n", rc);
|
||||
return rc;
|
||||
ret = rc;
|
||||
}
|
||||
|
||||
disable:
|
||||
rc = rradc_disable_continuous_mode(chip);
|
||||
if (rc < 0) {
|
||||
pr_err("Failed to switch to non continuous mode\n");
|
||||
return rc;
|
||||
ret = rc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rradc_enable_batt_id_channel(struct rradc_chip *chip, bool enable)
|
||||
|
|
Loading…
Add table
Reference in a new issue