summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* battery/max17055: Measure temperature using external thermistorPhilip Chen2017-10-241-0/+13
| | | | | | | | | | | | | | | | By default max17055 measures from internal temperature sensor. BUG=b:68170538 BRANCH=none TEST=place a heat source on top of the battery pack and see temperature rise from 'battery' command Change-Id: I1c0bb981e366a8a73d2e14e6c1fc92327069e8f1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/735080 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* driver: ppc: Add support for TI SN5S330.Aseda Aboagye2017-10-233-0/+425
| | | | | | | | | | | | | | | | | | | | This commit adds a basic driver for the TI SN5S330. This driver just sets up the IC and provides an API to turn on or off the PP2 FET. BUG=b:67663166, b:67663124 BRANCH=None TEST=Enable code for zoombini; Flash a board which has the SN5S330 stuffed; Verify that we're able to perform PD negotiation and negotiate all the way up to 20V. TEST=Boot only on AC. sysjump to RW, verify that board does not brownout. Change-Id: I9c147ee8465eed878843cf902db301d62e8f627e Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/722104 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* bq24392: Make chip_en active low.Aseda Aboagye2017-10-231-9/+26
| | | | | | | | | | | | | | | | | | | | | | The GPIO that turns on Vbus for the BQ24392 is active low. This commit changes the driver to make it clear that the enable is active low. Additionally, the 5V rail is turned on prior to performing detection and will be turned off if the AP is off. For zoombini, since the chipset task can also control the 5V rail, CONFIG_POWER_PP5000_CONTROL is enabled to do so in a task-safe way. BUG=b:65992382, b:65991615 BRANCH=None TEST=Verify that Vbus is turned on and the BQ24392 can output high on charge detect pin. Change-Id: Ib96ef9736ccc7fa285a3642ec6f3824a1df8f931 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/676762 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* isl9238: Add support for providing power using OTGNicolas Boichat2017-10-202-2/+51
| | | | | | | | | | | 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>
* scarlet: Lower VMIVRPhilip Chen2017-10-191-1/+1
| | | | | | | | | | | | | | | | Lower minimum input voltage regulation from 4.4V to 4V. BUG=b:67932466 BRANCH=none TEST=manually poke the register value and confirm VMIVR is 4V Change-Id: Ia1af423612a35ef48ecdd2987cdcc7d10f81bc28 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/727411 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* chip/stm32/usart: Add flags to usart_configNicolas Boichat2017-10-181-0/+1
| | | | | | | | | | | | | Allows setting TXINV/RXINV bits. BRANCH=none BUG=b:65697962 TEST=make BOARD=wand -j Change-Id: Ib1bb290cd9758c53b98c8fc1ca1a9369c8cff39e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/694561 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* isl9237: Fix HW ramp setting in charger_post_initNicolas Boichat2017-10-181-3/+3
| | | | | | | | | | | | | | | | | While introducing support for isl9238, I accidentally used an incorrect config option (CONFIG_ISL9237), instead of CONFIG_CHARGER_ISL9237. BRANCH=none BUG=b:35585464 TEST=make buildall -j Fixes: b1101b8ed66 charger: isl923x: Add support for ISL9238 Change-Id: I2f62f3fbefbc60cc9d83726ef88a66c5c9f1b245 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/725121 Reviewed-by: Rong Chang <rongchang@chromium.org>
* charge_ramp: Move ramp allowed / ilim callbacks to common codeShawn Nematbakhsh2017-10-064-28/+87
| | | | | | | | | | | | | | | | | | | | | The decision on whether to ramp (and how high) depends on the quirks of charger identification, so move the decision out of board, into the drivers that implement usb_charger. Also, rename CONFIG_CHARGE_RAMP to CONFIG_CHARGE_RAMP_SW, to better contrast with the existing CONFIG_CHARGE_RAMP_HW. BUG=None TEST=Manual on kevin, verify ramp occurs when port plugged into Z840 workstation. BRANCH=None Change-Id: I5b395274133837a18a4f4ac34b59b623287be175 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/702681 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* driver: bm160: Fix minimal gyro frequencyGwendal Grignou2017-09-201-1/+1
| | | | | | | | | | | | | | | | | | | Was set in Hz unit instead of mHz. The minimal frequency of the gyroscope is 25Hz. By setting it at 25mHz, we make believe that the gyro was also supporting 5Hz or 10Hz: the test would complain when instead the samples came with a 25Hz. Fix up of cl/482703 BUG=b:65000611 TEST=compile BRANCH=caroline,eve,twinkie Change-Id: I162d0d2e9b545af82698d8d484875761f426efe4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/674003 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: lsm6dsm/lsm6dsl: Fix LSM6DSM_ODR_TO_NORMALIZE macroGwendal Grignou2017-09-201-6/+6
| | | | | | | | | | | | | | | | | | | | | Using builtin function in macro. Compact macros. BUG=none BRANCH=master TEST=Tested on discovery BOARD with LSM6DSM sensor connected to I2C master interface of target board. Using accelrate motion sense console command is possible to test with different data rate: all supported ODR has been tested for acc and gyro Change-Id: Icb11f90254521715dfb2abb5bac6eb87ce45b92d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/465375 Commit-Ready: mario tesi <mario.tesi@st.com> Tested-by: mario tesi <mario.tesi@st.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* hammer: Support different IC types in touchpad FW updateChun-Ta Lin2017-09-141-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | Some Elan touchpad ICs have a different firmware sizes (48, 56, or 64 KB). We use CONFIG_TOUCHPAD_VIRTUAL_SIZE, set in the board file, to determine the appropriate size, and, at runtime, we sanity check the firmware size according to the IC type reported by the touchpad. BRANCH=none BUG=b:65188846 TEST=Manually modify the CONFIG_TOUCHPAD_VIRTUAL_SIZE in hammer, executed and verified both (1) "EC_ERROR_UNKNOWN" returned (2) ic_type shows 0x09 on EC console TEST=Successfully flashing 48k firmware using CL:658920 on hammer and 56k firmware on staff. With success here, we specifically test with different firmware version and make sure it reflected in hammerd's touchpad info. Change-Id: Ib30917d8376d4a2e8b6137daabad2341ac48d1f8 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/664937 Commit-Ready: Chun-ta Lin <itspeter@chromium.org> Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* battery/max17055: update battery remaining capacity message dynamicLin Huang2017-09-131-1/+9
| | | | | | | | | | | | | | kernel will get the battery info through command "ectool battery", so we need to get the remaining capacity dynamic. BUG=b:65494883 BRANCH=none TEST=run "ectool battery" in kernel, and get the battery info. Change-Id: Idf824f6dc1e72acd17156c03d81c0ca87adc109f Signed-off-by: Lin Huang <hl@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/658160 Reviewed-by: Philip Chen <philipchen@chromium.org>
* cleanup: Remove lucid and snoball boardsShawn Nematbakhsh2017-09-121-7/+0
| | | | | | | | | | | | | BUG=None TEST=`make buildall -j` BRANCH=None Change-Id: I667e471d4d9187f530da7ae8807c8aa339a17847 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/663817 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* driver/touchpad_elan: Add support for FW updatingChun-Ta Lin2017-09-121-5/+157
| | | | | | | | | | | | | | | | | Provides touchpad_update_write functions that fw_update.c uses to update the FW over the USB updater interface. BRANCH=none BUG=b:63993173, b:65188846 TEST=./usb_updater2 -t touchpad.bin CQ-DEPEND=CL:593373 Change-Id: I5246cbfa65311cd6f0b1872f9bbc164f3a972153 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/601814 Commit-Ready: Chun-ta Lin <itspeter@chromium.org> Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* tcpm: it83xx: enable cc voltage detector after vconn is offedDino Li2017-09-081-2/+18
| | | | | | | | | | | | | | | | We found a potential risk that voltage might fed back into EC Vcore. If the CC pin voltage detector is enabled and there is an unexpected voltage source over 3.3v fed back into EC, this might cause an exception or unknown reset. BRANCH=none BUG=none TEST=The voltage detector is enabled after vconn is offed. Change-Id: I78975fa195eef0b96056a39ee3c6d92c3bb6f8c0 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/647673 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: Remove duplicate BD9995X CONFIGsShawn Nematbakhsh2017-09-023-10/+6
| | | | | | | | | | | | | BUG=chromium:700933 BRANCH=None TEST=`make buildall -j` Change-Id: Id76fe93612fcd1ef924d7fa94479c45a52db046b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/648566 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* touchpad_elan: Discard zero finger clicksNicolas Boichat2017-09-011-7/+11
| | | | | | | | | | | | | Do not report click events when no finger is present on the touchpad. BRANCH=none BUG=b:65098167 TEST=Bend case, hear click, but no event reported in evtest. Change-Id: I0385213102dab0775e1b6906cb3a45933deac757 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/637288 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* anx3429: force chip reset on PD_RESUMECaveh Jalali2017-08-292-2/+14
| | | | | | | | | | | | | | | | | | | | | | we need to properly restart the anx3429 after a firmware update. simply initializing the chip doesn't seem to get it to reload its firmware - at least not the portion of the chip that implements the firmware version register. so, we explicitly power down and reset the chip before reinitializing it to force it to run the new firmware. the chip also needs a 10ms "off" time so the reset is properly seen by the chip, so i did a light refactoring of the code paths that reset the anx3429. TEST=used 2 different firmware blobs and verified it switches between them during software sync. BRANCH=none BUG=b:35586895 Change-Id: I967898dd906f21bdc5bc4ce9c1dff9f873d198c1 Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/631976
* charger/rt946x: Fix the function namePhilip Chen2017-08-291-1/+1
| | | | | | | | | | | | | | BUG=b:63739819 BRANCH=none TEST=build scarlet when 'CONFIG_CHARGER_ILIM_PIN_DISABLED' is turned on Change-Id: I692346031867160774344e67e0a7e936278820a1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/639917 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* tcpm: fusb302: Round VNC and Rd thresholds to nearest stepShawn Nematbakhsh2017-08-281-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | fusb302 determines attach / no-attach (and Rd / Ra) by comparing CC voltage against an MDAC output (42 mV steps). The previous 'floor' calculation was particularly bad for 3.0A Rp (2600 / 42 = 61, 61 * 42 = 2562 mV - 21 = 2551 mV actual threshold, ignoring other error sources). Reduce the chance of error by rounding our thresholds, which also matches the suggested thresholds in the datasheet. BUG=chromium:758608 BRANCH=gru TEST=Attach problematic dingdong, verify we don't enter an attach / detach loop. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I9211782da0fdad8339246e272952ba1930b69851 Reviewed-on: https://chromium-review.googlesource.com/633276 Reviewed-by: Joe Bauman <joe.bauman@fairchildsemi.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 311b3e4e15fd37ea2ab151edb8b8a468e93355fd) Reviewed-on: https://chromium-review.googlesource.com/638694 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: bd9995x: Disable topoff modeShawn Nematbakhsh2017-08-281-3/+1
| | | | | | | | | | | | | | | | Zero ITERM_SET to keep the charger out of topoff mode, since it has undesirable side-effects related to dead / low battery charging. BUG=b:35575421 BRANCH=reef TEST=Previous testing on kevin with same register setting. Change-Id: Ic1dd280e1069d410895498c0f72989654a6b8c63 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/636152 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* anx3429: read chip firmware version during initCaveh Jalali2017-08-251-0/+2
| | | | | | | | | | | | | | | | | | | | fetching the chip firmware version toward the end of the chip anx74xx_tcpm_init() sequence is a good place to do this. we need this info in any case and this is a safe place to access device registers and cache the values. subsequent chip firmware queries typically return the cached value. also, tcpci_tcpm_init() is already structured this way. TEST=verified with follow-up CL that firmware update succeeds and new version is reported BRANCH=none BUG=b:35586895 Change-Id: Ic3fd07bbf8a220bfd506d59d8a1f3ea25b14e94c Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/634513 Reviewed-by: Shawn N <shawnn@chromium.org>
* anx74xx: enable driver "release".Caveh Jalali2017-08-241-1/+5
| | | | | | | | | | | | | | | | | | | TEST="make buildall" succeeds, "make runtests" passes for reef. returning SUCCESS instead of UNIMPLEMENTED from .release() means the pd_task() is allowed to reinitialize the TCPC when coming out of PD_STATE_SUSPENDED or similar scenario. TEST=verified anx3429 firmware update succeeds, USB port still usable for charging after update. BRANCH=none BUG=b:35586895 Change-Id: I1a624ccf25dfa6468de72f8564f936bc0a35edb1 Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/596797 Reviewed-by: Shawn N <shawnn@chromium.org>
* charger/rt946x: Disable battery thermal protectionPhilip Chen2017-08-222-0/+9
| | | | | | | | | | | | | | | We'll handle cell temperature from fuel gauge/battery side. BUG=b:64806333 BRANCH=none TEST=monitor charge current through 'battery' console command Change-Id: I82944de8d1e8834ca1f75c1f616b220e55d94f0e Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/626725 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* tcpm: Configure board specific post TCPC initVijay Hiremath2017-08-211-1/+11
| | | | | | | | | | | | | | | | | Some boards have TCPC configurations post TCPC initialization. Added code to support those configurations. BUG=b:64531818 BRANCH=glkrvp TEST=Manually verified on GLKRVP. External GPIOs of PTN5110 are configured properly. Change-Id: I3da1c171839f22cf183dacf390cf033becddce0f Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/624557 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>
* battery/max17055: Specify desired charging voltage/currentPhilip Chen2017-08-211-2/+2
| | | | | | | | | | | | | | BUG=b:64821815, b:63870414 CQ-DEPEND=CL:621777 BRANCH=none TEST=plug in AC, and check 'charger' command on ec console Change-Id: Ic60bcab7fd0ccc2ea73471ac46e9b0b887f251d9 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/621776 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* battery/max17055: Wait longer for initial configPhilip Chen2017-08-181-2/+2
| | | | | | | | | | | | | | | | | max17055 sometimes fails to finish configuration due to timeout. Let's wait longer. BUG=b:63870414 BRANCH=none TEST=boot scarlet rev1 10 times and ensure MODELCFG.REFRESH bit is cleared when retries value > 10. Change-Id: I62984c19014a244a378180bab6683e2e6f842cd1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/617653 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* battery/max17055: Process negative current/temperature rightPhilip Chen2017-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | On max17055, current/temperature register values are in 2's complement format. Therefore we need to consider the case of negative values before doing bitwise operation. BUG=b:63870414 BRANCH=none TEST=run 'battery' command and confirm the reported discharge current looks reasonable. Change-Id: Iea0c554aecf2b410fc27b547e01ee7a583a0dd00 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/617654 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger/rt946x: Finish init no matter which CHIP REV it isPhilip Chen2017-08-172-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | When booting scarlet rev1, the initialization of rt9466 is not finished because CHIP REV < 0x05. Actually, we shouldn't keep the latest CHIP REV in rt946x.h because it's hard to maintain. And we should try to finish rt946x_init() no matter what CHIP REV it is. Also, let's clean up the logging message in rt946x_init() a bit to make it clear that it's from RT946X. BUG=chromium:736821, b:63739819 BRANCH=none TEST=boot scarlet rev1 and confirm the initialization of rt946x is finished Change-Id: Ic0b1f837b801cc18744a1222794a055dfe8aa54c Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/612585 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* ps8xxx: use custom tcpm_drvCaveh Jalali2017-08-164-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | the ps8xxx family of TCPCs (ps8751, ps8805) have historically used the generic tcpci_tcpm_drv functions, but we need to override some of these entry points because the parade parts need to be woken up before accessing registers. in most cases, this doesn't matter because we access the chip in quick succession where we can "safely" assume the chip is awake -- and the code is structured to implicitly keep the chip awake. the new case we need to address here is where we need to suspend the pd_task and TCPC at an arbitrary point in time. the driver's .release method is called to shut down the chip, and that involves first waking up the chip to be able to access its regs to mask off interrupts, etc. BUG=b:35586896 BRANCH=none TEST=tested from depthcharge - we no longer get errors in the EC console logs about TCPC "release" failed. Change-Id: Ic2a90b71050b3f68c697b1cef48d736ed88b3f41 Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/616460 Reviewed-by: Shawn N <shawnn@chromium.org>
* usb_hid_touchpad: Add timestamp field to touch eventsNicolas Boichat2017-08-161-0/+14
| | | | | | | | | | | | | | | | | | | | | | We use the unofficial, Windows 8, Relative Scan time HID usage (Digitizer page, 0x56) to add timestamps to our HID touchpad events. The timestamps is a rolling, unsigned, 16-bit integer, with a resolution of 100us (so it wraps around every 6.5s). The host will be able to synchronize to that timestamp, resetting an offset every time the touchpad is quiet a certain amount of time (e.g. 1 second). BRANCH=none BUG=b:63685117 TEST=Flash hammer, timestamps are reported in HID descriptor. Change-Id: Ie5d56a9df14e464d2cdcd559f550d6e3cc81961f Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/603041 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* usb_mux: Merge PS8743 & PS8740 as PS874XVijay Hiremath2017-08-117-342/+233
| | | | | | | | | | | | | | | | | Merge PS8743 & PS8740 as PS874X as both the drivers are almost same. BUG=b:64598680 BRANCH=glkrvp TEST=make buildall -j On GLKRVP, verify mux setting is correct with Apple dongle (VGA + USB) and Pluggable adapter. Change-Id: Ic6d31979936ee213b07c4c71859809102ee91452 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/612209 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>
* usb_mux: Add driver support for PS8743 chipDivya Sasidharan2017-08-113-0/+149
| | | | | | | | | | | | | | | | | Initial patch for supporting PS8743 USB Type-C Redriving Switch for USB Host / DisplayPort. BUG=b:64598680 BRANCH=glkrvp TEST=On GLKRVP, verify mux setting is correct with Apple dongle (VGA + USB) and Pluggable adapter. Change-Id: Ib45e328fc9ef6ccc410cef4550086be95ef17e8a Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/506810 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>
* sensors: add bmi160 & kionix orientation driverNick Vaccaro2017-08-085-2/+178
| | | | | | | | | | | | | BRANCH=none BUG=chromium:718919 TEST=make buildall -j works, orientation works when enabled on gru and scarlet. Change-Id: I16dcfa5d9dea39c082d98190fa1bb6e496168b17 Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/540124 Tested-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* Fix inconsistent task function declarationsStefan Reinauer2017-08-084-4/+5
| | | | | | | | | | | | | | | Tasks are defined inconsistently across the code base. Signed-off-by: Stefan Reinauer <reinauer@google.com> BRANCH=none TEST=make buildall -j, also verify kevin boots to OS BUG=none Change-Id: I19a076395a9a8ee1e457e67a89d80d2f70277c97 Reviewed-on: https://chromium-review.googlesource.com/602739 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* driver: Add driver header for PCA9555 I/O port controllerVijay Hiremath2017-08-071-0/+41
| | | | | | | | | | | | | | BUG=b:64394037 BRANCH=glkrvp TEST=Manually tested on GLKRVP, i2cxfer works Change-Id: If65e5039987ecbb7fa2a3a5eeeef5af6d73ab66a Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/603987 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* bq24392: Remove unneeded variables.Aseda Aboagye2017-08-041-16/+10
| | | | | | | | | | | | | | | | | | | The variable is_high_power was only used if a board was using charge ramping. However, we can get rid of the variable entirely. Additionally some of the intermediate gpio_signal variables can be removed as well. BUG=none BRANCH=none TEST=Build a board that uses the bq24392 but does not charge ramp. Verify that there are no compliation errors. Change-Id: I7edaa74f5029c08662d8c4a15c973beae9729fdf Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/601533 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* bd9995x: Don't set charger current in battery profile functionScott Collyer2017-08-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the function bd9995x_battery_charging_profile_settings, the current values for trickle, precharge, and fastcharge were being set. Fastcharge current level was being set via charger_set_current(PD_MAX_CURRENT_MA). By calling this function with a non-zero parameter, charging will always be enabled. In addition, PD_MAX_CURRENT_MA is an input current limit and doesn't neceassrily apply to the fastcharge current level which would be read from the fuel gauge. The other side effect is that by enabling charging, VSYS is being set to battery->voltage_min which reverts VSYS being set to battery->voltage_max in the init routine. Per Rohm, all charging profile registers should be set prior to enabling charging. On Coral, enabling charging at this point was leading to VSYS collapse when no battery was connected or a fully depleted battery case. I also believe that enabling charging here exacerbates other issues we've been running into with low battery startup cases. BUG=b:64388515 BRANCH=eve TEST=On Coral tested both no battery a fully depleted battery cases. Verified that without the call to charger_set_current() that VSYS consistently collapses and that after removing this call, the start up was stable and the battery begins charging. Change-Id: Ice20ed5d8147fe9ad8faa754286a2ec8a784f8d8 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/602493 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* usb_update: Add a way to fetch touchpad informationNicolas Boichat2017-08-031-0/+35
| | | | | | | | | | | | | | | | | | | | | We'd like to know touchpad vendor/product id, as well as currently running FW version. This CL does that by adding a new UPDATE_EXTRA_CMD_TOUCHPAD_INFO command. We also make the interface more generic by adding a CONFIG_TOUCHPAD configuration option, even though we only support Elan touchpads currently. BRANCH=none BUG=b:63418037 TEST=Flash hammer, ./usb_updater -t Change-Id: Icce3c785eb3235bcc50b2ae7c0227ce11cbc9f2b Signed-off-by: Nicolas Boichat <drinkcat@google.com> Reviewed-on: https://chromium-review.googlesource.com/593000 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
* driver: Move PI3USB9281 to bc12 directory.Aseda Aboagye2017-07-312-5/+3
| | | | | | | | | | | | | | | | | | | | The primary purpose of the Pericom PI3USB9281 is for BC1.2 detection. Therefore, move the driver to the bc12/ directory. Additonally, rename the config option to match. CONFIG_USB_SWITCH_PI3USB9281 => CONFIG_BC12_DETECT_PI3USB9281 BUG=None BRANCH=None TEST=`make -j buildall` Change-Id: I02f17064c0625e62d6779f895e69899c24898f74 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/594710 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* driver: Add support for TI BQ24392.Aseda Aboagye2017-07-312-0/+146
| | | | | | | | | | | | | | | | | | | | | | The BQ24932 is a dual single-pole single-throw USB 2.0 high-speed isolation switch with charger detection capabilities. The device's charger detection circuitry can support USB Battery Charging Specification version 1.2 (BC1.2), Apple, TomTom, and other non-standard chargers. BUG=None BRANCH=None TEST=`make -j buildall` TEST=Enable support for the BQ24392 on a board. Verify that it complies. Change-Id: I82f426f1eedabdbb6b951a6ce0252135de3368db Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/592133 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* chip/stm32/usb_hid_touchpad: Widen pressure field to 10 bitsNicolas Boichat2017-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | id only really needs 4 bits (16 touch events should be more than enough), so we can steal 2 bits from that field. We also reorder the fields to make sure that width/x are aligned on 8-bit boundary. BRANCH=none BUG=b:63936194 TEST=Flash hammer, touchpad works, ABS_PRESSURE > 255 is reported when a palm is pressed on the touchpad. Change-Id: I1abf1bf53cc9dd998082cea5dc7cd3be17f99ec6 Reviewed-on: https://chromium-review.googlesource.com/583297 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: KT Liao <kt.liao@emc.com.tw>
* battery/max17055: Add max17055 fuel gauge driverPhilip Chen2017-07-272-0/+376
| | | | | | | | | | | | | | | | | BUG=chromium:736603 BRANCH=none TEST=Follow the steps below 1) add MAX17055 config to Scarlet and build the code 2) hook up max17055 eval board and a single cell battery 3) battery command from ec console shows reasonable numbers for temperature, voltage, and charge percentage Change-Id: I3f838ff92c591665e9f1d0a7ba636ff83d9b7612 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/578300 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger/rt946x: Add chip-specific interface functionsPhilip Chen2017-07-272-0/+46
| | | | | | | | | | | | | | | | | | | | | | | Add rt946x_enable_charger_boost() to enable/disable rt946x. Add rt946x_is_vbus_ready() to check if VBUS is ready. Add rt946x_cutoff_battery to cutoff battery. BUG=chromium:736821 BRANCH=none TEST=build scarlet when rt946x driver is used Change-Id: I61b07ca0925f5ba2c71fe8033a3a496fe00869d9 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/573584 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* driver: sensor: tune MAX_FREQGwendal Grignou2017-07-132-3/+3
| | | | | | | | | | | | | | | | | | | | Reduce maximum frequency of BMM150 compass to 80Hz, 800Hz is a typo. Reduce SI1141 maximum frequency to 50Hz: 100Hz is too high when polling mode is used. Fix up of CL:482703 BRANCH=eve, glados BUG=chromium:615059 TEST=On eve, check CTS test android.hardware.cts.SensorBatchingTests#testMagneticField_fastest_flush passes. Observed that dumpsys sensorservice returns compass maxRate at 80Hz instead of 200Hz. Change-Id: If4e688ab59aa53c402d34714b6bb33ccd4a4ab96 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/570482 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* charger/rt946x: add Richtek rt946x charger driverPhilip Chen2017-07-133-0/+957
| | | | | | | | | | | | | | | | | BUG=chromium:736821 BRANCH=none TEST= 1) add RT9467 config to Scarlet and build the code 2) hook up rt9467 eval board with dummy load 3) verify the i2c traffic: set voltage, set current, and get device id Change-Id: Ie0dc2650711465b89eb4a5fbf69a326d6277b583 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/565055 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* driver: tcpm: ps8xxx: Add support for PS8805.Aseda Aboagye2017-07-115-57/+80
| | | | | | | | | | | | | | | | | | | | | This commit adds support for the PS8805, another Parade Tech TCPC with integrated superspeed muxes. This also creates a generic Parade Tech TCPC driver which supports the PS8xxx series. The current supported TCPCs are: - PS8751 - PS8805 BUG=b:63508740 BRANCH=None TEST=`make -j buildall` Change-Id: I78383af414996e0e8d6220985d286f95267136f8 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/564799 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* tcpm: it83xx: Use pd common code macro to analyze message headerDino Li2017-06-292-18/+5
| | | | | | | | | | | | | Use existed macro instead of creating new one. BRANCH=none BUG=none TEST=plug USB-C power adapter and USB-C to hdmi adapter, both work. Change-Id: I133142232ac6abfa7f285c289eb03c4d65e84d5f Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/554655 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* tcpm: add .release driver operation.Caveh Jalali2017-06-287-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | similar to the USB_PD_TCPC case, add release/init operations when the pd_task enters/leaves the PD_STATE_SUSPENDED state. one use case for PD_SUSPEND is to get exlusive access to the TCPC for things like firmware update, so the release/init operation is needed to get the TCPC and driver into a good state. updated all tcpm_drv style drivers. for backward compatibility, "old" drivers that may not handle init/release properly simply return EC_ERROR_UNIMPLEMENTED for tcpm_release(). pd_task() uses this as a signal that it should not try to re-init() the driver. TEST=tested in combination with follow-on CLs to do TCPC firmware update on electro. also built for kevin, eve, sand which are some of the other boards using these drivers. "make buildall -j" passes. BRANCH=none BUG=b:35586896 Change-Id: I3d2964a79e710428f7a6e7004d68ab424af85be8 Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/544660 Reviewed-by: Shawn N <shawnn@chromium.org>
* cleanup: Remove big and pit boardsShawn Nematbakhsh2017-06-224-1463/+0
| | | | | | | | | | | | | | | | | Remove big and pit boards along with several now-obsolete CONFIGs / source files. BUG=chromium:735109 TEST=`make buildall -j` BRANCH=None CQ-DEPEND=CL:544681 Change-Id: Ieb784bd36157fd1f6240cd19de6e6d12191a8097 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/540667 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>