mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Add a way to set indiviual sensitivity factor for each TMP006 sensor
Each TMP006 temperature sensor has different sensitivity factor. Let's add a field to set different sensitivity factor for each sensor. Also update the factors to get more reasonable temperature readings, but still need more precise calibration. BUG=chrome-os-partner:9599 TEST=Build and read tempearture succeeded. Change-Id: Ib4feea3b78b71f6d37c9a02668ffa7bd9e63d390
This commit is contained in:
@@ -56,8 +56,9 @@ const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
|
||||
};
|
||||
|
||||
const struct tmp006_t tmp006_sensors[TMP006_COUNT] = {
|
||||
{"CPU", TEMP_CPU_ADDR},
|
||||
{"PCH", TEMP_PCH_ADDR},
|
||||
{"DDR", TEMP_DDR_ADDR},
|
||||
{"Charger", TEMP_CHARGER_ADDR},
|
||||
/* TODO: Calibrate sensitivity factors. See crosbug.com/p/9599 */
|
||||
{"CPU", TEMP_CPU_ADDR, 2771},
|
||||
{"PCH", TEMP_PCH_ADDR, 4762},
|
||||
{"DDR", TEMP_DDR_ADDR, 6400},
|
||||
{"Charger", TEMP_CHARGER_ADDR, 7154},
|
||||
};
|
||||
|
||||
@@ -160,7 +160,8 @@ static int tmp006_read_object_temp(int idx)
|
||||
v);
|
||||
|
||||
/* TODO: Calibrate the sensitivity factor. */
|
||||
return tmp006_calculate_object_temp(t, v, 6400) / 100;
|
||||
return tmp006_calculate_object_temp(t, v,
|
||||
tmp006_sensors[idx].sens) / 100;
|
||||
}
|
||||
|
||||
static int tmp006_poll_sensor(int sensor_id)
|
||||
|
||||
@@ -16,6 +16,8 @@ struct tmp006_t {
|
||||
const char* name;
|
||||
/* I2C address formed by TMP006_ADDR macro. */
|
||||
int addr;
|
||||
/* Sensitivity factor, in 10^11. */
|
||||
int sens;
|
||||
};
|
||||
|
||||
/* Poll all TMP006 sensors. Return 0 on success. */
|
||||
|
||||
Reference in New Issue
Block a user