From: Linus Walleij <linusw@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, Linus Walleij <linusw@kernel.org>
Subject: [PATCH 09/15] power: supply: ab8500_charger: Respect AB8505 register layout
Date: Wed, 16 Sep 2026 08:49:31 +0200 [thread overview]
Message-ID: <20260916-ab8500-charging-v1-9-e986ed321cc6@kernel.org> (raw)
In-Reply-To: <20260916-ab8500-charging-v1-0-e986ed321cc6@kernel.org>
Several AB8505 charger fields differ from AB8500. Its long VBUS
falling debounce is 300 ms rather than 100 ms, and its VBUS
overvoltage selector has a different encoding programmed through OTP.
Writing the AB8500 6.3 V value selects 9 V on AB8505.
AB8505 revision 3 also defines SwControlFallback as reserved,
correcting older documentation which led the driver to support
autopower there. Preserve the AB8505 overvoltage setting, wait for its
documented debounce, and reject the unsupported autopower setting.
Fixes: 0ed5107fa860 ("ab8500-charger: Do not touch VBUSOVV bits")
Fixes: b016322293c7 ("ab8500-charger: Add support for autopower on AB8505 and AB9540")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
drivers/power/supply/ab8500_charger.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c
index 4810dfbe948d..08042ef222be 100644
--- a/drivers/power/supply/ab8500_charger.c
+++ b/drivers/power/supply/ab8500_charger.c
@@ -52,7 +52,7 @@
#define MAIN_CH_DET 0x01
#define MAIN_CH_CV_ON 0x04
#define USB_CH_CV_ON 0x08
-#define VBUS_DET_DBNC100 0x02
+#define VBUS_DET_DBNC_LONG 0x02
#define VBUS_DET_DBNC1 0x01
#define OTP_ENABLE_WD 0x01
#define DROP_COUNT_RESET 0x01
@@ -383,6 +383,10 @@ static void ab8500_enable_disable_sw_fallback(struct ab8500_charger *di,
u8 bit;
int ret;
+ /* SwControlFallback is reserved and must remain clear on AB8505. */
+ if (is_ab8505(di->parent))
+ return;
+
dev_dbg(di->dev, "SW Fallback: %d\n", fallback);
if (is_ab8500(di->parent)) {
@@ -703,12 +707,16 @@ static int ab8500_charger_detect_chargers(struct ab8500_charger *di, bool probe)
if (!probe) {
/*
- * AB8500 says VBUS_DET_DBNC1 & VBUS_DET_DBNC100
+ * AB8500 says VBUS_DET_DBNC1 & VBUS_DET_DBNC_LONG
* when disconnecting ACA even though no
* charger was connected. Try waiting a little
- * longer than the 100 ms of VBUS_DET_DBNC100...
+ * longer than its 100 ms debounce. AB8505 uses
+ * a 300 ms falling debounce for the same bit.
*/
- msleep(110);
+ if (is_ab8505(di->parent))
+ msleep(310);
+ else
+ msleep(110);
}
ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER,
AB8500_CH_USBCH_STAT1_REG, &val);
@@ -719,7 +727,7 @@ static int ab8500_charger_detect_chargers(struct ab8500_charger *di, bool probe)
dev_dbg(di->dev,
"%s AB8500_CH_USBCH_STAT1_REG %x\n", __func__,
val);
- if ((val & VBUS_DET_DBNC1) && (val & VBUS_DET_DBNC100))
+ if ((val & VBUS_DET_DBNC1) && (val & VBUS_DET_DBNC_LONG))
result |= USB_PW_CONN;
return result;
@@ -3185,7 +3193,7 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
}
}
- if (is_ab8505_2p0(di->parent))
+ if (is_ab8505(di->parent))
ret = abx500_mask_and_set_register_interruptible(di->dev,
AB8500_CHARGER,
AB8500_USBCH_CTRL2_REG,
@@ -3534,11 +3542,14 @@ static int ab8500_charger_probe(struct platform_device *pdev)
di->bm = &ab8500_bm_data;
- di->autopower_cfg = of_property_read_bool(np, "autopower_cfg");
-
/* get parent data */
di->dev = dev;
di->parent = dev_get_drvdata(pdev->dev.parent);
+ di->autopower_cfg = of_property_read_bool(np, "autopower_cfg");
+ if (di->autopower_cfg && is_ab8505(di->parent)) {
+ dev_warn(dev, "autopower is not supported on AB8505\n");
+ di->autopower_cfg = false;
+ }
/* Get ADC channels */
if (!is_ab8505(di->parent)) {
--
2.55.0
next prev parent reply other threads:[~2026-09-16 6:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 6:49 [PATCH 00/15] power: supply: Fix AB8500 and AB8505 charging Linus Walleij
2026-09-16 6:49 ` [PATCH 01/15] power: supply: ab8500_fg: Accept status from supplied power Linus Walleij
2026-09-16 6:49 ` [PATCH 02/15] power: supply: ab8500_fg: Report sub-percent charge changes Linus Walleij
2026-09-16 6:49 ` [PATCH 03/15] power: supply: ab8500: Correct register definitions Linus Walleij
2026-09-16 6:49 ` [PATCH 04/15] power: supply: ab8500_fg: Drop nonexistent AB8505 controls Linus Walleij
2026-09-16 6:49 ` [PATCH 05/15] power: supply: ab8500_btemp: Fix event temperature reporting Linus Walleij
2026-09-16 6:49 ` [PATCH 06/15] power: supply: ab8500: Preserve battery termination current Linus Walleij
2026-09-16 6:49 ` [PATCH 07/15] power: supply: ab8500_charger: Fix AC charger re-enable Linus Walleij
2026-09-16 6:49 ` [PATCH 08/15] power: supply: ab8500_charger: Decode AB8505 USB status Linus Walleij
2026-09-16 6:49 ` Linus Walleij [this message]
2026-09-16 6:49 ` [PATCH 10/15] power: supply: ab8500_charger: Handle detection errors Linus Walleij
2026-09-16 6:49 ` [PATCH 11/15] power: supply: ab8500_charger: Skip absent AB8505 main charger Linus Walleij
2026-09-16 6:49 ` [PATCH 12/15] power: supply: ab8500_charger: Retry AB8505 USB detection Linus Walleij
2026-09-16 6:49 ` [PATCH 13/15] power: supply: ab8500_charger: Recover inactive AB8505 charger Linus Walleij
2026-09-16 6:49 ` [PATCH 14/15] power: supply: ab8500_fg: Finalize current measurements Linus Walleij
2026-09-16 6:49 ` [PATCH 15/15] power: supply: ab8500_fg: Avoid reserved AB8505 CCConf bit Linus Walleij
2026-10-02 22:07 ` [PATCH 00/15] power: supply: Fix AB8500 and AB8505 charging Linus Walleij
2026-10-04 19:33 ` Sebastian Reichel
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=20260916-ab8500-charging-v1-9-e986ed321cc6@kernel.org \
--to=linusw@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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