public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	 Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	 Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	 Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	 Alexandre Belloni <alexandre.belloni@bootlin.com>,
	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 <andreas@kemnade.info>
Subject: Re: [PATCH RESEND v6 15/17] power: supply: bd71828: Support wider register addresses
Date: Mon, 12 Jan 2026 01:45:55 +0100	[thread overview]
Message-ID: <aWREICvFRzoelLWm@venus> (raw)
In-Reply-To: <57c87f7e2082a666f0adeafcd11f673c0af7d326.1765804226.git.mazziesaccount@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2825 bytes --]

Hi,

On Mon, Dec 15, 2025 at 03:21:03PM +0200, Matti Vaittinen wrote:
> From: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> 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 <mazziesaccount@gmail.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Greetings,

-- Sebastian

> Revision history:
>  v2 => :
>  - No changes
> 
>  RFCv1 => 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/bd71828-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
>  
>  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;
>  };
>  
>  static const struct pwr_regs pwr_regs_bd71828 = {
> -- 
> 2.52.0
> 



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-01-12  0:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 13:16 [PATCH RESEND v6 00/17] Support ROHM BD72720 PMIC Matti Vaittinen
2025-12-15 13:17 ` [PATCH RESEND v6 01/17] dt-bindings: regulator: ROHM BD72720 Matti Vaittinen
2025-12-15 13:17 ` [PATCH RESEND v6 02/17] dt-bindings: battery: Clarify trickle-charge Matti Vaittinen
2025-12-15 13:17 ` [PATCH RESEND v6 03/17] dt-bindings: battery: Add trickle-charge upper limit Matti Vaittinen
2025-12-15 13:18 ` [PATCH RESEND v6 04/17] dt-bindings: battery: Voltage drop properties Matti Vaittinen
2025-12-15 13:18 ` [PATCH RESEND v6 05/17] dt-bindings: mfd: ROHM BD72720 Matti Vaittinen
2025-12-15 13:18 ` [PATCH RESEND v6 06/17] dt-bindings: leds: bd72720: Add BD72720 Matti Vaittinen
2025-12-15 13:19 ` [PATCH RESEND v6 07/17] mfd: rohm-bd71828: Use regmap_reg_range() Matti Vaittinen
2025-12-15 13:19 ` [PATCH RESEND v6 08/17] mfd: rohm-bd71828: Use standard file header format Matti Vaittinen
2025-12-15 13:19 ` [PATCH RESEND v6 09/17] mfd: rohm-bd71828: Support ROHM BD72720 Matti Vaittinen
2025-12-15 13:19 ` [PATCH RESEND v6 10/17] regulator: bd71828: rename IC specific entities Matti Vaittinen
2025-12-15 13:20 ` [PATCH RESEND v6 11/17] regulator: bd71828: Support ROHM BD72720 Matti Vaittinen
2025-12-15 13:20 ` [PATCH RESEND v6 12/17] gpio: Support ROHM BD72720 gpios Matti Vaittinen
2025-12-15 13:20 ` [PATCH RESEND v6 13/17] clk: clk-bd718x7: Support BD72720 clk gate Matti Vaittinen
2025-12-15 13:20 ` [PATCH RESEND v6 14/17] rtc: bd70528: Support BD72720 rtc Matti Vaittinen
2025-12-15 13:21 ` [PATCH RESEND v6 15/17] power: supply: bd71828: Support wider register addresses Matti Vaittinen
2026-01-12  0:45   ` Sebastian Reichel [this message]
2025-12-15 13:21 ` [PATCH RESEND v6 16/17] power: supply: bd71828-power: Support ROHM BD72720 Matti Vaittinen
2026-01-12  0:51   ` Sebastian Reichel
2026-01-12  6:11     ` Andreas Kemnade
2026-01-12  6:44     ` Matti Vaittinen
2025-12-15 13:21 ` [PATCH RESEND v6 17/17] MAINTAINERS: Add ROHM BD72720 PMIC Matti Vaittinen
2025-12-15 13:27 ` [PATCH RESEND v6 00/17] Support " Matti Vaittinen
2026-01-08 17:27 ` Lee Jones
2026-01-09  6:29   ` Matti Vaittinen
2026-01-09  9:38     ` Lee Jones
2026-01-12  0:53       ` Sebastian Reichel
2026-01-12 12:04         ` Matti Vaittinen
2026-01-14  0:26           ` Sebastian Reichel
2026-01-15 13:49 ` [GIT PULL] Immutable branch between MFD, Clk, GPIO, Power, Regulator and RTC due for the v6.20 merge window Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWREICvFRzoelLWm@venus \
    --to=sebastian.reichel@collabora.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andreas@kemnade.info \
    --cc=brgl@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=pavel@kernel.org \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox