Commit Graph

6 Commits

Author SHA1 Message Date
Randall Spangler
d83f42bdc8 Switch temp sensor polling to use hooks instead of task
This reduces memory / code size, and gets rid of ifdefs in temp_sensor.c.

BUG=chrome-os-partner:15714
BRANCH=none
TEST=boot system and run 'ectool temps all' every few seconds
    - ectool temps all
The numbers should update over time.

Change-Id: Idaac7e6e4cbc1d6689f5d3b607c623a5cc536a4f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36940
2012-11-01 12:45:22 -07:00
Randall Spangler
25c6574da6 link: TMP006 S0 param is uncalibrated by default
S0 values are incorrect and may even need to be calibrated on a
per-system basis.  Set them to 0 by default so that the EC doesn't
return inaccurate remote temperature readings before calibration data
is sent.

BUG=chrome-os-partner:15174
BRANCH=link
TEST=manual

- temps -> remote temps are all not calibrated
- t6cal 1 s0 9301
- temps -> PCH D-Object temp now returns a temperature

Change-Id: I43facc60cf947ebd9441a8a629a76f7ffc8f3959
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35302
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 14:24:41 -07:00
Randall Spangler
8f2e99da75 link: Temp sensor read can return an error code
This will be used in a follow-up CL to return specific error codes
(not powered, not calibrated, etc.)

BUG=chrome-os-partner:15174
BRANCH=link
TEST=manual

Power on system.
'temps' should return all good temps.
Power off system (into S5)
Only ECInternal temp should work; others should return Error 1
'gpioset enable_vs 1' and wait a second
Now all the I2C temps should display good data, but PECI will still be error 1.

Change-Id: I925434e71653ad53ad76bad992a7a8fdeadb088c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35286
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 13:47:17 -07:00
Randall Spangler
0b6b6b7754 Refactor TMP006 module
1) Use floating-point more freely, since it's on all the time now, and
the old fixed-point code no longer compiled.

2) Sensitivity and Bn values are now in a RAM-based struct in
preparation for setting them at runtime.  No changes from current
values.

3) If a sensor fails to read good data, is initialized, or loses
power, its die temperature history will be set to the next good
temperature, rather than persisting an arbitrary start value or old
state.  This fixes reading wildly inaccurate object temperatures for
the first few seconds following boot/resume.

4) If a sensor loses power, wait for the sensor to report data-ready
before reading temperature/voltage.  Otherwise, those read as 0, which
again throws off the first few seconds of data.

BUG=chrome-os-partner:14955
BRANCH=link

TEST=Boot system and set at login screen for a minute to reach thermal
equilibrium.  Then reboot system, type 'temps' repeatedly.  Data from
TMP006's should initially be Error; after a second or so it should be
good, and shouldn't change more than a few degrees.

Change-Id: Id0b42b9b18e94978ba7d3a1ee33194e44b1904bc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35188
2012-10-11 10:06:54 -07:00
Vic Yang
86cfeb5232 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
2012-05-28 16:42:17 +08:00
Vic Yang
0fefd25c0c Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.

Factor out sensor specific part to keep code clean.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.

Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
2012-02-18 13:37:53 +08:00