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: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Eddie James
2018-11-08 15:05:27 -06:00
committed by Guenter Roeck
parent aa195fe49b
commit c10e753d43
4 changed files with 629 additions and 0 deletions

View File

@@ -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);