public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>,  Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Jonathan Corbet <corbet@lwn.net>,
	 Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>,
	 linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-i2c@vger.kernel.org
Subject: Re: [PATCH 2/3] hwmon: (pmbus/core) add POWER_GOOD signal limits support
Date: Tue, 10 Sep 2024 17:00:49 +0200	[thread overview]
Message-ID: <1jr09rsgda.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <08b6d9af-51b7-4eda-a4f6-62b688665fd9@roeck-us.net> (Guenter Roeck's message of "Tue, 10 Sep 2024 07:37:09 -0700")

On Tue 10 Sep 2024 at 07:37, Guenter Roeck <linux@roeck-us.net> wrote:

> 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.

That's not what PMBus spec says about it:

"""
15.32. POWER_GOOD Signal Limits
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 will be 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.
"""

It's only supposed to have an effect on the power_good signal, not the
reset. I guess someone could wire that signal to a reset. Same could be
done with the alert or the fault one, I suppose

>
>> 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).

It does support GOOD_OFF, althought TI renamed the register to
VOUT_PGTH (Section 8.3.14.7.1.52, p87):

"""
VOUT_PGTH is a standard PMBus® command for setting or reading an 8-bit
output voltage threshold at which Power Good (PGOOD) is be de-asserted.
"""

Same as the PMBus spec. Changing the value through this command does
affect the signal as intented. How the signal is depends on the
implementation. It just drives an LED on the EVM.

Anyway, I don't want to hold things on this. I'll drop it from the next version.

>
> Guenter

-- 
Jerome

  reply	other threads:[~2024-09-10 15:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 15:39 [PATCH 0/3] hwmon: pmbus: add tps25990 efuse support Jerome Brunet
2024-09-09 15:39 ` [PATCH 1/3] dt-bindings: hwmon: pmbus: add ti tps25990 documentation Jerome Brunet
2024-09-10  7:48   ` Krzysztof Kozlowski
2024-09-10  9:31     ` Jerome Brunet
2024-09-11 14:45       ` Rob Herring
2024-09-11 17:26         ` Jerome Brunet
2024-09-16  8:45       ` Krzysztof Kozlowski
2024-09-09 15:39 ` [PATCH 2/3] hwmon: (pmbus/core) add POWER_GOOD signal limits support Jerome Brunet
2024-09-09 18:16   ` Guenter Roeck
2024-09-10  6:43     ` Jerome Brunet
2024-09-10 14:37       ` Guenter Roeck
2024-09-10 15:00         ` Jerome Brunet [this message]
2024-09-10 16:22           ` Guenter Roeck
2024-09-09 15:39 ` [PATCH 3/3] hwmon: (pmbus/tps25990): add initial support Jerome Brunet
2024-09-09 22:52   ` Guenter Roeck
2024-09-10  9:07     ` Jerome Brunet
2024-09-10 17:07       ` Guenter Roeck
2024-09-11  9:37         ` Jerome Brunet
2024-09-10  8:08   ` kernel test robot
2024-09-10 10:32   ` kernel test robot

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=1jr09rsgda.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@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