summaryrefslogtreecommitdiff
path: root/zephyr/emul/emul_isl923x.c
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: add a zephyr/ prefix to all zephyr includesFabio Baltieri2022-05-091-6/+6
| | | | | | | | | | | | | | | | | | | This adds a zephyr/ prefix to all #include path pointing to Zephyr header files, so that we could drop LEGACY_INCLUD_PATH once all upstream code has been converted. Generated using something similar to the script in: c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I5ba2c859fe10a34ea8d3a49a612132ea4d02f2cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3634345 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: test: Add tests for AMON/BMONAl Semjonovs2022-03-291-0/+12
| | | | | | | | | | | | | Add test cases to validate AMON/BMON BRANCH=none BUG=b:184856906 TEST=zmake -D configure --coverage --test zephyr/test/drivers/ Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: Ia802e4c5c0203a8c0cd20925b8da3e7be68e174d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454204 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: drivers: Add rule to reset emulated to registersAl Semjonovs2022-03-101-1/+24
| | | | | | | | | | | | | | | Reset emulated registers to successful state after each test BRANCH=none BUG=b:184856906 TEST=zmake testall Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I2ee77a15a94a176fc7b67d1284ff1d3386b2357b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3459741 Reviewed-by: Tristan Honscheid <honscheid@google.com> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr test: Set ISL923x in natural unitsAbe Levkoy2022-01-311-3/+2
| | | | | | | | | | | | | | Accept voltage in mV as an argument to isl923x_emul_set_adc_vbus. Test using this interface. BUG=b:216497851 TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I8a0ec6019f1d4ef7853d731b11726e4fb1bdf136 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425638 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: emul: use non-deprecated includesAaron Massey2022-01-241-1/+1
| | | | | | | | | | | | | Drop usage of deprecated <emul.h> for <drivers/emul.h> BRANCH=none BUG=none TEST=zmake configute --test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I9e221f44fa3b70305916914c0bbeed21b6a6bed8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3413067 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: emul: ISL923x upgradesTristan Honscheid2021-12-161-130/+122
| | | | | | | | | | | | | | | | | | | | | | Make some improvements to the ISL923x emulator for upcoming unit tests * Add support for new registers: * Min. voltage reg * Control 4 * Control 8 * Info 2 * Use macros in the read/write reg functions to cut down on a lot of repeated code * Add a function for manipulating the AC OK status BRANCH=None BUG=b:184856906 TEST=zmake -D configure --test test-drivers; Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I67e9f21ce3903726f87f23c1b2d4e24965d1371f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3327328 Reviewed-by: Sam Hurst <shurst@google.com>
* zephyr: Connect isl923x emul to battery emulJeremy Bettis2021-11-241-0/+43
| | | | | | | | | | | | | | | | | When the current limit is changed in isl923x, also change the reported battery current. BRANCH=None BUG=b:201314530 TEST=integration_usb Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I8ed908b451ba2b998edd4a1891e487e743ea6e4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3298887 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: test: isl923x::initYuval Peress2021-10-051-0/+9
| | | | | | | | | | | | | | | | Test the remaining (failure/uncommon) code paths in init(). This includes a mocking of the system_jumped_late function which was already stubbed to always return false. This mock will later need to be cleaned up with a better mock to avoid the custom struct added. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I1be53b0a15850d8b97b7b5a96ccef764f0782816 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201916 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: test: isl923x::get_vbus_voltageYuval Peress2021-10-051-0/+18
| | | | | | | | | | | | | | Verify all the code paths in get_vbus_voltage (including calculated mV value). BRANCH=none BUG=b:201819565 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I508880a8af30c2d546655424b289d521f3c22626 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201915 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: test: Add ctrl3 register for isl9238 emulatorYuval Peress2021-10-051-0/+19
| | | | | | | | | | | | | | Adding support for this register improves code coverage for the existing init function. No additional tests are needed at this point. BRANCH=none BUG=b:201819565 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I9e19372501775940f1a23d05317ba3971212083a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201913 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: isl923x set/unset comparator inversionYuval Peress2021-10-051-0/+19
| | | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I3296c94fd2b591a37349f08c3cd29c92ce5831b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201912 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: isl923x DC prochotYuval Peress2021-10-051-0/+20
| | | | | | | | | | | | | | Verify setting the prochot amps as well as edge conditions BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I12cd413172bfdf395a1c60ef7e487b33687202bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200055 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: test: isl923x AC prochotYuval Peress2021-10-051-0/+27
| | | | | | | | | | | | | Verify setting the prochot amps as well as edge conditions BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I306adf1d74eea65a8522c61e5ed71cf8deacfe2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200054 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: test: isl923x::set_mode always turns off learn modeYuval Peress2021-10-051-0/+18
| | | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ic2481c0de52268cc65475de8e79f1db7834358d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198686 Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: verify isl923x get/set ctrl 0/1 registersYuval Peress2021-10-021-0/+38
| | | | | | | | | | | | | | | Test the code paths for the options in control 0 and 1 registers. Including the expected bits 23 and 0 which will always be 0 when reading. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I9fd4e00b8a3f6fcc7a7295f1084987b7bb493e56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198238 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: test: verify isl923x device ID code pathYuval Peress2021-10-021-0/+17
| | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I08b24d571e0b27fd7fc5f644efdba18c5a639128 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198237 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: verify isl923x manufacturer ID code pathYuval Peress2021-10-021-0/+18
| | | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I2000ea7ea73a311184c5f66c3aa16518261b065d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198236 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: test: isl923x: Test input current get/setYuval Peress2021-10-021-0/+55
| | | | | | | | | | | | | | Test all the code paths for the get/set input current of the isl923x. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I452690a4087c97b67e75bad23e1b82e5b3dc366a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198235 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: test: isl923x: Add tests for get/set volt/currentYuval Peress2021-10-011-1/+72
| | | | | | | | | | | | | | | Add emulator functionality to support getting/setting the voltage and current of the isl923x. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Id3e16c810a296bd697326d358dfcabb350defc5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195203 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: test: Add stub isl923x emulatorYuval Peress2021-10-011-0/+64
Add the skeleton code needed to emulate the isl923x charger. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ic9af555ccd7ff6a0be2e7a0818b5e566816a0c13 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195202 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>