summaryrefslogtreecommitdiff
path: root/board/elm
Commit message (Collapse)AuthorAgeFilesLines
* common: motion_sense: Require CONFIG_MOTION_SENSOR_MAX_COUNTYuval Peress2019-08-022-40/+49
| | | | | | | | | | | | | | | | | | | This changes requires all boards to define the maximum number of sensors they support. This will allow us to later create static arrays with the appropriate length. BUG=chromium:966506 BRANCH=None TEST=make buildall Change-Id: I5a2fa8f0fdcaef69065dfd4c2bfea4e3f371e986 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637414 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719565 Reviewed-by: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* mkbp_event,include/config.h: Clarify MKBP delivery method.Yilun Lin2019-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we have two MKBP delivery methods: 1. define CONFIG_MKBP_USE_HOST_EVENT to notify via host event 2. undef CONFIG_MKBP_USE_HOST_EVENT to notify via GPIO interrupt It may become more complicated if new notification methods introduced. e.g.: mt_scp uses IPI, rather than host event and GPIO interrupt. This CL does: 1. add CONFIG_MKBP_USE_GPIO to explicilty declare that MKBP event are sent via GPIO interrupt. 2. CONFIG_MKBP_USE_CUSTOM for boards which have custmized methods. 3. Remove weak attribute in mkbp_set_host_active (which can be done with CONFIG_MKBP_USE_CUSTOM now. 4. Removes mkbp_set_host_active function in board Nocturne. It only deliver MKBP events through GPIO interrupt now. BRANCH=None BUG=b:120808999 TEST=grep -rn "CONFIG_MKBP_USE_GPIO\|EC_INT_L" board/ baseboard/ and see the result is reasonable: 1. EC_INT_L must be 1-to-1 mapped to define CONFIG_MKBP_USE_GPIO in every board, except that meep, yorp, ampton which are defined in baseboard octopus. 2. undef CONFIG_MKBP_USE_GPIO in bip and casta, which use host event, but also have baseboard octopus. Change-Id: I4af6110e4fd3c009968075c3623ef2d91cbd770b Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1490794 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719541 Reviewed-by: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* ss-mux: remove unused port_addr initializationv2.1.0Jett Rink2018-09-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | We do not need to set the port_addr variable most places because the SS-MUX is also the TCPC and the tcpc_config_t information is used instead. Remove unused variable setting to avoid confusion. BRANCH=none BUG=none TEST=buildall. phaser USB-C communication (and muxs) still work which is a nominal case for all of these changes. Change-Id: I72ee5da251956eb133091974e8dce5ac7f8787c6 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1200064 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1231473 Reviewed-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org>
* type: Rename matrix_3x3_t to mat33_fp_tYilun Lin2018-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Naming of many vector types and matrix types are not clear enough. For example, we have: vector_3_t, which is a vector of three int. vec3_t, which is a vector of three float. size4_t, which is a vector of four size_t. mat33_t, which is a 3x3 matrix of float. matrix_3x3_t, which is a 3x3 matrix of fixed point. Besides, we have types like int8_t, uint16_t types. To clearly distinguished types, the CL propose to, For vector types, naming should be `$type + 'v' + $num + '_t'`: vector_3_t becomes intv3_t vec3_t becomes floatv3_t vector 4 of uint16_t becomes uint16v4_t (which doesn't exist yet) For matrix types, naming should be `mat$N$N_` + $type + '_t', where $N is the matrix size: matrix_3x3_t becomes mat33_fp_t # fp: fixed point mat33_t becomes mat33_float_t TEST=make buildall -j BUG=b:114662791 Change-Id: I51d88d44252184e4b7b3564236833b0b892edc39 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1215449 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1230991 Reviewed-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org>
* servo_v4: add per port dualrole settingNick Sanders2018-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This adds support to configure dualrole setting per port, so that servo v4 can adjust charge and dut port separately. servo will detect charge capability on CHG port and choose source or sink as appropriate. Fix null dereference bug in genvif duel to dynamic src_pdo. "cc" command allows src, snk, srcdts, snkdts configurations. BRANCH=None BUG=b:72557427 TEST=charge through and also passive hub. Note Dru doesn't accept DTS hub. TEST=make buildall -j Change-Id: I19f1d1a5c37647fec72202191faa4821c06fb460 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1096654 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* board: Clean up DMA channel mappingNicolas Boichat2018-07-231-3/+2
| | | | | | | | | | | | | | | | | | | | | The code to remap DMA channels on STM32F09x is a little obscure, let's try to make it a bit clearer by using simpler masks. A more proper fix might be to setup better macros, or use the existing dma_select_channel function, but this already improves readability. BRANCH=none BUG=b:80159522 TEST=Flash kukui, see that UART and eMMC emulation work. TEST=Compare binaries for elm kukui oak rainier rowan scarlet before and after this change, and see that resulting binaries are identical. Change-Id: Id4d2b9cfec86230b2329fa04a4c1992ec13be4e1 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1146128 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power: Rename mediatek to mt817xNicolas Boichat2018-06-071-1/+1
| | | | | | | | | | | BRANCH=none BUG=b:109850749 TEST=make buildall -j Change-Id: I69538a210f9b2198614720537faa3ee75bc0600e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1090522 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* system: update board version to return an error if encounteredJett Rink2018-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | Now that board version can come from CBI, we can have a real error reading it. We should pass that error to the console or to the AP on the host command and let the AP firmware (or user) decided how to handle that error case Also update the CONFIG_BOARD_VERSION to be derived instead of needed in most cases. BRANCH=none BUG=b:77972120 TEST=Error reported on EC console and AP console when CBI is invalid on yorp Change-Id: Ib8d80f610ea226265a61e68b61965150cdc9bb04 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1015776 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cleanup: CONFIG_USB_PD_CUSTOM_VDM is not usedDivya Sasidharan2018-04-091-1/+0
| | | | | | | | | | | | | | | | | | | The pd_custom_vdm is called in common/usb_pd_protocol no matter you have this defined or not. No where else I see pd_vdm being used. So we should not have to deal with this CONFIG_USB_PD_CUSTOM_VDM. BUG=None BRANCH=None TEST=make buildall -j Change-Id: I4e8b710240ee27b12625d797e7824f29044e6462 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/998520 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* board: In motion sensor array, remove assignment to 0Gwendal Grignou2018-03-141-28/+0
| | | | | | | | | | | | Assignment to 0 are no necessary. BUG=none TEST=compile, check nami. BRANCH=none Change-Id: I1bc11efcff31cbfe2947580e7b8db0d5ba72d444 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959502
* driver/charger/isl923x: Make sure CONFIG_CHARGER_NARROW_VDC is setNicolas Boichat2018-01-101-1/+0
| | | | | | | | | | | | | | | | | | Without this, the battery will discharge if we disallow battery charging (e.g. calling charge_request with either voltage == 0 or current == 0, either by policy, or when the battery is full). Also update config.h to set the option whenever isl923x is used. BRANCH=none BUG=b:66575472 BUG=b:35585464 TEST=make buildall -j Change-Id: Id5515d5ea82a393a3693a3da44cbdc2778296a95 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/856538 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* charge_manager: Enter safe mode at bootShawn Nematbakhsh2017-11-021-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | Charge port / current selection often needs to be significantly altered when a battery cannot provide sufficient charge, so have charge_manager initially enter safe mode. After a battery with sufficient capacity has been identified, charge manager will leave safe mode, and port / current selection will return to standard rules. BUG=chromium:777596 BRANCH=None TEST=Pass charge_manager unit tests. On kevin, remove battery, attach Apple PD charger, verify safe mode is not exited and device does not brown out. Hot-plug battery and verify safe mode is exited. Next, remove battery, attach to Samus, verify safe mode is not exited and device doesn't brown out. Hot-plug battery, verify that safe mode is exited and no active charge port, due to dual-role exclusion. Change-Id: I7784865750087a037aad8dbbac058b22c77ba6d4 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/733954 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* hana: Add EC console USART internal pull-upRong Chang2017-10-201-1/+1
| | | | | | | | | | | | | | | This change prevents the floating RX console pin from entering unwanted commands. BRANCH=oak BUG=b:67033247 TEST=manual load on hana and probe USART RX pin Change-Id: I6dc05e03f82dcc71ea6f957f93c5fe7c6b65d2bf Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/722381 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Revert "hana: disable console input when system is locked"Rong Chang2017-10-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit df12bc1c0246ceec39f28151efadb73f8e5fd7a5. Reason for revert: the config flag is deprecated and should not use in any project. Original change's description: > hana: disable console input when system is locked > > Shipped devices were found that batteries could enter ship mode > unexpectedly. Fail rate is about 5/700pcs per day. Failure happens > when battery is charged fully and eneters sleep(mem), and then AC is > plugged out. > Battery ship mode is entered because ec execute console command > "cutoff". Still do not know what causes that when no any device > connected to servo board connector (console TX and RX are floated). > Enable this config item will cut off route from RX input and fix > the issue. > > BUG=b:67033247 > BRANCH=none > TEST=with 50 DUTs, flash ec to DUTs and then lock the system, charge > the battery from about 80% capacity to 100% capacity, close the lid > for 20 minutes, unplug AC, boot the system, all DUTs boot, no DUT's > battery enter ship mode. The same test repeats 3 times. > > Change-Id: I9939fed1467026bc2d85c645b6ecebae4b6796c6 > Signed-off-by: Chao Ge <chao.ge@bitland.com.cn> > Reviewed-on: https://chromium-review.googlesource.com/693921 > Commit-Ready: ge chao <chao.ge@bitland.com.cn> > Tested-by: ge chao <chao.ge@bitland.com.cn> > Reviewed-by: Rong Chang <rongchang@chromium.org> Bug: b:67033247 Change-Id: Ide8a3cc8d1eeee9914922d47ec12c44b7d0e9675 Reviewed-on: https://chromium-review.googlesource.com/718237 Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* hana: disable console input when system is lockedgc2017-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Shipped devices were found that batteries could enter ship mode unexpectedly. Fail rate is about 5/700pcs per day. Failure happens when battery is charged fully and eneters sleep(mem), and then AC is plugged out. Battery ship mode is entered because ec execute console command "cutoff". Still do not know what causes that when no any device connected to servo board connector (console TX and RX are floated). Enable this config item will cut off route from RX input and fix the issue. BUG=b:67033247 BRANCH=none TEST=with 50 DUTs, flash ec to DUTs and then lock the system, charge the battery from about 80% capacity to 100% capacity, close the lid for 20 minutes, unplug AC, boot the system, all DUTs boot, no DUT's battery enter ship mode. The same test repeats 3 times. Change-Id: I9939fed1467026bc2d85c645b6ecebae4b6796c6 Signed-off-by: Chao Ge <chao.ge@bitland.com.cn> Reviewed-on: https://chromium-review.googlesource.com/693921 Commit-Ready: ge chao <chao.ge@bitland.com.cn> Tested-by: ge chao <chao.ge@bitland.com.cn> Reviewed-by: Rong Chang <rongchang@chromium.org>
* charge_ramp: Move ramp allowed / ilim callbacks to common codeShawn Nematbakhsh2017-10-061-33/+0
| | | | | | | | | | | | | | | | | | | | | 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>
* pd: Move *_set_input_current() to common codeShawn Nematbakhsh2017-10-051-20/+0
| | | | | | | | | | | | | | | | | | | Boards that use charge_manager have identical implementations of typec_set_input_current_limit() and pd_set_input_current_limit(), so move these functions to charge_manager. BUG=b:67413505 TEST=`make buildall -j`, also verify that fizz continues to power-on and boot AP, in both protected and unprotected mode, with barrel jack power and with zinger. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I99a5314d02c4696db944c0f8ac689405f4f1f707 Reviewed-on: https://chromium-review.googlesource.com/701412 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* power: Add flags parameter to power_signal_infoFurquan Shaikh2017-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | Replace structure member "level" in power_signal_info with "flags". "level" has been used on all boards to indicate active-high or active-low levels. Addition of "flags" allows easy extension of power_signal_info structure to define various flags that might be applicable to power signals (e.g. "level"). Going forward, additional flag will be added in follow-up CLs. Also, provide a helper function power_signal_is_asserted that checks the actual level of a signal and compares it to the flags level to identify if a power signal is asserted. BUG=b:65421825 BRANCH=None TEST=make -j buildall Change-Id: Iacaabd1185b347c17b5159f05520731505b824b8 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/679979 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Treat SYSTEM_IMAGE_RW_B also as RW copyDaisuke Nojiri2017-09-091-2/+1
| | | | | | | | | | | | | | SYSTEM_IMAGE_RW_B hasn't been globally treated as a RW copy. This change makes EC treat it also as a RW copy. BUG=none BRANCH=none TEST=make buildall Change-Id: Iae5a9090cdf30f980014daca44cdf8f2a65ea1f2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/656337 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* board/elm/board.h: Remove CONFIG_CMD_HOSTCMDChe-yu Wu2017-08-161-1/+0
| | | | | | | | | | | | | | | | The command "hostcmd" in console isn't very useful and will cause stack overflow in console task when processing some hash commands. BUG=chromium:755048 BRANCH=none TEST=make BOARD=elm -j make BOARD=elm tests There should be no hostcmd command in the console of elm. Change-Id: Ifa721a1731bc1ebfb39e12430b6631338bdccd9f Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/616600 Reviewed-by: Rong Chang <rongchang@chromium.org>
* pd_log: Make PD logging more generic for general purpose loggingShawn Nematbakhsh2017-08-021-1/+0
| | | | | | | | | | | | | | | | | | We can re-use our pd_log FIFO for other purposes, such as TPM logging. Carve out event_log, a generic logging module which pd_log is compatible with. BUG=b:63760920 TEST=On kevin, verify PD logging is still functional and entries are seen in dmesg. BRANCH=None Change-Id: I8e6ad6f93e9eebc676aca64652c60f81da471a94 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/597314 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* driver: Move PI3USB9281 to bc12 directory.Aseda Aboagye2017-07-312-3/+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>
* common: sensors: add extra sensor attributesNick Vaccaro2017-05-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | Adds min_frequency and max_frequency to struct motion_sensor_t. New attributes min_frequency and max_frequency are now returned in ectool's MOTIONSENSE_CMD_INFO response. Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3. Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's header file. BRANCH=none BUG=chromium:615059 TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin, make buildall -j passes. Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/482703 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* stm32f09x: fix flash protection offsetRong Chang2017-02-271-0/+24
| | | | | | | | | | | | | | | | | | | | | STM32F091VC has 32 flash protection sectors (31 x 4KB + 1 x 132KB), which doesn't fit the layout requirement in config_std_internal_flash.h. This CL hardcodes the layout and flash bank mapping. BUG=chrome-os-partner:62372 BUG=chromium:694972 TEST=load on elm and manually enable write protect using flashrom # flashrom -p ec:dev=0 --wp-enable check ec console write protect option bytes, bank 31 is writable > rw 0x1ffff808 read 0x1ffff808 = 0xff00ff00 > rw 0x1ffff80c read 0x1ffff80c = 0x7f80ff00 BRANCH=oak Change-Id: I23dcf87bfbcd2f37e97a87e94847dce1ea1d343c Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/446176
* 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>
* 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>
* Fix EC build for latest llvm for elm boardManoj Gupta2016-11-221-0/+2
| | | | | | | | | | | | | | | | | | | | Mark host command structures as aligned for elm board. Without marking as aligned, llvm was correctly complaining about taking address of packed member. util/ectool.c:1158 error: taking address of packed member 'size' of class or structure 'ec_params_usb_pd_fw_update' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] BRANCH=none BUG=chromium:665240 TEST=Builds now Change-Id: Ic4a2e81f6af8ef2a906d6ac7aca87ea6d00fe318 Reviewed-on: https://chromium-review.googlesource.com/413108 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> 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>
* reef/pyro/elm/amenia/snappy: Remove false battery critical messageVijay Hiremath2016-10-251-3/+1
| | | | | | | | | | | | | | | | | | Till the charger task is initialized port is not set for the BD9995X users and a false battery critical message is printed. Removed the false message printed for BD9995X users to avoid confusion. BUG=chrome-os-partner:58972 BRANCH=none TEST=Manually tested on Reef. False battery critical message is not printed on the EC console. Change-Id: Iec8d0f354c4f6dc17efa9da8db38b125e57addab Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/402668 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>
* 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>
* elm: disable 3.3V to ANX7688 by default and enable it in board_power_on_pd_mcu.Milton Chiang2016-10-132-1/+3
| | | | | | | | | | | | | | | | | | | | | In dead battery mode, we can find ANX7688 will pull the CC to Rp in the beginning; some of the adapters will drop the VBUS since this should be treated as a disconnection, hence the whole system lost the only power source and cannot boot up. According to chrome-os-partner:58283, there's a chance for ANX7688 to be in an abnormal state if the system provides it with 3.3V first but RESET_N and PWR_EN are still in an unstable level. To prevent this situation, we try to enable the 3.3V only after RESET_N and PWR_EN are in their initial state. BRANCH=none BUG=chrome-os-partner:58283 TEST=plug in the adapter, check ANX7688 does not pull CC to Rp in the beginning, and boot up system in dead battery mode Change-Id: Ibb81a33a7dd957d3bdc6c54bb7723cc9ffdcfd26 Signed-off-by: Milton Chiang <milton.chiang@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/394408 Reviewed-by: Nicolas Boichat <drinkcat@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>
* driver: kionix: Remove variant field.Gwendal Grignou2016-09-011-4/+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
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Use CONFIG_DPTF flag instead of THROTTLE_AP.Ravi Chandra Sadineni2016-07-302-15/+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>
* Elm: Allow rejected 'Dont charge' request on initRyan Zhang2016-07-171-0/+14
| | | | | | | | | | | | | | | | | | If our battery isn't able to provide enough power to the EC on boot, we should not cut off our input power, regardless of dual role determination or other charging policy. BUG=chrome-os-partner:54944 BRANCH=master TEST=Manual on Elm. Drain battery completely, attach USB-C charger, verify that "Battery critical, don't disable charging" is seen on the console and the EC doesn't brown out. Change-Id: I7782d333da89b872e33ea31304f878ca490329cf Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/360781 Reviewed-by: YH Huang <yh.huang@mediatek.com> Reviewed-by: Rong Chang <rongchang@chromium.org>
* elm: Add sensor power controlKoro Chen2016-07-131-0/+3
| | | | | | | | | | | | | PD11 is added in PVT to control power of sensors BRANCH=none BUG=chrome-os-partner:54129 TEST=verify sensor power can be controlled on a reworked elm Change-Id: Ib7457c9c21a26ec853b00f3709922aab70c9d514 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/359153 Reviewed-by: Rong Chang <rongchang@chromium.org>
* Elm: Update max input current for safetyRyan Zhang2016-07-101-0/+2
| | | | | | | | | | | | | | | | tested Constant Current from 2248mA (100%:2.25A) become 2136mA (95%:2137.5) BUG=chrome-os-partner:54890 BRANCH=master TEST=`make -j BOARD=elm` Change-Id: I1c64eb98e044262f9dd54c21cfeb4339e411d4b3 Reviewed-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/356354 Commit-Ready: Ryan Zhang <Ryan.Zhang@quantatw.com> Tested-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* Remove Makefile symlinks under board directoryDaisuke Nojiri2016-07-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This feature is inconsistent. Not all boards have such a symlink (for a obvious reason). This feature is fragile. It's most likely not tested and going to be broken if not already. Developers won't like it if they have to test two different ways to build boards before submitting patches. This feature is not necessary. If you build EC in the standard way (e.g. make BOARD=samus), these symlinks are not needed. This feature is wasteful. Extra disk spaces are used and extra lines are added to Makefile (increasing code complexity slightly). BUG=chromium:626776 BRANCH=none TEST=make buildall Change-Id: Id5444284d773cb0e9225f39abd877441b8f61440 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359321 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* elm: Increase UART TX buffer size to 8kbNicolas Boichat2016-07-091-0/+4
| | | | | | | | | | | | | | | | | We have more than enough memory for that, and it makes it possible to poll the logs from AP much more unfrequently. BRANCH=oak BUG=chromium:527904 TEST=make buildall -j TEST=Boot elm, cat /sys/kernel/debug/cros_ec/console_log does not miss any data. Change-Id: I8cce88e39d00a94397b6fc852a371b4595870b24 Reviewed-on: https://chromium-review.googlesource.com/358181 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* elm: Disable hostcommand debuggingNicolas Boichat2016-07-091-0/+3
| | | | | | | | | | | | | | | | | elm EC console output is very spammy, as EC_CMD_MOTION_SENSE_CMD is called every 100ms. Even when hcdebug is set to off, we still get command errors. BRANCH=oak BUG=chrome-os-partner:55001 TEST=make buildall -j TEST=Flash elm EC, see that output is fairly quiet. Change-Id: I0a5ab2950911648e2e34f4ab1b6886e3e4bff774 Reviewed-on: https://chromium-review.googlesource.com/358438 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* elm: Set PD_MAX_POWER_MW to 45WKoro Chen2016-07-051-1/+1
| | | | | | | | | | | | | Since we are targeting a 45W solution, set max power to 45W. BRANCH=none BUG=chrome-os-partner:54519 TEST=Plug in Zinger and make sure 20V/2.25A is used instead of 20V/3A Change-Id: Ie57a1df39f0cc642fe3644535aa1b5aa92f1ff35 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/358320 Reviewed-by: Rong Chang <rongchang@chromium.org>
* elm: Choose low input voltage whenever possibleKoro Chen2016-06-291-0/+3
| | | | | | | | | | | | | | | To achieve higher power efficiency, we want the input voltage to be as low as possible. If the PD source advertise several choices over PD_MAX_POWER_MW, choose the one with the lowest voltage. BRANCH=none BUG=chrome-os-partner:54519 TEST=Plug in Liteon charger and make sure 15V/3A is selected Change-Id: I6157eb94a1cb45cd537acc79c377db2cff09d922 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/356317 Reviewed-by: Rong Chang <rongchang@chromium.org>
* 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/+1
| | | | | | | | | | | | | | | | | | | | 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>
* Elm: Update battery parameters for SanyoRyan Zhang2016-06-251-5/+5
| | | | | | | | | | | | | BUG=chrome-os-partner:54617 BRANCH=master TEST=`make -j BOARD=elm` Change-Id: Id4bf6180b7776363f470f29d1b7d3d4d8095c659 Reviewed-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/353514 Commit-Ready: Ryan Zhang <Ryan.Zhang@quantatw.com> Tested-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* Elm: update LED controlstabilize-8481.BRyan Zhang2016-06-201-9/+39
| | | | | | | | | | | | | following Change#227416 to meet client's spec. BUG=chrome-os-partner:54263 BRANCH=master TEST=`make -j BOARD=elm`, check factory force IDLE, works good Change-Id: I1f0abdcbd56eeab379a6258869ccc133ff80736d Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/353521 Reviewed-by: Shawn N <shawnn@chromium.org>
* Revert "elm: get VBUS statue from GPIO"Koro Chen2016-06-173-7/+2
| | | | | | | | | | This reverts commit abe2a55191dbcdf8c92bfea64601b607471d75be due to it triggers Issue 54108. Change-Id: I19c89511e31b056285680e3afff95f44b4d932a6 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/352832 Reviewed-by: Shawn N <shawnn@chromium.org>
* elm: anx7688: make anx7688 always onKoro Chen2016-06-161-17/+10
| | | | | | | | | | | | | | | | | This makes the boot time less painful since it requires a long delay for FW loading after power on this chip. This also makes it easier to upgrade FW as we don't need to power on the chip before doing upgrade. BRANCH=none BUG=chrome-os-partner:52815 TEST=plug and unplug dongle and check DP output plug/unplug adapter and check pd 0 state Change-Id: Ia344c748697a3b1d06c9b442e1bf1d7227861f9b Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com> Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/347181 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>