summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* driver: bma2x2: Remove tables for range/frequencyGwendal Grignou2018-03-152-82/+37
| | | | | | | | | | | | | | | | To save space, instead of using tables, use macros to convert range/frequencies into register values. BUG=b:73205042 BRANCH=none TEST=Check we save space on Kevin. (184 bytes looking at __image_size in kevin.RO.map). Check on nami that range/bandwidth are set properly. Change-Id: I193768be1f2e7325b986e8ccff25a7809bfb4096 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959388 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* board: nami: Enable sensors in forced modeGwendal Grignou2018-03-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sensors without interrupt line needs to be in forced mode, otherwise the EC may not poll them. BUG=b:73205042 BRANCH=master TEST=Check with accelrate the ec rate is 100ms by default: Before: > accelrate 0 Data rate for sensor 0: 15620 EC rate for sensor 0: 0 Current EC rate: 1000000 Current Interrupt rate: 0 After: +accelrate 0 Data rate for sensor 0: 15620 EC rate for sensor 0: 100000 Current EC rate: 100000 Current Interrupt rate: 0 Change-Id: Ib626e06f572d97efe4ccd80bf87c18958f940c5c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/960940 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ec: Add /baseboard to EC projectScott Collyer2018-03-157-13/+62
| | | | | | | | | | | | | | | | | | | | | | This CL introduces /baseboard to the EC project which can contain config options and code which is specific to certain family, but can be shared among the board derivatives of that family. Only the infrastructure changes are included with an empty baseboard.c/.h for octopus. BRANCH=none BUG=b:74358864 TEST='make buildall' and ensure that all boards build successfully. In addition, temporarily moved config options for USB-C and charger to baseboard.h and tested that 'make BOARD=yorp' is successful. Change-Id: I16656574f835c56598a9d2bf49bc1e946d71fe76 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/954444 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* board: In motion sensor array, remove assignment to 0Gwendal Grignou2018-03-1421-968/+2
| | | | | | | | | | | | 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
* battery/max17055: Fix the unit of cycle countPhilip Chen2018-03-141-1/+9
| | | | | | | | | | | | | | | | | | The cycle counts we get from battery_cycle_count() is in the unit of 1%. But we should convert it to absolute count to match the behavior of a smart battery. BUG=b:74576000 BRANCH=scarlet TEST='ectool battery' shows reasonable cycle counts Change-Id: I9d351f8766c90e0addb72a088917ddadfa6c840a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/961303 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: OPT3001: Re-order application of scale.Aseda Aboagye2018-03-141-3/+6
| | | | | | | | | | | | | | | | | This commit simply reorders the application of scale in order to preserve the sensor precision. BUG=b:72985601 BRANCH=stabilize-meowth-10444.B TEST=Flash meowth; Set scale to 1000; Verify that more significant digits are present compared to before. Change-Id: Ibf46e574fccdde50ceb5f8174f9b4a29e60bfbfe Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/955967 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* scarlet: Hookup the vsync pin and the sync driverAlexandru M Stan2018-03-143-2/+46
| | | | | | | | | | | | | | BUG=b:67743747 TEST=With kernel driver, turn on camera and see interrupt here for every frame. BRANCH=master Change-Id: I447f753cb2224bf78442fbd15c5fa2d2c713a9e7 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802832 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* sensors: Add driver for SYNCAlexandru M Stan2018-03-144-0/+151
| | | | | | | | | | | | | | | | | Useful for recording the exact time a gpio interrupt happened in the context of sensors. Adding it for camera vsync purposes. BUG=b:67743747 TEST=With next patch see it work on scarlet. BRANCH=master Change-Id: Ic8e8fb444e08200e5d8daded8b4a5920b13431ac Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/850580 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* motion: Lower jitter of Sensor->EC timestampAlexandru M Stan2018-03-145-23/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead getting the time for each sample in the task code, we should be getting it as soon as the sensor reported it added it to its fifo (so sensor just finished integration). Because of that each sensor should provide the time when it provides a sample, ideally from an accurate spot like an interrupt. Deprecate motion_sense_fifo_add_unit (without a timestamp) in favour of motion_sense_fifo_add_data (which adds the timestamps). Update all relevant sensors to use the new api. Note: for now I focused on the BMI160, where I actually made it get the time in the interrupt. The other sensors were made to use the new api, but still don't record the time in the right place (though it's not any worse than before). BUG=b:67743747 TEST=In the kernel, fifo_info->info.timestamp still has sane values. TEST=CTS should still pass BRANCH=master Change-Id: I9829343f8702e00cc19f9c88134fa1f258c9e1e9 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/807331 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* power button: Wait for charger and battery initializationEdward Hill2018-03-131-5/+16
| | | | | | | | | | | | | | | | | | | | | | | For PWRBTN_STATE_INIT_ON, before attempting to power the system on, we need to wait for charger and battery to be ready to supply sufficient power. Check every 100 milliseconds, and give up after 1 second. This allows time for charger, battery and USB-C PD initialization. Previously, init-on would fail because it called set_pwrbtn_to_pch too soon (before charge current had been initialized, and before the USB-C 3A current was detected). BUG=b:72645441,b:74017044 BRANCH=none TEST=cold reset Grunt with ac/battery connected/disconnected Change-Id: I0413e7f2d7b19a99c994b51b22f28a2f993137de Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/900049 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* nds32: task: allow context switching if task_start() is calledDino Li2018-03-132-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | We got a symptom that keyboard didn't work without connecting servo board after this change (CL:897315) was merged. This is because our uart RX will receive a data (0) with framing error if RX level is low and trigger a re-scheduling request in uart ISR (HOOKS task will be wake at later and then start the task scheduling). And that will cause we don't return to main() function to finish all operations of initialization after uart_init() is called. I think we will get the same symptom if GPIO/peripheral interrupts are enabled and wake some task at initialization. This change makes sure we will start the task scheduling if task_start() is called. BUG=none BRANCH=none TEST=With this change, keyboard works after EC reboot without servo board connected. Change-Id: I0bda84b1cb56ced6aad2a38b0786d1b336e77211 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/956794 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cr50: fix hash database parser to reject misformatted offsets/sizesVadim Bendebury2018-03-131-1/+1
| | | | | | | | | | | | | | | | | Section offsets and sizes are hex numbers which should not be longer than 8 characters. BRANCH=none BUG=b:73668125 TEST=descriptions which miss the size field are properly reported now. Before the utility would just terminate with an error without a message. Change-Id: I9bc461b5f848b80e464fecc9b40dcf0ea213c9a7 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949311 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* driver: bma2x2: indent register definitionGwendal Grignou2018-03-122-95/+98
| | | | | | | | | | | BUG=none BRANCH=none TEST=compile Change-Id: I9507cbe760f886acaa4c6b432cfd8482faeb4618 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959387 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charger/rt946x: Enable charge current terminationPhilip Chen2018-03-122-1/+7
| | | | | | | | | | | | | | | BUG=b:74373538 BRANCH=scarlet TEST=confirm charge current drops to 0mA right after it hits 400mA, when battery is nearly fully charged Change-Id: Icd4a7886bf68f3bd4ed91d2b8e705cb62f6e4fb8 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/958295 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org>
* nami: Order sensors properlyGwendal Grignou2018-03-122-147/+147
| | | | | | | | | | | | | | | | When reading through IO memory is set up for sensors (LPC is used), the first 2 entries must be accelerometers, then gyroscope. For BMI160, accel, gyro and compass sensors must be next to each other. BUG=b:73205042 BRANCH=none TEST=Can read lid sensor information. Change-Id: Ic188f6d4b1a23c7073c2a10f600fccb8d9c0d93e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/957303 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
* nautilus: Customize charging algorithmPhilip Chen2018-03-121-16/+63
| | | | | | | | | | | | | | | | | | | | | | According to the battery datasheet, the battery requires different voltage/current in different operating temperature. But this battery doesn't smart enough to ask for the proper voltage/current as the datasheet states. So let's override the charging voltage/current based on the datasheet. BUG=b:70906362 BRANCH=none TEST=none Change-Id: I5d6607a41970f6a1b62e6e410ae85f1f69a63a7c Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/935204 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: YongBeum Ha <ybha@samsung.com> Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* grunt: Improve battery presence checksEdward Hill2018-03-123-2/+97
| | | | | | | | | | | | | | | | | | | | | | | | Use CONFIG_BATTERY_HW_PRESENT_CUSTOM and CONFIG_BATTERY_PRESENT_CUSTOM to make Grunt closer to Coral and Eve. This gets auto-power-on-with-no-battery closer to working, because charge_prevent_power_on uses battery_hw_present for its factory override check: "Factory override: Always allow power on if WP is disabled, except when auto-power-on at EC startup and the battery is physically present." BUG=b:72645441 BRANCH=none TEST=cold reset Grunt with battery connected and disconnected Change-Id: I2b158bedcad7dffc340992dc020145a4c6e60802 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/900048 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* servo_micro: switch parity to 8 bit dataNick Sanders2018-03-122-2/+11
| | | | | | | | | | | | | | Parity defaulted to 7 bit data, but hammer wants 8 bit. Change servo_micro to match. BRANCH=servo-firmware BUG=b:37513705 TEST=flash_ec -b hammer Change-Id: I91cc126b03c99107084fb0d1d2e90031b2435fe2 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/952677 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* meowth: zoombini: Ignore AC when checking cutoff.Aseda Aboagye2018-03-121-24/+20
| | | | | | | | | | | | | | | | | | | | | | | | | When charge manager safe mode is enabled, it prevents us from selecting CHARGE_PORT_NONE if we have a battery which is disconnected/cutoff. The cutoff reporting code was essentially making the assumption that if AC is not present, then we must be running off of battery power. However, AC presence is debounced and can take some time to be reported to the system. Therefore, we may wrongly assume that we are running off of battery power and cut off our AC power source. This commit simply removes that assumption and still consults the battery regarding the cutoff/disconnect state. BUG=b:74125001 BRANCH=stabilize-meowth-10444.B TEST=flash meowth; cutoff battery, insert AC, verify system comes up. Verify that CHARGE_PORT_NONE is not selected until battery wakes up. Change-Id: I79a27bd2d5f09c2ffe65df98402c0ae0182fdba2 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/957888 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Nami: Disable one USB-C portDaisuke Nojiri2018-03-095-10/+12
| | | | | | | | | | | | | | | | The TCPC of the left USB-C port is being swapped with Anx7447. This patch temporarily disables the port so that the boot is not inhibited by running a wrong driver on the port. BUG=b:73793947 BRANCH=none TEST=Boot Nami with/without battery. Verify it can be charged through the right port. Change-Id: I30b63f87cb3669c38a04e908b6556eef1424fbd7 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/957814 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* charger/rt946x: Limit ADC timeout to 50msPhilip Chen2018-03-091-13/+17
| | | | | | | | | | | | | | | | | | | | | In practice, ADC conversion rarely takes more than 35ms. However, according to the datasheet, ADC conversion may take up to 200ms. But we can't wait for that long, otherwise host command would time out. So here we set ADC timeout as 50ms. If ADC times out, we just return the last read vbus_mv. BUG=b:70641844, chromium:780364 BRANCH=scarlet TEST=test 'ectool usbpdpower' for 50k cycles w/o seeing host command timeout Change-Id: I09c3abf729e96b113f7a0f64a67cd35906da9e3e Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/956900 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org>
* usbc: add config support for multiple (and no) vbus adc channelsJett Rink2018-03-098-14/+34
| | | | | | | | | | | | | | yorp measures each port's vbus separately on a deticated ADC. Also, add config to take care of ADV_VBUS -1 case too. BRANCH=none BUG=b:74127309 TEST=none Change-Id: I6f4df96caffc3b527b69e67358631dd448172cde Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956555 Reviewed-by: Edward Hill <ecgh@chromium.org>
* bc12: add support for active low/high on all gpio signalsJett Rink2018-03-096-27/+119
| | | | | | | | | | | | | | yorp inverts both bc12 signals and the bc12 driver needs to handle the inverted logic BRANCH=none BUG=b:74127309 TEST=none Change-Id: I6848375fc652251aecb553c3f53d62a5f775bec4 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956321 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion: remove load_fifoGwendal Grignou2018-03-096-227/+234
| | | | | | | | | | | | | | | | | | | | | To prevent invalid timestamping, call load_fifo only when we get a FIFO interrupt. In consequence, remove load_fifo entry point and only process fifo inside the IRQ. Add helper function to know when we are in forced mode (the EC needs to periodically read sensor data or interrupt driven). BUG=b:73557414 BRANCH=master TEST=compile Change-Id: I959e476f3f7215be95424c07223f7421e8b13da1 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/938146 Commit-Ready: Alexandru M Stan <amstan@chromium.org> Tested-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* sensor: bmi160: Don't batch data on the sensorAlexandru M Stan2018-03-091-3/+2
| | | | | | | | | | | | | | | | | | | Set the sensor side fifo watermark to interrupt the EC as soon as there's any data in there, that way we get more frequent accelerometer interrupts (which is handy when you want to mark down the time of each sample accuratelly). BUG=b:67743747 TEST=Sensor should still be working normally, the ec will probably start recieving sensor interrupts (before this was probably not the case). BRANCH=master Change-Id: I726550e68447a74bbfed88b703d2f68b6967ac93 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956626 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* coral: removing unused CONFIG_USB_PD_TCPC_BOARD_INITJett Rink2018-03-091-1/+0
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: Iaae5aa12b329b859d775605c4e117b17816da28b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/953064 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* yorp: add USB-C, Power, Charging skeleton codeJett Rink2018-03-097-3/+592
| | | | | | | | | | | BRANCH=none BUG=b:73811887,b:74127309 TEST=none Change-Id: Iac2d90e63db151d37db871dc33681dc35e9127a5 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/955941 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* yorp: add usb gpio definitionsJett Rink2018-03-092-2/+66
| | | | | | | | | | | BRANCH=none BUG=b:74127309 TEST=none Change-Id: I598da6cd2f5e1cd262d0994c2e265a74cbc8fcc1 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/952960 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* meowth: suppress noisy host commands loggingVincent Palatin2018-03-092-0/+5
| | | | | | | | | | | | | | | Before enabling timberslide/eclog, suppress noisy host commands from the console output. BRANCH=none BUG=b:74394742 TEST=none Change-Id: I7db1ff4d8f4b8c4d7fba49e053ceecba0eb840fb Reviewed-on: https://chromium-review.googlesource.com/955649 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* charge_state_v2: When suspended, charge base if battery criticalNicolas Boichat2018-03-091-10/+15
| | | | | | | | | | | | | | | | | | | The exact behaviour still needs to be optimized based on actual power consumption (for example, it might be worth providing power to base without charging it, or charge it a bit more, then let it slowly discharge). BRANCH=none BUG=b:71881017 BUG=b:74414928 TEST=Low base battery, check that lid provides power to it in S0 or suspend. TEST=Check that lid stops providing power in S5. Change-Id: Idf198ab1b4358827f9db6c0898234b6e2be45808 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956982 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charge_state_v2: Simplify low-battery base power logicNicolas Boichat2018-03-091-8/+13
| | | | | | | | | | | | | | | | | | | | | When the base battery is low, we need to provide it with some power, to make sure the battery does not fully deplete. Instead of relying on a separate configuration value, we simply reuse min_base_system_power. Also, we fix a bug that incorrectly used a power value as current. BRANCH=none BUG=b:71881017 BUG=b:74414928 TEST=With a critically low wand (3%), lux is able to provide enough power to charge wand battery a little (44mA), even when backlight is fully on, and touchpad is in use. Change-Id: I3174ac273712eeb83ce1283dda3d786ad503e6f3 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956661 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* i2c: npcx: Check that unwedging succeedsSimon Glass2018-03-091-3/+6
| | | | | | | | | | | | | | | | | | | | | | | If the I2C port is completely broken then there is no point in trying to continue with the transaction. This can happen if the pull-ups on the bus are not working because they are in a power domain which is not currently enabled. Check the return value from i2c_unwedge() and return if it doesn't work. Tidy up a few comments at the same time. BUG=b:72129419 BRANCH=none TEST=manually remove the check AP being off in sb_tsi_get_val() and see that it quickly fails now, rather than hanging the EC for a while trying the transaction. Change-Id: I66ab52943459726537dfc74355f8aeaa5817dba5 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956017 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Aaron Durbin <adurbin@google.com>
* isl923x: Round up requested OTG currentNicolas Boichat2018-03-092-3/+6
| | | | | | | | | | | | | | | | | | | | Without this patch, requesting 100mA or output current would be rounded down to zero. This would also cause other issues when doing base/lid and lid/base power transfers on lux/wand, as the input current has a much finer grain control, which could lead the input charger to brown out the output charger. BRANCH=none BUG=b:67920792 TEST=Flash lux/wand, lux can provide as little as 100mA of current successfully. Change-Id: Ibf170a6ee3c2dfbdbbc03948c3b0e6ab878eee47 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956660 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* wand: Hibernate instead of cutting battery power if battery is lowNicolas Boichat2018-03-091-1/+0
| | | | | | | | | | | | | | | | | | If wand ever reaches low enough battery level (<3%), it should hibernate, instead of cutting off the battery, as the latter will disable all the switches, and lead lux to redetect the base. BRANCH=none BUG=b:74414928 TEST=Discharge wand as much as possible, then put lux in S0ix (no power transfer currently), discharge wand further (using pwm 0 100 to activate backlight to draw a bit more power), see that wand goes into hibernate. Change-Id: I9edb517aada7d21fbcddbce4ad06ab7fbcafce38 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956659 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* base_detect_lux: Only allow enabling power if base is connectedNicolas Boichat2018-03-091-2/+7
| | | | | | | | | | | | | | | | | | | Since we only enable power to the base in the charger task (we can't enable power before OTG/power allocation is setup properly), there is a potential race when we quickly plug/unplug the base. Fix this by only allowing the enable power when the detection code knows that the base is actually connected. BRANCH=none BUG=b:74403503 TEST=Plug/unplug wand several times with charger attached, PPVAR_VAR_BASE is always 0 whenever the base is disconnected. Change-Id: I96da9ed39ddbbbe7aea54ad96c62fde6115538c0 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956204 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* scarlet: set accelerometer default range to +/- 4gAlexandru M Stan2018-03-091-1/+1
| | | | | | | | | | | | | | | BUG=b:67743747 BRANCH=master TEST=sensor should still work, ARC++ apps should see bigger range Change-Id: I81a5399711bd6a5311b8b486978a398388554222 Suggested-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956878 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Allow repeated waitms commands without resettingSimon Glass2018-03-081-1/+14
| | | | | | | | | | | | | | | | | | | | At present issuing several 'waitms 1000' commands immediately after each other trips the watchdog. Add a watchdog reload to avoid this. Also document the behaviour in the command help. BUG=b:72542719 BRANCH=none TEST=manually on grunt, pasting these three lines in: waitms 1000 waitms 1000 waitms 1000 and see that it does not reset now. Change-Id: I453708299e4e26c1bbdb5fc406f26e916e7389af Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/955927 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org>
* scarlet: Limit the maximal acceptable VBUS to 9.5VPhilip Chen2018-03-081-1/+1
| | | | | | | | | | | | | | | | We're prioritizing lower voltages for efficiency. BUG=b:74399717 BRANCH=scarlet TEST=build scarlet Change-Id: I85090f75f4dae2be269957ffc3745eb54c446f7a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/956355 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org>
* cleanup: remove incorrect commentJett Rink2018-03-083-9/+9
| | | | | | | | | | | | | | The port_address field is used in the driver. Also making array declaration consistent with other parts of the file. BRANCH=none BUG=none TEST=none Change-Id: I43c72182c6afefbdbb7286918326b7ea6f92c7d7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/955940 Reviewed-by: Edward Hill <ecgh@chromium.org>
* motion: driver: Fix activity inclusion in accelgyro.hGwendal Grignou2018-03-081-1/+1
| | | | | | | | | | | | | | | | | | list/add_activities should be include even when FIFO support is not compiled it, when the host is not asking for them, as it is needed for double tap support. BUG=b:73546254 BRANCH=master TEST=Compile when just CONFIG_GESTURE_DETECTION is defined. Change-Id: Icec7ccec7fd8463ea40afbe05ce1e177ae7d609d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/924404 Commit-Ready: Gwendal Grignou <gwendal@google.com> Tested-by: Gwendal Grignou <gwendal@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@google.com>
* rma_reset: add server side responseMary Ruthven2018-03-081-6/+61
| | | | | | | | | | | | | | Add support for generating the authcode from cr50's challenge. BUG=b:74019846 BRANCH=none TEST=create a cr50 image with test keys. Verify that the output from rma_reset -c opens cr50. Change-Id: I85a209e55dc23daa118e0071e868878b6fbfcb69 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/945419 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tcpm/fusb302: Update VBUS supplier when VBUS level changesPhilip Chen2018-03-081-4/+22
| | | | | | | | | | | | | | | | | To enable USB charging on boards where fusb302 takes care of VBUS detection BUG=b:65446459 BRANCH=none TEST=on Scarlet rev3, verify VBUS supplier is updated based on whether VBUS is present - plug/unplug USB2 charger, boot with USB2 charger plugged. Change-Id: I50177d40b0eb0490634ad2f103306e0079633fbe Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/905401 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* yorp: Implement initial power sequence for chipset.Jett Rink2018-03-084-8/+134
| | | | | | | | | | | | | Also adding eSPI define. BRANCH=none BUG=b:74020444,b:74018816 TEST=none Change-Id: Id237de92ed1276213b60b61968e2fc59817e0aa7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949722 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* grunt: Enable discharge on ACEdward Hill2018-03-081-0/+1
| | | | | | | | | | | | | | | Add support for setting the battery to discharge even if AC is present. Used for factory testing. BRANCH=none BUG=b:74096137 TEST=ectool chargecontrol discharge, ectool battery Change-Id: I79e6bfabcfc0327e5c12c789decc27591911a6ee Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/954283 Reviewed-by: Cheng-Han Yang <chenghan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* stm32mon: fix progressbar parameterVincent Palatin2018-03-071-1/+1
| | | | | | | | | | | | | | | | | | Ensure that the short parameter '-p' works as well as the long one '--progressbar'. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=run 'stm32mon -p' and 'stm32mon --progress' none of them are displaying the command usage. Change-Id: If24accf0991dc9705a1fb3e29acf12581d7ab8dc Reviewed-on: https://chromium-review.googlesource.com/952966 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* npcx: remove optional CONFIG_PECI since no one is using it with npcxJett Rink2018-03-0714-13/+1
| | | | | | | | | | | | | | | | | | | Some boards have forgotten to undef CONFIG_PECI but it is benign. This should be an opt-in feature instead of an opt-out feature. No one is using it, so no one will opt-in. BRANCH=none BUG=none TEST=Verified that grunt, kahlee, meowth, and zoombini are not using the PECI bus for Soc temperature via schematics (GPIO81). Other boards are a no-op. See cl:951407 for steps taken to ensure all npcx boards were accounted for. Change-Id: I6ca4b9d22b7cb23c9842729658810ebe165ff6cc Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/951408 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* CBI: Make cbi-util set field size automaticallyDaisuke Nojiri2018-03-071-26/+41
| | | | | | | | | | | | | | | | | | | | | Currently cbi-util accepts only fixed length values. This patch makes it automatically calculate the required field size to accomodate the given integer value. The stored values are expanded to uint32_t when they're read. BUG=b:74174598,b:70702820 BRANCH=none TEST=Run cbi-util with --sku_id set to the followings: 0x10 -> field size = 1, 0x1000 -> field size = 2, 0x10000 -> field size = 4, 0x100000000 -> Error Change-Id: I2221ebfa18260bae2c574d9ebb794dbe645579e5 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/951711 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: fix error codes for servo v2 spi supportVincent Palatin2018-03-061-4/+3
| | | | | | | | | | | | | | | | | | | When the EC sends back an error code inside the 'result' field of the v3 protocol, the transport is supposed to return -EECRESULT-error_code. Fix the the servo spi transport to do so. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:72360575 TEST=with ZerbleBarn connected to a Servo v2, run 'ectool_servo fpinfo' and 'ectool_servo fptemplate badfile.bin' Change-Id: I54eec9194cfefd422078344500685736aadaffcf Reviewed-on: https://chromium-review.googlesource.com/951682 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* fan: Allow board to configure fans at run timeDaisuke Nojiri2018-03-0614-192/+251
| | | | | | | | | | | | | | | 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>
* npcx: Conforming CONFIG_UART_HOST define to match intentionJett Rink2018-03-0615-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CONFIG_UART_HOST is supposed to be defined to the index of the UART we want to use. It is not supposed to be defined as a boolean. Updated npcx and all incorrect uses. BRANCH=none BUG=none TEST=Added the following diff to ensure that everything still built: diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c index 446baa842..826233744 100644 --- a/chip/npcx/lpc.c +++ b/chip/npcx/lpc.c @@ -897,6 +897,9 @@ static void lpc_init(void) /* Initialize Hardware for UART Host */ #ifdef CONFIG_UART_HOST +#if !CONFIG_UART_HOST +#error "Fix me" +#endif /* Init COMx LPC UART */ /* FMCLK have to using 50MHz */ NPCX_DEVALT(0xB) = 0xFF; Change-Id: Ia46c7cb86c6040a5c75dddf23d5ccd8e33210581 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949308 Reviewed-by: Randall Spangler <rspangler@chromium.org>