From nobody Tue Dec 16 08:55:43 2025 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 D9E2D32F748; Mon, 15 Dec 2025 13:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765804877; cv=none; b=CJ5ECIin6kNAedRj9EqUPqvnu9EX7+/Lxcp+HQIScUpZxwi6lV8xG2IcM58woCIS/wZBDAMISqKF4YGeTJK96E8J9okYBBsaQmkYdVs5uEFF48EhxYKbvPuO8IF5Wr4CmLDH9fwi0XQC25gxJZOqo7buG2HZv5PVkwljjPivIkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765804877; c=relaxed/simple; bh=Jw+CX3PHdG2rHH3xrE0jpWheNpQR9tkuVjIZOkOxeqE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C0H6kq+M/gT2HPhn3PhXDK7koVYoy/gmec2ChKUUHoCPvlQ49enU9aj4ysm+VQ89J7fnYvm11rDGFI5pkjhQHuTMGm3rQdiw2NBqQ7HlTn5n4qJSc/iYOBNVBNF6Zid6YDKdtnXn/cRLDysGcyO7WYaBCXVQbBNtCFye+xwXLVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=LH8JqM5G; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="LH8JqM5G" Date: Mon, 15 Dec 2025 15:21:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1765804872; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=aIDX8dlrQfZYDV9HKQkvFvrDlGxMhp6dMUe5xU4EmoA=; b=LH8JqM5GKm+62fg3Y9/5ch2nGoFMzwpXp615ZbEYkM5Z1S58/BzvBFWvgLrM+mRURC65Um 5kJ2Ehs2DvchUvmV+BKlJ/DWHQYVuGkC3ykYRXVKFN94gLice1KM1FrtYh+F0dHuqm8dBN HwCwvTcj0PP401mb8LmYDTgdjcfbb7c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Liam Girdwood , Mark Brown , Michael Turquette , Stephen Boyd , Matti Vaittinen , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org, Andreas Kemnade Subject: [PATCH RESEND v6 15/17] power: supply: bd71828: Support wider register addresses Message-ID: <57c87f7e2082a666f0adeafcd11f673c0af7d326.1765804226.git.mazziesaccount@gmail.com> Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="54kIi+IO5qC+nA/M" Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT --54kIi+IO5qC+nA/M Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The BD71828 power-supply driver assumes register addresses to be 8-bit. The new BD72720 will use stacked register maps to hide paging which is done using secondary I2C slave address. This requires use of 9-bit register addresses in the power-supply driver (added offset 0x100 to the 8-bit hardware register addresses). The cost is slightly used memory consumption as the members in the struct pwr_regs will be changed from u8 to unsigned int, which means 3 byte increase / member / instance. This is currently 14 members (expected to possibly be increased when adding new variants / new functionality which may introduce new registers, but not expected to grow much) and 2 instances (will be 3 instances when BD72720 gets added). So, even if the number of registers grew to 50 it'd be 150 bytes / instance. Assuming we eventually supported 5 variants, it'd be 5 * 150 bytes, which stays very reasonable considering systems we are dealing with. As a side note, we can reduce the "wasted space / member / instance" from 3 bytes to 1 byte, by using u16 instead of the unsigned int if needed. I rather use unsigned int to be initially prepared for devices with 32 bit registers if there is no need to count bytes. Signed-off-by: Matti Vaittinen --- Revision history: v2 =3D> : - No changes RFCv1 =3D> v2: - New patch --- drivers/power/supply/bd71828-power.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/power/supply/bd71828-power.c b/drivers/power/supply/bd= 71828-power.c index f667baedeb77..ce73c0f48397 100644 --- a/drivers/power/supply/bd71828-power.c +++ b/drivers/power/supply/bd71828-power.c @@ -44,19 +44,19 @@ #define VBAT_LOW_TH 0x00D4 =20 struct pwr_regs { - u8 vbat_avg; - u8 ibat; - u8 ibat_avg; - u8 btemp_vth; - u8 chg_state; - u8 bat_temp; - u8 dcin_stat; - u8 dcin_collapse_limit; - u8 chg_set1; - u8 chg_en; - u8 vbat_alm_limit_u; - u8 conf; - u8 vdcin; + unsigned int vbat_avg; + unsigned int ibat; + unsigned int ibat_avg; + unsigned int btemp_vth; + unsigned int chg_state; + unsigned int bat_temp; + unsigned int dcin_stat; + unsigned int dcin_collapse_limit; + unsigned int chg_set1; + unsigned int chg_en; + unsigned int vbat_alm_limit_u; + unsigned int conf; + unsigned int vdcin; }; =20 static const struct pwr_regs pwr_regs_bd71828 =3D { --=20 2.52.0 --54kIi+IO5qC+nA/M Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmlACz8ACgkQeFA3/03a ocVqxggAj3bxN7BT3GSQ2QVWHScrNKrRMRVFc3iP68Nd9RFiIi5Ov/+uWUR24H7+ 8Yiz5/dSaRG1LCvaritIa/mUdmma8fcsTF9dGialP36OhRGSPcu0uEYqkCR3acMY asB8C6XrQYIIXD/48D1SWX2ar1sdkIMzqmeQ3RlYpgZmalNEsaBqUeCGanDtguVu OMtxomHQJ6Glm8nvaYKLbGEkL4g9A0mZh9ArQwLlvaGaswdMd1AH+lDlUeIG3Zdd tkrfAb1zlu2irUfwo+0+gPw/A6mBry6eMGBrEN4vHxmpKgYb5HweysGcCQ9hIzgC JFYNxkgJ0Lynd4Do5u77t3ysxOJcmg== =eSjJ -----END PGP SIGNATURE----- --54kIi+IO5qC+nA/M--