Skip to contentSkip to conversation

mfd: bd71828: Add some missing charger related registers

PATCH Applied Andreas Kemnade 3 participants 5 messages Dec 7, 2025 – Jan 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: bd71828: Add some missing charger related registers

As there are some registers missing which are required for future charger extensions, add them.

---
I have something in preparation for the power supply driver, but I am sending this now if this might go in earlier e.g. via BD72720 immutable branch to avoid more immutable branches.
@Matti: Can you check the situation with the other chips supported by that driver. Is that register there, too?

 include/linux/mfd/rohm-bd71828.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/mfd/rohm-bd71828.h +2 -0
index 73a71ef69152..39fe275a8117 100644
@@ -249,6 +249,8 @@ enum {
 #define BD71828_REG_BATCAP_MON_LIMIT_U	0xcc
 #define BD71828_REG_CONF		0x64
 
+#define BD71828_REG_ILIM_STAT		0x6d
+#define BD71828_REG_DCIN_SET		0x70
 #define BD71828_REG_DCIN_CLPS		0x71
 
 #define BD71828_REG_MEAS_CLEAR		0xaf
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andreas Kemnade

As there are some registers missing which are required for future charger extensions, add them.

Thanks for working with this driver! Much appreciated :)

Quoted 6 lines

---
I have something in preparation for the power supply driver, but I am sending this now if this might go in earlier e.g. via BD72720 immutable branch to avoid more immutable branches.
@Matti: Can you check the situation with the other chips supported by that driver. Is that register there, too?

Sure.

Just purely based on the data-sheets:

- BD71815: I didn't find one.
- BD71879: (As you know) - basically the same as BD71828, so they can both use the BD71828_REG_ILIM_STAT and BD71828_REG_DCIN_SET.
- BD72720:
1: I see 'CHG_ILIM_STAT' with ILIM_VBUS_STAT[6:0], which says:
"Actual value of VBUS current-limitation. The VBUS current limit is increased or decreased automatically. The actual limit can be read from ILIM_VBUS_STAT register."
This may, or may not be related to the stuff you are working with. I think I have this register included in the include/linux/mfd/rohm-bd72720.h. On top of that, the BD72720 has OTP options to configure (time) "Interval for VBUS Current Limitation / Relaxation".
2: I see a read-only 'CHG_VBUS_STAT' with 'ILIM_VBUS' bit and:
"0 = Normal operation
1 = Automatic limit control"
3: I see enable/disable control for:
"VBUS input current limit in Battery Assist"
4: There is also: CHG_VBUS_SET with IBUS_INLIM[6:0], which says:
"VBUS current limit setting for Charge. VBUS current limit is automatically changed to supply enough current to the Battery Charger. Present current limit is available to read from ILIM_VBUS_STAT register." This may be something similar to the DCIN_SET.

I asked for some clarification from the HQ folks - but they may be quite busy, and my request(s) may not be at the top of the priority list. So, let's see...

Are you planning to expose the current limit values to user-space? Allow setting the control to AUTO/fixed value? I suppose this is what enabled you to do some low-power charging, right?

Yours,
-- Matti

---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

maintainer
#2 lore raw

Hi again,

It was faster than one could guess :) I got the response from the HQ. In a nutshell:

"BD72720 ILIM_VBUS_STAT and IBUS_INLIM provide the same functionality as BD71828 ILIM_DCIN_STAT and ILIM_DCIN, but note that the offset and resolution differ."

OTP settings for the time-interval aren't available for BD71828 (and variants). Furthermore, they can't be read/set at runtime on BD72720 which makes them more or less 'invisible' for the SW.

The 'ILIM_VBUS' bit in 'CHG_VBUS_STAT' register (for BD72720) corresponds to the 'DCIN_ILIM_MOD' bit in 'DCIN_STAT' for BD71828.

Finally:
"The Anti-Collapse function present in BD71828 is implemented in analog circuitry on BD72720, so ILIM_VBUS_STAT does not fluctuate due to Anti-Collapse. On BD71828, ILIM_DCIN_STAT changes during Anti-Collapse."

Yours,
-- Matti

Quoted 60 lines · Matti Vaittinen
Quoted 4 lines · Andreas Kemnade

As there are some registers missing which are required for future charger extensions, add them.

Thanks for working with this driver! Much appreciated :)

Quoted 6 lines

---
I have something in preparation for the power supply driver, but I am sending this now if this might go in earlier e.g. via  BD72720 immutable branch to avoid more immutable branches.
@Matti: Can you check the situation with the other chips supported by that driver. Is that register there, too?

Sure.

Just purely based on the data-sheets:

- BD71815: I didn't find one.
- BD71879: (As you know) - basically the same as BD71828, so they can both use the BD71828_REG_ILIM_STAT and BD71828_REG_DCIN_SET.
- BD72720:
  1: I see 'CHG_ILIM_STAT' with ILIM_VBUS_STAT[6:0], which says:
    "Actual value of VBUS current-limitation. The VBUS current limit is increased or decreased automatically. The actual limit can be read from ILIM_VBUS_STAT register."
    This may, or may not be related to the stuff you are working with. I think I have this register included in the include/linux/mfd/rohm-bd72720.h. On top of that, the BD72720 has OTP options to configure (time) "Interval for VBUS Current Limitation / Relaxation".
  2: I see a read-only 'CHG_VBUS_STAT' with 'ILIM_VBUS' bit and:
    "0 = Normal operation
    1 = Automatic limit control"
  3: I see enable/disable control for:
    "VBUS input current limit in Battery Assist"
  4: There is also: CHG_VBUS_SET with IBUS_INLIM[6:0], which says:
    "VBUS current limit setting for Charge. VBUS current limit is automatically changed to supply enough current to the Battery Charger. Present current limit is available to read from ILIM_VBUS_STAT register." This may be something similar to the DCIN_SET.

I asked for some clarification from the HQ folks - but they may be quite busy, and my request(s) may not be at the top of the priority list. So, let's see...

Are you planning to expose the current limit values to user-space? Allow setting the control to AUTO/fixed value? I suppose this is what enabled you to do some low-power charging, right?

Yours,
    -- Matti

---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Signature · 6 lines
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
#3 lore raw
In reply to Matti Vaittinen
Quoted 10 lines · On Mon, 8 Dec 2025 09:47:43 +0200 Matti Vaittinen <[email protected]>…
Quoted 4 lines · Andreas Kemnade

As there are some registers missing which are required for future charger extensions, add them.

Thanks for working with this driver! Much appreciated :)

[...]

Quoted 8 lines

I asked for some clarification from the HQ folks - but they may be quite busy, and my request(s) may not be at the top of the priority list. So, let's see...

Are you planning to expose the current limit values to user-space? Allow setting the control to AUTO/fixed value? I suppose this is what enabled you to do some low-power charging, right?

I am thinking about adding input_current_limit property and providing the ILIM_DCIN_EN as a custom sysfs property like maybe "auto_input_current_limitation"

I had issues with using my bike hub dynamo and some solar panels without any additional batteries in between, just regulator (and in the bike hub dynamo, of course a rectifier with a smoothing capacitor). I would expect to just see the current limited so that voltage stays at the anticollapse voltage, but that is not the case.
I have solved the problem with clearing ILIM_DCIN_EN and setting current accordingly (often to something like 0.4A). I will try to use the next sun ray arriving here to recheck. I have created a script to manipulate things using i2cset in a lonely place in nature where I obviously did not want to spend time with datasheets as short as possible.

The key point is not only low-power charging but also power sources with changing properties.

Regards,
Andreas

maintainer Applied
#4 lore raw

Re: (subset) [PATCH] mfd: bd71828: Add some missing charger related registers

In reply to Andreas Kemnade
Quoted 4 lines · Andreas Kemnade

As there are some registers missing which are required for future charger extensions, add them.

Applied, thanks!

[1/1] mfd: bd71828: Add some missing charger related registers

      commit: 86257bba09afc9d8e52b5e80848b9a1980e5d101

--
Lee Jones [李琼斯]