* [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property @ 2026-03-11 10:58 Flaviu Nistor 2026-03-11 10:58 ` [PATCH 2/2] hwmon: lm75: Add support for label Flaviu Nistor 2026-03-13 13:26 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Krzysztof Kozlowski 0 siblings, 2 replies; 7+ messages in thread From: Flaviu Nistor @ 2026-03-11 10:58 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-hwmon, devicetree, linux-kernel, Flaviu Nistor Add support for an optional label property similar to other hwmon devices. This allows, in case of boards with multiple LM75 sensors, to assign distinct names to each instance. Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> --- Documentation/devicetree/bindings/hwmon/lm75.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml index 0b9fda81e3ec..cde6299c9b4f 100644 --- a/Documentation/devicetree/bindings/hwmon/lm75.yaml +++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml @@ -87,6 +87,7 @@ examples: compatible = "st,stlm75"; reg = <0x48>; vs-supply = <&vs>; + label = "somelabel"; }; }; - | @@ -101,5 +102,6 @@ examples: vs-supply = <&vs>; interrupt-parent = <&gpio1>; interrupts = <17 IRQ_TYPE_EDGE_BOTH>; + label = "somelabel"; }; }; -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] hwmon: lm75: Add support for label 2026-03-11 10:58 [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Flaviu Nistor @ 2026-03-11 10:58 ` Flaviu Nistor 2026-03-13 18:37 ` Guenter Roeck 2026-03-13 13:26 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Krzysztof Kozlowski 1 sibling, 1 reply; 7+ messages in thread From: Flaviu Nistor @ 2026-03-11 10:58 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-hwmon, devicetree, linux-kernel, Flaviu Nistor Add support for label sysfs attribute similar to other hwmon devices. This is particularly useful for systems with multiple sensors on the same board, where identifying individual sensors is much easier since labels can be defined via device tree. Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> --- drivers/hwmon/lm75.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index eda93a8c23c9..66178ac63e4f 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -108,6 +108,7 @@ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, #define PCT2075_REG_IDLE 0x04 struct lm75_data { + const char *label; struct regmap *regmap; u16 orig_conf; u8 resolution; /* In bits, 9 to 16 */ @@ -363,6 +364,16 @@ static irqreturn_t lm75_alarm_handler(int irq, void *private) return IRQ_HANDLED; } +static int lm75_read_string(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, const char **str) +{ + struct lm75_data *data = dev_get_drvdata(dev); + + *str = data->label; + + return 0; +} + static int lm75_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { @@ -534,6 +545,9 @@ static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type, switch (attr) { case hwmon_temp_input: return 0444; + case hwmon_temp_label: + /* Hide label node if label is not provided */ + return (config_data->label) ? 0444 : 0; case hwmon_temp_max: case hwmon_temp_max_hyst: return 0644; @@ -553,13 +567,14 @@ static const struct hwmon_channel_info * const lm75_info[] = { HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL), HWMON_CHANNEL_INFO(temp, - HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST | + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_MAX | HWMON_T_MAX_HYST | HWMON_T_ALARM), NULL }; static const struct hwmon_ops lm75_hwmon_ops = { .is_visible = lm75_is_visible, + .read_string = lm75_read_string, .read = lm75_read, .write = lm75_write, }; @@ -721,6 +736,9 @@ static int lm75_generic_probe(struct device *dev, const char *name, /* needed by custom regmap callbacks */ dev_set_drvdata(dev, data); + /* Save the connected input label if available */ + of_property_read_string(dev->of_node, "label", &data->label); + data->kind = kind; data->regmap = regmap; -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] hwmon: lm75: Add support for label 2026-03-11 10:58 ` [PATCH 2/2] hwmon: lm75: Add support for label Flaviu Nistor @ 2026-03-13 18:37 ` Guenter Roeck 0 siblings, 0 replies; 7+ messages in thread From: Guenter Roeck @ 2026-03-13 18:37 UTC (permalink / raw) To: Flaviu Nistor Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree, linux-kernel On Wed, Mar 11, 2026 at 12:58:08PM +0200, Flaviu Nistor wrote: > Add support for label sysfs attribute similar to other hwmon devices. > This is particularly useful for systems with multiple sensors on the > same board, where identifying individual sensors is much easier since > labels can be defined via device tree. > > Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> > --- > drivers/hwmon/lm75.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c > index eda93a8c23c9..66178ac63e4f 100644 > --- a/drivers/hwmon/lm75.c > +++ b/drivers/hwmon/lm75.c > @@ -108,6 +108,7 @@ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, > #define PCT2075_REG_IDLE 0x04 > > struct lm75_data { > + const char *label; > struct regmap *regmap; > u16 orig_conf; > u8 resolution; /* In bits, 9 to 16 */ > @@ -363,6 +364,16 @@ static irqreturn_t lm75_alarm_handler(int irq, void *private) > return IRQ_HANDLED; > } > > +static int lm75_read_string(struct device *dev, enum hwmon_sensor_types type, > + u32 attr, int channel, const char **str) > +{ > + struct lm75_data *data = dev_get_drvdata(dev); > + > + *str = data->label; > + > + return 0; > +} > + > static int lm75_read(struct device *dev, enum hwmon_sensor_types type, > u32 attr, int channel, long *val) > { > @@ -534,6 +545,9 @@ static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type, > switch (attr) { > case hwmon_temp_input: > return 0444; > + case hwmon_temp_label: > + /* Hide label node if label is not provided */ > + return (config_data->label) ? 0444 : 0; Unnecessary () > case hwmon_temp_max: > case hwmon_temp_max_hyst: > return 0644; > @@ -553,13 +567,14 @@ static const struct hwmon_channel_info * const lm75_info[] = { > HWMON_CHANNEL_INFO(chip, > HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL), > HWMON_CHANNEL_INFO(temp, > - HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST | > + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_MAX | HWMON_T_MAX_HYST | > HWMON_T_ALARM), > NULL > }; > > static const struct hwmon_ops lm75_hwmon_ops = { > .is_visible = lm75_is_visible, > + .read_string = lm75_read_string, > .read = lm75_read, > .write = lm75_write, > }; > @@ -721,6 +736,9 @@ static int lm75_generic_probe(struct device *dev, const char *name, > /* needed by custom regmap callbacks */ > dev_set_drvdata(dev, data); > > + /* Save the connected input label if available */ > + of_property_read_string(dev->of_node, "label", &data->label); Please use device_property_read_string(). Thanks, Guenter > + > data->kind = kind; > data->regmap = regmap; > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property 2026-03-11 10:58 [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Flaviu Nistor 2026-03-11 10:58 ` [PATCH 2/2] hwmon: lm75: Add support for label Flaviu Nistor @ 2026-03-13 13:26 ` Krzysztof Kozlowski 2026-03-14 7:48 ` Flaviu Nistor 1 sibling, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2026-03-13 13:26 UTC (permalink / raw) To: Flaviu Nistor Cc: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree, linux-kernel On Wed, Mar 11, 2026 at 12:58:07PM +0200, Flaviu Nistor wrote: > Add support for an optional label property similar to other hwmon devices. I do not see any support being added here. Subject is not accurate either. You did not add the label property. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property 2026-03-13 13:26 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Krzysztof Kozlowski @ 2026-03-14 7:48 ` Flaviu Nistor 2026-03-14 8:50 ` Krzysztof Kozlowski 0 siblings, 1 reply; 7+ messages in thread From: Flaviu Nistor @ 2026-03-14 7:48 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Jean Delvare, Guenter Roeck, Rob Herring, Conor Dooley, Flaviu Nistor, linux-hwmon, devicetree, linux-kernel On Fri, 13 Mar 2026 14:26:35 +0100, Krzysztof Kozlowski wrote: >On Wed, Mar 11, 2026 at 12:58:07PM +0200, Flaviu Nistor wrote: >> Add support for an optional label property similar to other hwmon devices. > >I do not see any support being added here. > >Subject is not accurate either. You did not add the label property. > >Best regards, >Krzysztof Hello and thanks for the reply. I probably did not use the best description and subject name, I wanted to be linked to the other patch in the series). The label property is already added by you via the hwmon-common.yaml. I will have to send out a v2 for this series so I will change the subject to "Add examples for label property" and also specify in the description more clear that is just a simple "Add label property in the two examples." Best regards, Flaviu ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property 2026-03-14 7:48 ` Flaviu Nistor @ 2026-03-14 8:50 ` Krzysztof Kozlowski 2026-03-18 20:03 ` Flaviu Nistor 0 siblings, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2026-03-14 8:50 UTC (permalink / raw) To: Flaviu Nistor, Krzysztof Kozlowski Cc: Jean Delvare, Guenter Roeck, Rob Herring, Conor Dooley, linux-hwmon, devicetree, linux-kernel On 14/03/2026 08:48, Flaviu Nistor wrote: > On Fri, 13 Mar 2026 14:26:35 +0100, Krzysztof Kozlowski wrote: >> On Wed, Mar 11, 2026 at 12:58:07PM +0200, Flaviu Nistor wrote: >>> Add support for an optional label property similar to other hwmon devices. >> >> I do not see any support being added here. >> >> Subject is not accurate either. You did not add the label property. >> >> Best regards, >> Krzysztof > > Hello and thanks for the reply. > I probably did not use the best description and subject name, > I wanted to be linked to the other patch in the series). > The label property is already added by you via the hwmon-common.yaml. > I will have to send out a v2 for this series so I will change the subject to > "Add examples for label property" and also specify in the description more clear > that is just a simple "Add label property in the two examples." Your commit msg must explain WHY you are doing this. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property 2026-03-14 8:50 ` Krzysztof Kozlowski @ 2026-03-18 20:03 ` Flaviu Nistor 0 siblings, 0 replies; 7+ messages in thread From: Flaviu Nistor @ 2026-03-18 20:03 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Jean Delvare, Guenter Roeck, Rob Herring, Conor Dooley, Flaviu Nistor, linux-hwmon, devicetree, linux-kernel On Sat, Mar 14, 2026 at 10:50 AM, Krzysztof Kozlowski wrote: >On 14/03/2026 08:48, Flaviu Nistor wrote: >> On Fri, 13 Mar 2026 14:26:35 +0100, Krzysztof Kozlowski wrote: >>> On Wed, Mar 11, 2026 at 12:58:07PM +0200, Flaviu Nistor wrote: >>>> Add support for an optional label property similar to other hwmon devices. >>> >>> I do not see any support being added here. >>> >>> Subject is not accurate either. You did not add the label property. >>> >>> Best regards, >>> Krzysztof >> >> Hello and thanks for the reply. >> I probably did not use the best description and subject name, >> I wanted to be linked to the other patch in the series). >> The label property is already added by you via the hwmon-common.yaml. >> I will have to send out a v2 for this series so I will change the subject to >> "Add examples for label property" and also specify in the description more clear >> that is just a simple "Add label property in the two examples." > >Your commit msg must explain WHY you are doing this. My initial intention was to make sure that dtbs_check is not generating errors, but since then I got to understand that the example section is not actually used during the validation of DT source files. My second intention was to add the label property to the example section as a good practice, but I also have seen that this is not a general rule. As I understand this is not a mandatory change, I will drop the binding patch from v2. Best regards, Flaviu > >Best regards, >Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-18 20:03 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-11 10:58 [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Flaviu Nistor 2026-03-11 10:58 ` [PATCH 2/2] hwmon: lm75: Add support for label Flaviu Nistor 2026-03-13 18:37 ` Guenter Roeck 2026-03-13 13:26 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add label property Krzysztof Kozlowski 2026-03-14 7:48 ` Flaviu Nistor 2026-03-14 8:50 ` Krzysztof Kozlowski 2026-03-18 20:03 ` Flaviu Nistor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox