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

Commit 6fed94d4 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: Fix incorrect ADC channel configuration"

parents b9fa92c7 298bf748
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
 */

#include <linux/device.h>
@@ -3359,13 +3359,13 @@ int smblib_get_prop_usb_voltage_now(struct smb_charger *chg,
{
	union power_supply_propval pval = {0, };
	int rc, ret = 0;
	u8 reg;
	u8 reg, adc_ch_reg;

	mutex_lock(&chg->adc_lock);

	if (chg->wa_flags & USBIN_ADC_WA) {
		/* Store ADC channel config in order to restore later */
		rc = smblib_read(chg, BATIF_ADC_CHANNEL_EN_REG, &reg);
		rc = smblib_read(chg, BATIF_ADC_CHANNEL_EN_REG, &adc_ch_reg);
		if (rc < 0) {
			smblib_err(chg, "Couldn't read ADC config rc=%d\n", rc);
			ret = rc;
@@ -3422,7 +3422,7 @@ int smblib_get_prop_usb_voltage_now(struct smb_charger *chg,
restore_adc_config:
	 /* Restore ADC channel config */
	if (chg->wa_flags & USBIN_ADC_WA) {
		rc = smblib_write(chg, BATIF_ADC_CHANNEL_EN_REG, reg);
		rc = smblib_write(chg, BATIF_ADC_CHANNEL_EN_REG, adc_ch_reg);
		if (rc < 0)
			smblib_err(chg, "Couldn't write ADC config rc=%d\n",
						rc);