From nobody Mon Feb 9 00:26:34 2026 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 4B58D2DCBF3 for ; Wed, 5 Nov 2025 07:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328386; cv=none; b=dZKEpW91wh1LY3EGOsjs33Bv85CVpcKVicwmIXIZ9Vexmc76fX5Ig4DgP3bEdlnygq/kZqU0R53TzuffGvloRyuHc8PlijKdGHhcPQGB7gcgLbXsEsOFsK8hwNkh6O3Bc5FF3tK5MHk8XluLbzQCcjcDSd89iq7JjFu0Pc663No= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762328386; c=relaxed/simple; bh=FzU68KgfWd0Ag+ZNIa/sYCVuLPYQCRz4V7ZnZID9rcE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ksXg5fD0d+FgqG6TceNBz0lsdg8PQaorzA2imX/5q4YRmh1GOPlqyExcYqVoqX49j72TmVqj961Ex9rCJw1gfEvtsrSIn8RK0pdJa69l31l0+JoGFEja+V5oBPHTHjrWrBMO1/dUGxVdlFen07F5X8rIZT6OxABlCyGFd4j14ng= 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=SZOmc4Bw; arc=none smtp.client-ip=91.218.175.179 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="SZOmc4Bw" Date: Wed, 5 Nov 2025 09:39:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762328382; 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=dHdKl5NTAo+EJl7nxyYj/jaxADZc5iBvVUPFVMj0iS0=; b=SZOmc4BwUQlyC7Xac7B1qPITme3IllFExOQVyU2yIMO4w8k+eXaKs84AUo57s2UCvIKdtj vPgQwe/a9SqIIj9XiUmVuzD23n8dB4ECAxYrZHlvcg/bDAGipIctqpsdtVlZNZJ4RBxKPS 3L6Ih9CU5n2QR5Btn9976cKJ6o9luNw= 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 v3 14/16] power: supply: bd71828: Support wider register addresses Message-ID: <903c078d0ea74862e4f8595dd9c162677e5c0399.1762327887.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="4F51MbzgHAMPXqGB" Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT --4F51MbzgHAMPXqGB 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.0 --4F51MbzgHAMPXqGB Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmkK/zgACgkQeFA3/03a ocU1IAgAtAPo754Dgh/kqxA7PstHheEX5dg3WyX7i8k3vOgns0hEUL7EUHKNhLsk AttEnpsHdwzp/BvufbtzSaYx/NoMD7KKGtsusCTOqfpwypJN3PqPMIrC3sQlfWQU aQKx8JmT40N4l7sLIPNe9U1rgX1b5s8STRuUkTVgcQ65A+hwz6jsF60v1gy6WJIj 2MWSKb0sP1AATXaMgQ23OAmGY43V4t8to9MO02D3D4EV39aQnxJBqn1XF9kCcjIl wvSbw7uFOYXAG5dNuykxVvoGbUOka32YIBe97AIHzV55zS6v4gPVDWti2kp3vuDo UdS3LQEieV7JlqmjItZ/YEJc+fqsMg== =M2qa -----END PGP SIGNATURE----- --4F51MbzgHAMPXqGB--