summaryrefslogtreecommitdiff
path: root/zephyr/emul/emul_smart_battery.c
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: drivers: add smart battery mf access testTomasz Michalec2021-11-081-11/+19
| | | | | | | | | | | | | | | | Add test for sb_read_mfgacc() function. Smart Battery emulator is updated to handle custom read handler for unknown registers. BUG=b:184855975 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ie214fe39c3de3f9dd619f6556d8fd36b660725f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3259938 Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: test: Add a common i2c_emul_api instanceYuval Peress2021-10-011-5/+1
| | | | | | | | | | | | | | | | Refactor emulators that all set the same i2c_emul_api to use the same common API. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I6da6df23c77f0710a24bab8d9f0b7fb6fa14dff2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195201 Reviewed-by: Tomasz Michalec <tm@semihalf.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: update EMUL_DEFINE call sitesYuval Peress2021-09-101-1/+2
| | | | | | | | | | | | | | | | Update the call sites of EMUL_DEFINE to include the data pointer. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:3154404 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icb1a788a2ffcbdd969c231edb2214447041ed5ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153590 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: emul: i2c: Add device label for better debugYuval Peress2021-09-071-0/+1
| | | | | | | | | | | | | | | | Improve the debug output by including the device label in the common configs. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic331e7842efdfae70d3f994a694c7723fdcd9640 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144313 Reviewed-by: Tomasz Michalec <tm@semihalf.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Replace DT_ENUM_TOKEN with DT_STRING_TOKENJack Rosenthal2021-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Zephyr v2.7, DT_ENUM_TOKEN is deprecated in favor of DT_STRING_TOKEN. Additionally, DT_ENUM_UPPER_TOKEN is deprecated in favor of DT_STRING_UPPER_TOKEN. See the v2.7 release notes for details: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html Since we backported the DT_STRING_* macros to our v2.6 branch, let's switch to them ahead of time to prepare for the v2.7 uprev. Note: the DT_STRING_* macros are compatible with Zephyr's device tree enums, but also allow non-enum properties to be used in the same fashion. This commit does the bare minimum for compatibility with v2.7, i.e., just swap the macros without dropping enum properties anywhere. We should investigate whether we want to continue using the enum properties or abandon some of them for any string in the future. BUG=b:198824039 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1efd8f99bc7d93504c0ab94510406cd36ad24cd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144536 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: emul: Use common I2C code in emulatorsTomasz Michalec2021-09-031-229/+127
| | | | | | | | | | | | | | | | | | | Align following emulators to use common I2C code: - bb_retimer - bma255 - bmi (both 160 and 260) - smart_battery - tcs3400 BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I7515407b867487574a29dcae3456d96920a24979 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140202 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Removing unused varsJeremy Bettis2021-08-311-2/+0
| | | | | | | | | | | | | | | | | | | zephyr toolchain doesn't allow unused vars, so this is preventing running tests on gitlab. Add -Werror=unused-variable to clang args so that this doesn't backslide. BUG=None TEST=zmake coverage on docker BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I7749041fd0f09e5cf35e6a6c1d4555af805469c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131880 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Fix uninitialized varJeremy Bettis2021-06-031-1/+1
| | | | | | | | | | | | | | | | | The ret var was uninitialized, and with coverage enabled, the tests failed. BUG=b:184855975 BRANCH=none TEST=zmake configure --coverage --test zephyr/test/drivers Change-Id: Ib3c34c4a87ded0ff5cb1b2ab81fa0b9b2ec65358 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2934661 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add Smart Battery emulatorTomasz Michalec2021-05-181-0/+995
Add Smart Battery emulator which is emulated device on i2c bus. Emulated battery properties are defined through device tree, but they can be changed in runtime through Smart Battery emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BUG=b:184855975 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ia94a0a122123e3259882dfdc80d067c61c98379b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2903206 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>