summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2012-05-24 16:15:13 +0800
committerVic Yang <victoryang@chromium.org>2012-05-28 16:42:17 +0800
commit86cfeb5232bb58a5a996bdd58c147fb5575adc2c (patch)
tree577564e4f2eacf7f83674fec4fc743ceae67aad1
parentb85a7ce9d686799e88bf65fa95ed49c6d561d621 (diff)
downloadchrome-ec-86cfeb5232bb58a5a996bdd58c147fb5575adc2c.tar.gz
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
-rw-r--r--board/link/board_temp_sensor.c9
-rw-r--r--common/tmp006.c3
-rw-r--r--include/tmp006.h2
3 files changed, 9 insertions, 5 deletions
diff --git a/board/link/board_temp_sensor.c b/board/link/board_temp_sensor.c
index 91b3d1ba4c..4534f0ba05 100644
--- a/board/link/board_temp_sensor.c
+++ b/board/link/board_temp_sensor.c
@@ -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},
};
diff --git a/common/tmp006.c b/common/tmp006.c
index 18882c5fde..819ecda7c2 100644
--- a/common/tmp006.c
+++ b/common/tmp006.c
@@ -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)
diff --git a/include/tmp006.h b/include/tmp006.h
index 1d6e07ffdd..6d8b26857d 100644
--- a/include/tmp006.h
+++ b/include/tmp006.h
@@ -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. */