mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Adil Hüsrev Tepe" <tadilhusrev@gmail.com>
Cc: sre@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	 conor+dt@kernel.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] power: supply: s2mu106-fuelgauge: add standalone driver
Date: Mon, 23 Nov 2026 13:30:48 +0100	[thread overview]
Message-ID: <20261123-tasteful-famous-dragon-00ee8d@quoll> (raw)
In-Reply-To: <20261117104328.1176951-3-tadilhusrev@gmail.com>

On Tue, Nov 17, 2026 at 01:43:28PM +0300, Adil Hüsrev Tepe wrote:
> Add a standalone driver for the fuel gauge in the Samsung S2MU106
> PMIC, as fitted on the Samsung Galaxy XCover5 (own I2C address, 0x3b).
> It shares the S2MU005 fuel gauge's STATUS/RVBAT/RCURCC/RSOC register
> layout and scaling, which this driver reads directly with the stock
> fixed-point formulas; it has no MONOUT average-monitoring registers,
> so unlike s2mu005-battery.c it never reads VOLTAGE_AVG/CURRENT_AVG or
> uses current_avg to decide POWER_SUPPLY_STATUS.
> 
> This replaces a previous version of this series
> (https://lore.kernel.org/all/20261116074000.355176-1-tadilhusrev@gmail.com/)
> that instead extended s2mu005-battery.c with a samsung,s2mu106-fuel-gauge
> fallback compatible; see "dt-bindings: power: supply: add
> samsung,s2mu106-fuelgauge" in this series for why that shape was
> dropped.

No relevant

> 
> The driver was drafted with an AI coding assistant (Claude Code,
> Anthropic) from this register map; I reviewed every line, built it

Not relevant!

> (arm64, 0 warnings), ran checkpatch --strict (clean), and tested it on
> a Samsung Galaxy XCover5 (re-confirmed 2026-11-17, kernel
> 7.4.0-rc1-00023-gdcb8b91fb779+ #30): it probes, and
> /sys/class/power_supply/s2mu106-battery/ reports plausible voltage,
> capacity and charging-status values that track the device's actual
> state (confirmed live, including across a flash/reboot cycle).

Even less relevant, drop. AI usage goes to changelog.


> +static int s2mu106_fg_probe(struct i2c_client *client)
> +{
> +	struct s2mu106_fg *fg;
> +	struct power_supply_config cfg = {};
> +
> +	fg = devm_kzalloc(&client->dev, sizeof(*fg), GFP_KERNEL);
> +	if (!fg)
> +		return -ENOMEM;
> +
> +	fg->dev = &client->dev;
> +	mutex_init(&fg->lock);
> +
> +	fg->regmap = devm_regmap_init_i2c(client, &s2mu106_fg_regmap_config);
> +	if (IS_ERR(fg->regmap))
> +		return PTR_ERR(fg->regmap);
> +
> +	i2c_set_clientdata(client, fg);
> +
> +	cfg.drv_data = fg;
> +	fg->psy = devm_power_supply_register(&client->dev, &s2mu106_fg_desc, &cfg);
> +	if (IS_ERR(fg->psy))
> +		return PTR_ERR(fg->psy);
> +
> +	dev_info(&client->dev, "S2MU106 fuel gauge registered (addr 0x%02x)\n",
> +		 client->addr);

Drop, drivers should be silent on success.

> +	return 0;

Why do you need a new driver instead of integrating it into existing
s2mu005?


Best regards,
Krzysztof


  reply	other threads:[~2026-11-23 12:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 10:43 [PATCH 0/2] power: supply: add standalone S2MU106 fuel gauge (Samsung Galaxy XCover5) Adil Hüsrev Tepe
2026-11-17 10:43 ` [PATCH 1/2] dt-bindings: power: supply: add samsung,s2mu106-fuelgauge Adil Hüsrev Tepe
2026-11-23 12:29   ` Krzysztof Kozlowski
2026-11-25 14:41     ` Adil Hüsrev Tepe
2026-11-17 10:43 ` [PATCH 2/2] power: supply: s2mu106-fuelgauge: add standalone driver Adil Hüsrev Tepe
2026-11-23 12:30   ` Krzysztof Kozlowski [this message]
2026-11-25 14:41     ` Adil Hüsrev Tepe

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=20261123-tasteful-famous-dragon-00ee8d@quoll \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    --cc=tadilhusrev@gmail.com \
    /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

all inboxes | Powered by JetHome®