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 7F57A171AC for ; Mon, 8 May 2023 11:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAD67C433A0; Mon, 8 May 2023 11:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683545020; bh=HcVHmsYf0WHbDYdxMfdo34ht14fDlnotCj2cU3dTJdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yD83udAI5kUc0nciJ1pdndyi5VAx9bEjOGGWuaX6FbgVbZsRQ8lqtW1ae7Oz7G+Pd Y3wDI1+yqKkwIyjxLbYuIA37yjZim6U+q60rFTwO26DXPbRda+tDYq8+wIlnoi4Q09 lub56fb6E2PTfsMoOxOQrxslhU0AOo4rWZherd5w= 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 6.3 598/694] power: supply: generic-adc-battery: fix unit scaling Date: Mon, 8 May 2023 11:47:13 +0200 Message-Id: <20230508094454.601413716@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230508094432.603705160@linuxfoundation.org> References: <20230508094432.603705160@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 66039c665dd1e..0af536f4932f1 100644 --- a/drivers/power/supply/generic-adc-battery.c +++ b/drivers/power/supply/generic-adc-battery.c @@ -135,6 +135,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