From: Guenter Roeck <linux@roeck-us.net>
To: eajames@linux.vnet.ibm.com
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org, andrew@aj.id.au,
"Edward A. James" <eajames@us.ibm.com>
Subject: Re: drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model
Date: Sat, 21 Oct 2017 09:10:13 -0700 [thread overview]
Message-ID: <20171021161013.GA12794@roeck-us.net> (raw)
In-Reply-To: <1508446628-13112-1-git-send-email-eajames@linux.vnet.ibm.com>
On Thu, Oct 19, 2017 at 03:57:08PM -0500, eajames@linux.vnet.ibm.com wrote:
> From: "Edward A. James" <eajames@us.ibm.com>
>
> The MFR_ID and MFR_MODEL, which are manually read before probing the
> pmbus core, are only valid for the two pages that the ir35221 has
> available. Since we don't know the state of the device when we start
> probing, set the page number first before reading id and model.
>
If the device only has two pages, it is highly unlikely that it is possible
to select another page which is not supported; any attempts to do so should
result in a command error.
Is this theory or based on an actual problem observed ? If so, it will require
some additional explanation.
Thanks,
Guenter
> Signed-off-by: Edward A. James <eajames@us.ibm.com>
> ---
> drivers/hwmon/pmbus/ir35221.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/hwmon/pmbus/ir35221.c b/drivers/hwmon/pmbus/ir35221.c
> index 8b906b4..9a53930 100644
> --- a/drivers/hwmon/pmbus/ir35221.c
> +++ b/drivers/hwmon/pmbus/ir35221.c
> @@ -267,6 +267,12 @@ static int ir35221_probe(struct i2c_client *client,
> | I2C_FUNC_SMBUS_READ_BLOCK_DATA))
> return -ENODEV;
>
> + ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
> + if (ret < 0) {
> + dev_err(&client->dev, "Failed to set PMBUS_PAGE\n");
> + return ret;
> + }
> +
> ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
> if (ret < 0) {
> dev_err(&client->dev, "Failed to read PMBUS_MFR_ID\n");
next prev parent reply other threads:[~2017-10-21 16:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 20:57 [PATCH] drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model Eddie James
2017-10-21 16:10 ` Guenter Roeck [this message]
2017-10-23 15:23 ` Eddie James
2017-10-23 22:12 ` Guenter Roeck
2017-10-25 19:54 ` Eddie James
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=20171021161013.GA12794@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew@aj.id.au \
--cc=eajames@linux.vnet.ibm.com \
--cc=eajames@us.ibm.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.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