Message ID | 20240909-tps25990-v1-0-39b37e43e795@baylibre.com |
---|---|
Headers | show |
Series | hwmon: pmbus: add tps25990 efuse support | expand |
On Mon 09 Sep 2024 at 11:16, Guenter Roeck <linux@roeck-us.net> wrote: > On 9/9/24 08:39, Jerome Brunet wrote: >> Add support for POWER_GOOD_ON and POWER_GOOD_OFF standard PMBus commands. >> For PMBus devices that offer a POWER_GOOD signal, these commands are used >> for setting the output voltage at which a power good signal should be >> asserted and negated. >> Power Good signals are device and manufacturer specific. Many factors >> other >> than output voltage may be used to determine whether or not the POWER_GOOD >> signal is to be asserted. PMBus device users are instructed to consult the >> device manufacturer’s product literature for the specifics of the device >> they are using. >> Note that depending on the choice of the device manufacturer that a >> device >> may drive a POWER_GOOD signal high or low to indicate that the signal is >> asserted. >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >> --- >> drivers/hwmon/pmbus/pmbus.h | 3 +++ >> drivers/hwmon/pmbus/pmbus_core.c | 6 ++++++ >> 2 files changed, 9 insertions(+) >> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h >> index 5d5dc774187b..e322d2dd9fb7 100644 >> --- a/drivers/hwmon/pmbus/pmbus.h >> +++ b/drivers/hwmon/pmbus/pmbus.h >> @@ -78,6 +78,9 @@ enum pmbus_regs { >> PMBUS_IIN_OC_FAULT_LIMIT = 0x5B, >> PMBUS_IIN_OC_WARN_LIMIT = 0x5D, >> + PMBUS_POWER_GOOD_ON = 0x5E, >> + PMBUS_POWER_GOOD_OFF = 0x5F, >> + >> PMBUS_POUT_OP_FAULT_LIMIT = 0x68, >> PMBUS_POUT_OP_WARN_LIMIT = 0x6A, >> PMBUS_PIN_OP_WARN_LIMIT = 0x6B, >> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c >> index 0ea6fe7eb17c..94ddf0166770 100644 >> --- a/drivers/hwmon/pmbus/pmbus_core.c >> +++ b/drivers/hwmon/pmbus/pmbus_core.c >> @@ -1768,6 +1768,12 @@ static const struct pmbus_limit_attr vout_limit_attrs[] = { >> .attr = "crit", >> .alarm = "crit_alarm", >> .sbit = PB_VOLTAGE_OV_FAULT, >> + }, { >> + .reg = PMBUS_POWER_GOOD_ON, >> + .attr = "good_on", >> + }, { >> + .reg = PMBUS_POWER_GOOD_OFF, >> + .attr = "good_off", >> }, { >> .reg = PMBUS_VIRT_READ_VOUT_AVG, >> .update = true, >> > > Those attributes are not hardware monitoring attributes and therefore not > acceptable. In general I am not sure if they should be configurable in the > first place, but definitely not from the hardware monitoring subsystem. > Maybe the regulator subsystem callbacks set_over_voltage_protection and > set_under_voltage_protection would be appropriate (with severity > REGULATOR_SEVERITY_PROT), but that should be discussed with regulator > subsystem maintainers. According to PMBUS spec, there is no protection associated with that command. It just tells when the output voltage is considered good, when it is not. What it does after that really depends the device, it may drive a pin for example (or an LED indicator in my case). It is very similar to 'crit' or other limits in that sense, I think. I don't really get why such property is not OK in hwmon then and why it should not be configurable, if the other limits are ? I don't mind dropping that completly, that change is not critical to me. The intent was to contribute something to overall pmbus support. > > Thanks, > Guenter
On Mon, Sep 09, 2024 at 05:39:03PM +0200, Jerome Brunet wrote: > Add DT binding documentation for the Texas Instruments TPS25990 eFuse > > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > --- > .../bindings/hwmon/pmbus/ti,tps25990.yaml | 73 ++++++++++++++++++++++ > 1 file changed, 73 insertions(+) > A nit, subject: drop second/last, redundant "documentation". The "dt-bindings" prefix is already stating that these are bindings/docs. See also: https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18 > diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml > new file mode 100644 > index 000000000000..e717942b3598 > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml > @@ -0,0 +1,73 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > + Drop blank line. > +$id: http://devicetree.org/schemas/hwmon/pmbus/ti,tps25990.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Texas Instruments TPS25990 Stackable eFuse > + > +maintainers: > + - Jerome Brunet <jbrunet@baylibre.com> > + > +description: | Do not need '|' unless you need to preserve formatting. > + The TI TPS25990 is an integrated, high-current circuit > + protection and power management device with PMBUS interface > + > +properties: > + compatible: > + const: ti,tps25990 > + > + reg: > + maxItems: 1 > + > + ti,rimon-milli-ohms: > + description: > + milli Ohms value of the resistance installed between the Imon pin > + and the ground reference. Ohms is not enough? We don't have mOhm in property units. https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > + > + interrupts: > + description: PMBUS SMB Alert Interrupt. > + maxItems: 1 > + > + regulators: > + type: object > + description: > + list of regulators provided by this controller. You have just one regulator, so drop "regulators" node and use directly vout here. > + > + properties: > + vout: > + $ref: /schemas/regulator/regulator.yaml# > + type: object > + unevaluatedProperties: false > + additionalProperties: false > + > +required: > + - compatible > + - reg > + - ti,rimon-milli-ohms > + > +additionalProperties: false Best regards, Krzysztof
On 9/9/24 23:43, Jerome Brunet wrote: > On Mon 09 Sep 2024 at 11:16, Guenter Roeck <linux@roeck-us.net> wrote: > >> On 9/9/24 08:39, Jerome Brunet wrote: >>> Add support for POWER_GOOD_ON and POWER_GOOD_OFF standard PMBus commands. >>> For PMBus devices that offer a POWER_GOOD signal, these commands are used >>> for setting the output voltage at which a power good signal should be >>> asserted and negated. >>> Power Good signals are device and manufacturer specific. Many factors >>> other >>> than output voltage may be used to determine whether or not the POWER_GOOD >>> signal is to be asserted. PMBus device users are instructed to consult the >>> device manufacturer’s product literature for the specifics of the device >>> they are using. >>> Note that depending on the choice of the device manufacturer that a >>> device >>> may drive a POWER_GOOD signal high or low to indicate that the signal is >>> asserted. >>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >>> --- >>> drivers/hwmon/pmbus/pmbus.h | 3 +++ >>> drivers/hwmon/pmbus/pmbus_core.c | 6 ++++++ >>> 2 files changed, 9 insertions(+) >>> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h >>> index 5d5dc774187b..e322d2dd9fb7 100644 >>> --- a/drivers/hwmon/pmbus/pmbus.h >>> +++ b/drivers/hwmon/pmbus/pmbus.h >>> @@ -78,6 +78,9 @@ enum pmbus_regs { >>> PMBUS_IIN_OC_FAULT_LIMIT = 0x5B, >>> PMBUS_IIN_OC_WARN_LIMIT = 0x5D, >>> + PMBUS_POWER_GOOD_ON = 0x5E, >>> + PMBUS_POWER_GOOD_OFF = 0x5F, >>> + >>> PMBUS_POUT_OP_FAULT_LIMIT = 0x68, >>> PMBUS_POUT_OP_WARN_LIMIT = 0x6A, >>> PMBUS_PIN_OP_WARN_LIMIT = 0x6B, >>> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c >>> index 0ea6fe7eb17c..94ddf0166770 100644 >>> --- a/drivers/hwmon/pmbus/pmbus_core.c >>> +++ b/drivers/hwmon/pmbus/pmbus_core.c >>> @@ -1768,6 +1768,12 @@ static const struct pmbus_limit_attr vout_limit_attrs[] = { >>> .attr = "crit", >>> .alarm = "crit_alarm", >>> .sbit = PB_VOLTAGE_OV_FAULT, >>> + }, { >>> + .reg = PMBUS_POWER_GOOD_ON, >>> + .attr = "good_on", >>> + }, { >>> + .reg = PMBUS_POWER_GOOD_OFF, >>> + .attr = "good_off", >>> }, { >>> .reg = PMBUS_VIRT_READ_VOUT_AVG, >>> .update = true, >>> >> >> Those attributes are not hardware monitoring attributes and therefore not >> acceptable. In general I am not sure if they should be configurable in the >> first place, but definitely not from the hardware monitoring subsystem. >> Maybe the regulator subsystem callbacks set_over_voltage_protection and >> set_under_voltage_protection would be appropriate (with severity >> REGULATOR_SEVERITY_PROT), but that should be discussed with regulator >> subsystem maintainers. > > According to PMBUS spec, there is no protection associated with that > command. It just tells when the output voltage is considered good, when > it is not. What it does after that really depends the device, it may > drive a pin for example (or an LED indicator in my case). > It is much more likely that it connects to the reset signal on the board, or it enables/disables power to parts of the board. > It is very similar to 'crit' or other limits in that sense, > I think. I don't really get why such property is not OK in hwmon then > and why it should not be configurable, if the other limits are ? > Its use is for hardware control, not monitoring, even if it may be connected to a status LED. MAX15301, for example, groups the command under "Voltage Sequencing Commands". On top of that, the voltages are value/hysteresis values. The "off" voltage is lower than the "on" voltage. TPS25990 doesn't even support the command according to its datasheet, so I am at loss about your use case in the context of this patch series (the PGOOD pin on this chip signals to the downstream load that it is ok to draw power). Guenter
gOn Tue, Sep 10, 2024 at 11:31:18AM +0200, Jerome Brunet wrote: > On Tue 10 Sep 2024 at 09:48, Krzysztof Kozlowski <krzk@kernel.org> wrote: > > > On Mon, Sep 09, 2024 at 05:39:03PM +0200, Jerome Brunet wrote: > >> Add DT binding documentation for the Texas Instruments TPS25990 eFuse > >> > >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > >> --- > >> .../bindings/hwmon/pmbus/ti,tps25990.yaml | 73 ++++++++++++++++++++++ > >> 1 file changed, 73 insertions(+) > >> > > > > A nit, subject: drop second/last, redundant "documentation". The > > "dt-bindings" prefix is already stating that these are bindings/docs. > > See also: > > https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18 > > > >> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml > >> new file mode 100644 > >> index 000000000000..e717942b3598 > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml > >> @@ -0,0 +1,73 @@ > >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > >> +%YAML 1.2 > >> +--- > >> + > > > > Drop blank line. > > > >> +$id: http://devicetree.org/schemas/hwmon/pmbus/ti,tps25990.yaml# > >> +$schema: http://devicetree.org/meta-schemas/core.yaml# > >> + > >> +title: Texas Instruments TPS25990 Stackable eFuse > >> + > >> +maintainers: > >> + - Jerome Brunet <jbrunet@baylibre.com> > >> + > >> +description: | > > > > Do not need '|' unless you need to preserve formatting. > > > >> + The TI TPS25990 is an integrated, high-current circuit > >> + protection and power management device with PMBUS interface And wrap at 80. > >> + > >> +properties: > >> + compatible: > >> + const: ti,tps25990 > >> + > >> + reg: > >> + maxItems: 1 > >> + > >> + ti,rimon-milli-ohms: > >> + description: > >> + milli Ohms value of the resistance installed between the Imon pin > >> + and the ground reference. > > > > Ohms is not enough? We don't have mOhm in property units. > > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > > > > Same discussion as we've had on the driver change. > At the moment Ohms is enough for the cases I've seen. > > Will it be, not sure. > Using mOhms is' way to avoid "S**t, R is 80.2 Ohms, I > need another digit to not loose precision " kind of situation and > introduce a second property just for that. > > No idea if Rimon will get that low. Probably not. > > I'll switch to Ohms. You can can use "-micro-ohms" too. The reason we don't have every possible unit is so we have everyone picking their own. Rob
On 10/09/2024 11:31, Jerome Brunet wrote: >>> + >>> + interrupts: >>> + description: PMBUS SMB Alert Interrupt. >>> + maxItems: 1 >>> + >>> + regulators: >>> + type: object >>> + description: >>> + list of regulators provided by this controller. >> >> You have just one regulator, so drop "regulators" node and use directly >> vout here. > > Just took the example the other pmbus device and did the same for > consistency. > > In that case, there other (possible) regulator called gpdac1 and gpdac2. > I haven't even tried to implement the support for those. Your binding should be complete. Does not matter whether you implemented it in drivers or not. > > Since it would not break old DTs to add that later, I thought it would be OK > to add them later. Should I add them now ? This should be added now. Best regards, Krzysztof