[PATCH V6 2/6] power: supply: sgm41542: Add SG Micro sgm41542 charger
Sebastian Reichel
sebastian.reichel at collabora.com
Mon Jun 8 14:19:54 PDT 2026
Hi,
On Mon, Jun 08, 2026 at 12:55:17PM -0500, Chris Morgan wrote:
> Add support for the SG Micro SGM41542 charger/boost converter.
> Driver was adapted from Rockchip BSP driver [1] and confirmed
> with vendor datasheet [2].
>
> [1] https://github.com/rockchip-linux/kernel/blob/develop-6.6/drivers/power/supply/sgm41542_charger.c
> [2] https://www.sg-micro.de/rect/assets/1e8de70b-657e-4156-be68-a64fdbe8e418/SGM41541_SGM41542.pdf
>
> Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
> ---
> drivers/power/supply/Kconfig | 8 +
> drivers/power/supply/Makefile | 1 +
> drivers/power/supply/sgm41542_charger.c | 1057 +++++++++++++++++++++++
> 3 files changed, 1066 insertions(+)
> create mode 100644 drivers/power/supply/sgm41542_charger.c
> [...]
> +static int sgm4154x_set_recharge_volt_ua(struct sgm4154x_device *sgm, int recharge_volt)
> +{
> + int reg_val;
> + int ret;
> +
> + recharge_volt = recharge_volt / 1000;
> +
> + reg_val = (recharge_volt - SGM4154X_VRECHRG_OFFSET_MV) / SGM4154X_VRECHRG_STEP_MV;
These are the only millivolt offset/steps, so drop the 1000 divison
and simply do:
#define SGM4154X_VRECHRG_OFFSET_UV 100000
#define SGM4154X_VRECHRG_STEP_UV 100000
reg_val = (recharge_volt - SGM4154X_VRECHRG_OFFSET_UV) / SGM4154X_VRECHRG_STEP_UV;
Otherwise LGTM.
> [...]
Greetings,
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20260608/771dca22/attachment.sig>
More information about the Linux-rockchip
mailing list