public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	KancyJoe <kancy2333@outlook.com>
Subject: Re: [PATCH 2/2] regulator: add SGM3804 Dual Output driver
Date: Wed, 29 Apr 2026 10:05:33 +0200	[thread overview]
Message-ID: <7d2fd0d7-2ac2-43d8-be5c-4f9fcd7908bb@linaro.org> (raw)
In-Reply-To: <afFS3W5hokXy3T7x@sirena.co.uk>

On 4/29/26 02:37, Mark Brown wrote:
> On Tue, Apr 28, 2026 at 03:52:06PM +0200, Neil Armstrong wrote:
>> From: KancyJoe <kancy2333@outlook.com>
>>
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> Signed-off-by: KancyJoe <kancy2333@outlook.com>
> 
> Your signoff should appear at the bottom of the list here.

Right

> 
>> @@ -0,0 +1,280 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * SGMicro SGM3804 regulator Driver
>> + *
>> + * Copyright (C) 2025 Kancy Joe <kancy2333@outlook.com>
>> + * Copyright (C) 2026 Linaro Limited
>> + * Author: Neil Armstrong <neil.armstrong@linaro.org>
>> + */
> 
> Please make the entire comment a C++ one so things look more
> intentional.  The authorship overall appears a bit confused?

Sorry, what's confusing here ?

> 
>> +/*
>> + * The registers are only writable when the gpio is enabled, so we
>> + * can't use the regulator regmap helpers & internal gpio handling
>> + * so we need to track the state and apply the state at enable time.
>> + */
>> +struct sgm3804_data {
>> +	struct regmap *regmap;
>> +	bool active_discharge[SGM3804_RAIL_COUNT];
>> +	unsigned int sel[SGM3804_RAIL_COUNT];
>> +	struct gpio_desc *gpios[SGM3804_RAIL_COUNT];
>> +};
> 
>> +static int sgm3804_enable(struct regulator_dev *rdev)
>> +{
> 
>> +       ret = regmap_write(ctx->regmap, rdev->desc->vsel_reg,
>> +                          ctx->sel[rdev_get_id(rdev)]);
>> +       if (ret)
>> +               goto err;
>> +
>> +       ret = regulator_set_active_discharge_regmap(rdev,
>> +                                                   ctx->active_discharge[rdev_get_id(rdev)]);
> 
> It seems like this should be a regcache sync then only the enable and
> disable operations need to be custom?  There is a register cache and it
> covers these registers, without it the _active_discharge wouldn't work
> since it does a regmap_update_bits() and all the registers are marked
> unreadable.

I added regcache defaults with the default hardware values so it uses the
cache default to do regmap_update_bits(), and yes none registers can be read
so it uses the cache.

> 
>> +MODULE_DESCRIPTION("SGMicro SGM3804 regulator Driver");
>> +MODULE_AUTHOR("Kancy Joe <kancy2333@outlook.com>");
>> +MODULE_LICENSE("GPL");
> 
> More author information here not looking joined up.

I'll add my entry.

Neil


  parent reply	other threads:[~2026-04-29  8:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 13:52 [PATCH 0/2] regulator: add support for SGM3804 Dual Output driver Neil Armstrong
2026-04-28 13:52 ` [PATCH 1/2] dt-bindings: regulator: document the SGM3804 Dual Output regulator Neil Armstrong
2026-04-28 15:30   ` Rob Herring (Arm)
2026-04-29  0:23   ` Mark Brown
2026-04-29  0:38   ` Mark Brown
2026-04-29  8:02     ` Neil Armstrong
2026-04-28 13:52 ` [PATCH 2/2] regulator: add SGM3804 Dual Output driver Neil Armstrong
2026-04-29  0:37   ` Mark Brown
2026-04-29  0:44     ` Mark Brown
2026-04-29  8:05     ` Neil Armstrong [this message]
2026-04-30  1:06       ` Mark Brown
2026-04-30  7:16         ` Neil Armstrong

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=7d2fd0d7-2ac2-43d8-be5c-4f9fcd7908bb@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kancy2333@outlook.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@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