summaryrefslogtreecommitdiff
path: root/board/oak
Commit message (Collapse)AuthorAgeFilesLines
* pd: Move PD_DEFAULT_STATE to a common define in usb_pd.hScott2017-01-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Servo_v4 requires the ability to have a different default state per port. In previous devices, the assumption was that each supported port had the same default usb pd state and power role. This CL moves the by the default power role which in turn is derived from CONFIG_USB_PD_DUAL_ROLE. In addiiton to moving the location, it now uses 'port' as argument so it can be port specific if required. PD_DEFAULT_STATE was a board.h specific config, but in practice each instance used to date was set to PD_STATE_SNK_DISCONNECTED if CONFIG_USB_PD_DUAL_ROLE was defined and set to PD_STATE_SRC_DISCONNECTED otherwise. BUG=chrome-os-partner:61878 BRANCH=servo TEST=Manual run 'make -j buildall' to verify that all instances of PD_DEFAULT_STATE were removed. Change-Id: Iaf40718668732f525485ed7942ee7fc246d3f75d Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/431787 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* als: Define CONFIG_ALS when HAS_TASK_ALS is present.Gwendal Grignou2016-12-284-17/+30
| | | | | | | | | | | | | | For oak, set a different list of task (no als, no accel) for compiling revision 4 or less. Fix GPIO include issue. BUG=chrome-os-partner:59423,chrome-os-partner:59084 TEST=compile for oak with board 4 and 5, tested on Reef. BRANCH=kevin,reef Change-Id: I09051a69cbad6d477a7b3bf9907f4c5c144b5136 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424220 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* driver: Move sensor private struture definition to boards.Gwendal Grignou2016-12-281-1/+1
| | | | | | | | | | | | | | | | sensor private structure for bmi160 and bmp280 were defined in the drivers themselves. It worked because there was only one instance of each sensors on a board. However, this is an error it should be in board files, as it was done for other sensors like the kionix. BUG=none TEST=buildall. BRANCH=kevin,reef Change-Id: Ica3aba358d141a7df9a3e97251d4c1e520cbf2c8 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424218 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* charge_state_v2: Limit i/p current to meet allowed MAX i/p system powerVijay Hiremath2016-12-051-2/+4
| | | | | | | | | | | | | | | | | | | | | If battery is not present, input current is set to PD_MAX_CURRENT_MA. If the input power set is greater than the maximum allowed system power, system might get damaged. Hence, limit the input current to meet maximum allowed input system power. BUG=chrome-os-partner:58498 BRANCH=none TEST=Manually tested on Reef. Removed the battery & using 'charger' console command observed the following. With Zinger charger at 20V - Input current is set to 2.25A With Type-C & other chargers - Input current is set to 3A Change-Id: Ife8686f322e095aa74b740a7c469bfe87107fb9a Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/397865 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>
* elm / kevin / oak: Don't wake from S3 on lid closeShawn Nematbakhsh2016-11-051-2/+1
| | | | | | | | | | | | | | | BUG=chrome-os-partner:59256 BRANCH=gru TEST=None Change-Id: I8e41dc131343e7639850364db27a3ff926164fba Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/407078 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Re-enable Google USBC peripheral FW updates.Todd Broch2016-10-181-1/+15
| | | | | | | | | | | | | | | Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=glados,gru,oak BUG=chrome-os-partner:57458 TEST=usbpd_GFU Change-Id: I5a6bfde742a5c698680f99f342b1696084fd002a Reviewed-on: https://chromium-review.googlesource.com/397862 Commit-Ready: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Benson Leung <bleung@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cleanup: Rename charge_temp_sensor_get_val() to charge_get_battery_temp()Vijay Hiremath2016-10-141-1/+1
| | | | | | | | | | | | | | | | | charge_temp_sensor_get_val() is used to get the battery temperature value hence renamed it to charge_get_battery_temp(). BUG=none BRANCH=none TEST=make buildall -j Change-Id: I2b52cac57dcde12a6b7405e7d712240e278954e2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/397962 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* charge_manager: Pass uncapped / max current to current limit callbackShawn Nematbakhsh2016-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | charge_manager may request a charge current limit less than the capability of the supply in certain cases (eg. during PD voltage transition, to make an effort to comply with reduced load spec). Depending on the battery / system state, setting a reduced charge current limit may result in brownout. Pass the uncapped / max negotiated current to board_set_charge_limit() so that boards may use it instead of the requested limit in such circumstances. BUG=chrome-os-partner:56139 BRANCH=gru TEST=Manual on kevin with subsequent commit, boot system with zinger + low-charge battery, verify devices powers up to OS without brownout. Change-Id: I2b8e0d44edcf57ffe4ee0fdec1a1ed35c6becbbd Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383732 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* oak: Remove redundant GPIO definitionShawn Nematbakhsh2016-09-091-2/+2
| | | | | | | | | | | | | | | PE2 / PE4 functions were changed away from USB_C*_DEVMODE in rev5. BUG=None TEST=`make buildall -j` BRANCH=None Change-Id: I10b0cc45444127724cb64f213238c3f72866af76 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380598 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* driver: kionix: Remove variant field.Gwendal Grignou2016-09-011-3/+1
| | | | | | | | | | | | | | | Field is not required: sensor->chip already has that information. BRANCH=veyron BUG=none TEST=compile (cherry picked from commit 90fcd6be2b5d2104301efef295113d7816e14042) Reviewed-on: https://chromium-review.googlesource.com/379096 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Change-Id: I6c0bc2e71d7c848968caa78c749dd3fb916f6263 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/379541
* Use CONFIG_DPTF flag instead of THROTTLE_AP.Ravi Chandra Sadineni2016-07-302-12/+1
| | | | | | | | | | | | | | | | | Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> BRANCH=none BUG=chromium:631848 TEST=make buildall -j CQ-DEPEND=CL:363008 Change-Id: I3c35f5ab2e3a1537ac6e8c750171d5c2b3a6570f Reviewed-on: https://chromium-review.googlesource.com/363583 Commit-Ready: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* common: Decouple temp sensor from thermal throttlingMary Ruthven2016-06-281-0/+1
| | | | | | | | | | | | | | | Not everything with a temperature sensor uses thermal throttling. This change modifies the conditional build to enable building temp sensor source without thermal throttling. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I8c0753f12899e9f203c04477ae520bcda40d5fd8 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356484 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BD99955: Added support for 'psys' & 'amonbmon' console commandsVijay Hiremath2016-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | Added console commands for the debugging purpose psys - Can be used to measure the system power amonbmon - Can be used to measure AMON/BMON voltage diff, current BUG=chrome-os-partner:54273 BRANCH=none TEST=Manually tested on Amenia psys - Ran fish task and observed psys value changes. amonbmon - AMON & BMON voltage & current are same as measured across sense resistors. Change-Id: I6653e814d9b00efe7dae9ce1fbd7ddbc2356f8e0 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/353043 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>
* cleanup: pd: Define VBUS detection sourceShawn Nematbakhsh2016-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously CONFIG_USB_PD_TCPM_VBUS had two uses which were independent: - When operating as a TCPC, it indicated that the VBUS level should be tracked (through GPIO inputs) and sent to the external TCPM when appropriate. - When operating as a TCPM, it indicated that the VBUS level should be obtained by querying the TCPC. These two independent uses have been split into CONFIG_USB_PD_TCPC_TRACK_VBUS and CONFIG_USB_PD_VBUS_DETECT_TCPC, which sould be more clear. In addition, CONFIG_USB_PD_VBUS_DETECT_* CONFIGs have been added for other means of VBUS detection. BUG=chromium:616580 BRANCH=None TEST=Verify kevin continues to boot + charge. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I936821481d6577e17e3e9c61ff97c037574d6923 Reviewed-on: https://chromium-review.googlesource.com/348950 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Driver: BD99955: Enable BC1.2 supportVijay Hiremath2016-05-241-1/+3
| | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=Manually tested on Amenia. Connected Zinger, Type-C, DCP & CDP chargers. Device can negotiate to desired current & voltage and the battery can charge. USB2.0 sync device is detected by Kernel. Change-Id: I58cb69289eef9a966e06bef8fe31d35beaec5e27 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/341030 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* Deferred: Remove hard coded number of deferredsAnton Staaf2016-04-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Previously the maximum number of deferred routines was specified by the the default maximum number of deferred routines you had to override this, and if you wanted fewer, you still payed the price of having the defer_until array statically allocated to be the maximum size. This change removes that define and instead creates the RAM state of the deferred routine (the time to wait until to call the deferred) when the deferred is declared. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j manually test on discovery-stm32f072 Change-Id: Id3db84ee1795226b7818c57f68c1f637567831dc Reviewed-on: https://chromium-review.googlesource.com/335597 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Deferred: Use deferred_data instead of function pointerAnton Staaf2016-04-181-5/+5
| | | | | | | | | | | | | | | | | | | | | Previously calls to hook_call_deferred were passed the function to call, which was then looked up in the .rodata.deferred section with a linear search. This linear search can be replaced with a subtract by passing the pointer to the deferred_data object created when DECLARE_DEFERRED was invoked. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None CQ-DEPEND=CL:*255812 TEST=make buildall -j Change-Id: I951dd1541302875b102dd086154cf05591694440 Reviewed-on: https://chromium-review.googlesource.com/334315 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* tcpm: update code to support multiple tcpm driverKevin K Wong2016-04-171-2/+3
| | | | | | | | | | | BUG=chromium:593822 BRANCH=none TEST=make buildall Change-Id: Ic30c1b890da7639aa80a53040ecc5bebfb4be2e8 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/336030 Reviewed-by: Shawn N <shawnn@chromium.org>
* oak: increase HOSTCMD task stack sizeYH Huang2016-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Use LARGER_TASK_STACK_SIZE to increase stack size to 640 bytes. Check HOSTCMD stack usage with "taskinfo" command while running the suspend/resume stress test. 8 R HOSTCMD 00000001 21.133553 496/640 It exceeds 488 bytes of TASK_STACK_SIZE. BUG=chrome-os-partner:51773 BRANCH=none TEST=enter "suspend_stress_test -i spi32766.0" in AP to do suspend test. System won't do cold reboot which is cause by "Stack overflow in HOSTCMD task!". Change-Id: Ic5edebc6b77637ca2c648798398e3f24bc87ca27 Signed-off-by: YH Huang <yh.huang@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/336593 Reviewed-by: Rong Chang <rongchang@chromium.org>
* charge_manager: Report UNKNOWN USB charger for 2 seconds after changeShawn Nematbakhsh2016-04-031-1/+1
| | | | | | | | | | | | | | | | | | | After a charger is attached, we may set a charge limit based upon BC1.2 or USB-C Rp before PD negotiation completes. Therefore, allow 2 seconds for all negotiation to complete. Previously this behavior was implicit when using SW charge ramp. BUG=chrome-os-partner:51280 BRANCH=glados TEST=Manual on chell. Insert stock charger, verify that it is detected as TYPE_UNKNOWN until timeout. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I52f02de46fa92b66a9fbaddb94a062310688f028 Reviewed-on: https://chromium-review.googlesource.com/334312 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* sensor: update sensor driver to use I2C port from motion_sensor_tKevin K Wong2016-03-311-0/+3
| | | | | | | | | | | | | this allow motion sensor devices to be locate on different I2C port BUG=none BRANCH=none TEST=make buildall Change-Id: Ia7ba2f5729ebb19561768ec87fdb267e79aafb6a Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/334269 Reviewed-by: Shawn N <shawnn@chromium.org>
* oak: allow charging of dead battery requesting nilstabilize-8104.BYH Huang2016-03-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | On oak battery, when the battery is dead it reports 0 for desired voltage, current, and state of charge. In this case we should allow charging. Added a CONFIG option for this that should be removed as soon as the battery side is fixed. With this CL, when a dead oak battery is used and a charger is connected, we attempt to charge it. BUG=chrome-os-partner:51454 BRANCH=none TEST=test on an oak with a dead battery. w/o this CL, the battery never charges because the charging not allowed flag is set. With this CL, the battery charges. Change-Id: If9f1250cd41aec265838e1d109f53c1bcd58c111 Signed-off-by: YH Huang <yh.huang@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/334471 Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: Clean up CONFIG_PMIC_FW_LONG_PRESS_TIMER related codesKoro Chen2016-03-161-1/+0
| | | | | | | | | | | | | | | | | | | | | CONFIG_PMIC_FW_LONG_PRESS_TIMER was ported long time ago from Tegra, but the codes are actually not used and erroneous. It might wrongly trigger set_pmic_pwron(0), and turn off PMIC power accidentally. This causes POWER_GOOD lost and power state will go back to S5 during boot up. Clean up the codes by referencing check_for_power_off_event() of Rockchip. BRANCH=none BUG=none TEST=bootup and press power button quickly right after we are in S0. Bootup should still complete normally. Change-Id: Ie034efa3575dbebae4debb1afc206fddd9116350 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/332724 Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: rev5: increase cycle time for LED in SUSPENDWei-Ning Huang2016-03-161-2/+9
| | | | | | | | | | | | | | Increase LED blink cycle time to reduce power consumption on Oak rev5 with GlaDOS ID. BUG=chrome-os-partner:50317 TEST=`make EXTRA_CFLAGS=-DBOARD_REV=5 BOARD=oak -j` Change-Id: Ic00512434965471a82b94ef431e0ec88c9e4c0c3 Reviewed-on: https://chromium-review.googlesource.com/332346 Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org> Tested-by: Wei-Ning Huang <wnhuang@chromium.org> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
* oak: Fix rev5 battery LEDKoro Chen2016-03-071-12/+17
| | | | | | | | | | | | | | rev5 battery LED control was misplaced in wrong function. Move it back to oak_led_set_battery(). BRANCH=none BUG=chrome-os-partner:49375 TEST=ectool led battery [green red off] are correct Change-Id: I83bc24c7ea7695be2a638e97b7db6e0c38840a16 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/330509 Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: set up base accelerometer rotation matrixRicky Liang2016-03-041-1/+8
| | | | | | | | | | | | | | | The base accelerometer on oak rev5 needs to be rotated 180 degrees along the z-axis to match the standard reference frame. BUG=chrome-os-partner:50312 BRANCH=none TEST=manually rotate my oak rev5 and verify that `ectool motionsense` reports correct accelerometer readings Change-Id: I05a377b5f0827e2aad47d388dc3264d451580989 Signed-off-by: Ricky Liang <jcliang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/330484 Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: fix issues on building oak rev1-4 ECRong Chang2016-03-033-19/+22
| | | | | | | | | | | | | | | | | | | The default target hardware is rev5. This is a maintainess change for old and deprecated HW. BRANCH=none BUG=chrome-os-partner:49114 BUG=chrome-os-partner:50720 TEST=manual for N=1,5 do make BOARD=oak clean && make BOARD=oak EXTRA_CFLAGS="-DBOARD_REV=$N" -j Signed-off-by: Rong chang <rongchang@chromium.org> Change-Id: Ibb4ebf9fab429964ace7c3e548598f0fb08e7dea Reviewed-on: https://chromium-review.googlesource.com/330065 Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
* oak: enable lid angle updateRong Chang2016-03-022-0/+7
| | | | | | | | | | | | | | | | | This change enables lid angle update that turns off keyboard scan in tablet mode. BRANCH=none BUG=chrome-os-partner:49114 TEST=make BOARD=oak runtests make BOARD=oak -j && make BOARD=oak_pd -j load on oak and boot to vt2 console. flip lid to disable range, type keyboard and check. Signed-off-by: Rong Chang <rongchang@chromium.org> Change-Id: Ibd2f0d6ae33a95380c9fc52a7568166a04c119e9 Reviewed-on: https://chromium-review.googlesource.com/328884 Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
* oak: change the default board revision to OAK_REV5.Ben Lok2016-03-021-1/+1
| | | | | | | | | | | | | | | revise the OAK_REV_DEFAULT to OAK_REV5 for Oak-rev5 board. BRANCH=none BUG=chrome-os-partner:49375 TEST=make -j buildall Change-Id: I378aaae9073b308ba403b292d41ca360c81f9b1d Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/321583 Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: updates for rev5Ben Lok2016-03-015-80/+151
| | | | | | | | | | | | | | | | | | | 1. Muxer of USB C1 port changes to Parade PS8740. 2. Add control of DP switch TS3USB3000RSER, using for switch DP to port 0/1 (same as rev2). 3. LED control logic is same as rev2. 4. Updates GPIO setting for rev5 pinouts. BUG=chrome-os-partner:49375 BRANCH=none TEST=build -j buildall tests Change-Id: Ifc45ac30be8d46caa1cdb032ccce7569e5a14b99 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/321024 Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: Add base accel & gyro via SPI bus for rev5Ben Lok2016-03-015-9/+176
| | | | | | | | | | | | | | | | | | | | | | | | refer to commit d341615383f1ea5d3a540a67bcec777ba902bdfb, adds the base accelerometer as well as the gyroscope to the list of motion sensors on the board, connect with SPI bus. They are currently wrapped behind an ifdef for HAS_TASK_MOTIONSENSE and OAK_REV5. BUG=chrome-os-partner:50312 BRANCH=none TEST=Build Oak EC with driver enabled and verify that we can calcuate a valid lid angle. TEST=Verify that signs of accelerometer conform to those shown in the Chrome/Android/HTML5 doc/spec. See description in accelerometer_types.h TEST=Verify that signs of gyroscope conform to those shown in the "Sysfs interface to EC accelerometers" document. TEST=make buildall tests Change-Id: I4d900bc6bd7329db6ea53660fae86e5e2bbe9028 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/319295 Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: Add kx022 lid accelerometer for rev5.Ben Lok2016-03-013-4/+60
| | | | | | | | | | | | | | | | | | | | | | refer to commit 574c8065710432f5a91fd8dd11d1fa28e2be1f3b, adds the lid accelerometer to the list of motion sensors on the rev5. Since commit bc404c94b4ab1e6a62e607fd7ef034aa31d6388e, math_util.c is no longer to include "math.h" header file. BUG=chrome-os-partner:50312 BRANCH=none TEST=Build Oak EC with driver enabled and verify that valid accelerometer data is read, and that range, resolution, and odr can all be modified. TEST=Verified that signs of accelerometer data conform to those shown in the doc. TEST=make buildall tests Change-Id: I8df1b2331a1fbea82015b97985541e2ebc393d10 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/319332 Commit-Ready: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: Enable TI OPT3001 ambient light sensor for rev5Ben Lok2016-02-263-0/+26
| | | | | | | | | | | | Refer to commit 3f2dc44158630f0ce93633c21df8daaddb2b7324, enable light sensor driver for oak rev5 BUG=chrome-os-partner:50312 Change-Id: I896cf99fd781f5d4d8dad206d43f5a3d8faeb9a2 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/319271 Reviewed-by: Rong Chang <rongchang@chromium.org>
* cleanup: Add warning comment to gpio.inc filesBill Richardson2016-02-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | With commit e9883124ff16, a GPIO_INT macro was added. That change also required that all instances of GPIO_INT in a board's gpio.inc file come before any GPIO macros, or the interrupt handler wouldn't work properly. This CL just adds a warning comment about requirement to all gpio.inc files. BUG=chromium:471331 BRANCH=none TEST=make buildall, test image on Cr50 This is a change to comments only. There is no new behavior to verify, although I did run try out one new image just to be sure nothing stupid happened. Change-Id: I83f7819929a53bce3a8bae04d15b3ee3bda11738 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/329334 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* GPIO: Move definitions of GPIO_KB_INPUT and OUTPUTAnton Staaf2016-02-222-3/+3
| | | | | | | | | | | | | | | | | | | | Previously these were often done in board.c files, which made it impossible to include the gpio.inc anywhere else. As part of refactoring the GPIO code we now need to be able to include gpio.inc from common/gpio.c. Moving these defines into gpio.inc makes them available wherever gpio.inc is included. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I28e7b5a1d40b113ae824b18f020b2d1e51e0c08a Reviewed-on: https://chromium-review.googlesource.com/328822 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* oak: pd: move power change notification to function board_set_charge_limit.Ben Lok2016-01-082-5/+14
| | | | | | | | | | | | | | | | | | | | | | if CONFIG_USB_PD_TCPM_VBUS is enabled, a race condition may happen: In function pd_set_input_current_limit() and typec_set_input_current_limit(), EC may notify AP power change event before PD send the up-to-date POWER_STATUS TCPC alert to EC. It will cause the AP get the stale power status. Move the power change event notification to board_set_charge_limit(), it will be called after EC receives POWER_STATUS TCPC alert, and sending power change event notification only if the "charge limit" or "charge port" or supplier is changed. BUG=chrome-os-partner:48801 BRANCH=none TEST=make buildall -j; Tested on Oak by plug/unplug AC adapter to type-C ports and verify the UI battery icon shows the correct status instantly. Change-Id: I52f0e268fdebc45e609d843847540ae48cd0a9eb Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/320066 Reviewed-by: Rong Chang <rongchang@chromium.org>
* pd: Add common EC_HOST_EVENT_PD_MCU implementationShawn Nematbakhsh2016-01-071-35/+1
| | | | | | | | | | | | | | | | | | | | | For TCPMs with an off chip TCPC, PD MCU host event status can be handled in a common way. When a status flag is updated (ex. from charge_manager), notify the AP through the host event, and save the status flag for later retrieval. BUG=chrome-os-partner:49124 BRANCH=None TEST=Verify `cat /sys/class/power_supply/CROS_USB_PD_CHARGER1/online` on chell reflects the actual online status of the charger. Also verify UI charge icon tracks the online status correctly. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I63bc70205627474590e38ffd282faedaea3bcc66 Reviewed-on: https://chromium-review.googlesource.com/320796 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* oak: pd: increase stack size of PDCMD taskBen Lok2015-12-011-1/+1
| | | | | | | | | | | | | | | | | | | Stack of PDCMD task may be overflow during plug/unplug stree test with Apple's AV Multiport Adapter. Enlarge the stack size to avoid system reboot. BUG=chrome-os-partner:47728 BRANCH=none TEST=Manual 1.Connect DUT to sink monitor via HDMI dongle. 2.Unplug HDMI USB from DUT side. 3.Plug HDMI USB cable to DUT USB socket. 4.Repeat (Plug and unplug) USB from DUT for 10 times. Change-Id: Ib6a1fbd0a552b2c6d4656c12554e1306c21adb8a Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/315020 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: enable HW charge rampingBen Lok2015-12-012-0/+35
| | | | | | | | | | | | | | | refer to commit 75f740fa, enabling the option on oak too. BUG=none 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. Signed-off-by: Ben Lok <ben.lok@mediatek.com> Change-Id: I9c6a0726e9cb23af59d5841c63a81897ae624998 Reviewed-on: https://chromium-review.googlesource.com/314436 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: send power change event to AP whenever input power is changedBen Lok2015-12-011-0/+6
| | | | | | | | | | | | | | | Send power change event to AP whenever input power is changed, ensure that AP gets the latest power charging info. BUG=chrome-os-partner:47677 BRANCH=none TEST=tested on Oak by plug/unplug AC adapter to type-C ports and verifying the UI battery icon shows the correct status instantly. Change-Id: I7465afcd8bc9b1c56ecf70fc74446866a8ab1b9a Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/313926 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: add VCONN swap abilityBen Lok2015-11-252-0/+10
| | | | | | | | | | | | | | refer to commit 776bedc3, enable VCONN swap option for oak. BUG=chrome-os-partner:41838 BRANCH=none TEST=test on oak. ask for vconn swap and make sure vconn swap is successful. Change-Id: I2afa68e073d088302c2c6ba2315a6c9f4551ef87 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/313913 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* tcpm: Add configuration struct for tcpc i2c paramsShawn Nematbakhsh2015-11-081-0/+5
| | | | | | | | | | | | | | | | | | | Add a new configuration struct tcpc_config_t that initially defines the i2c host port and i2c slave address of all TCPCs present on the board. This will allow us to create boards with multiple TCPCs on different i2c ports, with arbitrary i2c slave addresses. BUG=chromium:551078 TEST=Manual on glados. Verify PD communication / charging is still functional on both PD ports. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I9b2bde85d7f1642e8727c052e064371be7967619 Reviewed-on: https://chromium-review.googlesource.com/311000 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* chg: add narrow VDC power path supportRong Chang2015-11-051-0/+1
| | | | | | | | | | | | | | | | | | Under NVDC, BGATE natively has a body diode. Hence there's a discharging path if VSYS is lower than VBAT. This change keeps VSYS voltage when turning off charging. BRANCH=none BUG=chrome-os-partner:46698 TEST=manual make buildall -j load on boards with isl9237 charger. charge the battery to full, and check charging voltage and current. Change-Id: I8a6046444dd40a3b57f034be124b9e8fe281de40 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309289 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: using only one standby mode wakeup source.Ben Lok2015-11-031-1/+5
| | | | | | | | | | | | | | | | | | | | | Before Oak rev4, it defines 2 wakeup source EC_WAKE(PA0), EC_PWR_BTN_L(PB5). Due to the wakeup source limitation of STM32F0 (http://goo.gl/VQk9GV), Oak can only use one wakeup source, because EC_PWR_BTN_L is low-active and it is kept high always. The HW & SW should be changed after rev4: Using PA0 as wakeup source only, instead of both (PA0 & PB5). BRANCH=none BUG=chrome-os-partner:46670 TEST=Manual on oak rev4 with HW rework. Detach PD power adapter, run 'hibernate' on EC console, make sure that both EC and PD go to hibernate, verify the following cases individually: 1. Press power button and verify that both EC and PD wake. 2. Plug PD power adapter and verfy that both EC and PD wake. Change-Id: Ief37aa1f11a84dd358875f22fa35c484b10bc388 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/309246 Reviewed-by: Rong Chang <rongchang@chromium.org>
* cleanup: Standardize use of CONFIG_I2C and add MASTER/SLAVE CONFIGsShawn Nematbakhsh2015-11-031-0/+1
| | | | | | | | | | | | | | | | | | | Some chips previously defined CONFIG_I2C and others didn't. Standardize the usage by removing CONFIG_I2C from all config_chip files and force it to be defined at the board level. Also, make boards define CONFIG_I2C_MASTER and/or CONFIG_I2C_SLAVE based on the I2C interfaces they will use - this will assist with some later cleanup. BUG=chromium:550206 TEST=`make buildall -j` BRANCH=None Change-Id: I2f0970e494ea49611abc315587c7c9aa0bc2d14a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/310070 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* oak: handle the warm reset key from servo boardBen Lok2015-11-031-0/+2
| | | | | | | | | | | | | | | | | | Warm reset key from servo board lets the POWER_GOOD signal deasserted temporarily (about 1~2 seconds) since Oak rev4. In order to detect this case, check the AP_RESET_L status, ignore the transient state if reset key is pressing. BUG=chrome-os-partner:46655 BRANCH=none TEST=make buildall -j; Press warm reset key of servo board, AP should reset normally. Change-Id: Ib9f111d2273cde61354e72367fe74d4ee15d2291 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/307201 Tested-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-by: Rong Chang <rongchang@chromium.org>
* oak: Adding 2S and 3S battery supportBen Lok2015-11-031-6/+2
| | | | | | | | | | | | | | | | | | | The default battery type of Oak is 3S, in order to compatible to 2S battery, set the minimum voltage of battery to 6V rather than 9V. BRANCH=none BUG=chrome-os-partner:46540 TEST=manual 1. connect 2S battery to rev4 2. check the battery info with EC command: > battery 3. confirm the voltage of battery is match to setting of battery_info. Change-Id: Ieb7e39817bb0cefa523f73039b68943adb50f045 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/306381 Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* glados: oak: chell: enable USB PD loggingAlec Berg2015-10-301-0/+2
| | | | | | | | | | | | | | | Enable USB PD logging. BUG=chrome-os-partner:45933 BRANCH=none TEST=make -j buildall make -j BOARD=glados tests Load on glados and test that PDLOG events show up in dmesg Change-Id: I61dbc5019ea3228542c2c244228bbb483cf51ead Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309881 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* glados: oak: reboot EC if PD MCU crashesAlec Berg2015-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If PD MCU crashes, it will go back to RO code and stay there until the next AP boot. So, if EC detects PD has crashed, then EC should panic reboot with debug message that it detected a PD crash. PD MCU crash is detected by EC by seeing the PD MCU transition from RW to RO, without it setting the flag that it got there from a sysjump. This CL also makes minor changes to oak_pd and glados_pd board.c files to make them identical, other than the few minor real differences between them. BUG=none BRANCH=none TEST=tested on glados using pdcmd console command on EC to test sysjumps and reboots: sysjump to RW: pdcmd 0xd2 0 2 0 sysjump to RO: pdcmd 0xd2 0 1 0 cold reboot: pdcmd 0xd2 0 4 0 Verified that PD can jump back and forth between RO and RW without EC panicing. Verified that if PD MCU is in RW and reboots, then the EC will panic and print 'PD crash'. Verify if PD MCU reboots while in RO, without ever going to RW first, then EC does not panic. Change-Id: Id3191f4005e70a6c61a9322bf535b4374e85eb9a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308586 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: change battery and variable sink cap for voltage inaccuracyAlec Berg2015-10-231-2/+2
| | | | | | | | | | | | | | | Change battery and variable sink capabilities for all boards to account for +/-5% voltage inaccuracy. BUG=none BRANCH=none TEST=test glados with third party variable power supply and make sure it see's our sink capabilities as 4.75V-21V. Change-Id: I2481ccbe6c47bfed1a6b8b237329e70bd0f8e4ac Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308237 Reviewed-by: Todd Broch <tbroch@chromium.org>