summaryrefslogtreecommitdiff
path: root/board/samus
Commit message (Collapse)AuthorAgeFilesLines
* chgstv2: Unify power-on and shutdown battery thresholdsDaisuke Nojiri2022-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, power-on battery SoC and shutdown battery SoC are independently configured by each board. This patch will unify the setting as follows: CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 2 (don't boot if soc < 2%) CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2 (shutdown if soc <= 2%) BATTERY_LEVEL_SHUTDOWN = 3 (shutdown if soc < 3%) CONFIG_BATTERY_EXPORT_DISPLAY_SOC = Y (removed) CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC = 1 This allows us to show the low battery alert whenever we can because EC doesn't inhibit power-on even if it knows the host would immediately shut down. With CONFIG_BATTERY_EXPORT_DISPLAY_SOC, boards will start using the CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2% as the low battery threshold (and the SoC will be agreed between the EC and Powerd). Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 1 will keep the same threshold. This is for avoiding degrading the UX by increasing the power-on threshold (even though a question that 1% may not be enough for soft sync to finish consistently remains to be answered). Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON > 2 will have a lower threshold but we think 2% is enough to finish the software sync. A lower threshold also improves the UX by showing the low battery alert in the situation where otherwise the system would leave the user uninformed by not responding to a power button press. BUG=b:191837893 BRANCH=None TEST=buildall Change-Id: If6ff733bc181f929561a3fffb8a84e760668ce37 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2981468 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872712
* Remove __7b, __8b and __7bfDenis Brockus2019-08-234-41/+41
| | | | | | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767528 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-08-234-35/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767525 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* common: motion_sense: Require CONFIG_MOTION_SENSOR_MAX_COUNTYuval Peress2019-08-021-2/+9
| | | | | | | | | | | | | | | | | | | 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>
* motion: Define macros for custom eventsGwendal Grignou2019-08-021-2/+0
| | | | | | | | | | | | | | | | | | Define macros to define custom events used by sensor interrupt handlers. Remove CONFIG_ for activity events. BUG=none BRANCH=none TEST=compile, sensors work on eve. Change-Id: I08ef6ed2a004466ebc5f7650d6952a150b9de713 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1272189 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719544 Reviewed-by: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@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>
* keyboard: Move keyboard_special (lightbar demo) to samus/board.cHung-Te Lin2018-08-202-0/+55
| | | | | | | | | | | | | | | | | | Currently the keyboard_special has only one function - to enter demo or easter egg mode if lightbar task is running. However, only Samus has lightbar so we should not waste time doing keyboard_special on all boards. The better approach is to use the new CONFIG_KEYBOARD_SCANCODE_CALLBACK and provide the lightbar demo check inside samus board.c. BUG=None TEST=make buildall -j BRANCH=None Change-Id: Ie8ab994b5439309663328a75680d45230a6eaeea Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1168702 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* board: eve: Do not set accelerometer ODR beyond 200HzGwendal Grignou2018-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | When ODR is set above 200Hz, the EC can not keep up with the accelerometer, causing deadlock. ODR was set at 400Hz for double tap detection. However, that high frequency is only needed for LSM6DS0 where tap detection is done in software (samus). 200Hz is good enough when tap detection is done in hardware. BUG=b:112672627 BRANCH=eve TEST=Check eve is done dead locking at boot. Check double tap still works. Change-Id: Id41dc06eb357b1cdc78d22b89440f01c44a3c16c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1179182 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* i2c: Split i2c_xfer into locked/unlocked versions.Jonathan Brandmeyer2018-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename i2c_xfer to i2c_xfer_unlocked. Audit all users of i2c_xfer to see if they can use simple locking semantics or require their own locking. Since locked accesses are only safe for I2C_XFER_SINGLE transactions, remove the flags parameter from i2c_xfer. This also makes the audit a bit easier. Some remaining applications hold the bus locked across several transactions that would otherwise be atomic, and a few others implement complex I2C transactions in multiple commands. Add a (nondeterministic) verification on the I2C port locking correctness. This will catch all statically incorrect locking patterns, although dynamically incorrect locking patterns may not be caught. Related: Revise the i2c_port_active_count to be a bitmap of the active ports instead of a count of the active ports. The EC's mutex does not provide an is_locked() primitive, and we would prefer not to have one. - board/glados: Custom locking for battery reset - board/mchpevb1: Custom locking for battery reset - board/oak: Custom locking for battery reset - board/samus: Custom locking for lightbar reset - board/sweetberry: simple locking - board/servo_micro: Custom locking for funky i2c transfers - capsense: simple locking - host_command_master: multi-command transactions - lb_common: manual locking to support samus power sequence - smbus: multi-command transactions - usb_i2c: simple locking - driver/tcpm/fusb302: simple locking and multi-command transactions - driver/tcpm/tcpi: Forward _unlocked and implicitly locked interface to fusb302 - driver/touchpad_elan: simple locking BUG=chromium:871851 BRANCH=none TEST=buildall; very careful audit TEST=grunt clamshell and Coral clamshell, test boot, battery charging, PD communication, and TCPC port low-power mode. Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ieabf22bcab42780bdb994fca3ced5d8c62519d56 Reviewed-on: https://chromium-review.googlesource.com/1169913 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* reset: Log the reason for AP resets.Jonathan Brandmeyer2018-07-261-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides a new EC host command 'uptime info' which gathers up some information which may be useful for debugging spurious resets on the AP (was the EC reset recently? Why was the EC reset? If the EC reset the AP, why did it do so?, etc.). Provide ectool support for the same. Example results of `ectool uptimeinfo`: ``` localhost ~ # ectool uptimeinfo EC uptime: 475.368 seconds AP resets since EC boot: 2 Most recent AP reset causes: 315.903: reset: console command 363.507: reset: keyboard warm reboot EC reset flags at last EC boot: reset-pin | sysjump ``` BRANCH=none TEST=Perform some `apreset` commands from the EC console and observe their side-effects via the `ectool uptimeinfo` command on the AP side. Test sequences include no-resets through 5 resets, observing that the ring buffer handling was correct. BUG=b:110788201, b:79529789 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: I0bf29d69de471c64f905ee8aa070b15b4f34f2ba Reviewed-on: https://chromium-review.googlesource.com/1139028 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* test/build.mk: Allow boards to specify test listsNicolas Boichat2018-05-281-0/+4
| | | | | | | | | | | | | | | | | Some tests cannot be built on some boards (not enough SRAM, unusual configuration, etc.). Instead of the long list of exceptions in test/build.mk that we currently use, allow each board (or chip) build.mk to set test-list-y, and only use the default list if it is unset. BRANCH=poppy BUG=b:80167548 TEST=make buildalltests -j Change-Id: I803c691f419451aad4396529302a4805cbe3f9b5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1074572 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>
* Code cleanup: Remove cold reset logicVijay Hiremath2018-04-031-32/+13
| | | | | | | | | | | | | | | | | | | | | Majority of the chipsets do not have a dedicated GPIO to trigger AP cold reset. Current code either ignores cold reset or does a warm reset instead or have a work around to put AP in S5 and then bring back to S0. In order to avoid the confusion, removed the cold reset logic and only apreset is used hence forth. BUG=b:72426192 BRANCH=none TEST=make buildall -j Manually tested on GLKRVP, apreset EC command can reset AP. Change-Id: Ie32d34f2f327ff1b61b32a4d874250dce024cf35 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/991052 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: Jett Rink <jettrink@chromium.org>
* board: In motion sensor array, remove assignment to 0Gwendal Grignou2018-03-141-40/+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
* fan: Allow board to configure fans at run timeDaisuke Nojiri2018-03-061-17/+23
| | | | | | | | | | | | | | | This patch splits struct fan_t into two parts: base configuration and RPM configuration. RPMs are expected to be different from model to model while a base configuration is most likely shared. BUG=b:73720175 BRANCH=none TEST=make buildall Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949382 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: Change the way host_set_single_event is usedFurquan Shaikh2017-11-151-2/+5
| | | | | | | | | | | | | | | | | In order to avoid runtime 64-bit left shift, check for extpower and add two separate calls to host_set_single_event rather than calculating the parameter at runtime. This avoids the requirement of runtime logical shift for 64-bit. BUG=b:69329196 BRANCH=None TEST=make -j BOARD=samus Change-Id: I64cacf6253878ed7d69f6b17baeb6c27c470378a Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/771854 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fizz: Modify thermal tableRyan Zhang2017-11-061-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify thermal table for Fizz reference patches: 627542, 288256, 329359 on off RPM step0 0 step1 16 2 2800 step2 27 18 3200 step3 35 29 3400 step4 43 37 4200 step5 54 45 4800 step6 64 56 5200 step7 97 83 5600 Prochot degree: active when t >= 88C release when t <= 85C Shutdown degree: when t >= 90C BUG=b:67487721, b:64439568 BRANCH=master TEST=fan target speed follows table, make -j buildall pass Change-Id: I3378668a560b8ddc568fe9cbf2703613fad8e4b6 Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/729606 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cleanup: Use CONFIG_BATTERY to indicate whether a board has a batteryShawn Nematbakhsh2017-10-131-1/+0
| | | | | | | | | | | | | BUG=b:35528297 BRANCH=None TEST=`make buildall -j` Change-Id: I9e4814b4172f20711f7edd691c9569f9130aec8e Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/713395 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* power: Add flags parameter to power_signal_infoFurquan Shaikh2017-10-031-9/+9
| | | | | | | | | | | | | | | | | | | | | | 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>
* cleanup: Remove jtag_pre_init()Shawn Nematbakhsh2017-09-072-1/+23
| | | | | | | | | | | | | | | Use our newly-created chip_pre_init() for doing JTAG initialization. BUG=chromium:747629 BRANCH=None TEST=`make buildall -j` Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ic5771895a214a9f1aa9bd289eef576f52adf973f Reviewed-on: https://chromium-review.googlesource.com/629676 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* usb_port_power_smart: Add CDP/SDP only option.Aseda Aboagye2017-08-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | For some boards, the control lines to the charging port controller are all tied to a power rail. In essence, this leaves the ILIM_SEL as the only signal able to be controlled, which means that we only support CDP/SDP. This commit adds a new CONFIG_* option which describes this. CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY Additionally, some cleanup is made to not always assume the number of smart power ports. BUG=None BRANCH=None TEST=make -j buildall Change-Id: I080ccd67ffc20ccccf1e6b33a3cf9374a6b70ad6 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/634274 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* sensor: Add board specific function for double tap eventScott Collyer2017-06-011-0/+5
| | | | | | | | | | | | | | | | | | | The previous boards that used double tap both used lightbar sequence. Eve, also needs double tap, but doens't have lightbar. Added a board specific call when processing the double tap event to allow more flexibility. BUG=b:35584895 BRANCH=none TEST=Manual tested double tap and verified it was detected based on the console print. Change-Id: I73d8669803e7dcbbbac00de09822f4a286965fce Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/516546 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* common: sensors: add extra sensor attributesNick Vaccaro2017-05-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | 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>
* usb_port_power: Allow variable number of portsDaisuke Nojiri2017-05-011-0/+5
| | | | | | | | | | | | | | | | | Currently, usb_port_power_dumb allows fixed number of ports (2) and usb_port_power_smart allows less than 4 ports. This change removes the limitation and makes them accept variable number of ports. BUG=chromium:715178 BRANCH=none TEST=Verified usbchargemode returns consistent charge_mode across sysjumps on Electro. Change-Id: I7675c65ba03d3e6f7f53b2fe48cbe510231d945a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/481077 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* smart_battery: Cleanup smart battery & SB users codeVijay Hiremath2017-01-021-14/+6
| | | | | | | | | | | | | BUG=chrome-os-partner:61173 BRANCH=none TEST=Manually tested on Reef. Battery info works. Change-Id: I6e867eee38885186f8e63a934f52e826f0cf72fd Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/422998 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>
* als: Define CONFIG_ALS when HAS_TASK_ALS is present.Gwendal Grignou2016-12-281-1/+0
| | | | | | | | | | | | | | 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>
* 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>
* 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
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-242-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Standard locations for board specific battery codeVictor Prupis2016-08-192-1/+311
| | | | | | | | | | | | | Moved battery code for samus and ryu from driver tree to board tree. BUG=chrome-os-partner:42486 BRANCH=master TEST=none Change-Id: Iaad1456323f85e5852d8aa8e3e2d453b26e2d452 Signed-off-by: Victor Prupis <vprupis@google.com> Reviewed-on: https://chromium-review.googlesource.com/371402 Reviewed-by: Stefan Reinauer <reinauer@google.com>
* 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>
* 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>
* 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-182-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>
* 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>
* 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>
* charger: Change unlocked battery level ignore conditionsShawn Nematbakhsh2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | x86 systems will auto-power-on when power is applied to the EC. When the battery level is critically low, power-on is prevented, except when the system is unlocked. So, when unlocked, some systems will auto-power-on regardless of battery level, overcurrent the charger / battery, and then repeat forever. Prevent this reboot loop by ignoring auto-power-up when the battery is critically low, regardless of system unlocked status. BUG=chrome-os-partner:48339 TEST=Verify power-up is prevented on no-battery chell w/ donette. Then, run 'powerbtn' on EC console and verify system powers on (and overcurrents). BRANCH=None Change-Id: Ia631b5a8c45b42ec805e4a0c3f827929a0efd236 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/319187 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* pwm: Add common initialization for PWM pinsShawn Nematbakhsh2015-12-041-2/+2
| | | | | | | | | | | | | | | | | | | Rather than having various PWM module groups initialized from various HOOK_INIT functions, group them all into a single module and initialize them all from a common function in pwm.c. BUG=chromium:563708 TEST=Manual on samus / samus_pd (with CONFIG_ADC enabled). Verify that samus fan + KB backlight control is functional and samus_pd correctly sets PWM output. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I9f9b09bfa544cd9bc6b7a867e77757dff0505941 Reviewed-on: https://chromium-review.googlesource.com/314882 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* motion: Change units of ec_rate from us to ms.Gwendal Grignou2015-11-181-5/+5
| | | | | | | | | | | | | To ease finer calculation of ec rate change units from ms to us. BRANCH=smaug BUG=b:24367625 TEST=compile Change-Id: I52057c8ca1b1180a64b58d1ba0af9ec53f40b026 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312984
* cleanup: Standardize use of CONFIG_I2C and add MASTER/SLAVE CONFIGsShawn Nematbakhsh2015-11-031-0/+2
| | | | | | | | | | | | | | | | | | | 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>
* samus: increase POWERBTN task stack sizeAlec Berg2015-10-301-1/+1
| | | | | | | | | | | | | BUG=chromium:547879 BRANCH=samus TEST=make BOARD=samus Change-Id: Iba29d53918245714ffcf6c87f42d1fa98be028b8 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309142 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 12d924b7a05ddcd64a6d845faba5d6dc348c4bbd) Reviewed-on: https://chromium-review.googlesource.com/309553
* ALS: Disable the ALS task if all the ALS inits failVijay Hiremath2015-10-021-1/+1
| | | | | | | | | | | | | | | BUG=none TEST=Manually tested on Kunimitsu & Strago. Removed the ALS sensor from DUT, using "taskinfo" console command observed that the ALS task is not running. BRANCH=none Change-Id: I96cb720bd8d70033d433cdc2cd9cea9b56a3b389 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/301753 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>
* common: lightbar: put multiple commands under i2c_lockGwendal Grignou2015-09-191-1/+19
| | | | | | | | | | | | | | | | | | If other i2c traffic happens around the time the light bar is initialized, the i2c bus is wedged. Instead of waiting 500ms in the motion task loop for the tap sequence to complete, set under i2c lock the lp power and init sequence. BRANCH=smaug, samus BUG=chrome-os-partner:45223 TEST=With msleep(500) removed and With lb_power + lb_init + 100ms, I don't see the wedge at TAP sequence. Change-Id: I931eb25bcc5e3237b6c569f2330f72f9fc415964 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299543 Reviewed-by: Bill Richardson <wfrichar@google.com>
* samus: Set CONFIG_FPU for tmp6 driver.Gwendal Grignou2015-09-181-0/+1
| | | | | | | | | | | | | tmp6 driver requires floating point. Enable it on Samus. BRANCH=samus BUG=none TEST=compile. Change-Id: Iacd83fe5e04ed555db19187d3cb7037af397410b Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299518 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* common: motion: move gesture actions in motion task.Gwendal Grignou2015-09-181-0/+2
| | | | | | | | | | | | | | Change the IRQ interface to allow adding events. Move code to send the lightbar sequence from gesture.c to motion task. TEST=compile, works on Ryu. BRANCH=smaug BUG=chrome-os-partner:44754 Change-Id: I981ea123ebef0e8e3d6aa320eade89f10e83b6fc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296822 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* motion: add config option to use the old accelerometer ref frameAlec Berg2015-09-172-16/+1
| | | | | | | | | | | | | | | | | | | | | | | Add config option to use the old accelerometer reference frame, which is used on samus and products using 3.14 or earlier kernel. This fixes samus so that the lid angle calculation is correct again. This also moves the accel_orientation structure out of the board directory and into common code, since it purely is a function of the reference frame being used. BUG=chrome-os-partner:43494 BRANCH=none TEST=test on samus, verify lid angle calculation is correct once again. also, enable the motion_lid test and verify that it passes. Change-Id: I948a74a71964b54c68be66e828a030ddd0418947 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/300510 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: Refactor Kionix Accelerometer drivers.Aseda Aboagye2015-09-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new basic driver for the Kionix KX022 Accelerometer. Currently, the driver is capable of reading the sensor data and manipulating its ODR, resolution, and range. This sensor also has integrated support for Directional Tap/Double-Tap(TM), however that functionality is not yet implemented in the driver. Lastly, since this accelerometer is very similar to the previous KXCJ9, this commit tries to combine the drivers. Note, the variant of the Kionix accelerometer MUST be specified in the private data structure. BUG=chrome-os-partner:43494 BRANCH=None TEST=Build GLaDOS EC with driver enabled and verify that valid accelerometer data is read, and that range, resolution, and odr can all be modified. TEST=Build samus EC image and verify that the lid still works. Additionally, verify that I can change the odr, rate, and resolution. TEST=make buildall tests Change-Id: I238ff1dc13f5342a93f8f701a0da85c52f25d214 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/299013 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* samus: gyro is on all the time.Gwendal Grignou2015-09-141-1/+1
| | | | | | | | | | | | | | Given it is in the chip as the accelerometer, it is on all the time. Put it in suspend by setting its ODR to 0 is S3 and S5. BRANCH=smaug BUG=none TEST=gyro still works in S0 and after S3/S5 transitions. Change-Id: Ibbf51eb555e2c513a6561a1d22e231796b3da4b4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299542 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* common: Add variable to enable software gesture recognition.Gwendal Grignou2015-09-111-0/+1
| | | | | | | | | | | | | | | Gesture recognition can be done in software (by the EC) or in hardware, by the sensor itself. Add variable to compile gesture.c only in the software case. BRANCH=smaug TEST=compile. BUG=b:23570481 Change-Id: I22bef0bf744516df267020d9458e0299a4da3d72 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296211 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* als: Disable task when host is not runningDuncan Laurie2015-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the ALS is not enabled in S3/S5 states then it will generate errors when trying to read so should be gated. This could be done with a check for chipset_state or adding a new CONFIG_ALS_POWER_GPIO to check. However the ALS is also not needed when the host is in S3/S5 yet the task continues to run in the background every 1 second. This commit adds a new task enable/disable hook to disable the task when the system is suspended and enable the task when it is resumed. In order to fit this new task in glados the als console command is guarded by a new config option. Since this is not a very frequently used/needed console command it is disabled by default. And finally the kunimitsu and strago boards try to enable ALS but they never actually enabled the ALS task so this new code was failing to build because TASK_ID_ALS did not exist. Also samus was enabling it but as TASK_NOTEST so tests will fail, though they are disabled globally on samus. BUG=chrome-os-partner:43493 BRANCH=none TEST=enable ALS on glados and successfully build and use it, also successfully build EC and tests for kunimitsu, strago, and samus which are the other boards that use the ALS task. Change-Id: I192940d7f306a1663c7cb789c313151bbb5f2b90 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298156 Reviewed-by: Shawn N <shawnn@chromium.org>