From: Guenter Roeck <linux@roeck-us.net>
To: Dmitry Bazhenov <bazhenov.dn@gmail.com>
Cc: Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (pmbus) Fix page count auto-detection.
Date: Mon, 15 Oct 2018 12:45:19 -0700 [thread overview]
Message-ID: <20181015194519.GA21672@roeck-us.net> (raw)
In-Reply-To: <20181015092122.10533-1-bazhenov.dn@gmail.com>
On Mon, Oct 15, 2018 at 02:21:22PM +0500, Dmitry Bazhenov wrote:
> Devices with compatible="pmbus" field have zero initial page count,
> and pmbus_clear_faults() being called before the page count auto-
> detection does not actually clear faults because it depends on the
> page count. Non-cleared faults in its turn may fail the subsequent
> page count auto-detection.
>
> This patch fixes this problem by calling pmbus_clear_fault_page()
> for currently set page and calling pmbus_clear_faults() after the
> page count was detected.
>
> Signed-off-by: Dmitry Bazhenov <bazhenov.dn@gmail.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/pmbus/pmbus.c | 2 ++
> drivers/hwmon/pmbus/pmbus_core.c | 5 ++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 7718e58dbda5..7688dab32f6e 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -118,6 +118,8 @@ static int pmbus_identify(struct i2c_client *client,
> } else {
> info->pages = 1;
> }
> +
> + pmbus_clear_faults(client);
> }
>
> if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 82c3754e21e3..2e2b5851139c 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2015,7 +2015,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
> if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
> client->flags |= I2C_CLIENT_PEC;
>
> - pmbus_clear_faults(client);
> + if (data->info->pages)
> + pmbus_clear_faults(client);
> + else
> + pmbus_clear_fault_page(client, -1);
>
> if (info->identify) {
> ret = (*info->identify)(client, info);
prev parent reply other threads:[~2018-10-15 19:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 9:21 [PATCH] hwmon: (pmbus) Fix page count auto-detection Dmitry Bazhenov
2018-10-15 19:45 ` Guenter Roeck [this message]
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=20181015194519.GA21672@roeck-us.net \
--to=linux@roeck-us.net \
--cc=bazhenov.dn@gmail.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;
as well as URLs for NNTP newsgroup(s).