summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* coil: I2C_PORT_MASTER -> I2C_PORT_CONTROLLERMary Ruthven2021-01-071-2/+2
| | | | | | | | | | BUG=b:175244613 TEST=make buildall -j Change-Id: If5b5dc1b2390dfec43955ec88a959ba26b52082b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611758 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* coil: remove unused driver codeMary Ruthven2021-01-06165-41777/+0
| | | | | | | | | | | | | | | | | | The extra driver code uses coil terms we're removing, but we don't use it in platform/cr50. Remove the code instead of replacing the terms. Cr50 boards only use inaxx code. The host uses thermister code. Remove everythinge else. We can cleanup the tests that run the thermsiter code later. BUG=b:175244613 TEST=make buildall -j Change-Id: I368a6c6ac3b543913225416fbc003c3f52863c22 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613137 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* coil: remove fingerprint supportMary Ruthven2021-01-0622-1829/+0
| | | | | | | | | | | | | This code uses coil terms we're removing, but we don't use it in platform/cr50. Remove the code instead of replacing the terms. BUG=b:175244613 TEST=make buildall -j Change-Id: I909e21693d839cb3769e680c58d9d34017802aa1 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613136 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* coil: remove usbc, usb_pd, charge_manager, and tcpmMary Ruthven2021-01-0623-7609/+0
| | | | | | | | | | | | | This code uses coil terms we're removing, but we don't use it in platform/cr50. Remove the code instead of replacing the terms. BUG=b:175244613 TEST=make buildall -j Change-Id: Ia64e1ff4df941d2fe19e95e84dee8b743616aa88 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613135 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: change OWNERS to cr50 team membersMary Ruthven2019-12-101-1/+0
| | | | | | | | | | | | | | Change the OWNERS to cr50 team members and remove OWNERS files from all subdirectories. BUG=none BRANCH=none TEST=none Change-Id: I5ddff7c433a55b6724d92c026e9e64e82e1492ad Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1957850 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* usb_mux: cleanup the usb_mux_get() functionVijay Hiremath2019-11-261-19/+14
| | | | | | | | | | | | | | Simplified the usb_mux_get() function and made the MUX info prints same as in ectool. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Iefb16e1dbd323afbe248b06fe9c53abc63be9a67 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1931284 Reviewed-by: Jett Rink <jettrink@chromium.org>
* trembyle: tcpc fault needs to be clearedDenis Brockus2019-11-251-0/+22
| | | | | | | | | | | | | | | | | We currently do not use the TCPCI fault for anything but need to clear any faults to stop an alert storm. Added debug output so we can see what is coming out in times of fault, just as an FYI. BUG=b:144126745 BRANCH=none TEST=insert-extract charger from USB-C0 and verify AC on/off Change-Id: Ifc5ffc4e18790e6fc9763bbeb334cbdff901ad43 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1934045 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* usbc: make BB virtual mux retimer compatible with non-virtualDenis Brockus2019-11-253-43/+30
| | | | | | | | | | | | | | | | Changed the driver interface for BB virtual mux retimer to stop using global functions and use the usb_retimers array instead. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I56befaca1720eb2f4e0599a983629b4df45dc76b Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928121 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* Reland "smart_battery: add smbus error checking support"Ting Shen2019-11-251-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of daccb3adea9394116d7ab2c807e4a360cb5a93a1 Original change's description: > smart_battery: add smbus error checking support > > Jacuzzi/Kodama has a unstable software controlled i2c bus, its data > transmission may be interrupted by other higher priority tasks and > causes device timeout. > > If timeout happens when ec is reading data, it has no knowledge about > what's happening on slave, and keep receiving bad data (0xFF's) until > end. The standard i2c/smbus error handling mechanism can not handle this > case, so we need the error checking feature from smbus 1.1 to ensure our > received data is correct. > > This CL adds the error checking (PEC) functions to i2c and smart battery > module. > > BUG=b:138415463 > TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST, > no failure after 100k read/writes. > test code at CL:1865054 > BRANCH=master > > Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3 > Signed-off-by: Ting Shen <phoenixshen@google.com> > Reviewed-on: http://crrev.com/c/1827138 > Reviewed-by: Denis Brockus <dbrockus@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> BUG=b:138415463 TEST=in addition to the TESTs above, verified this CL boots on hatch(npcx chips), and reef_it8320(it83xx chips). BRANCH=master Change-Id: I67975eee677cfd6e383742d48103662372cac061 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1913940 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* battery : Define CONFIG_BATTERY_DEAD_UNTIL_VALUEYongBeum Ha2019-11-221-0/+4
| | | | | | | | | | | | | | | | It takes 850ms~950ms to get valid RSOC after battery wake-up. Sometimes battery FG returns garbage data(1%) as RSOC and 0 value of desired current / voltage. Add CONFIG_BATTERY_DEAD_UNTIL_VALUE to continue charging. BUG=b:138413964 BRANCH=None TEST=build & flash, check battery charging with dead battery Change-Id: I0cbe30aa973499b0c27faf9b6da03a0344ad1065 Signed-off-by: YongBeum Ha <ybha@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1918985 Reviewed-by: Jett Rink <jettrink@chromium.org>
* cleanup: Segregate ioexpander related drivers in ioexpander folderVijay Hiremath2019-11-229-5/+5
| | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall -j Change-Id: I7fe9ab23254dbd8515936d10ad6782305e76236c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1925173 Reviewed-by: Jett Rink <jettrink@chromium.org>
* usbc: add enter_low_power_mode for retimer muxDenis Brockus2019-11-212-6/+53
| | | | | | | | | | BUG=b:139428185 BRANCH=none TEST=verify mode is set correctly when switching devices Change-Id: I3e40e0321cb1026180b7edc0bfe99439c13acafb Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1922062
* charger/rt946x: fix mt6370 IEOC inaccuracyYilun Lin2019-11-211-8/+63
| | | | | | | | | | | | | | | | mt6370's IEOC is inaccurate when charging current < 900mA; the power path only partially turned on under such situation. Hence, we have to raise the IEOC setting if the current is under 900mA to compensate the IEOC original setting. BUG=b:144532905 BRANCH=kukui TEST=ensure IEOC is raised when Ichg < 900mA. Change-Id: I9f1575bb707bc91e428c06a93c4682dde22d90fc Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1924167 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* driver: lsm6dsm: Allow building without CONFIG_ACCEL_FIFOYuval Peress2019-11-212-37/+68
| | | | | | | | | | | | | | | | This change refactors the lsm6dsm to allow building without the use of the FIFO or sensor interrupts. BUG=None BRANCH=None TEST=make buildall Change-Id: I5b338d81061f25fd1c8209b4555f63ea4d8b2dbc Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1916679 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Auto-Submit: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* driver: lsm6dso: Fix build issue and align to motion sense fifo apiMario Tesi2019-11-191-1/+5
| | | | | | | | | | | | | | | | | Fix build issue, replaced motion_sense_fifo_add_data with motion_sense_fifo_stage_data and motion_sense_fifo_commit_data fifo api. BUG=none BRANCH=master TEST=Fixed build issue. Tested on discovery target BOARD with LSM6DSO connected to EC i2c master bus and motion sense task running. Change-Id: I7e4e81f1b6fe95b33ef6a4bfc5fdd509273c6f7b Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1903129 Reviewed-by: Yuval Peress <peress@chromium.org>
* driver/ioexpander_it8801: add I/O expander driver for keyboardtim2019-11-193-0/+274
| | | | | | | | | | | | | | IT8801 is an I/O expander with a keyboard matrix controller. BUG=b:133200075 BRANCH=none TEST=Press any key on keyboard and the console command "ksstate on" can print keyboard scan state. Change-Id: I6903aad1eacfdfb6a7c6c04e6954a14e8c8caaac Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1677976
* driver/it83xx: Don't set cc when set message header power roleRuibin Chang2019-11-181-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When driver's setting pd message header function is called from TCPM, driver shouldn't set cc resistance. We should follow the comment just setting header defined in set_msg_header. The message header power role equal our cc resistance Rp/Rd state in mostly case. But there is an exception, like power role swap from SNK to SRC, there is a temporal transition state that both port cc assert Rd and GoodCRC power role field is swapped for response original SRC PS_RDY, so we shouldn't assert cc in set_msg_header function. [refer]: PD3.0 spec v2 ch8.3.2.6 BUG=none BRANCH=none TEST=connect to dongle, adapter, DRP on board ampton 1.Power role swap successfully 2.PD state to SRC_RDY or SNK_RDY Change-Id: Ibad3d8fcfcaa382fef4c8ef8ed26e920c63730b5 Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1916759 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* rt946x: Fix MT6370 charger type detectionGene Chen2019-11-141-0/+30
| | | | | | | | | | | | | | add bc12 workaround when bc12 detect SDP BRANCH=kukui BUG=b:128049211 TEST=boot kukui, slow plug in DCP, check bc12 detect chg type Change-Id: Ie9b8780fdad6e061e967ebb127b27bf63a11db2e Signed-off-by: Gene Chen <gene_chen@mediatek.corp-partner.google.com> Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1568887 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* ec: Add driver for TI INA3221 voltage sensors.Andrew McRae2019-11-143-0/+218
| | | | | | | | | | | | | | | | | Add driver for TI INA3221 voltage sensors. Puff has several of these devices, and the EC has access to them. BRANCH=none BUG=b:144132145 TEST=EC buildall, tests Change-Id: I37efd6ce7f154339f002c633e5daf6a18fef05aa Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1903629 Reviewed-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
* usbc: retimer pi3dpx1207Denis Brockus2019-11-144-7/+191
| | | | | | | | | | | BUG=b:139428185 BRANCH=none TEST=verify mode is set correctly when switching devices Change-Id: Ic9d460a94bb8007f17168ac5237a4dcbc24cfb2b Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1900123 Reviewed-by: Edward Hill <ecgh@chromium.org>
* retimer: usbc retimer name cleanupDenis Brockus2019-11-133-11/+9
| | | | | | | | | | | | | | Need to cleanup naming around USBC Retimers for adding PI2DPX1207 code BUG=none BRANCH=none TEST=make buildall -j Change-Id: I7e18e0abbe5bfd89bf0e20fa7b5174669689778f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911296 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb_mux: Change AMD_FP5 mux driver to handle no powerDenis Brockus2019-11-131-6/+28
| | | | | | | | | | | | | | | Make sure if we are setting the mux to 0 and no power is applied, make sure to return back SUCCESS, Also when getting this with power off, we should return 0 and SUCCESS. BUG=none BRANCH=none TEST=plug in charger into USBC with no power to AP and verify no errors Change-Id: I3a63961a80c8ecd73dd21cf01e7d7e99b128e189 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1910485 Reviewed-by: Edward Hill <ecgh@chromium.org>
* rt946x: Fix MT6370 Charger back boost and INT miss issueAllen Chiang2019-11-132-44/+342
| | | | | | | | | | | | | | | | | | | | | | | 1. Add ADC readings. 2. Add MIVR IRQ, when trigger mivr irq then get ibus adc, if the ibus < 100mA then toggle cfo to stop LX/RX function, that can cancel the back boost voltage. 3. In order to solve the issue of missing IRQ, it is necessary to record the state of IRQs before and after reading event of IRQs. BRANCH=kukui BUG=b:134372910 TEST=boot kukui, trigger interrupt, check interrupt handler is OK. Change-Id: I695125b1c25f13ab73713304727cbb7a1d90083c Signed-off-by: Allen Chiang <allen_chiang@mediatek.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660522 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org> Tested-by: Eric Yilun Lin <yllin@chromium.org>
* Clean up double tap related definitionHeng-Ruey Hsu2019-11-132-9/+9
| | | | | | | | | | | | | | | | Fixes: commit 2f2a81079191ca "Add double tap and make motion sense wake up ap" CONFIG_GESTURE_DETECTION_MASK includes significant motion in activity list. We cannot use it for double tap. Add more flags to distinguish it. BUG=b:135575671 BRANCH=kukui TEST=AP can receive mkbp event when double tap is triggered Change-Id: I13776a01b14dc251396a615c8c97353f2d0477d4 Signed-off-by: Heng-Ruey Hsu <henryhsu@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911263 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver/battery: add command to fake battery temperaturePaul Fagerburg2019-11-121-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'batttempfake' command allows overriding the battery temperature reading, to test scenarios where the battery temperature affects the charging operations. BUG=None BRANCH=None TEST=Set GBB flags to disable software sync and disable rollback checks $ make -j BOARD=kohaku $ ./util/flash_ec --board=kohaku When the system reboots, open the EC console and execute the commands: > help batttempfake Usage: batttempfake temperature (-1 = use real temperature) Set fake battery temperature in deciKelvin (2731 = 273.1 K = 0 deg C) > batttempfake 2731 Fake batt temperature 273.1 K > battery ... Temp: 0x0aab = 273.1 K (0.0 C) ... > batttempfake -1 > battery ... Temp: 0x0bc9 = 301.7 K (28.6 C) ... Change-Id: I4c1fff13f3fec34e9e20d0016f66bd5c693e1537 Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1910582 Reviewed-by: Justin TerAvest <teravest@chromium.org>
* Add double tap and make motion sense wake up apHeng-Ruey Hsu2019-11-111-5/+5
| | | | | | | | | | | | | | | Change to use CONFIG_GESTURE_DETECTION_MASK since CONFIG_GESTURE_SENSOR_BATTERY_TAP and CONFIG_GESTURE_SENSOR_DOUBLE_TAP both define it. BUG=b:135575671 BRANCH=none TEST=build pass. EC can receive double tap interrupt. Change-Id: I6eec40ef7405ec0653ff62dbce98f975cb19e332 Signed-off-by: Heng-Ruey Hsu <henryhsu@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1710210 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Add a board specific helper to return USB PD port countKarthikeyan Ramasubramanian2019-11-099-12/+15
| | | | | | | | | | | | | | | | | | | | | Certain SKUs of certain boards have less number of USB PD ports than configured in CONFIG_USB_PD_PORT_MAX_COUNT. Hence define an overrideable board specific helper to return the number of USB PD ports. This helps to avoid initiating a PD firmware update in SKUs where there are less number of USB PD ports. Also update charge manager to ensure that absent/ invalid PD ports are skipped during port initialization and management. BUG=b:140816510, b:143196487 BRANCH=octopus TEST=make -j buildall; Boot to ChromeOS in bobba(2A + 2C config) and garg(2A + 1C + 1HDMI config). Change-Id: Ie345cef470ad878ec443ddf4797e5d17cfe1f61e Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879338 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* Kodama: SMP battery cannot be charged in over discharge statexiong.huang2019-11-082-0/+11
| | | | | | | | | | | | | | | | | | | | SMP battery uses HW pre-charge circuit and pre-charge current is limited to ~50mA. Once the charge current is lower than IEOC level within CHG_TEDG_EOC, and TE is enabled, the charging power path will be turned off. Charger vendor advice that disable EOC and TE when battery stays over discharge state, otherwise enable EOC and TE. BUG=b:142630134 TEST=Verified on both SMP battery and Celxpert battery in over discharge state, all passed. BRANCH=kukui Change-Id: I7d6907d54ab555587a489333350de6e9aeffe60e Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1893901 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* kukui: Support mt6370 bc12 detect apple/samsung TATJ Wu2019-11-072-42/+190
| | | | | | | | | | | | | | | | Support mt6370 bc12 detect apple/samsung TA TEST=plug in apple/samsung TA, and use power supply check charger type BUG=b:118791032 b:122866184 BRANCH=kukui Change-Id: Ieb684f7a3d38e3b36aab9bcf27cbc823b5a7df81 Signed-off-by: TJ Wu <tj_wu@richtek.com> Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1351910 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
* touchpad_gt7288: replace Kernel-doc with DoxygenHarry Cutts2019-11-062-30/+35
| | | | | | | | | | | | | | | | When I wrote the driver I was under the mistaken impression that Kernel-doc style documentation comments were in use it CrOS EC. Looking at it now, Doxygen is far more common. BUG=chromium:991365 TEST=make buildall -j BRANCH=none Change-Id: I25be469d362bba256fdfb7f81438da28f24bfeb5 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1899337 Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
* Rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNTKarthikeyan Ramasubramanian2019-11-0119-45/+46
| | | | | | | | | | | | | | | | | Certain SKUs of certain boards have lesser number of USB PD ports than defined by CONFIG_USB_PD_PORT_COUNT. Hence rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT. BUG=b:140816510, b:143196487 BRANCH=octopus TEST=make -j buildall; Boot to ChromeOS Change-Id: I7c33b27150730a1a3b5813b7b4a72fd24ab73c6a Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879337 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* tcpci: fix tcpc_alert error messageCaveh Jalali2019-11-011-2/+2
| | | | | | | | | | | | | | this adds a missing newline to the end of a CPRINTF format string. BRANCH=none BUG=none TEST=builall passes Change-Id: I4a380983bce107af7a0f6eb7304bb9090c5b621a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1886033 Reviewed-by: Caveh Jalali <caveh@google.com> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* Cleanup: Renaming pd_is_ufp to pd_partner_is_ufpAyushee2019-11-011-1/+1
| | | | | | | | | | | | | | | | pd_is_ufp function returns port partner CC status, renaming it to pd_partner_is_ufp to avoid ambiguity between host and port partner's CC status. BUG=b:141971044 BRANCH=None TEST=make buildall -j Change-Id: I19da8c8470db134e438271b92918994d77e4eb5d Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1894119 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* tcpm/fusb302: implement low power modeTing Shen2019-10-311-1/+10
| | | | | | | | | | | | | | | | | Implement tcpc_low_power_mode to reduce power consumption in G3. BUG=b:142760774 TEST=measure power consumption on jacuzzi. verify that power consumption is reduced by 3~4mW see b:142760774 comment 3 for more detail. BRANCH=master Change-Id: I04436d3baaa97b7c049ae3f3d9a9510e5a2024d9 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1880773 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Revert "smart_battery: add smbus error checking support"Caveh Jalali2019-10-301-43/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit daccb3adea9394116d7ab2c807e4a360cb5a93a1. Reason for revert: <INSERT REASONING HERE> broke USB-C charging. all we get now is: 2019-10-30 01:26:15 New chg p0[49.441303 CL: p0 s2 i500 v5000] 2019-10-30 01:26:16 C0 st5 2019-10-30 01:26:16 C0 Req [1] 5000mV 3000mA 2019-10-30 01:26:16 New chg p0[50.305144 CL: p0 s0 i500 v5000] 2019-10-30 01:26:16 C0 HARD RST RX 2019-10-30 01:26:16 C0 st4 2019-10-30 01:26:16 New chg p0[50.354280 CL: p0 s2 i500 v5000] 2019-10-30 01:26:17 C0 st5 2019-10-30 01:26:17 C0 Req [1] 5000mV 3000mA ... Original change's description: > smart_battery: add smbus error checking support > > Jacuzzi/Kodama has a unstable software controlled i2c bus, its data > transmission may be interrupted by other higher priority tasks and > causes device timeout. > > If timeout happens when ec is reading data, it has no knowledge about > what's happening on slave, and keep receiving bad data (0xFF's) until > end. The standard i2c/smbus error handling mechanism can not handle this > case, so we need the error checking feature from smbus 1.1 to ensure our > received data is correct. > > This CL adds the error checking (PEC) functions to i2c and smart battery > module. > > BUG=b:138415463 > TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST, > no failure after 100k read/writes. > test code at CL:1865054 > BRANCH=master > > Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3 > Signed-off-by: Ting Shen <phoenixshen@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1827138 > Reviewed-by: Denis Brockus <dbrockus@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> Bug: b:138415463 Change-Id: Ibd8a512dd6d43cca95628f698e7a66a695b7fc59 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1889435 Reviewed-by: Caveh Jalali <caveh@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Caveh Jalali <caveh@google.com> Tested-by: Caveh Jalali <caveh@google.com>
* battery/mm8013: Fix reversed WANT_CHG flag.Yilun Lin2019-10-301-3/+3
| | | | | | | | | | | | | battery_flag()'s return code is 0 on success. TEST=see allowing charge in command battery BUG=None BRANCH=kukui Change-Id: I26d6a69deadca1ad5a0f5d7faaa031ed0dffe78d Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1888004 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* fpsensor: Clean up headers and MakefilesTom Hughes2019-10-2810-25/+55
| | | | | | | | | | | | | | We no longer need the various levels of indirection since the source files are public. BRANCH=none BUG=b:137848573 TEST=make buildall -j Cq-Depend: chrome-internal:2005128 Change-Id: I7483c233dc54c5dbf2907441365feffc9ae9f0a5 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869533
* fpsensor: Add OWNERS for driver/fingerprint directoryTom Hughes2019-10-281-0/+1
| | | | | | | | | | | BRANCH=none BUG=b:137848573 TEST=make buildall -j Change-Id: I1dc902cb74ef902444b43642af52e28394296ae3 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869532 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* fpsensor: Copy BEP and libfp source files from private repoTom Hughes2019-10-2820-0/+1802
| | | | | | | | | | | | | | | | | | These source files have been approved to be released publicly (see http://b/137848573#comment20). There were no source changes in the move, except for small changes to the Makefiles to adjust for the move. For future "git blame"s refer to the history of the files in the private repo if you need to access the full history. BRANCH=none BUG=b:137848573 TEST=make buildall -j Cq-Depend: chrome-internal:2005127 Change-Id: I1a809ac5a4d95637840ee47712e9c80a40a445c5 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869531
* smart_battery: add smbus error checking supportTing Shen2019-10-281-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Jacuzzi/Kodama has a unstable software controlled i2c bus, its data transmission may be interrupted by other higher priority tasks and causes device timeout. If timeout happens when ec is reading data, it has no knowledge about what's happening on slave, and keep receiving bad data (0xFF's) until end. The standard i2c/smbus error handling mechanism can not handle this case, so we need the error checking feature from smbus 1.1 to ensure our received data is correct. This CL adds the error checking (PEC) functions to i2c and smart battery module. BUG=b:138415463 TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST, no failure after 100k read/writes. test code at CL:1865054 BRANCH=master Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1827138 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* driver: lis2dw12/lis2dwl: fix wrong __fls usagePaul Ma2019-10-252-10/+24
| | | | | | | | | | | | | | | | | | | | | | | __fls(n) is defined as (31 - __builtin_clz(n)) in include/common.h. Because of the definition, n can't be 0. When n is 0, __fls(0) will be -1 and it is a wrong result. Since sensor data rate can be set lower than LIS2DW12_ODR_MIN_VAL, it is possible for __fls() to get a 0 parameter. This CL will fix this condition. Because macros are getting complex, move them to c file and convert to functions. BUG=b:143242489 BRANCH=none TEST=run 'suspend_stress_test --suspend_min=10 --wake_min=10 \ --count=2500' on DUTs, test pass and no EC crash. Change-Id: I46febb602b47624ba5d0106abaedd34a23ebe96f Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876297 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* driver: g753: add driver supportLu Zhang2019-10-253-0/+246
| | | | | | | | | | | | | | | | g753 is used on akemi board. It's a temperature sensor, analog-to-digital converter, and digital over-temperature detector with SMBus interface. BUG=b:138426009, b:143046086 BRANCH=none TEST=use Akemi board, add g753 as temp sensor, boot the board and make sure temperature can be read from g753 Change-Id: Iefa1039628171170cf0ca322b462a29b33eb0df5 Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1857978 Reviewed-by: Philip Chen <philipchen@chromium.org>
* tcpci: remove extra write when sending HARD_RSTJett Rink2019-10-231-0/+10
| | | | | | | | | | | | | Per the TCPCI spec, we don't need to try to write the header or byte count when sending a non SOP* packet. BRANCH=none BUG=none TEST=PS8751 can still send a hard reset Change-Id: I6cccbc52cf600f7930f0cbc3ac2aab578a81dc51 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1872603
* usb_mux: Add driver for AMD FP5 USB/DP MuxEdward Hill2019-10-233-0/+119
| | | | | | | | | | | BUG=b:138600585 BRANCH=none TEST=build Change-Id: I547309c7000e7d3ca8549a7e626a63789665305d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868921 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* board/hammer: Fix masterball touchpad settingsNicolas Boichat2019-10-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the dimensions, and also the size, and make sure that updating the FW actually works (it seems like increasing the timeout to 2000ms is needed). BRANCH=kukui BUG=b:140596094 TEST=Flash masterball, no warning in console on start TEST= Host: make TOUCHPAD_FW=S8648A-15H0_FW01.bin BOARD=masterball -j USE=updater_utils emerge-kukui -av ec-utils cros deploy $IP ec-utils DUT: usb_updater2 -d 18d1:503c -r; sleep 0.5; \ usb_updater2 -d 18d1:503c -s; usb_updater2 -d 18d1:503c ec.bin usb_updater2 -d 18d1:503c -p S8648A-15H0_FW01.bin Change-Id: Ia473ac420b42f52ad1639f950a3f08ff5d32df09 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1847512 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* driver: bmi160: Move commit to end of loopYuval Peress2019-10-161-2/+7
| | | | | | | | | | | | | | | | | | This change moves the motion_sense_fifo_commit_data call outside of the do...while loop in irq_handler. This is needed to allow for 1 commit per last_interrupt_timestamp which makes the commit more efficient and accurate. BUG=b:137758297,b:140157960 TEST=Ran CTS on Kohaku (this doesn't fix all the issues but improves the state) BRANCH=None Change-Id: Ifd680fb8d6eb47383928e25858898ac828fe4e92 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1856829 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* helios: Detect PPC sn5s330 CC1/CC2 OVP and release OVP.Michael5 Chen2019-10-142-14/+58
| | | | | | | | | | | | | | | | If PPC have CC OVP protection, check VBUS_GOOD. If VBUS_GOOD is ok, release CC OVP. BUG=b:141587322 BRANCH=Master TEST=Manual Do ESD test to trigger CC1/CC2 OVP. Using EC console command PPC_DUMP to check ppc regiset is correct. Change-Id: I3b817cc1dcec4c14ed4e2098b7ad7582b938f613 Signed-off-by: Michael5 Chen <michael5_chen@pegatroncorp.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1826098 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* tcpci: protect against buffer overflowCaveh Jalali2019-10-111-6/+12
| | | | | | | | | | | | | | | | | we need to sanity check data read from TCPCs to avoid buffer overflows. the TCPC can return bogus size information which can cause a buffer overflow when processing TCPM messages. if the claimed message size is bogus, return an error. BUG=b:142296767 BRANCH=none TEST=EC no longer gets an exception Change-Id: I7754c6e3d20847827b849423c5880756bae46393 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1845587 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Caveh Jalali <caveh@google.com>
* trembyle: board specific fast switch enable/disableDenis Brockus2019-10-092-3/+5
| | | | | | | | | | | | | | | | | Added board specific tcpc FRS enable/disable to work around timing issues that we found with trembyle. Also added some of the bringup debug settings BUG=b:138599218 BRANCH=none TEST=make buildall -j Change-Id: Ia16db22a9c2b3a47a4273ea1350a5ea58b78f5aa Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1847174 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* common: add `RETURN_ERROR` macroHarry Cutts2019-10-091-6/+0
| | | | | | | | | | | | | | This had been used in the GT7288 driver, but is now being used quite a bit in the private repo, so it's time to put it in common. BRANCH=none BUG=chromium:1008568 TEST=Check that a board which uses the GT7288 driver builds correctly. Change-Id: I111018a73def7a30ff899f9bf435da6f89d9b86a Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1848493 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>