summaryrefslogtreecommitdiff
path: root/include/charger.h
Commit message (Collapse)AuthorAgeFilesLines
* OCPC: charger: Add support for VSYS compensationAseda Aboagye2020-06-041-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Some charger ICs can compensate VSYS for losses across the board when charging from an auxiliary charger in an OCPC scheme. This commit adds that support to the common charger and OCPC framework such that it can be leveraged. Charger ICs which can dynamically compensate and don't need continuous adjustments should return EC_SUCCESS as the PID won't be needed. Other chargers should return EC_ERROR_UNIMPLEMENTED since they require continuous adjustments. BUG=b:147440290,b:148980016 BRANCH=None TEST=With driver changes made for RAA48900, build and flash on waddledoo, verify that charging from the sub board works on board revs 0 and 1. TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ie6fb27260b2d6e040dbfdc0aaa5b64b52173037c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191298 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* OCPC: Add concept of active charger ICAseda Aboagye2020-05-011-7/+10
| | | | | | | | | | | | | | | | | | | | | | | With OCPC, one charger IC per Type-C port, there are now multiple charger ICs present in the system. This commit adds the beginning of OCPC support by adding the notion of an active charger IC. Charge Manager will select the active charger IC based upon the charge port. Boards must define this mapping in a board specific function. Additionally, this commit adds chgnum as a parameter to charger_set_input_current_limit(). BUG=b:148981052 BRANCH=None TEST=With other patches, verify that the active charger IC is able to be saved and retrieved. Change-Id: Iba4a8958171ad6e1630b0ca3d07d128bc1f2c4dd Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135963 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* charger: Add chgnum arg to charger_get_input_currentAseda Aboagye2020-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | With the advent of OCPC, one charger per Type-C, it will be required to retrieve the input current per charger IC. This commit adds the chgnum argument to charger_get_input_current. For boards with a single charger IC, they should simply pass in 0 for this argument. BUG=b:147440290,b:148980034 BRANCH=None TEST=`make -j buildall` TEST=With other code, verify that queries for input current is targeted at the correct charger IC. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Iac80255faa539a7b4cfeb495aaed2bf12e62f182 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135961 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Charger: Add driver function for sourcing OTGDiana Z2020-03-211-0/+5
| | | | | | | | | | | | | Fold charger_is_sourcing_otg_power into the charger driver structure. BUG=None BRANCH=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I0526495fff8464539e216d2cf80c34e09af2c418 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2110530 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* OCPC: Introduce charger enumDiana Z2020-03-161-1/+4
| | | | | | | | | | | | | | | This enum will specify which charger is primary, and the number of total charger chips for the board. This will be pre-defined for boards using a single charger chip. BUG=b:147440290 BRANCH=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id612ace560207a7805e103465fd4035d46beed8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2101220 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Charger: Convert boards to use new driver structureDiana Z2020-02-041-1/+0
| | | | | | | | | | | | | | | This commit removes the temporary common charger chip configuration and instead puts the configuration in each board. BRANCH=none BUG=b:147672225 TEST=builds, runs on waddledoo and octopus Change-Id: If81aef31e48c65999a87e202494f286716114bbb Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2031855 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Charger: change get_vbus_voltage to return EC errorDiana Z2020-01-281-2/+3
| | | | | | | | | | | | | | | The other driver structure members return an ec_error_list value and fill in parameters to return data. This commit changes the get_vbus_voltage call to follow that model. BRANCH=None BUG=b:147672225 TEST=builds Change-Id: I7308502a9734274dd308b830762493c4d70d147a Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2015340 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Charger: Create charger driver structureDiana Z2020-01-281-35/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With upcoming boards which use multiple charger chips, the EC codebase needs to be changed to assume chargers may have different I2C ports. This commit creates the driver structure and wrapper functions, which for now are hard-coded to chip 0 for equivalent behavior with previous code. A general charger config is created for all boards in charger.c for now, which uses the build information to fill in the structure. All boards will default to defining CONFIG_CHARGER_SINGLE_CHIP, which in turn defines a CHARGER_SOLO which can be used by drivers which have code that needs to determine charger numbers. For boards which have multiple chips, they may undefine this config and should generate build errors if their driver is still using the hardcoded charger reference of CHARGER_SOLO. Older drivers may continue using CHARGER_SOLO in non-static functions until they're needed in a multiple charger board. For boards which may be supporting different I2C configurations for the charger over board versions, they may define CONFIG_CHARGER_RUNTIME_CONFIG to fill in these fields after boot. BRANCH=none BUG=b:147672225 TEST=builds, chargers on hatch and octopus work Change-Id: I390ede494226252e512595c48099fa1288ffe93e Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008451 Reviewed-by: Jett Rink <jettrink@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* bq25703: Report actual input current limitVijay Hiremath2018-06-041-0/+9
| | | | | | | | | | | | | | | | | | | | | IIN_DPM register reflects the actual input current limit programmed in the register, either from host or from ICO. After ICO, the current limit used by DPM regulation may differ from the IIN_HOST register settings. BUG=b:80279932 BRANCH=none TEST=Manually tested on BIP Used BC1.2 DCP charger 'charger' command yield 900mA while charge ramp set to 2.4A. Change-Id: I6389205bd70d7729e9dd810fef3dfbf83a7d8c65 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1080343 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* isl923x: Round up requested OTG currentNicolas Boichat2018-03-091-2/+4
| | | | | | | | | | | | | | | | | | | | Without this patch, requesting 100mA or output current would be rounded down to zero. This would also cause other issues when doing base/lid and lid/base power transfers on lux/wand, as the input current has a much finer grain control, which could lead the input charger to brown out the output charger. BRANCH=none BUG=b:67920792 TEST=Flash lux/wand, lux can provide as little as 100mA of current successfully. Change-Id: Ibf170a6ee3c2dfbdbbc03948c3b0e6ab878eee47 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956660 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Introduce CONFIG_USB_PD_5V_CHARGER_CTRLPhilip Chen2018-03-051-0/+8
| | | | | | | | | | | | | | | | Add a new config for the boards using charger (e.g. rt946x) to report if VBUS source is enabled instead of using GPIO. BUG=b:65446459 BRANCH=none TEST=Charge Scarlet rev3 with SDP and DCP. Change-Id: Id0a07945f0f888b6a36c422c596b56c5aa5065c0 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/905400 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* charger/isl923x: Implement charger_get_system_power from PSYSNicolas Boichat2018-01-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On ISL923x, PSYS output is always enabled when the AP is on (provided CONFIG_CHARGER_PSYS is enabled). We add support for charger_get_system_power function, reading PSYS value, when CONFIG_CHARGER_PSYS_READ is defined. This will be used by the charging algorithm on lux. We also rename CONFIG_CMD_CHARGER_PSYS to CONFIG_CHARGER_PSYS_READ as CONFIG_CHARGER_PSYS_READ provides both "psys" console command and the new function. We also cleanup unneeded undefs in board files. Note that this does not implement the function on bd9995x, but this could be done without too much effort. BRANCH=none BUG=b:71520677 TEST=On lux, without AC connected, check that "psys" output roughly matches the output current from the battery. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Change-Id: Ie1ce8e0ac103daacc5a08b8ccae604d1d83551b8 Reviewed-on: https://chromium-review.googlesource.com/848487 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* isl9238: Add support for providing power using OTGNicolas Boichat2017-10-201-2/+18
| | | | | | | | | | | BRANCH=none BUG=b:66575472 TEST=Flash lux and wand, wand can provide power to lux. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Change-Id: I59091c509b78bacf9f382550ab380a77fbf68ba9 Reviewed-on: https://chromium-review.googlesource.com/725122 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charge_ramp: Specify port number in board_is_vbus_too_low()Shawn Nematbakhsh2017-02-021-2/+2
| | | | | | | | | | | | | | | | | | | charge_ramp needs to make a decision based upon the VBUS level on one specific port - the port that is ramping. The VBUS level on any other charge ports (if present) is not relevant. BUG=chrome-os-partner:54099 BRANCH=reef, gru TEST=With subsequent patches, verify charge_ramp success with a variety of BC1.2 chargers. Change-Id: Ie0a51a577e2b7491222560cd08dd5321ff3b7975 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/435561 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* Fix various misspellings in commentsMartin Roth2016-11-151-1/+1
| | | | | | | | | | | | | No functional changes. BUG=none BRANCH=none TEST=make buildall passes Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403417 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* charger: BD99955: Get the VBUS level from the chargerVijay Hiremath2016-07-131-0/+3
| | | | | | | | | | | | | | | | | Added code to get the VBUS level by reading the charger registers. BUG=chrome-os-partner:55117 BRANCH=none TEST=Manually tested on Amenia, VBUS_VAL (5Ch) & VCC_VAL (5Eh) registers are updated with the correct VBUS value on the respective ports. Change-Id: I3b019b2d87e4c347f12596df387a2a659092ae25 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/359416 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: Change unlocked battery level ignore conditionsShawn Nematbakhsh2016-01-061-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | x86 systems will auto-power-on when power is applied to the EC. When the battery level is critically low, power-on is prevented, except when the system is unlocked. So, when unlocked, some systems will auto-power-on regardless of battery level, overcurrent the charger / battery, and then repeat forever. Prevent this reboot loop by ignoring auto-power-up when the battery is critically low, regardless of system unlocked status. BUG=chrome-os-partner:48339 TEST=Verify power-up is prevented on no-battery chell w/ donette. Then, run 'powerbtn' on EC console and verify system powers on (and overcurrents). BRANCH=None Change-Id: Ia631b5a8c45b42ec805e4a0c3f827929a0efd236 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/319187 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* glados: isl9237: add HW charge rampingAlec Berg2015-11-091-0/+1
| | | | | | | | | | | | | | | | | | | | | Add HW charge ramping option and enable on glados. Modify charge_manager to enable/disable HW charge ramping when option is defined. Unfortunately, the isl9237 doesn't have a way to determine what the input current limit has settled on, so the EC will always report the max input current for that supplier. BUG=chrome-os-partner:47335 BRANCH=none TEST=plug in CDP, SDP, DCP, type-C, and PD charger. Make sure we ramp to a reasonable value for the correct suppliers. Make sure we don't ramp for type-C and PD chargers. Change-Id: Ib541fa0be48d8f4d261c71b853b0ee72b2adbf6b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311301 Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: Inhibit power-on until charger is initializedShawn Nematbakhsh2015-07-221-0/+2
| | | | | | | | | | | | | | | | | | It's sometimes desirable to boot without a battery, but we may brown out if we don't have sufficient current. Inhibit AP power-on, even if the system is unprotected, until our charger and current limit are initialized. BUG=chrome-os-partner:41258 TEST=Manual on reworked glados with subsequent commit. Remove battery and attach Zinger. Verify EC powers on and AP doesn't boot. Run `powerbtn`, verify that AP boots. Remove all power and attach battery, verify that EC powers on and AP boots. BRANCH=None Change-Id: Ifc3d16f8288a035854e9fd05812ce6de33170d6a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/280563 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* cleanup: remove board_discharge_on_ac() unless custom func neededAlec Berg2015-07-141-0/+3
| | | | | | | | | | | | | | | | | | Remove duplicate board_discharge_on_ac() functions and create CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM for boards that have a unique implementation of board_discharge_on_ac(). BUG=chrome-os-partner:42294 BRANCH=none TEST=make -j buildall. load on samus and test 'ectool chargecontrol discharge' forces discharging on AC, and 'ectool chargecontrol normal' resumes normal charging. Change-Id: I2b7c04b9278d07748d6d41798ceab1a7e90684e4 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/284911 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add "debug" option to charge_state_v2.cBill Richardson2014-05-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This is useful for testing battery charge profiles. When enabled, a dump of all battery, charger, and charge state information will be printed whenever the battery charge percentage changes. BUG=none BRANCH=ToT TEST=make buildall -j On the EC console: chg debug on then watch the console while either charging or discharging the battery. Disable with chg debug off Change-Id: I6725c461461f90fcd812873f97490e980ab47bc6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199816 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Add charger_get_params() function to query charger state.Bill Richardson2014-03-281-7/+27
| | | | | | | | | | | | | | | | | | | This returns all the parameters of the charger that must be monitored frequently. While some of the fields are charger-specific, all of the parameters are present in all supported chargers. Nothing uses this yet. BUG=chrome-os-partner:20881 BRANCH=ToT TEST=make buildall -j All targets build; all tests pass. Change-Id: Id3e00532469b193aeab3acf93e94afe3ffb8c6b6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191985 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Support discharge on BQ24715 for Rambi and SquawksJustin Chuang2014-01-161-0/+3
| | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:25031 BRANCH=rambi TEST=Manually make BOARD=peppy make BOARD=falco make BOARD=rambi make BOARD=squawks On rambi and squawks, connect charger ectool chargecontrol discharge ectool i2cread 16 0 0x16 0x0a It should return 16-bit negative integer. Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6 Signed-off-by: Justin Chuang <jchuang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182586 Reviewed-by: Dave Parker <dparker@chromium.org>
* Temporary OTG and external power supportVic Yang2013-09-051-0/+6
| | | | | | | | | | | | | | | This is only for initial bringup that requires OTG to boot kernel. Note that we are expecting firmware for USB ID detection and hardware change to charger chip, so this is likely going to be thrown away. BUG=chrome-os-partner:21964 TEST=Plug in OTG dongle and check VBUS voltage is ~5V TEST=Unplug and check it's ~0V. BRANCH=None Change-Id: Iee66bef117188fea14a76459945be3bf5afef0dd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/167832
* Constrain charging voltage to values chargers can provide.Dave Parker2013-07-191-0/+9
| | | | | | | | | | | | | | | BUG=chrome-os-partner:20863 BRANCH=falco,peppy,slippy,wolf TEST=Manual. On Peppy, there should no longer be "Charging Voltage" messages every second on the EC console. On other platforms verify that V_Batt reported by the 'charger' command is divisible by 16. Change-Id: Idd775a1d8033ff3405d10919e1e15ddddebc6c23 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62699 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add support for TI's Smart Battery Charger BQ24707ABill Richardson2013-06-071-0/+8
| | | | | | | | | | | | | | | | This is very similar to the BQ24725. There are just enough differences to require a separate file. BUG=chrome-os-partner:19976 BRANCH=none TEST=none Nothing to test until it's enabled. Change-Id: I3247fcfde93ac75f5f9790acadc7feca28038608 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57811 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Only ask the charger for current steps it can supplyRandall Spangler2012-09-241-0/+9
| | | | | | | | | | | | | | | This reduces oscillations in the charging algorithm. This change also adds more debug output so it's easier to see what the charging state machine is doing. BUG=chrome-os-partner:9572 BRANCH=link TEST=discharge battery; charge battery; note infrequent but useful debug output Change-Id: I4c8609c2ca8a6cab3eae151ecf2bb1520103fece Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/33811 Reviewed-by: Rong Chang <rongchang@chromium.org>
* Clean up initsRandall Spangler2012-04-191-3/+0
| | | | | | | | | | | | We can clear the reset cause in system pre-init now because of a previous change which preserves it across a sysjump. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: I1d8b99df5a0be0de9545d22ad1a6b7fb3140f813
* Add basic smart battery driverRong Chang2012-02-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a common part of smart battery driver. Following features are not implemented, or in chip specific driver: Battery access control, authentication, factory mode Manufacturer access/data commands Block read/write, device name, flash data Chip specific features, per cell info/temp/capacity Signed-off-by: Rong Chang <rongchang@google.com> BUG=chrome-os-partner:7856 TEST=console command check battery staus [unplug power] > battery [check voltage,current,capacity,time to empty] [plug power] > charger voltage 8400 > charger current 4250 > battery [check current,time to full] > charger input 4032 > battery [check current,time to full] [wait 130 seconds, charger watch dog timeout] > battery [check current] Change-Id: Ifac17a0892f52e8f37eebc14b00e71f18360776c Signed-off-by: Rong Chang <rongchang@chromium.org>
* Initial bq24725 charger driver importRong Chang2012-02-071-0/+44
| | | | | | | | | | | | | | | | Battery charging state machine contains many file changes. This is the 1st part of the break down. Refactor original test code into board dummy driver. Normalize charger API. And import link's charger IC driver. Signed-off-by: Rong Chang <rongchang@google.com> BUG=chrome-os-partner:7855 TEST=build without warning and error BOARD=bds make BOARD=link make BOARD=discovery make Change-Id: I34b6e9862a45331378916bc77653d4adb22ca548
* Refactor temperature sensor code and add support of Link I2C temp sensor.Vic Yang2012-02-041-0/+13
Refactor board/chip-specific code into corresponding directories. Add support of the four I2C temp sensor in Link. Use table lookup to handle different types of temperature sensors. BUG=chrome-os-partner:7527 TEST=Correctly read EC internal temperature on bds. Compile for link succeeded. Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2