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

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

Merge "thermal: qpnp-adc-tm: Fix shutdown path for ADC_TM"

parents c9b4dc70 cb0e0c2a
Loading
Loading
Loading
Loading
+38 −23
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3292,20 +3292,31 @@ static int qpnp_adc_tm_remove(struct platform_device *pdev)
static void qpnp_adc_tm_shutdown(struct platform_device *pdev)
{
	struct qpnp_adc_tm_chip *chip = dev_get_drvdata(&pdev->dev);
	int rc = 0;
	int rc = 0, i = 0;
	u8 reg_val = 0, status1 = 0, en_ctl1 = 0;

	if (!chip->adc_tm_hc) {
		/* Set measurement in single measurement mode */
		reg_val = ADC_OP_NORMAL_MODE << QPNP_OP_MODE_SHIFT;
		rc = qpnp_adc_tm_mode_select(chip, reg_val);
		if (rc < 0)
			pr_err("adc-tm single mode select failed\n");
	}

	/* Disable bank */
	rc = qpnp_adc_tm_disable(chip);
	if (rc < 0)
		pr_err("adc-tm disable failed\n");

	if (chip->adc_tm_hc) {
		for (i = 0; i < 8; i++) {
			rc = qpnp_adc_tm_reg_update(chip,
				QPNP_BTM_Mn_EN(i),
				QPNP_BTM_Mn_MEAS_EN, false);
			if (rc < 0)
				pr_err("multi meas disable failed\n");
		}
	} else {
		/* Check if a conversion is in progress */
		rc = qpnp_adc_tm_req_sts_check(chip);
		if (rc < 0)
@@ -3313,19 +3324,23 @@ static void qpnp_adc_tm_shutdown(struct platform_device *pdev)

		/* Disable multimeasurement */
		reg_val = 0;
	rc = qpnp_adc_tm_write_reg(chip, QPNP_ADC_TM_MULTI_MEAS_EN, reg_val, 1);
		rc = qpnp_adc_tm_write_reg(chip,
				QPNP_ADC_TM_MULTI_MEAS_EN, reg_val, 1);
		if (rc < 0)
		pr_err("adc-tm multi-measurement mode disable failed\n");
			pr_err("adc-tm multi-meas mode disable failed\n");

	rc = qpnp_adc_tm_read_reg(chip, QPNP_ADC_TM_STATUS1, &status1, 1);
		rc = qpnp_adc_tm_read_reg(chip,
				QPNP_ADC_TM_STATUS1, &status1, 1);
		if (rc < 0)
			pr_err("adc-tm status1 read failed\n");

	rc = qpnp_adc_tm_read_reg(chip, QPNP_EN_CTL1, &en_ctl1, 1);
		rc = qpnp_adc_tm_read_reg(chip,
				QPNP_EN_CTL1, &en_ctl1, 1);
		if (rc < 0)
			pr_err("adc-tm en_ctl1 read failed\n");

	pr_debug("adc-tm status1=0%x, en_ctl1=0x%x\n", status1, en_ctl1);
		pr_debug("status1=0%x, en_ctl1=0x%x\n", status1, en_ctl1);
	}
}

static int qpnp_adc_tm_suspend_noirq(struct device *dev)