Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: zlukwins <zbigniew.lukwinski@linux.intel.com>
Cc: jae.hyun.yoo@linux.intel.com, lukasz.tuz@intel.com,
	linux-hwmon@vger.kernel.org
Subject: Re: Maximum rate value of input power for pmbus device
Date: Mon, 29 Jun 2020 09:59:50 -0700
Message-ID: <20200629165950.GB113813@roeck-us.net> (raw)
In-Reply-To: <ddcb240a-5444-ba46-ecdf-70350d27125f@linux.intel.com>

+ linux-hwmon@vger.kernel.org

On Mon, Jun 29, 2020 at 08:31:11AM +0200, zlukwins wrote:
> Hi,
> 
> 
> I am OpenBMC FW developer working currently on some power measurement stuff.
> 
> I would like to have maximum rated input power for pmubus device available
> in hwmon sysfs. This value is read by MFR_PIN_MAX command:
> 
> /MFR_PIN_MAX//
> //The MFR_PIN_MIN command sets or retrieves the maximum rated value, in
> watts, of//
> //the input power./

Interesting typo in the PMBus specification. Yes, it really does associate
MFR_PIN_MIN - which doesn't seem to exist - with the maximum rated output
power.

> 
> And I wondering which attribute shell be used to expose that value in sysfs.
> I went through documentation
> (https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface) and found
> the following:
> 
> power[1-*]_max			Maximum power.
> 				Unit: microWatt
> 				RW
> 
> But it looks like it is already occupied by PIN_OP_WARN_LIMIT.
> 
> Maybe new attribute shall be used? If so how to call that?
> 

None of the standard attributes reports (or is supposed to report) rated
values, so we can not just use any of those.

Also, we can not just add a single attribute to handle this situation,
for the simple reason that there are many more similar attributes.
PMBus specifies (this is from version 1.3.1):

MFR_VIN_MIN
MFR_VIN_MAX
MFR_IIN_MAX
MFR_PIN_MAX
MFR_VOUT_MIN
MFR_VOUT_MAX
MFR_IOUT_MAX
MFR_POUT_MAX
MFR_TAMBIENT_MAX
MFR_TAMBIENT_MIN
MFR_MAX_TEMP_{1,2.3}

All those report rated values. I do see the need/desire for reporting such
information. The only real solution I can see is to add a new set of
attributes to the hwmon ABI. Something like:

	currentX_rated_min	# for consistency
	currentX_rated_max
	inX_rated_min
	inX_rated_max
	powerX_rated_min	# for consistency
	powerX_rated_max
	tempX_rated_min
	tempX_rated_max
plus maybe, for consistency:
	humidityX_rated_min
	humidityX_rated_max

Those would be read-only attributes.

Thoughts, comments, feedback anyone ?

Thanks,
Guenter

       reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ddcb240a-5444-ba46-ecdf-70350d27125f@linux.intel.com>
2020-06-29 16:59 ` Guenter Roeck [this message]
2020-07-08 10:50   ` zlukwins
2020-07-08 13:33     ` 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=20200629165950.GB113813@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jae.hyun.yoo@linux.intel.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=lukasz.tuz@intel.com \
    --cc=zbigniew.lukwinski@linux.intel.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

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git