mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Stanislav Jakubek <stano.jakubek@gmail.com>,
	Jean Delvare <jdelvare@suse.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH] hwmon: (tmp108) Add basic regulator support
Date: Sat, 30 Nov 2024 09:58:17 -0800	[thread overview]
Message-ID: <fcf06424-c014-4e87-9ac5-ced1ea679fdd@roeck-us.net> (raw)
In-Reply-To: <Z0WJg5MMu_1AFYog@standask-GA-A55M-S2HP>

On 11/26/24 00:40, Stanislav Jakubek wrote:
> TMP108/P3T1085 are powered by the V+/VCC regulator, add support for it.
> 
> Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
> ---
>   drivers/hwmon/tmp108.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
> index 1f36af2cd2d9..85e4466259a3 100644
> --- a/drivers/hwmon/tmp108.c
> +++ b/drivers/hwmon/tmp108.c
> @@ -17,6 +17,7 @@
>   #include <linux/init.h>
>   #include <linux/jiffies.h>
>   #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>   #include <linux/slab.h>
>   
>   #define	DRIVER_NAME "tmp108"
> @@ -331,6 +332,10 @@ static int tmp108_common_probe(struct device *dev, struct regmap *regmap, char *
>   	u32 config;
>   	int err;
>   
> +	err = devm_regulator_get_enable(dev, "vcc");
> +	if (err)
> +		return dev_err_probe(dev, err, "Failed to enable regulator\n");
> +

Problem with this is that existing devicetree bindings do not provide
a reference to the regulator. Those would now fail to instantiate,
which would be unacceptable. I think you'll need something like

	err = devm_regulator_get_enable_optional(dev, "vcc");
	if (err && err != -ENODEV)
		return dev_err_probe(dev, err, "Failed to enable regulator\n");

Even though the regulator is now mandatory, existing devicetree bindings
don't know that.

Guenter


  reply	other threads:[~2024-11-30 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26  8:40 Stanislav Jakubek
2024-11-30 17:58 ` Guenter Roeck [this message]
2024-12-04  8:57   ` Stanislav Jakubek
2024-12-04 14:15     ` Guenter Roeck
2024-12-04 14:16 ` Guenter Roeck

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=fcf06424-c014-4e87-9ac5-ced1ea679fdd@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Frank.Li@nxp.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stano.jakubek@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®