From nobody Wed Feb 11 05:41:46 2026 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (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 92EDE33436F for ; Thu, 13 Nov 2025 08:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763024152; cv=none; b=OODIaX9hbpWNBUjbOnTUQNqNfmDuZc1Q98EA0edrgooxByxBCKwjSVrHNUKdWln1DK4Ha051+36crHXEs8XypikxbRgnEBqGlZlTRsmrvPq/OSUqHdNBaiiGr7pvpLmGtEuxfKaIv5fsEsiVNUz7BPSC2ExDyWaHGs6Dpvz1ArY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763024152; c=relaxed/simple; bh=C3ZMvDuioasZjRoAf0b9QlbXtu4KjheQxquE+z//3Lc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JDCxAv4kMBmmOS1dlIOEhup+mBQtlgucWziO2ZRfqFFUNfl7irX3TfOakYKjI11DXFN3WfU1p47MDu/8ZuYIA1YkBuPWl/09/BED76Su1k/w7BmIPu0pH/BR2nazyEUmCsKY8E+NBOW1f84xZ4GCcAEf/5/bsK8p93C9Oacdxis= 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=RPQz09cX; arc=none smtp.client-ip=95.215.58.172 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="RPQz09cX" Date: Thu, 13 Nov 2025 10:55:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763024148; 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=Z3c64nus2gBDbjXy+NF6FQnzWtEuBgRuvDiEA2DnSws=; b=RPQz09cXWLNFyDIeftlUUnFKbHRoWTZ3H5vHit12U8KPbOwjYievJL+5BpKGPkW67Te7bx NCvBRqMOckoCa0P77bXi3E7oqSJ9ibSFOGGWH1uPUz6Uqm6DvkBwXtWeM8Cp7kf4Ghyya8 Sdt5ImzIDNdlorpetfBjrZk0V3di31E= 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 v4 14/16] power: supply: bd71828: Support wider register addresses Message-ID: <6248200397d3582fe926938736da66d6bbf9535d.1763022807.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="eSUgsUv+8rMNn0JY" Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT --eSUgsUv+8rMNn0JY 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.51.1 --eSUgsUv+8rMNn0JY Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmkVnQsACgkQeFA3/03a ocVymgf9HuAKJbRXkn9pYwpQhTQZUTVZfclJ/tu5Iel6ae+3k6H8OdUxfS0ZeOGc S8uUNuPg5CVsyI5pBofeL/PtZeKuI+sNbwIaGlQG9otFoPs4zdlU4mlOkpLWCdKM Q9xNIoaP8CoKm93e2pqv+2TMknkd5FOKPcA4tI/aRHHIS8ySOx/+YmrtViSI0c2t M0e12+ETvMm6yWsvV/yyk/HnOgUw1wRGzLg/z9ENUrzbJUnfHYLJ/jwqlCoWj28K 8uKSbFOqlC/ALQtF0CgJhmifKWwLvn/5KKGXwzTP4W6ZFfa8jgklQzcEAiGn9kjK yTZv2nsS9R9fctQWNcnDiwTFlqABGQ== =y79L -----END PGP SIGNATURE----- --eSUgsUv+8rMNn0JY--