From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C908AFBF6 for ; Mon, 15 May 2023 17:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 251A4C4339B; Mon, 15 May 2023 17:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684172715; bh=Z3SH7zS4+UJqGz17yWcClfbdrPdo8ns43fqlpP3yl+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qq6N9Yt1p+n/PWav/48v3GVCpNqGOPfexEZ7swOGX60Qie6gse+WhDm19f/E+Dwqy /BVccUVxPphYsS7j+P20wAR+FLPSfDe9GygEIuMIxqvoczC0+M4S/1YQrG3q3r2x17 FSqsLvEUI9rItYyZLseW0OCsbcXsDvc0I9oBqw2I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linus Walleij , Matti Vaittinen , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.10 243/381] power: supply: generic-adc-battery: fix unit scaling Date: Mon, 15 May 2023 18:28:14 +0200 Message-Id: <20230515161747.683600140@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161736.775969473@linuxfoundation.org> References: <20230515161736.775969473@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Sebastian Reichel [ Upstream commit 44263f50065969f2344808388bd589740f026167 ] power-supply properties are reported in µV, µA and µW. The IIO API provides mV, mA, mW, so the values need to be multiplied by 1000. Fixes: e60fea794e6e ("power: battery: Generic battery driver using IIO") Reviewed-by: Linus Walleij Reviewed-by: Matti Vaittinen Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/generic-adc-battery.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c index 58f09314741a7..09bb4ff291cb0 100644 --- a/drivers/power/supply/generic-adc-battery.c +++ b/drivers/power/supply/generic-adc-battery.c @@ -138,6 +138,9 @@ static int read_channel(struct gab *adc_bat, enum power_supply_property psp, result); if (ret < 0) pr_err("read channel error\n"); + else + *result *= 1000; + return ret; } -- 2.39.2