* [PATCH] hwmon: (tmp108) Add basic regulator support
@ 2024-11-26 8:40 Stanislav Jakubek
2024-11-30 17:58 ` Guenter Roeck
2024-12-04 14:16 ` Guenter Roeck
0 siblings, 2 replies; 5+ messages in thread
From: Stanislav Jakubek @ 2024-11-26 8:40 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck; +Cc: linux-hwmon, linux-kernel, Frank Li
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");
+
tmp108 = devm_kzalloc(dev, sizeof(*tmp108), GFP_KERNEL);
if (!tmp108)
return -ENOMEM;
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (tmp108) Add basic regulator support
2024-11-26 8:40 [PATCH] hwmon: (tmp108) Add basic regulator support Stanislav Jakubek
@ 2024-11-30 17:58 ` Guenter Roeck
2024-12-04 8:57 ` Stanislav Jakubek
2024-12-04 14:16 ` Guenter Roeck
1 sibling, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2024-11-30 17:58 UTC (permalink / raw)
To: Stanislav Jakubek, Jean Delvare; +Cc: linux-hwmon, linux-kernel, Frank Li
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (tmp108) Add basic regulator support
2024-11-30 17:58 ` Guenter Roeck
@ 2024-12-04 8:57 ` Stanislav Jakubek
2024-12-04 14:15 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Stanislav Jakubek @ 2024-12-04 8:57 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, linux-kernel, Frank Li
On Sat, Nov 30, 2024 at 09:58:17AM -0800, Guenter Roeck wrote:
> 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
Doesn't devm_regulator_get_enable fallback to a dummy regulator when
a reference to the regulator isn't provided?
lm90 does it this way too.
Regards,
Stanislav
>
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (tmp108) Add basic regulator support
2024-12-04 8:57 ` Stanislav Jakubek
@ 2024-12-04 14:15 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2024-12-04 14:15 UTC (permalink / raw)
To: Stanislav Jakubek; +Cc: Jean Delvare, linux-hwmon, linux-kernel, Frank Li
On 12/4/24 00:57, Stanislav Jakubek wrote:
> On Sat, Nov 30, 2024 at 09:58:17AM -0800, Guenter Roeck wrote:
>> 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
>
> Doesn't devm_regulator_get_enable fallback to a dummy regulator when
> a reference to the regulator isn't provided?
>
> lm90 does it this way too.
>
Ah yes, you are correct. I misinterpreted the code. I'll apply the patch.
Thanks,
Guenter
> Regards,
> Stanislav
>
>>
>> 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
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (tmp108) Add basic regulator support
2024-11-26 8:40 [PATCH] hwmon: (tmp108) Add basic regulator support Stanislav Jakubek
2024-11-30 17:58 ` Guenter Roeck
@ 2024-12-04 14:16 ` Guenter Roeck
1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2024-12-04 14:16 UTC (permalink / raw)
To: Stanislav Jakubek; +Cc: Jean Delvare, linux-hwmon, linux-kernel, Frank Li
On Tue, Nov 26, 2024 at 09:40:35AM +0100, 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>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-04 14:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26 8:40 [PATCH] hwmon: (tmp108) Add basic regulator support Stanislav Jakubek
2024-11-30 17:58 ` Guenter Roeck
2024-12-04 8:57 ` Stanislav Jakubek
2024-12-04 14:15 ` Guenter Roeck
2024-12-04 14:16 ` Guenter Roeck
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®