mfd: cros_ec: Fix temperature API
Improve API to retrieve temperature information. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Benson Leung <bleung@chromium.org> Reviewed-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
716bf50ea8
commit
170309b438
|
@ -2945,9 +2945,28 @@ enum ec_temp_thresholds {
|
|||
/*
|
||||
* Thermal configuration for one temperature sensor. Temps are in degrees K.
|
||||
* Zero values will be silently ignored by the thermal task.
|
||||
*
|
||||
* Set 'temp_host' value allows thermal task to trigger some event with 1 degree
|
||||
* hysteresis.
|
||||
* For example,
|
||||
* temp_host[EC_TEMP_THRESH_HIGH] = 300 K
|
||||
* temp_host_release[EC_TEMP_THRESH_HIGH] = 0 K
|
||||
* EC will throttle ap when temperature >= 301 K, and release throttling when
|
||||
* temperature <= 299 K.
|
||||
*
|
||||
* Set 'temp_host_release' value allows thermal task has a custom hysteresis.
|
||||
* For example,
|
||||
* temp_host[EC_TEMP_THRESH_HIGH] = 300 K
|
||||
* temp_host_release[EC_TEMP_THRESH_HIGH] = 295 K
|
||||
* EC will throttle ap when temperature >= 301 K, and release throttling when
|
||||
* temperature <= 294 K.
|
||||
*
|
||||
* Note that this structure is a sub-structure of
|
||||
* ec_params_thermal_set_threshold_v1, but maintains its alignment there.
|
||||
*/
|
||||
struct ec_thermal_config {
|
||||
uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */
|
||||
uint32_t temp_host_release[EC_TEMP_THRESH_COUNT]; /* release levels */
|
||||
uint32_t temp_fan_off; /* no active cooling needed */
|
||||
uint32_t temp_fan_max; /* max active cooling needed */
|
||||
} __ec_align4;
|
||||
|
@ -2973,32 +2992,63 @@ struct ec_params_thermal_set_threshold_v1 {
|
|||
/* Toggle automatic fan control */
|
||||
#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x0052
|
||||
|
||||
/* Get TMP006 calibration data */
|
||||
#define EC_CMD_TMP006_GET_CALIBRATION 0x0053
|
||||
/* Version 1 of input params */
|
||||
struct ec_params_auto_fan_ctrl_v1 {
|
||||
uint8_t fan_idx;
|
||||
} __ec_align1;
|
||||
|
||||
/* Get/Set TMP006 calibration data */
|
||||
#define EC_CMD_TMP006_GET_CALIBRATION 0x0053
|
||||
#define EC_CMD_TMP006_SET_CALIBRATION 0x0054
|
||||
|
||||
/*
|
||||
* The original TMP006 calibration only needed four params, but now we need
|
||||
* more. Since the algorithm is nothing but magic numbers anyway, we'll leave
|
||||
* the params opaque. The v1 "get" response will include the algorithm number
|
||||
* and how many params it requires. That way we can change the EC code without
|
||||
* needing to update this file. We can also use a different algorithm on each
|
||||
* sensor.
|
||||
*/
|
||||
|
||||
/* This is the same struct for both v0 and v1. */
|
||||
struct ec_params_tmp006_get_calibration {
|
||||
uint8_t index;
|
||||
} __ec_align1;
|
||||
|
||||
struct ec_response_tmp006_get_calibration {
|
||||
/* Version 0 */
|
||||
struct ec_response_tmp006_get_calibration_v0 {
|
||||
float s0;
|
||||
float b0;
|
||||
float b1;
|
||||
float b2;
|
||||
} __ec_align4;
|
||||
|
||||
/* Set TMP006 calibration data */
|
||||
#define EC_CMD_TMP006_SET_CALIBRATION 0x0054
|
||||
|
||||
struct ec_params_tmp006_set_calibration {
|
||||
struct ec_params_tmp006_set_calibration_v0 {
|
||||
uint8_t index;
|
||||
uint8_t reserved[3]; /* Reserved; set 0 */
|
||||
uint8_t reserved[3];
|
||||
float s0;
|
||||
float b0;
|
||||
float b1;
|
||||
float b2;
|
||||
} __ec_align4;
|
||||
|
||||
/* Version 1 */
|
||||
struct ec_response_tmp006_get_calibration_v1 {
|
||||
uint8_t algorithm;
|
||||
uint8_t num_params;
|
||||
uint8_t reserved[2];
|
||||
float val[0];
|
||||
} __ec_align4;
|
||||
|
||||
struct ec_params_tmp006_set_calibration_v1 {
|
||||
uint8_t index;
|
||||
uint8_t algorithm;
|
||||
uint8_t num_params;
|
||||
uint8_t reserved;
|
||||
float val[0];
|
||||
} __ec_align4;
|
||||
|
||||
|
||||
/* Read raw TMP006 data */
|
||||
#define EC_CMD_TMP006_GET_RAW 0x0055
|
||||
|
||||
|
|
Loading…
Reference in New Issue