summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
Commit message (Collapse)AuthorAgeFilesLines
...
* temp_sensor: Separate ADC interface and thermistor mathsWonjoon Lee2015-09-113-88/+128
| | | | | | | | | | | | | | | | | | Separate the bd99992gw ADC interface from the NCP15WB thermistor adc-to-temp maths so that the thermistor can be used with various other interfaces. BUG=chrome-os-partner:44764 TEST=make buildall -j Manual on Glados. Boot to S0, run "temps". Verify that temperatures start around 28C and begin to increase after system is powered-on for a long duration. BRANCH=None Change-Id: I3e72e9f390feebaac2440dbe722485f8d1cf8c56 Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/296871 Reviewed-by: Shawn N <shawnn@chromium.org>
* driver/temp_sensor: Add power control API for TMP432Ben Lok2015-09-032-4/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some boards didn't define the CONFIG_TEMP_SENSOR_POWER_GPIO (such as: Oak), Due to the hardware design, the power of temp sensor is always on. But, we can enable/disable the temperature measurement circuitry of tmp432 by setup the shutdown (SD) bit. Add a new API: tmp432_set_power() to let upper layer to control the power of tmp432 by SW approach for power saving. BRANCH=none BUG=chrome-os-partner:44170 TEST=manual 1. make BOARD=oak -j 2. Turn off the TMP432: > tmp432 power off 3. check whether tmp432 is shutdown: > tmp432 ERROR: Temp sensor not powered. Not Powered 4. Turn on the TMP432: > tmp432 power on 5. check whether tmp432 is running: > tmp432 Local: Temp 29C Therm Trip 85C High Alarm 85C Low Alarm 0C Remote1: Temp 27C Therm Trip 85C High Alarm 85C Low Alarm 0C Remote2: Temp 27C Therm Trip 85C High Alarm 85C Low Alarm 0C STATUS: 10000000 CONFIG1: 00000000 CONFIG2: 00111100 Change-Id: Iab95c4c0b0130baf3bce380a8132e08ded8d159e Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/295058 Reviewed-by: Rong Chang <rongchang@chromium.org>
* driver/temp_sensor: Add support for BD99992GWShawn Nematbakhsh2015-08-032-0/+350
| | | | | | | | | | | | | | | Add support for ADC / thermistor reads on the BD99992GW PMIC. BUG=chrome-os-partner:42156 TEST=Manual on Glados with subsequent commit. Boot to S0, run "temps". Verify that temperatures start around 28C and begin to increase after system is powered-on for a long duration. BRANCH=None Change-Id: Ic15f41046130317a0e0c3bce4a923ba624328c0d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/289935 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Driver: Add macros to conditionally compile the console commandsVijay Hiremath2015-07-293-0/+14
| | | | | | | | | | | | | | Added macros to conditionally compile the console commands to save the memory. These macros can be enabled/disabled in the board specific files. BUG=none TEST=make buildall -j BRANCH=none Change-Id: I108a072c333762cd24ea973612202c9cc4d40914 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/288950 Reviewed-by: Shawn N <shawnn@chromium.org>
* cleanup: fix all the header guardsBill Richardson2015-06-182-6/+6
| | | | | | | | | | | | | | | This unifies all the EC header files to use __CROS_EC_FILENAME_H as the include guard. Well, except for test/ util/ and extra/ which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively. BUG=chromium:496895 BRANCH=none TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029 Reviewed-on: https://chromium-review.googlesource.com/278121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: new algorithm for tmp006 object temperatureBill Richardson2014-10-222-207/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original algorithm is given in the TMP006 User's Guide (SBOU107.pdf). The algorithm we previously implemented is that, plus some additional and completely undocumented massaging of the Tdie and Vobj registers. The original meaning of that hack is now lost in the mists of time, thanks to our email retention policy. This CL introduces a new algorithm variant, but at least this time the details are in the bug report. It's essentially the same as the User's Guide algorithm, except that we apply one-stage FIR filters to the Tdie input and the Tobj output. There are five new parameters: d0, d1, ds, e0, e1. Refer to tmp006_read_object_temp_k() in ec/driver/temp_sensor/tmp006.c to see how these new parameters are applied. CAUTION: The tmp006 sensor algorithm is mostly math and magic numbers. The spreadsheet attached to the bug report has six sheets with wildly varying values for those parameters. Since the correct parameter values haven't yet been determined for Samus, all I can be sure of with this CL is that it seems to work and isn't any worse than the old one. Oh, and note that the EC's 't6cal' console command has been disabled until/unless we add support for floating point IO. Use ectool from the host to get and set the params instead. BUG=chrome-os-partner:32260 BRANCH=ToT,Samus TEST=manual After booting, look at the sensor values using ectool: localhost ~ # ectool temps all 0: 312 1: 314 2: 313 Sensor 3 not calibrated 4: 311 Sensor 5 not calibrated 6: 305 Sensor 7 not calibrated 8: 306 Sensor 9 not calibrated 10: 307 Sensor 11 not calibrated 12: 312 Sensor 13 not calibrated localhost ~ # localhost ~ # ectool tempsinfo all 0: 0 PECI 1: 1 ECInternal 2: 1 I2C-Charger-Die 3: 2 I2C-Charger-Object 4: 1 I2C-CPU-Die 5: 2 I2C-CPU-Object 6: 1 I2C-Left C-Die 7: 2 I2C-Left C-Object 8: 1 I2C-Right C-Die 9: 2 I2C-Right C-Object 10: 1 I2C-Right D-Die 11: 2 I2C-Right D-Object 12: 1 I2C-Left D-Die 13: 2 I2C-Left D-Object EC result 2 (ERROR) ... localhost ~ # There are six tmp006 object temps that need calibrating. The index used for the calibration is for the tmp006 objects, not the 3,5,7,.. numbers reported for all temp sensors. See the current values with tmp006cal: localhost ~ # /tmp/ectool tmp006cal 5 algorithm: 1 params: s0 0.000000e+00 a1 1.750000e-03 a2 -1.678000e-05 b0 -2.940000e-05 b1 -5.700000e-07 b2 4.630000e-09 c2 1.340000e+01 d0 2.000000e-01 d1 8.000000e-01 ds 1.480000e-04 e0 1.000000e-01 e1 9.000000e-01 localhost ~ # If the s0 param is zero, this sensor is uncalibrated. The params are entered in the order in which they're displayed You can change any or all of the parameters. Skip the ones you don't want to update by specifying '-' for its position. (Note: throw in an extra '--' first so that ectool doesn't think that negative numbers are command options). For example, to change s0 and b0: localhost ~ # ectool -- tmp006cal 5 1.0 - - -3.0 localhost ~ # localhost ~ # ectool tmp006cal 5 algorithm: 1 params: s0 1.000000e+00 a1 1.750000e-03 a2 -1.678000e-05 b0 -3.000000e+00 b1 -5.700000e-07 b2 4.630000e-09 c2 1.340000e+01 d0 2.000000e-01 d1 8.000000e-01 ds 1.480000e-04 e0 1.000000e-01 e1 9.000000e-01 localhost ~ # Now sensor 13 (tmp006 object index 5) is calibrated: localhost ~ # ectool temps all 0: 310 1: 315 2: 313 Sensor 3 not calibrated 4: 310 Sensor 5 not calibrated 6: 305 Sensor 7 not calibrated 8: 307 Sensor 9 not calibrated 10: 307 Sensor 11 not calibrated 12: 312 13: 313 Change-Id: I61b5da486f5e053a028c533ca9e00b9a82a91615 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224409 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add cprints() and ccprints()Vic Yang2014-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: Add host command to read raw tmp006 dataRandall Spangler2014-03-071-0/+22
| | | | | | | | | | | | | | | This is needed to calibrate the tmp006 remote sensor values. BUG=chrome-os-partner:26581 BRANCH=none TEST='ectool tmp006raw N' works for N=0,1,2,3 And fails with invalid param for N=4. Data matches result of tmp006 ec console command. Change-Id: I04ec093c7727b55caca7d02baaf373d1ff234731 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189207 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cleanup: Remove checkpatch warningsRandall Spangler2013-12-192-29/+29
| | | | | | | | | | | | | | | | This make minor syntactic changes and renames some camel-cased symbols to keep checkpatch from complaining. The goal is to reduce the temptation to use 'repo upload --no-verify'. This is a big furball of find/replace, but no functional changes. BUG=chromium:322144 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/180495
* Clean up g781 temp sensor function namesChromeOS Developer2013-12-091-35/+35
| | | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Manual. Run the following console commands: g781 - verify temps and status look sane. temps - verify local and remote values for the 781 are listed g781 settemp 0x05 80 - verify local high alarm set to 80C g781 setbyte 0x09 0x80 - verify config register is 1000 0000 Change-Id: Ia437647fd052295dfd8901c2ef241ff69c0d950e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/179152 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Basic driver for tmp432 temperature sensorChromeOS Developer2013-12-072-0/+313
| | | | | | | | | | | | | | | | | | | | | This allows local and remote temp values to be added to a board's list of temp sensors. It also adds a 'tmp432' EC console command to query temps and set alert thresholds. Fractional degrees are not supported. DPTF support is not addressed. BUG=chrome-os-partner:23985 BRANCH=none TEST=Add tmp432 support to a board with the sensor then run the 'tmp432' and 'temps' EC console commands. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ifee47cf4d4cf5eedef9ef2bfa2149f183f1d7a7b Reviewed-on: https://chromium-review.googlesource.com/178688 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* cleanup: Rename and move header filesRandall Spangler2013-10-233-1/+103
| | | | | | | | | | | | | | Device-specific headers belong in driver/ or chip/. The include/ directory should be for common interfaces. Code should not normally need to include driver-specific headers. If it does, it should use the full relative path from the EC project root (for example, drivers/charger/bq24715.h). Change-Id: Id23db37a431e2d802a74ec601db6f69b613352ba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173746 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move source files to driver/ and power/ subdirsRandall Spangler2013-10-232-0/+654
The common/ subdir was getting cluttered. Move drivers for external components to a new driver/ tree, and move what used to be called chipset_*.c to a new power/ directory. This does not move/rename header files or CONFIG options. That will be done in subsequent steps, since moving and modifying .c files in the same CL is harder to review. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I67a3003dc8564783a320335cf0e9620a21982d5e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173601 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>