diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-05-13 13:38:33 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-05-14 19:58:34 -0600 |
commit | e8f339e0e8bb15ba6e4079d0a239ddc211a02935 (patch) | |
tree | 4fdd151e07a51987f7a629cd9abe18a38a28dec4 /include/power | |
parent | 5d387d0df9816cdf05d7bce3b7379057068a7e58 (diff) | |
download | u-boot-imx-e8f339e0e8bb15ba6e4079d0a239ddc211a02935.zip u-boot-imx-e8f339e0e8bb15ba6e4079d0a239ddc211a02935.tar.gz u-boot-imx-e8f339e0e8bb15ba6e4079d0a239ddc211a02935.tar.bz2 |
test: dm: add sandbox PMIC framework tests
This change adds new file to sandbox driver model test environment.
The file is: test/dm/power.c, and it includes tests for PMIC framework,
which includes PMIC uclass and REGULATOR uclass.
All tests are based od Sandbox PMIC emulated device. Some test constants for
this device are defined in the header: include/power/sandbox_pmic.h
PMIC tests includes:
- pmic get - tests, that pmic_get() returns the requested device
- pmic I/O - tests I/O by writing and reading some values to PMIC's registers
and then compares, that the write/read values are equal.
The regulator tests includes:
- Regulator get by devname/platname
- Voltage set/get
- Current set/get
- Enable set/get
- Mode set/get
- Autoset
- List autoset
For the regulator 'get' test, the returned device pointers are compared,
and their names are also compared to the requested one.
Every other test, first sets the given attribute and next try to get it.
The test pass, when the set/get values are equal.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/power')
-rw-r--r-- | include/power/sandbox_pmic.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/power/sandbox_pmic.h b/include/power/sandbox_pmic.h index f317c3a..ae14292 100644 --- a/include/power/sandbox_pmic.h +++ b/include/power/sandbox_pmic.h @@ -102,4 +102,37 @@ enum { /* Operation mode id -> register value conversion */ #define OM2REG(x) (x) +/* Test data for: test/dm/power.c */ + +/* BUCK names */ +#define SANDBOX_BUCK1_DEVNAME "buck1" +#define SANDBOX_BUCK1_PLATNAME "SUPPLY_1.2V" +#define SANDBOX_BUCK2_DEVNAME "buck2" +#define SANDBOX_BUCK2_PLATNAME "SUPPLY_3.3V" +/* LDO names */ +#define SANDBOX_LDO1_DEVNAME "ldo1" +#define SANDBOX_LDO1_PLATNAME "VDD_EMMC_1.8V" +#define SANDBOX_LDO2_DEVNAME "ldo2" +#define SANDBOX_LDO2_PLATNAME "VDD_LCD_3.3V" + +/* + * Expected regulators setup after call of: + * - regulator_autoset() + * - regulator_list_autoset() + */ + +/* BUCK1: for testing regulator_autoset() */ +#define SANDBOX_BUCK1_AUTOSET_EXPECTED_UV 1200000 +#define SANDBOX_BUCK1_AUTOSET_EXPECTED_UA 200000 +#define SANDBOX_BUCK1_AUTOSET_EXPECTED_ENABLE true + +/* LDO1/2 for testing regulator_list_autoset() */ +#define SANDBOX_LDO1_AUTOSET_EXPECTED_UV 1800000 +#define SANDBOX_LDO1_AUTOSET_EXPECTED_UA 100000 +#define SANDBOX_LDO1_AUTOSET_EXPECTED_ENABLE true + +#define SANDBOX_LDO2_AUTOSET_EXPECTED_UV 3000000 +#define SANDBOX_LDO2_AUTOSET_EXPECTED_UA -ENOSYS +#define SANDBOX_LDO2_AUTOSET_EXPECTED_ENABLE false + #endif |