linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Vadim Pasternak <vadimp@nvidia.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH hwmon-next v3 2/3] hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller
Date: Mon, 3 May 2021 10:34:30 -0700	[thread overview]
Message-ID: <c03c6c3b-0aab-6668-b032-f5869ff69bef@roeck-us.net> (raw)
In-Reply-To: <DM6PR12MB389893AC33FCFC7073C41F77AF5B9@DM6PR12MB3898.namprd12.prod.outlook.com>

On 5/3/21 9:11 AM, Vadim Pasternak wrote:
> Hi Guenter!
> 
...
>>> +	case PMBUS_VIN_OV_FAULT_LIMIT:
>>> +	case PMBUS_VIN_UV_WARN_LIMIT:
>>> +		ret = pmbus_read_word_data(client, page, phase, reg);
>>> +		if (ret <= 0)
>>> +			return ret;
>>> +
>>> +		val = mp2888_reg2data_linear11(ret, PSC_VOLTAGE_IN);
>>> +		ret = val * MP2888_VIN_MANTISSA;
>>> +		break;
>>
>> Unless I am missing something, this is linear11 with, for some reason, bit 10
>> erroneously set for PMBUS_READ_VIN. That means that setting the format
>> for PSC_VOLTAGE_IN and clearing bit 10 for PMBUS_READ_VIN should work
>> without local conversion. Am I missing something ?
> 
> On board I have vin 12V.
> From register I am getting 0xed80.
> If I am masking bit 10, 0xe980, it gives me 48.12 V, masking bits 11,10 gives 24.00.
> For getting 12, I should mask bits 11, 10 and shift left bits 8 - 0.
> But I it doesn't look right things to do. 
> 
Turns out that is because the data format for READ_VIN is not linear11,
it is something like linear10. The mantissa is 10 bit (unsigned), the
exponent is 6 bit. So the exponent is -5, not -6 as one would assume.

With that in mind, I'd still prefer to fix up READ_VIN to linear11
instead of converting the limits to direct mode.

Thanks,
Guenter

  reply	other threads:[~2021-05-03 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 22:17 [PATCH hwmon-next v3 0/3] Add support for MPS Multi-phase mp2888 controller Vadim Pasternak
2021-04-26 22:17 ` [PATCH hwmon-next v3 1/3] hwmon: (pmbus) Increase maximum number of phases per page Vadim Pasternak
2021-04-26 22:17 ` [PATCH hwmon-next v3 2/3] hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller Vadim Pasternak
2021-05-02 15:46   ` Guenter Roeck
2021-05-03 16:11     ` Vadim Pasternak
2021-05-03 17:34       ` Guenter Roeck [this message]
2021-04-26 22:17 ` [PATCH hwmon-next v3 3/3] dt-bindings: Add MP2888 voltage regulator device Vadim Pasternak

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=c03c6c3b-0aab-6668-b032-f5869ff69bef@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=vadimp@nvidia.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
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;
as well as URLs for NNTP newsgroup(s).