From b50f071af685bbb1be57c71e682263584bf7ed62 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Fri, 22 Jul 2022 13:42:08 -0500 Subject: [PATCH] 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 --- tests/drivers/regulator/pmic/Kconfig | 10 ---------- .../regulator/pmic/boards/mimxrt685_evk_cm33.conf | 1 - .../regulator/pmic/boards/mimxrt685_evk_cm33.overlay | 2 ++ tests/drivers/regulator/pmic/src/main.c | 5 ++--- 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 tests/drivers/regulator/pmic/Kconfig delete mode 100644 tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.conf diff --git a/tests/drivers/regulator/pmic/Kconfig b/tests/drivers/regulator/pmic/Kconfig deleted file mode 100644 index 369b0b9e71..0000000000 --- a/tests/drivers/regulator/pmic/Kconfig +++ /dev/null @@ -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 diff --git a/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.conf b/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.conf deleted file mode 100644 index 5da34b0a0c..0000000000 --- a/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TEST_PMIC_REGULATOR_NAME="LDO2_REG" diff --git a/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.overlay b/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.overlay index 56c4e90a0b..37dcbb2379 100644 --- a/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.overlay +++ b/tests/drivers/regulator/pmic/boards/mimxrt685_evk_cm33.overlay @@ -10,3 +10,5 @@ io-channels = <&lpadc0 0>; }; }; + +test_regulator: &pca9420_ldo2 { }; diff --git a/tests/drivers/regulator/pmic/src/main.c b/tests/drivers/regulator/pmic/src/main.c index 1482a9c441..27e66ce6e6 100644 --- a/tests/drivers/regulator/pmic/src/main.c +++ b/tests/drivers/regulator/pmic/src/main.c @@ -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 */