Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Andreas Kemnade <akemnade@kernel.org>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alistair Francis <alistair@alistair23.me>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] regulator: sy7636a: add gpios and input regulator
Date: Sat, 6 Sep 2025 22:32:40 +0800	[thread overview]
Message-ID: <20250906143240.GA12656@nxa18884-linux.ap.freescale.net> (raw)
In-Reply-To: <20250906-sy7636-rsrc-v1-3-e2886a9763a7@kernel.org>

On Sat, Sep 06, 2025 at 11:09:14AM +0200, Andreas Kemnade wrote:
>Initialize input regulator and gpios to proper values to have things
>basically working as well as in the case when these things are
>hardwired.
>
>Signed-off-by: Andreas Kemnade <akemnade@kernel.org>
>---
> drivers/regulator/sy7636a-regulator.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
>diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
>index 27e3d939b7bb9..bd8739624c727 100644
>--- a/drivers/regulator/sy7636a-regulator.c
>+++ b/drivers/regulator/sy7636a-regulator.c
>@@ -12,6 +12,7 @@
> #include <linux/mfd/sy7636a.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
>+#include <linux/regulator/consumer.h>
> #include <linux/regulator/driver.h>
> #include <linux/regulator/machine.h>
> #include <linux/regmap.h>
>@@ -19,6 +20,8 @@
> struct sy7636a_data {
> 	struct regmap *regmap;
> 	struct gpio_desc *pgood_gpio;
>+	struct gpio_desc *en_gpio;
>+	struct gpio_desc *vcom_en_gpio;
> };
> 
> static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev)
>@@ -98,6 +101,29 @@ static int sy7636a_regulator_probe(struct platform_device *pdev)
> 	data->regmap = regmap;
> 	data->pgood_gpio = gdp;
> 
>+	ret = devm_regulator_get_enable_optional(&pdev->dev, "vin");
>+	if (ret)
>+		return dev_err_probe(&pdev->dev, ret,
>+				     "failed to get vin regulator\n");
>+
>+	data->en_gpio = devm_gpiod_get_optional(&pdev->dev, "en",
>+						GPIOD_OUT_HIGH);
>+	if (IS_ERR(data->en_gpio))
>+		return dev_err_probe(&pdev->dev,
>+				     PTR_ERR(data->en_gpio),
>+				     "failed to get en gpio\n");
>+
>+	/* Let VCOM just follow the default power on sequence */
>+	data->vcom_en_gpio = devm_gpiod_get_optional(&pdev->dev,
>+						     "vcom-en", GPIOD_OUT_LOW);
>+	if (IS_ERR(data->vcom_en_gpio))
>+		return dev_err_probe(&pdev->dev,
>+				     PTR_ERR(data->en_gpio),
>+				     "failed to get en gpio\n");

Nit: s/en/vcom en/

>+
>+	if (data->en_gpio)
>+		usleep_range(2500, 4000);

It would be better to add a comment on this delay.

Regards
Peng

  reply	other threads:[~2025-09-06 13:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-06  9:09 [PATCH 0/4] regulator: sy7636a: define and init all resources needed Andreas Kemnade
2025-09-06  9:09 ` [PATCH 1/4] dt-bindings: mfd: sy7636a: Add missing gpio pins and supply Andreas Kemnade
2025-09-06 12:01   ` Krzysztof Kozlowski
2025-09-08 10:54     ` Andreas Kemnade
2025-09-08 14:34     ` Mark Brown
2025-09-09  0:44       ` Rob Herring
2025-09-09  7:13         ` Andreas Kemnade
2025-09-06  9:09 ` [PATCH 2/4] regulator: sy7636a: fix lifecycle of power good gpio Andreas Kemnade
2025-09-06 14:35   ` Peng Fan
2025-09-08  8:00   ` Alistair
2025-09-06  9:09 ` [PATCH 3/4] regulator: sy7636a: add gpios and input regulator Andreas Kemnade
2025-09-06 14:32   ` Peng Fan [this message]
2025-09-07 11:26   ` Dan Carpenter
2025-09-06  9:09 ` [PATCH 4/4] ARM: dts: imx: e70k02: add sy7636 Andreas Kemnade
2025-09-08  8:07   ` Alistair
2025-09-09 13:34 ` (subset) [PATCH 0/4] regulator: sy7636a: define and init all resources needed 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=20250906143240.GA12656@nxa18884-linux.ap.freescale.net \
    --to=peng.fan@oss.nxp.com \
    --cc=akemnade@kernel.org \
    --cc=alistair@alistair23.me \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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