summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* i2c(npcx): Replace cprints by cputs/cprintfNicolas Boichat2018-03-172-12/+13
| | | | | | | | | | | | | | | | | These print-outs are usually very deep in the call stack (rare error cases that do not happen often), and therefore are the longest branches on most tasks. Replacing cprints by cputs/cprintf helps with that. BRANCH=none BUG=b:75234824 TEST=make BOARD=soraka SECTION=RW analyzestack | grep Task shrinks significantly (more than 100 bytes on some tasks) Change-Id: I7c5bb750f4aa624cd06736e0bb6b24d307fc0196 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966041 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Nami: Remove thermal controlDaisuke Nojiri2018-03-162-20/+0
| | | | | | | | | | | | | | | | | On Nami, the CPU will manage temperature control. The EC's role is passive. It sends the CPU temperatures read from the sensors upon request and to control the fan speed as instructed. This patch removes thermal control. BUG=b:72959743 BRANCH=none TEST=Boot Nami Change-Id: If4bb7b9774e417813190327c98232eca536ba9c1 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/967145 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* Nami: modify battery smbus frequencyElthan_Huang2018-03-161-1/+1
| | | | | | | | | | | | | | | | | | | Modify battery smbus frequency to 100KHz. Due to the max working frequency is 100KHz, so EC change for support it. BUG=b:75077297 BRANCH=none TEST=Verify TI gauge battery that can be recognize via ec console. Change-Id: Ibdafdadbc83faed5b40b5ba00b179867ce307151 Signed-off-by: Elthan_Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/966048 Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com> Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* console: Fix help for parse_boolEdward Hill2018-03-162-3/+3
| | | | | | | | | | | | | | | A few commands had help text of "[0 | 1]" but parse_bool() doesn't recognize 0 and 1. Change help text to "[on | off]", matching other commands. BUG=b:75302458 BRANCH=none TEST=none Change-Id: I9b1e4a70e024d17ec8bccc015069e31d7fff08ca Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/967248 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* config: Put all sensor interrupt config events at a single locationGwendal Grignou2018-03-161-13/+5
| | | | | | | | | | | | | The number of interrupt events will increase with the ST sensors support. BUG=b:73546254 BRANCH=none TEST=compile Change-Id: If375afa97ad664594f005a6b007aa7d9439e8ecb Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/767611 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* EFS: Perform EFS even if flash WP is enabledDaisuke Nojiri2018-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | This patch removes flash WP check in the EFS main. It means even if the SPI flash is not write protected, it performs EFS. This allows dogfood devices to boot just like normal devices. BUG=b:74983574 BRANCH=none TEST=Boot Fizz. Verify EFS works as expected. HW_WP=0, SW_WP=0: No EFS HW_WP=0, SW_WP=1: No EFS HW_WP=1, SW_WP=0: EFS is performed (Dogfood devices) HW_WP=1, SW_WP=1: EFS is performed (Normal devices) Change-Id: I33b39463d6bd16fe0fc398cd49f3c92c76fa5103 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/964740 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* grunt: GPIO changes for board version 2Edward Hill2018-03-163-24/+55
| | | | | | | | | | | | | | Define GPIOs for board versions 0 and 2. Read version in board_init() and configure GPIOs correctly. BUG=b:74538637 BRANCH=none TEST=build + boot grunt (version 0) Change-Id: I1ff23d5c114cb12e3a32ef069f5e5dff50640d3f Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966591 Reviewed-by: Martin Roth <martinroth@chromium.org>
* temp_metrics: use fanduty 0 to enable fanRuben Rodriguez Buchillon2018-03-161-0/+3
| | | | | | | | | | | | | | | | | | | If the fan is never enabled, temp_metrics itself has no code-path to enable the fan. This fixes this by calling fanduty 0 in the beginning of temp_metrics, since fanduty does explicitly enable the fan. Note: This is a hack to avoid having to flash a new EC image. See crrev.com/c/964037 for a more fundamental fix to the same issue. BRANCH=link BUG=chromium:808764 TEST=couldn't reproduce issue with this version of temp_metrics. Change-Id: I8a9b258ba7b50cf5180497d318f8d94454dab434 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/964069 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Sameer Nanda <snanda@chromium.org>
* meowth_fp: move large buffersVincent Palatin2018-03-162-1/+11
| | | | | | | | | | | | | | | | | | | | | Configure the large arrays for the image frame and template in other SRAM memory regions to free up space for the malloc heap in the 'main' SRAM. Note: the template buffer is only used in future CLs. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:72360575 TEST=on ZerbleBarn, run the 'shmem' console and see 500kB of heap available for malloc. Change-Id: I31a1b4fb0d5e124e3229d29386cc6500e402dac0 Reviewed-on: https://chromium-review.googlesource.com/946370 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver: bma2x2: Add perform_calibGwendal Grignou2018-03-166-48/+92
| | | | | | | | | | | | | | | | | | Add fast compensation automatic calibration, like bmi160. Use timestamp_expired for timeout measurement for both perform_calib functions. Remove driver offset field, remove private bma2x2 structure. BUG=b:73205042 BRANCH=master TEST=echo 1 > calibrate perform calibration. Reading in_accel_*_calibbias is within range. Check on Lami for both bma2x2 and bmi160. Change-Id: I3472865287fa4769a05e6f872b92d7c3f933cb4e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/957872 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* board: kevin: undefined i2c_xfer commandGwendal Grignou2018-03-161-1/+1
| | | | | | | | | | | | | Save some space on kevin. BUG=b:73205042 BRANCH=master TEST=Can compile kevin with perform_calib addition. Change-Id: If1526a90925ad20e4cc335e68de266cbc1ae6a42 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/961223 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* scarlet: Enable BC 1.2Philip Chen2018-03-154-2/+18
| | | | | | | | | | | | | | | | | The CLs supporting BC 1.2 with rt946x have been merged. It's time to enable BC 1.2 on Scarlet! BUG=b:65446459 BRANCH=none TEST=Charge Scarlet rev4 with SDP (500mA), DCP (1500mA), PD charger, and Type-C charger (3000mA). Change-Id: Ia3c7a700586bc15d94c4ef104fbd5afc8be9b0af Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/905934 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: sensor: Remove set_resolution when NOOPGwendal Grignou2018-03-1510-79/+2
| | | | | | | | | | | | | | set_resolution is only used for few sensors and is not exposed to the AP. Remove definition when sensors have a fixed resolution. BUG=none BRANCH=master TEST=compile, kevin has enough space for perform_calib. Change-Id: I8482387e135356467edaee44da3a0e47cf1db524 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/961222 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* poppy/soraka: Disable power button shutdown timer on the PMICFurquan Shaikh2018-03-151-0/+3
| | | | | | | | | | | | | | | | | | Similar to eve, disable power button shutdown by PMIC on long press of power button. Using Vup+Pwr is the still the best way to do a PMIC reset. BUG=b:74866345 BRANCH=poppy TEST=Verified that holding power button for >80 seconds did not trigger PMIC shutdown. Change-Id: I6a844b1b5d68a9e28daaf0452e461233057e1869 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/964889 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* gsctool: require exactly two hash sections for every boardVadim Bendebury2018-03-152-42/+62
| | | | | | | | | | | | | | | | | | | | | | | The same Chrome OS device could have not only several released firmware images, but also several variations of the GBB contents. Any permutation of these two sets is possible, but both areas must match, as modified GBB is no smaller problem than modified code or RO data. With this patch the verifier will continue looking for board sections in the descriptors database until the entire database has been scanned. Only finding exactly two sections, and each section providing proper matches will qualify the check as 'pass'. BRANCH=none BUG=b:73668125 TEST=verified that both single and dual section descriptions are processed properly, and that matching 1 and 3 sections triggers a return error. Change-Id: I181655192246ce245c43e6ce7ba4768ac5c9e51a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/951864 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* driver: kionix: Use base accelgyro structureGwendal Grignou2018-03-152-11/+11
| | | | | | | | | | | | | | Unify get_range/get_datarate by using accelgyro_saved_data_t structure. BUG=none BRANCH=none TEST=compile Change-Id: I0bfa2f06c5dd2021a5af9e6499c97e65988167ce Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/961221 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* 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>