Commit c10e753d authored by Eddie James's avatar Eddie James Committed by Guenter Roeck

hwmon (occ): Add sensor types and versions

Add structures to define all sensor types and versions. Add sysfs show
and store functions for each sensor type. Add a method to construct the
"set user power cap" command and send it to the OCC. Add rate limit to
polling the OCC (in case user-space reads our hwmon entries rapidly).
Signed-off-by: default avatarEddie James <eajames@linux.ibm.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent aa195fe4
This diff is collapsed.
......@@ -3,6 +3,8 @@
#ifndef OCC_COMMON_H
#define OCC_COMMON_H
#include <linux/mutex.h>
struct device;
#define OCC_RESP_DATA_BYTES 4089
......@@ -80,8 +82,12 @@ struct occ {
struct occ_response resp;
struct occ_sensors sensors;
int powr_sample_time_us; /* average power sample time */
u8 poll_cmd_data; /* to perform OCC poll command */
int (*send_cmd)(struct occ *occ, u8 *cmd);
unsigned long last_update;
struct mutex lock; /* lock OCC access */
};
int occ_setup(struct occ *occ, const char *name);
......
......@@ -216,6 +216,7 @@ static int p8_i2c_occ_probe(struct i2c_client *client,
occ->bus_dev = &client->dev;
dev_set_drvdata(&client->dev, occ);
occ->powr_sample_time_us = 250;
occ->poll_cmd_data = 0x10; /* P8 OCC poll data */
occ->send_cmd = p8_i2c_occ_send_cmd;
......
......@@ -69,6 +69,7 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
occ->bus_dev = &pdev->dev;
platform_set_drvdata(pdev, occ);
occ->powr_sample_time_us = 500;
occ->poll_cmd_data = 0x20; /* P9 OCC poll data */
occ->send_cmd = p9_sbe_occ_send_cmd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment