mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
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:
committed by
Guenter Roeck
parent
aa195fe49b
commit
c10e753d43
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user