powerpc/powernv: Add support to enable sensor groups
Adds support to enable/disable a sensor group at runtime. This can be used to select the sensor groups that needs to be copied to main memory by OCC. Sensor groups like power, temperature, current, voltage, frequency, utilization can be enabled/disabled at runtime. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
committed by
Michael Ellerman
parent
1961acad2f
commit
04baaf28f4
@@ -32,6 +32,34 @@ static struct sensor_group {
|
||||
struct sg_attr *sgattrs;
|
||||
} *sgs;
|
||||
|
||||
int sensor_group_enable(u32 handle, bool enable)
|
||||
{
|
||||
struct opal_msg msg;
|
||||
int token, ret;
|
||||
|
||||
token = opal_async_get_token_interruptible();
|
||||
if (token < 0)
|
||||
return token;
|
||||
|
||||
ret = opal_sensor_group_enable(handle, token, enable);
|
||||
if (ret == OPAL_ASYNC_COMPLETION) {
|
||||
ret = opal_async_wait_response(token, &msg);
|
||||
if (ret) {
|
||||
pr_devel("Failed to wait for the async response\n");
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
ret = opal_error_code(opal_get_async_rc(msg));
|
||||
} else {
|
||||
ret = opal_error_code(ret);
|
||||
}
|
||||
|
||||
out:
|
||||
opal_async_release_token(token);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sensor_group_enable);
|
||||
|
||||
static ssize_t sg_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
|
||||
@@ -329,3 +329,4 @@ OPAL_CALL(opal_npu_tl_set, OPAL_NPU_TL_SET);
|
||||
OPAL_CALL(opal_pci_get_pbcq_tunnel_bar, OPAL_PCI_GET_PBCQ_TUNNEL_BAR);
|
||||
OPAL_CALL(opal_pci_set_pbcq_tunnel_bar, OPAL_PCI_SET_PBCQ_TUNNEL_BAR);
|
||||
OPAL_CALL(opal_sensor_read_u64, OPAL_SENSOR_READ_U64);
|
||||
OPAL_CALL(opal_sensor_group_enable, OPAL_SENSOR_GROUP_ENABLE);
|
||||
|
||||
Reference in New Issue
Block a user