From: Mark Brown <broonie@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.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 v2 2/2] regulator: add SGM3804 Dual Output driver
Date: Thu, 30 Apr 2026 19:34:09 +0900 [thread overview]
Message-ID: <afMwIVRDxl11Ty_P@sirena.co.uk> (raw)
In-Reply-To: <20260430-topic-sm8650-ayaneo-pocket-s2-sgm3804-v2-2-76108c65a560@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 2085 bytes --]
On Thu, Apr 30, 2026 at 10:48:47AM +0200, Neil Armstrong wrote:
> Add support for the SG Micro SGM3804 Single Inductor Dual Output
> Buck/Boost Converter used to power LCD panels a provide positive
> and negative power rails with configurable voltage and active
> discharge function for each output.
> +config REGULATOR_SGM3804
> + tristate "SGMicro SGM3804 voltage regulator"
> + depends on I2C && OF
> + help
> + This driver supports SGMicro SGM3804 dual-output voltage regulator.
> +
This needs to select REGMAP_I2C.
> +// 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 block a C++ one so things look more
intentional.
> +/*
> + * Since all registers are only writeable & volatile,
> + * regmap will only read from the cache data.
> + */
> +static bool sgm3804_readable_reg(struct device *dev, unsigned int reg)
> +{
> + return false;
> +}
Non-readable registers can't be volatile, volatile means always do a
read.
> +static int sgm3804_enable(struct regulator_dev *rdev)
> +{
> + struct sgm3804_data *ctx = rdev->reg_data;
> + int ret;
> +
> + ret = gpiod_set_value(ctx->gpios[rdev_get_id(rdev)], 1);
> + if (ret)
> + return ret;
This could use _cansleep() for wider interoperability.
> +
> + 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)]);
> + if (ret)
> + goto err;
I'm still not clear why this isn't doing a regcache sync instead of
writing things out individually.
> + ctx->gpios[i] = devm_gpiod_get_index(dev, "enable",
> + i, GPIOD_OUT_LOW);
> + if (IS_ERR(ctx->gpios[i]))
> + return dev_err_probe(dev, PTR_ERR(ctx->gpios[i]),
> + "failed to get enable GPIO %d\n", i);
Perhaps use GPIOD_ASIS for a smoother handover?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-04-30 10:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 8:48 [PATCH v2 0/2] regulator: add support for SGM3804 Dual Output driver Neil Armstrong
2026-04-30 8:48 ` [PATCH v2 1/2] regulator: dt-bindings: document the SGM3804 Dual Output regulator Neil Armstrong
2026-04-30 10:25 ` Rob Herring (Arm)
2026-04-30 8:48 ` [PATCH v2 2/2] regulator: add SGM3804 Dual Output driver Neil Armstrong
2026-04-30 10:34 ` Mark Brown [this message]
2026-04-30 13:28 ` Neil Armstrong
2026-04-30 23:46 ` Mark Brown
2026-05-04 6:55 ` Neil Armstrong
2026-05-04 12:50 ` Mark Brown
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=afMwIVRDxl11Ty_P@sirena.co.uk \
--to=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=neil.armstrong@linaro.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