Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2020, Linaro Limited |
| 4 | * |
| 5 | * Tests scmi_agent uclass and the SCMI drivers implemented in other |
| 6 | * uclass devices probe when a SCMI server exposes resources. |
| 7 | * |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 8 | * Note in test.dts the protocol@10 node in scmi node. Protocol 0x10 is not |
Yuepeng Xing | 71cc021 | 2022-12-02 14:23:07 +0800 | [diff] [blame] | 9 | * implemented in U-Boot SCMI components but the implementation is expected |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 10 | * to not complain on unknown protocol IDs, as long as it is not used. Note |
| 11 | * in test.dts tests that SCMI drivers probing does not fail for such an |
| 12 | * unknown SCMI protocol ID. |
| 13 | */ |
| 14 | |
| 15 | #include <common.h> |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 16 | #include <clk.h> |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 17 | #include <dm.h> |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 18 | #include <reset.h> |
AKASHI Takahiro | cc4ecda | 2023-10-11 19:06:59 +0900 | [diff] [blame] | 19 | #include <scmi_agent.h> |
| 20 | #include <scmi_protocols.h> |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 21 | #include <asm/scmi_test.h> |
| 22 | #include <dm/device-internal.h> |
| 23 | #include <dm/test.h> |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 24 | #include <linux/kconfig.h> |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 25 | #include <power/regulator.h> |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 26 | #include <test/ut.h> |
| 27 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 28 | static int ut_assert_scmi_state_preprobe(struct unit_test_state *uts) |
| 29 | { |
| 30 | struct sandbox_scmi_service *scmi_ctx = sandbox_scmi_service_ctx(); |
| 31 | |
| 32 | ut_assertnonnull(scmi_ctx); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 33 | ut_assertnull(scmi_ctx->agent); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts, |
| 39 | struct udevice *dev) |
| 40 | { |
| 41 | struct sandbox_scmi_devices *scmi_devices; |
| 42 | struct sandbox_scmi_service *scmi_ctx; |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 43 | struct sandbox_scmi_agent *agent; |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 44 | |
| 45 | /* Device references to check context against test sequence */ |
| 46 | scmi_devices = sandbox_scmi_devices_ctx(dev); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 47 | ut_assertnonnull(scmi_devices); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 48 | ut_asserteq(2, scmi_devices->clk_count); |
Etienne Carriere | c83a843 | 2021-03-08 22:38:08 +0100 | [diff] [blame] | 49 | ut_asserteq(1, scmi_devices->reset_count); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 50 | ut_asserteq(2, scmi_devices->regul_count); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 51 | |
| 52 | /* State of the simulated SCMI server exposed */ |
| 53 | scmi_ctx = sandbox_scmi_service_ctx(); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 54 | ut_assertnonnull(scmi_ctx); |
| 55 | agent = scmi_ctx->agent; |
| 56 | ut_assertnonnull(agent); |
Etienne Carriere | bf1f132 | 2022-02-21 09:22:41 +0100 | [diff] [blame] | 57 | ut_asserteq(3, agent->clk_count); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 58 | ut_assertnonnull(agent->clk); |
| 59 | ut_asserteq(1, agent->reset_count); |
| 60 | ut_assertnonnull(agent->reset); |
| 61 | ut_asserteq(2, agent->voltd_count); |
| 62 | ut_assertnonnull(agent->voltd); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | static int load_sandbox_scmi_test_devices(struct unit_test_state *uts, |
| 68 | struct udevice **dev) |
| 69 | { |
| 70 | int ret; |
| 71 | |
| 72 | ret = ut_assert_scmi_state_preprobe(uts); |
| 73 | if (ret) |
| 74 | return ret; |
| 75 | |
| 76 | ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_scmi", |
| 77 | dev)); |
| 78 | ut_assertnonnull(*dev); |
| 79 | |
| 80 | return ut_assert_scmi_state_postprobe(uts, *dev); |
| 81 | } |
| 82 | |
| 83 | static int release_sandbox_scmi_test_devices(struct unit_test_state *uts, |
| 84 | struct udevice *dev) |
| 85 | { |
| 86 | ut_assertok(device_remove(dev, DM_REMOVE_NORMAL)); |
| 87 | |
| 88 | /* Not sure test devices are fully removed, agent may not be visible */ |
| 89 | return 0; |
| 90 | } |
| 91 | |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 92 | /* |
| 93 | * Test SCMI states when loading and releasing resources |
| 94 | * related to SCMI drivers. |
| 95 | */ |
| 96 | static int dm_test_scmi_sandbox_agent(struct unit_test_state *uts) |
| 97 | { |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 98 | struct udevice *dev = NULL; |
| 99 | int ret; |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 100 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 101 | ret = load_sandbox_scmi_test_devices(uts, &dev); |
| 102 | if (!ret) |
| 103 | ret = release_sandbox_scmi_test_devices(uts, dev); |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 104 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 105 | return ret; |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 106 | } |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 107 | DM_TEST(dm_test_scmi_sandbox_agent, UT_TESTF_SCAN_FDT); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 108 | |
| 109 | static int dm_test_scmi_clocks(struct unit_test_state *uts) |
| 110 | { |
| 111 | struct sandbox_scmi_devices *scmi_devices; |
| 112 | struct sandbox_scmi_service *scmi_ctx; |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 113 | struct sandbox_scmi_agent *agent; |
AKASHI Takahiro | cc4ecda | 2023-10-11 19:06:59 +0900 | [diff] [blame] | 114 | struct udevice *agent_dev, *clock_dev, *dev; |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 115 | int ret_dev; |
| 116 | int ret; |
| 117 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 118 | ret = load_sandbox_scmi_test_devices(uts, &dev); |
| 119 | if (ret) |
| 120 | return ret; |
| 121 | |
| 122 | scmi_devices = sandbox_scmi_devices_ctx(dev); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 123 | ut_assertnonnull(scmi_devices); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 124 | scmi_ctx = sandbox_scmi_service_ctx(); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 125 | ut_assertnonnull(scmi_ctx); |
| 126 | agent = scmi_ctx->agent; |
| 127 | ut_assertnonnull(agent); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 128 | |
AKASHI Takahiro | cc4ecda | 2023-10-11 19:06:59 +0900 | [diff] [blame] | 129 | /* Sandbox SCMI clock protocol has its own channel */ |
| 130 | ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi", |
| 131 | &agent_dev)); |
| 132 | ut_assertnonnull(agent_dev); |
| 133 | clock_dev = scmi_get_protocol(agent_dev, SCMI_PROTOCOL_ID_CLOCK); |
| 134 | ut_assertnonnull(clock_dev); |
| 135 | ut_asserteq(0x14, sandbox_scmi_channel_id(clock_dev)); |
| 136 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 137 | /* Test SCMI clocks rate manipulation */ |
Etienne Carriere | bf1f132 | 2022-02-21 09:22:41 +0100 | [diff] [blame] | 138 | ut_asserteq(333, agent->clk[0].rate); |
| 139 | ut_asserteq(200, agent->clk[1].rate); |
| 140 | ut_asserteq(1000, agent->clk[2].rate); |
| 141 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 142 | ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0])); |
| 143 | ut_asserteq(333, clk_get_rate(&scmi_devices->clk[1])); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 144 | |
| 145 | ret_dev = clk_set_rate(&scmi_devices->clk[1], 1088); |
| 146 | ut_assert(!ret_dev || ret_dev == 1088); |
| 147 | |
Etienne Carriere | bf1f132 | 2022-02-21 09:22:41 +0100 | [diff] [blame] | 148 | ut_asserteq(1088, agent->clk[0].rate); |
| 149 | ut_asserteq(200, agent->clk[1].rate); |
| 150 | ut_asserteq(1000, agent->clk[2].rate); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 151 | |
| 152 | ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0])); |
| 153 | ut_asserteq(1088, clk_get_rate(&scmi_devices->clk[1])); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 154 | |
| 155 | /* restore original rate for further tests */ |
| 156 | ret_dev = clk_set_rate(&scmi_devices->clk[1], 333); |
| 157 | ut_assert(!ret_dev || ret_dev == 333); |
| 158 | |
| 159 | /* Test SCMI clocks gating manipulation */ |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 160 | ut_assert(!agent->clk[0].enabled); |
| 161 | ut_assert(!agent->clk[1].enabled); |
| 162 | ut_assert(!agent->clk[2].enabled); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 163 | |
| 164 | ut_asserteq(0, clk_enable(&scmi_devices->clk[1])); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 165 | |
Etienne Carriere | bf1f132 | 2022-02-21 09:22:41 +0100 | [diff] [blame] | 166 | ut_assert(agent->clk[0].enabled); |
| 167 | ut_assert(!agent->clk[1].enabled); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 168 | ut_assert(!agent->clk[2].enabled); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 169 | |
| 170 | ut_assertok(clk_disable(&scmi_devices->clk[1])); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 171 | |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 172 | ut_assert(!agent->clk[0].enabled); |
| 173 | ut_assert(!agent->clk[1].enabled); |
| 174 | ut_assert(!agent->clk[2].enabled); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 175 | |
| 176 | return release_sandbox_scmi_test_devices(uts, dev); |
| 177 | } |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame] | 178 | DM_TEST(dm_test_scmi_clocks, UT_TESTF_SCAN_FDT); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 179 | |
| 180 | static int dm_test_scmi_resets(struct unit_test_state *uts) |
| 181 | { |
| 182 | struct sandbox_scmi_devices *scmi_devices; |
| 183 | struct sandbox_scmi_service *scmi_ctx; |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 184 | struct sandbox_scmi_agent *agent; |
AKASHI Takahiro | cc4ecda | 2023-10-11 19:06:59 +0900 | [diff] [blame] | 185 | struct udevice *agent_dev, *reset_dev, *dev = NULL; |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 186 | int ret; |
| 187 | |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 188 | ret = load_sandbox_scmi_test_devices(uts, &dev); |
| 189 | if (ret) |
| 190 | return ret; |
| 191 | |
| 192 | scmi_devices = sandbox_scmi_devices_ctx(dev); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 193 | ut_assertnonnull(scmi_devices); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 194 | scmi_ctx = sandbox_scmi_service_ctx(); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 195 | ut_assertnonnull(scmi_ctx); |
| 196 | agent = scmi_ctx->agent; |
| 197 | ut_assertnonnull(agent); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 198 | |
AKASHI Takahiro | cc4ecda | 2023-10-11 19:06:59 +0900 | [diff] [blame] | 199 | /* Sandbox SCMI reset protocol doesn't have its own channel */ |
| 200 | ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi", |
| 201 | &agent_dev)); |
| 202 | ut_assertnonnull(agent_dev); |
| 203 | reset_dev = scmi_get_protocol(agent_dev, SCMI_PROTOCOL_ID_RESET_DOMAIN); |
| 204 | ut_assertnonnull(reset_dev); |
| 205 | ut_asserteq(0x0, sandbox_scmi_channel_id(reset_dev)); |
| 206 | |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 207 | /* Test SCMI resect controller manipulation */ |
Marek Vasut | 1531c4e | 2023-03-10 04:33:13 +0100 | [diff] [blame] | 208 | ut_assert(!agent->reset[0].asserted); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 209 | |
| 210 | ut_assertok(reset_assert(&scmi_devices->reset[0])); |
Marek Vasut | 1531c4e | 2023-03-10 04:33:13 +0100 | [diff] [blame] | 211 | ut_assert(agent->reset[0].asserted); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 212 | |
| 213 | ut_assertok(reset_deassert(&scmi_devices->reset[0])); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 214 | ut_assert(!agent->reset[0].asserted); |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 215 | |
| 216 | return release_sandbox_scmi_test_devices(uts, dev); |
| 217 | } |
Etienne Carriere | 8b9b689 | 2020-09-09 18:44:07 +0200 | [diff] [blame] | 218 | DM_TEST(dm_test_scmi_resets, UT_TESTF_SCAN_FDT); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 219 | |
| 220 | static int dm_test_scmi_voltage_domains(struct unit_test_state *uts) |
| 221 | { |
| 222 | struct sandbox_scmi_devices *scmi_devices; |
| 223 | struct sandbox_scmi_service *scmi_ctx; |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 224 | struct sandbox_scmi_agent *agent; |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 225 | struct dm_regulator_uclass_plat *uc_pdata; |
| 226 | struct udevice *dev; |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 227 | struct udevice *regul0_dev; |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 228 | |
| 229 | ut_assertok(load_sandbox_scmi_test_devices(uts, &dev)); |
| 230 | |
| 231 | scmi_devices = sandbox_scmi_devices_ctx(dev); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 232 | ut_assertnonnull(scmi_devices); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 233 | scmi_ctx = sandbox_scmi_service_ctx(); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 234 | ut_assertnonnull(scmi_ctx); |
| 235 | agent = scmi_ctx->agent; |
| 236 | ut_assertnonnull(agent); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 237 | |
| 238 | /* Set/Get an SCMI voltage domain level */ |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 239 | regul0_dev = scmi_devices->regul[0]; |
| 240 | ut_assert(regul0_dev); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 241 | |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 242 | uc_pdata = dev_get_uclass_plat(regul0_dev); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 243 | ut_assert(uc_pdata); |
| 244 | |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 245 | ut_assertok(regulator_set_value(regul0_dev, uc_pdata->min_uV)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 246 | ut_asserteq(agent->voltd[0].voltage_uv, uc_pdata->min_uV); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 247 | |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 248 | ut_assert(regulator_get_value(regul0_dev) == uc_pdata->min_uV); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 249 | |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 250 | ut_assertok(regulator_set_value(regul0_dev, uc_pdata->max_uV)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 251 | ut_asserteq(agent->voltd[0].voltage_uv, uc_pdata->max_uV); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 252 | |
Etienne Carriere | eeaf282 | 2021-03-08 22:38:09 +0100 | [diff] [blame] | 253 | ut_assert(regulator_get_value(regul0_dev) == uc_pdata->max_uV); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 254 | |
| 255 | /* Enable/disable SCMI voltage domains */ |
| 256 | ut_assertok(regulator_set_enable(scmi_devices->regul[0], false)); |
| 257 | ut_assertok(regulator_set_enable(scmi_devices->regul[1], false)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 258 | ut_assert(!agent->voltd[0].enabled); |
| 259 | ut_assert(!agent->voltd[1].enabled); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 260 | |
| 261 | ut_assertok(regulator_set_enable(scmi_devices->regul[0], true)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 262 | ut_assert(agent->voltd[0].enabled); |
| 263 | ut_assert(!agent->voltd[1].enabled); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 264 | |
| 265 | ut_assertok(regulator_set_enable(scmi_devices->regul[1], true)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 266 | ut_assert(agent->voltd[0].enabled); |
| 267 | ut_assert(agent->voltd[1].enabled); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 268 | |
| 269 | ut_assertok(regulator_set_enable(scmi_devices->regul[0], false)); |
Etienne Carriere | 09665cb | 2022-02-21 09:22:39 +0100 | [diff] [blame] | 270 | ut_assert(!agent->voltd[0].enabled); |
| 271 | ut_assert(agent->voltd[1].enabled); |
Etienne Carriere | b8f15cd | 2021-03-08 22:38:07 +0100 | [diff] [blame] | 272 | |
| 273 | return release_sandbox_scmi_test_devices(uts, dev); |
| 274 | } |
| 275 | DM_TEST(dm_test_scmi_voltage_domains, UT_TESTF_SCAN_FDT); |