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, joel@jms.id.au, jk@ozlabs.org,
andrew@aj.id.au, cbostic@linux.vnet.ibm.com,
"Edward A. James" <eajames@us.ibm.com>
Subject: Re: [v2,3/4] hwmon: (pmbus): Add generic alarm bit for iin and pin
Date: Sun, 13 Aug 2017 06:39:18 -0700 [thread overview]
Message-ID: <20170813133918.GA5353@roeck-us.net> (raw)
In-Reply-To: <1502402270-15328-4-git-send-email-eajames@linux.vnet.ibm.com>
On Thu, Aug 10, 2017 at 04:57:49PM -0500, eajames@linux.vnet.ibm.com wrote:
> From: "Edward A. James" <eajames@us.ibm.com>
>
> Add PB_STATUS_INPUT as the generic alarm bit for iin and pin. We also
> need to redo the status register checking before setting up the boolean
> attribute, since it won't necessarily check STATUS_WORD if the device
> doesn't support it, which we need for this bit.
>
> Signed-off-by: Edward A. James <eajames@us.ibm.com>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> drivers/hwmon/pmbus/pmbus_core.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 277d170..ef135d8 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -114,6 +114,7 @@ struct pmbus_data {
> */
> u16 status[PB_NUM_STATUS_REG];
>
> + bool has_status_word; /* device uses STATUS_WORD register */
> int (*read_status)(struct i2c_client *client, int page);
>
> u8 currpage;
> @@ -1045,6 +1046,7 @@ static int pmbus_add_sensor_attrs_one(struct i2c_client *client,
> const struct pmbus_sensor_attr *attr)
> {
> struct pmbus_sensor *base;
> + bool upper = !!(attr->gbit & 0xff00); /* need to check STATUS_WORD */
> int ret;
>
> if (attr->label) {
> @@ -1065,9 +1067,11 @@ static int pmbus_add_sensor_attrs_one(struct i2c_client *client,
> /*
> * Add generic alarm attribute only if there are no individual
> * alarm attributes, if there is a global alarm bit, and if
> - * the generic status register for this page is accessible.
> + * the generic status register (word or byte, depending on
> + * which global bit is set) for this page is accessible.
> */
> if (!ret && attr->gbit &&
> + (!upper || (upper && data->has_status_word)) &&
> pmbus_check_status_register(client, page)) {
> ret = pmbus_add_boolean(data, name, "alarm", index,
> NULL, NULL,
> @@ -1324,6 +1328,7 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client,
> .func = PMBUS_HAVE_IIN,
> .sfunc = PMBUS_HAVE_STATUS_INPUT,
> .sbase = PB_STATUS_INPUT_BASE,
> + .gbit = PB_STATUS_INPUT,
> .limit = iin_limit_attrs,
> .nlimit = ARRAY_SIZE(iin_limit_attrs),
> }, {
> @@ -1408,6 +1413,7 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client,
> .func = PMBUS_HAVE_PIN,
> .sfunc = PMBUS_HAVE_STATUS_INPUT,
> .sbase = PB_STATUS_INPUT_BASE,
> + .gbit = PB_STATUS_INPUT,
> .limit = pin_limit_attrs,
> .nlimit = ARRAY_SIZE(pin_limit_attrs),
> }, {
> @@ -1775,6 +1781,8 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
> dev_err(dev, "PMBus status register not found\n");
> return -ENODEV;
> }
> + } else {
> + data->has_status_word = true;
> }
>
> /* Enable PEC if the controller supports it */
next prev parent reply other threads:[~2017-08-13 13:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 21:57 [PATCH v2 0/4] hwmon: (pmbus): Core extension for STATUS_WORD and debugfs Eddie James
2017-08-10 21:57 ` [PATCH v2 1/4] hwmon: (pmbus): Switch status registers to 16 bit Eddie James
2017-08-13 13:36 ` [v2,1/4] " Guenter Roeck
2017-08-10 21:57 ` [PATCH v2 2/4] hwmon: (pmbus): Access word data for STATUS_WORD Eddie James
2017-08-13 13:38 ` [v2,2/4] " Guenter Roeck
2017-08-10 21:57 ` [PATCH v2 3/4] hwmon: (pmbus): Add generic alarm bit for iin and pin Eddie James
2017-08-13 13:39 ` Guenter Roeck [this message]
2017-08-10 21:57 ` [PATCH v2 4/4] hwmon: (pmbus): Add debugfs for status registers Eddie James
2017-08-11 13:52 ` Guenter Roeck
2017-08-14 14:58 ` 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=20170813133918.GA5353@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew@aj.id.au \
--cc=cbostic@linux.vnet.ibm.com \
--cc=eajames@linux.vnet.ibm.com \
--cc=eajames@us.ibm.com \
--cc=jdelvare@suse.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--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