From: Eddie James <eajames@linux.ibm.com>
To: linux-hwmon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jdelvare@suse.com,
linux@roeck-us.net, joel@jms.id.au, eajames@linux.ibm.com
Subject: [PATCH 1/4] hwmon: (occ) Add sysfs entry for IPS (Idle Power Saver) status
Date: Tue, 15 Feb 2022 09:10:19 -0600 [thread overview]
Message-ID: <20220215151022.7498-2-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220215151022.7498-1-eajames@linux.ibm.com>
BMC control applications need to check the Idle Power Saver status
byte returned by the OCC poll response, so export it in sysfs with
the other OCC-specific data.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/hwmon/occ/common.h | 1 +
drivers/hwmon/occ/sysfs.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/hwmon/occ/common.h b/drivers/hwmon/occ/common.h
index 5020117be740..a88c66d36e38 100644
--- a/drivers/hwmon/occ/common.h
+++ b/drivers/hwmon/occ/common.h
@@ -119,6 +119,7 @@ struct occ {
u8 prev_stat;
u8 prev_ext_stat;
u8 prev_occs_present;
+ u8 prev_ips_status;
};
int occ_setup(struct occ *occ, const char *name);
diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c
index 03b16abef67f..6dc69c9aa4c2 100644
--- a/drivers/hwmon/occ/sysfs.c
+++ b/drivers/hwmon/occ/sysfs.c
@@ -63,6 +63,9 @@ static ssize_t occ_sysfs_show(struct device *dev,
else
val = 1;
break;
+ case 8:
+ val = header->ips_status;
+ break;
default:
return -EINVAL;
}
@@ -88,6 +91,7 @@ static SENSOR_DEVICE_ATTR(occ_mem_throttle, 0444, occ_sysfs_show, NULL, 4);
static SENSOR_DEVICE_ATTR(occ_quick_pwr_drop, 0444, occ_sysfs_show, NULL, 5);
static SENSOR_DEVICE_ATTR(occ_state, 0444, occ_sysfs_show, NULL, 6);
static SENSOR_DEVICE_ATTR(occs_present, 0444, occ_sysfs_show, NULL, 7);
+static SENSOR_DEVICE_ATTR(occ_ips_status, 0444, occ_sysfs_show, NULL, 8);
static DEVICE_ATTR_RO(occ_error);
static struct attribute *occ_attributes[] = {
@@ -99,6 +103,7 @@ static struct attribute *occ_attributes[] = {
&sensor_dev_attr_occ_quick_pwr_drop.dev_attr.attr,
&sensor_dev_attr_occ_state.dev_attr.attr,
&sensor_dev_attr_occs_present.dev_attr.attr,
+ &sensor_dev_attr_occ_ips_status.dev_attr.attr,
&dev_attr_occ_error.attr,
NULL
};
@@ -162,6 +167,11 @@ void occ_sysfs_poll_done(struct occ *occ)
sysfs_notify(&occ->bus_dev->kobj, NULL, name);
}
+ if (header->ips_status != occ->prev_ips_status) {
+ name = sensor_dev_attr_occ_ips_status.dev_attr.attr.name;
+ sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+ }
+
if (occ->error && occ->error != occ->prev_error) {
name = dev_attr_occ_error.attr.name;
sysfs_notify(&occ->bus_dev->kobj, NULL, name);
@@ -174,6 +184,7 @@ void occ_sysfs_poll_done(struct occ *occ)
occ->prev_stat = header->status;
occ->prev_ext_stat = header->ext_status;
occ->prev_occs_present = header->occs_present;
+ occ->prev_ips_status = header->ips_status;
}
int occ_setup_sysfs(struct occ *occ)
--
2.27.0
next prev parent reply other threads:[~2022-02-15 15:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 15:10 [PATCH 0/4] hwmon: (occ) Add various poll response data in sysfs Eddie James
2022-02-15 15:10 ` Eddie James [this message]
2022-02-16 6:10 ` [PATCH 1/4] hwmon: (occ) Add sysfs entry for IPS (Idle Power Saver) status Joel Stanley
2022-02-19 14:36 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 2/4] hwmon: (occ) Add sysfs entry for OCC mode Eddie James
2022-02-16 6:11 ` Joel Stanley
2022-02-19 14:37 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 3/4] hwmon: (occ) Add sysfs entries for additional extended status bits Eddie James
2022-02-16 6:12 ` Joel Stanley
2022-02-19 14:37 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 4/4] hwmon: (occ) Add soft minimum power cap attribute Eddie James
2022-02-16 6:33 ` Joel Stanley
2022-02-16 20:09 ` Eddie James
2022-02-21 7:39 ` Joel Stanley
2022-02-22 16:52 ` 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=20220215151022.7498-2-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=joel@jms.id.au \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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).