Browse Source
Test for power domains driver based on TISCI API added. This test is for the target am243x_evm/am2434/r5f0_0. Signed-off-by: Dave Joseph <d-joseph@ti.com>pull/91688/head
4 changed files with 77 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||||
|
# SPDX-License-Identifier: Apache-2.0 |
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.20.0) |
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) |
||||||
|
project(power_tisci) |
||||||
|
|
||||||
|
target_sources(app PRIVATE src/main.c) |
@ -0,0 +1,9 @@ |
|||||||
|
# Copyright 2025 Texas Instruments Incorporated |
||||||
|
# SPDX-License-Identifier: Apache-2.0 |
||||||
|
|
||||||
|
CONFIG_ZTEST=y |
||||||
|
CONFIG_ASSERT=n |
||||||
|
CONFIG_PM_DEVICE=y |
||||||
|
CONFIG_POWER_DOMAIN=y |
||||||
|
CONFIG_PM=y |
||||||
|
CONFIG_PM_DEVICE_RUNTIME=y |
@ -0,0 +1,48 @@ |
|||||||
|
/*
|
||||||
|
* Copyright 2025 Texas Instruments Incorporated |
||||||
|
* SPDX-License-Identifier: Apache-2.0 |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <zephyr/ztest.h> |
||||||
|
#include <zephyr/pm/device_runtime.h> |
||||||
|
#include <zephyr/devicetree.h> |
||||||
|
#include <zephyr/device.h> |
||||||
|
|
||||||
|
#define POWER_DOMAIN_NODE DT_NODELABEL(adc0_pd) |
||||||
|
|
||||||
|
ZTEST(tisci_power_domain, test_power_domain_runtime) |
||||||
|
{ |
||||||
|
const struct device *pd_dev = DEVICE_DT_GET(POWER_DOMAIN_NODE); |
||||||
|
|
||||||
|
zassert_not_null(pd_dev, "Power domain device not found"); |
||||||
|
zassert_true(device_is_ready(pd_dev), "Power domain device not ready"); |
||||||
|
|
||||||
|
const struct device *dmsc = DEVICE_DT_GET(DT_NODELABEL(dmsc)); |
||||||
|
|
||||||
|
zassert_not_null(dmsc, "DMSC device not found"); |
||||||
|
zassert_true(device_is_ready(dmsc), "DMSC device not ready"); |
||||||
|
|
||||||
|
int ret; |
||||||
|
|
||||||
|
/* Power on */ |
||||||
|
ret = pm_device_runtime_get(pd_dev); |
||||||
|
|
||||||
|
zassert_ok(ret, "Failed to power ON"); |
||||||
|
|
||||||
|
/* Power off */ |
||||||
|
ret = pm_device_runtime_put(pd_dev); |
||||||
|
|
||||||
|
zassert_ok(ret, "Failed to power OFF"); |
||||||
|
|
||||||
|
/* Power on again */ |
||||||
|
ret = pm_device_runtime_get(pd_dev); |
||||||
|
|
||||||
|
zassert_ok(ret, "Failed to power ON again"); |
||||||
|
|
||||||
|
/* Power off again */ |
||||||
|
ret = pm_device_runtime_put(pd_dev); |
||||||
|
|
||||||
|
zassert_ok(ret, "Failed to power OFF again"); |
||||||
|
} |
||||||
|
|
||||||
|
ZTEST_SUITE(tisci_power_domain, NULL, NULL, NULL, NULL, NULL); |
@ -0,0 +1,13 @@ |
|||||||
|
# Copyright 2025 Texas Instruments Incorporated |
||||||
|
# SPDX-License-Identifier: Apache-2.0 |
||||||
|
|
||||||
|
tests: |
||||||
|
drivers.power.power_tisci: |
||||||
|
tags: |
||||||
|
- drivers |
||||||
|
- tisci |
||||||
|
timeout: 500 |
||||||
|
integration_platforms: |
||||||
|
- am243x_evm/am2434/r5f0_0 |
||||||
|
platform_allow: |
||||||
|
- am243x_evm/am2434/r5f0_0 |
Loading…
Reference in new issue