tests: regulator_pmic: rework to use DEVICE_DT_GET
Move to using a devicetree nodelabel (test_regulator) to reference the regulator device to test. This lets us remove use of Kconfig as well as device_get_binding(). Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
parent
5eca3922d5
commit
b50f071af6
|
@ -1,10 +0,0 @@
|
|||
# Copyright (c) 2021 NXP
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
mainmenu "PMIC Regulator Test"
|
||||
|
||||
source "Kconfig.zephyr"
|
||||
|
||||
config TEST_PMIC_REGULATOR_NAME
|
||||
string "PMIC regulator label to use for the test"
|
||||
default "" # Must be set by board overlay
|
|
@ -1 +0,0 @@
|
|||
CONFIG_TEST_PMIC_REGULATOR_NAME="LDO2_REG"
|
|
@ -10,3 +10,5 @@
|
|||
io-channels = <&lpadc0 0>;
|
||||
};
|
||||
};
|
||||
|
||||
test_regulator: &pca9420_ldo2 { };
|
||||
|
|
|
@ -116,15 +116,14 @@ static void test_basic(void)
|
|||
int rc, adc_reading;
|
||||
|
||||
adc_dev = DEVICE_DT_GET(ADC_NODE);
|
||||
reg_dev = device_get_binding(CONFIG_TEST_PMIC_REGULATOR_NAME);
|
||||
reg_dev = DEVICE_DT_GET(DT_NODELABEL(test_regulator));
|
||||
|
||||
zassert_true(device_is_ready(adc_dev), "ADC device is not ready");
|
||||
zassert_not_null(reg_dev, "Could not get regulator device binding");
|
||||
zassert_true(device_is_ready(reg_dev), "Regulator device is not ready");
|
||||
|
||||
/* Configure ADC */
|
||||
adc_channel_setup(adc_dev, &channel_cfg);
|
||||
|
||||
|
||||
reset_client();
|
||||
|
||||
/* Turn regulator on */
|
||||
|
|
Loading…
Reference in a new issue