Lines Matching full:test
9 #include <kunit/test.h>
11 static void clk_gate_register_test_dev(struct kunit *test) in clk_gate_register_test_dev() argument
17 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); in clk_gate_register_test_dev()
21 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_dev()
22 KUNIT_EXPECT_STREQ(test, "test_gate", clk_hw_get_name(ret)); in clk_gate_register_test_dev()
23 KUNIT_EXPECT_EQ(test, 0UL, clk_hw_get_flags(ret)); in clk_gate_register_test_dev()
29 static void clk_gate_register_test_parent_names(struct kunit *test) in clk_gate_register_test_parent_names() argument
36 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_register_test_parent_names()
40 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_parent_names()
41 KUNIT_EXPECT_PTR_EQ(test, parent, clk_hw_get_parent(ret)); in clk_gate_register_test_parent_names()
47 static void clk_gate_register_test_parent_data(struct kunit *test) in clk_gate_register_test_parent_data() argument
55 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_register_test_parent_data()
60 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_parent_data()
61 KUNIT_EXPECT_PTR_EQ(test, parent, clk_hw_get_parent(ret)); in clk_gate_register_test_parent_data()
67 static void clk_gate_register_test_parent_data_legacy(struct kunit *test) in clk_gate_register_test_parent_data_legacy() argument
75 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_register_test_parent_data_legacy()
80 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_parent_data_legacy()
81 KUNIT_EXPECT_PTR_EQ(test, parent, clk_hw_get_parent(ret)); in clk_gate_register_test_parent_data_legacy()
87 static void clk_gate_register_test_parent_hw(struct kunit *test) in clk_gate_register_test_parent_hw() argument
94 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_register_test_parent_hw()
98 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_parent_hw()
99 KUNIT_EXPECT_PTR_EQ(test, parent, clk_hw_get_parent(ret)); in clk_gate_register_test_parent_hw()
105 static void clk_gate_register_test_hiword_invalid(struct kunit *test) in clk_gate_register_test_hiword_invalid() argument
112 KUNIT_EXPECT_TRUE(test, IS_ERR(ret)); in clk_gate_register_test_hiword_invalid()
126 .name = "clk-gate-register-test",
137 static struct clk_gate_test_context *clk_gate_test_alloc_ctx(struct kunit *test) in clk_gate_test_alloc_ctx() argument
141 test->priv = ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_gate_test_alloc_ctx()
142 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in clk_gate_test_alloc_ctx()
148 static void clk_gate_test_parent_rate(struct kunit *test) in clk_gate_test_parent_rate() argument
150 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_parent_rate()
156 KUNIT_EXPECT_EQ(test, prate, rate); in clk_gate_test_parent_rate()
159 static void clk_gate_test_enable(struct kunit *test) in clk_gate_test_enable() argument
161 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_enable()
167 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_enable()
169 KUNIT_EXPECT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_enable()
170 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(hw)); in clk_gate_test_enable()
171 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(hw)); in clk_gate_test_enable()
172 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(parent)); in clk_gate_test_enable()
173 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(parent)); in clk_gate_test_enable()
176 static void clk_gate_test_disable(struct kunit *test) in clk_gate_test_disable() argument
178 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_disable()
185 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_disable()
186 KUNIT_ASSERT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_disable()
189 KUNIT_EXPECT_EQ(test, disable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_disable()
190 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(hw)); in clk_gate_test_disable()
191 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(hw)); in clk_gate_test_disable()
192 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(parent)); in clk_gate_test_disable()
193 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(parent)); in clk_gate_test_disable()
203 static int clk_gate_test_init(struct kunit *test) in clk_gate_test_init() argument
209 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_init()
212 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_test_init()
216 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_init()
224 static void clk_gate_test_exit(struct kunit *test) in clk_gate_test_exit() argument
226 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_exit()
233 .name = "clk-gate-test",
239 static void clk_gate_test_invert_enable(struct kunit *test) in clk_gate_test_invert_enable() argument
241 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_invert_enable()
247 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_invert_enable()
249 KUNIT_EXPECT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_invert_enable()
250 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(hw)); in clk_gate_test_invert_enable()
251 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(hw)); in clk_gate_test_invert_enable()
252 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(parent)); in clk_gate_test_invert_enable()
253 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(parent)); in clk_gate_test_invert_enable()
256 static void clk_gate_test_invert_disable(struct kunit *test) in clk_gate_test_invert_disable() argument
258 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_invert_disable()
265 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_invert_disable()
266 KUNIT_ASSERT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_invert_disable()
269 KUNIT_EXPECT_EQ(test, disable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_invert_disable()
270 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(hw)); in clk_gate_test_invert_disable()
271 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(hw)); in clk_gate_test_invert_disable()
272 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(parent)); in clk_gate_test_invert_disable()
273 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(parent)); in clk_gate_test_invert_disable()
282 static int clk_gate_test_invert_init(struct kunit *test) in clk_gate_test_invert_init() argument
288 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_invert_init()
291 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_test_invert_init()
297 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_invert_init()
306 .name = "clk-gate-invert-test",
312 static void clk_gate_test_hiword_enable(struct kunit *test) in clk_gate_test_hiword_enable() argument
314 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_hiword_enable()
320 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_hiword_enable()
322 KUNIT_EXPECT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_hiword_enable()
323 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(hw)); in clk_gate_test_hiword_enable()
324 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(hw)); in clk_gate_test_hiword_enable()
325 KUNIT_EXPECT_TRUE(test, clk_hw_is_enabled(parent)); in clk_gate_test_hiword_enable()
326 KUNIT_EXPECT_TRUE(test, clk_hw_is_prepared(parent)); in clk_gate_test_hiword_enable()
329 static void clk_gate_test_hiword_disable(struct kunit *test) in clk_gate_test_hiword_disable() argument
331 struct clk_gate_test_context *ctx = test->priv; in clk_gate_test_hiword_disable()
338 KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); in clk_gate_test_hiword_disable()
339 KUNIT_ASSERT_EQ(test, enable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_hiword_disable()
342 KUNIT_EXPECT_EQ(test, disable_val, le32_to_cpu(ctx->fake_reg)); in clk_gate_test_hiword_disable()
343 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(hw)); in clk_gate_test_hiword_disable()
344 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(hw)); in clk_gate_test_hiword_disable()
345 KUNIT_EXPECT_FALSE(test, clk_hw_is_enabled(parent)); in clk_gate_test_hiword_disable()
346 KUNIT_EXPECT_FALSE(test, clk_hw_is_prepared(parent)); in clk_gate_test_hiword_disable()
355 static int clk_gate_test_hiword_init(struct kunit *test) in clk_gate_test_hiword_init() argument
361 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_hiword_init()
364 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_test_hiword_init()
369 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_hiword_init()
378 .name = "clk-gate-hiword-test",
384 static void clk_gate_test_is_enabled(struct kunit *test) in clk_gate_test_is_enabled() argument
389 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_is_enabled()
393 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_is_enabled()
394 KUNIT_ASSERT_TRUE(test, clk_hw_is_enabled(hw)); in clk_gate_test_is_enabled()
399 static void clk_gate_test_is_disabled(struct kunit *test) in clk_gate_test_is_disabled() argument
404 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_is_disabled()
408 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_is_disabled()
409 KUNIT_ASSERT_FALSE(test, clk_hw_is_enabled(hw)); in clk_gate_test_is_disabled()
414 static void clk_gate_test_is_enabled_inverted(struct kunit *test) in clk_gate_test_is_enabled_inverted() argument
419 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_is_enabled_inverted()
423 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_is_enabled_inverted()
424 KUNIT_ASSERT_TRUE(test, clk_hw_is_enabled(hw)); in clk_gate_test_is_enabled_inverted()
429 static void clk_gate_test_is_disabled_inverted(struct kunit *test) in clk_gate_test_is_disabled_inverted() argument
434 ctx = clk_gate_test_alloc_ctx(test); in clk_gate_test_is_disabled_inverted()
438 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw); in clk_gate_test_is_disabled_inverted()
439 KUNIT_ASSERT_FALSE(test, clk_hw_is_enabled(hw)); in clk_gate_test_is_disabled_inverted()
453 .name = "clk-gate-is_enabled-test",