Lines Matching full:test

17 #include <kunit/test.h>
178 static int clk_test_init_with_ops(struct kunit *test, const struct clk_ops *ops) in clk_test_init_with_ops() argument
184 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_test_init_with_ops()
188 test->priv = ctx; in clk_test_init_with_ops()
201 static int clk_test_init(struct kunit *test) in clk_test_init() argument
203 return clk_test_init_with_ops(test, &clk_dummy_rate_ops); in clk_test_init()
206 static int clk_maximize_test_init(struct kunit *test) in clk_maximize_test_init() argument
208 return clk_test_init_with_ops(test, &clk_dummy_maximize_rate_ops); in clk_maximize_test_init()
211 static int clk_minimize_test_init(struct kunit *test) in clk_minimize_test_init() argument
213 return clk_test_init_with_ops(test, &clk_dummy_minimize_rate_ops); in clk_minimize_test_init()
216 static void clk_test_exit(struct kunit *test) in clk_test_exit() argument
218 struct clk_dummy_context *ctx = test->priv; in clk_test_exit()
224 * Test that the actual rate matches what is returned by clk_get_rate()
226 static void clk_test_get_rate(struct kunit *test) in clk_test_get_rate() argument
228 struct clk_dummy_context *ctx = test->priv; in clk_test_get_rate()
234 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_get_rate()
235 KUNIT_EXPECT_EQ(test, rate, ctx->rate); in clk_test_get_rate()
241 * Test that, after a call to clk_set_rate(), the rate returned by
247 static void clk_test_set_get_rate(struct kunit *test) in clk_test_set_get_rate() argument
249 struct clk_dummy_context *ctx = test->priv; in clk_test_set_get_rate()
254 KUNIT_ASSERT_EQ(test, in clk_test_set_get_rate()
259 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_set_get_rate()
260 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_set_get_rate()
266 * Test that, after several calls to clk_set_rate(), the rate returned
272 static void clk_test_set_set_get_rate(struct kunit *test) in clk_test_set_set_get_rate() argument
274 struct clk_dummy_context *ctx = test->priv; in clk_test_set_set_get_rate()
279 KUNIT_ASSERT_EQ(test, in clk_test_set_set_get_rate()
283 KUNIT_ASSERT_EQ(test, in clk_test_set_set_get_rate()
288 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_set_set_get_rate()
289 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_set_set_get_rate()
295 * Test that clk_round_rate and clk_set_rate are consitent and will
298 static void clk_test_round_set_get_rate(struct kunit *test) in clk_test_round_set_get_rate() argument
300 struct clk_dummy_context *ctx = test->priv; in clk_test_round_set_get_rate()
307 KUNIT_ASSERT_GT(test, rounded_rate, 0); in clk_test_round_set_get_rate()
308 KUNIT_EXPECT_EQ(test, rounded_rate, DUMMY_CLOCK_RATE_1); in clk_test_round_set_get_rate()
310 KUNIT_ASSERT_EQ(test, in clk_test_round_set_get_rate()
315 KUNIT_ASSERT_GT(test, set_rate, 0); in clk_test_round_set_get_rate()
316 KUNIT_EXPECT_EQ(test, rounded_rate, set_rate); in clk_test_round_set_get_rate()
330 * Test suite for a basic rate clock, without any parent.
335 .name = "clk-test",
341 static int clk_uncached_test_init(struct kunit *test) in clk_uncached_test_init() argument
346 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_uncached_test_init()
349 test->priv = ctx; in clk_uncached_test_init()
352 ctx->hw.init = CLK_HW_INIT_NO_PARENT("test-clk", in clk_uncached_test_init()
364 * Test that for an uncached clock, the clock framework doesn't cache
368 static void clk_test_uncached_get_rate(struct kunit *test) in clk_test_uncached_get_rate() argument
370 struct clk_dummy_context *ctx = test->priv; in clk_test_uncached_get_rate()
376 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_uncached_get_rate()
377 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_INIT_RATE); in clk_test_uncached_get_rate()
382 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_uncached_get_rate()
383 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_uncached_get_rate()
389 * Test that for an uncached clock, clk_set_rate_range() will work
392 static void clk_test_uncached_set_range(struct kunit *test) in clk_test_uncached_set_range() argument
394 struct clk_dummy_context *ctx = test->priv; in clk_test_uncached_set_range()
399 KUNIT_ASSERT_EQ(test, in clk_test_uncached_set_range()
406 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_uncached_set_range()
407 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_uncached_set_range()
408 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_uncached_set_range()
414 * Test that for an uncached clock, clk_set_rate_range() will work
421 static void clk_test_uncached_updated_rate_set_range(struct kunit *test) in clk_test_uncached_updated_rate_set_range() argument
423 struct clk_dummy_context *ctx = test->priv; in clk_test_uncached_updated_rate_set_range()
430 KUNIT_ASSERT_EQ(test, in clk_test_uncached_updated_rate_set_range()
437 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_uncached_updated_rate_set_range()
438 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_uncached_updated_rate_set_range()
451 * Test suite for a basic, uncached, rate clock, without any parent.
456 .name = "clk-uncached-test",
463 clk_multiple_parents_mux_test_init(struct kunit *test) in clk_multiple_parents_mux_test_init() argument
469 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_multiple_parents_mux_test_init()
472 test->priv = ctx; in clk_multiple_parents_mux_test_init()
478 ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[0].hw); in clk_multiple_parents_mux_test_init()
486 ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[1].hw); in clk_multiple_parents_mux_test_init()
491 ctx->hw.init = CLK_HW_INIT_PARENTS("test-mux", parents, in clk_multiple_parents_mux_test_init()
494 ret = clk_hw_register_kunit(test, NULL, &ctx->hw); in clk_multiple_parents_mux_test_init()
502 * Test that for a clock with multiple parents, clk_get_parent()
506 clk_test_multiple_parents_mux_get_parent(struct kunit *test) in clk_test_multiple_parents_mux_get_parent() argument
508 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_multiple_parents_mux_get_parent()
513 KUNIT_EXPECT_TRUE(test, clk_is_match(clk_get_parent(clk), parent)); in clk_test_multiple_parents_mux_get_parent()
520 * Test that for a clock with a multiple parents, clk_has_parent()
524 clk_test_multiple_parents_mux_has_parent(struct kunit *test) in clk_test_multiple_parents_mux_has_parent() argument
526 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_multiple_parents_mux_has_parent()
532 KUNIT_EXPECT_TRUE(test, clk_has_parent(clk, parent)); in clk_test_multiple_parents_mux_has_parent()
536 KUNIT_EXPECT_TRUE(test, clk_has_parent(clk, parent)); in clk_test_multiple_parents_mux_has_parent()
543 * Test that for a clock with a multiple parents, if we set a range on
552 clk_test_multiple_parents_mux_set_range_set_parent_get_rate(struct kunit *test) in clk_test_multiple_parents_mux_set_range_set_parent_get_rate() argument
554 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
556 struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
561 kunit_skip(test, "This needs to be fixed in the core."); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
563 parent1 = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[0].hw, NULL); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
564 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent1); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
565 KUNIT_ASSERT_TRUE(test, clk_is_match(clk_get_parent(clk), parent1)); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
567 parent2 = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[1].hw, NULL); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
568 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent2); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
571 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
574 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
579 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
582 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
585 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
586 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 - 1000); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
587 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_multiple_parents_mux_set_range_set_parent_get_rate()
598 * Test suite for a basic mux clock with two parents, with
606 .name = "clk-multiple-parents-mux-test",
612 clk_orphan_transparent_multiple_parent_mux_test_init(struct kunit *test) in clk_orphan_transparent_multiple_parent_mux_test_init() argument
618 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_orphan_transparent_multiple_parent_mux_test_init()
621 test->priv = ctx; in clk_orphan_transparent_multiple_parent_mux_test_init()
627 ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[1].hw); in clk_orphan_transparent_multiple_parent_mux_test_init()
631 ctx->hw.init = CLK_HW_INIT_PARENTS("test-orphan-mux", parents, in clk_orphan_transparent_multiple_parent_mux_test_init()
634 ret = clk_hw_register_kunit(test, NULL, &ctx->hw); in clk_orphan_transparent_multiple_parent_mux_test_init()
642 * Test that, for a mux whose current parent hasn't been registered yet and is
646 clk_test_orphan_transparent_multiple_parent_mux_get_parent(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_get_parent() argument
648 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_get_parent()
652 KUNIT_EXPECT_PTR_EQ(test, clk_get_parent(clk), NULL); in clk_test_orphan_transparent_multiple_parent_mux_get_parent()
658 * Test that, for a mux whose current parent hasn't been registered yet,
663 clk_test_orphan_transparent_multiple_parent_mux_set_parent(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent() argument
665 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent()
672 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent()
675 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent()
678 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent()
679 KUNIT_EXPECT_TRUE(test, clk_is_match(parent, new_parent)); in clk_test_orphan_transparent_multiple_parent_mux_set_parent()
686 * Test that, for a mux that started orphan but got switched to a valid
691 clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range() argument
693 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
701 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
704 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
707 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
710 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
713 KUNIT_ASSERT_GT(test, new_parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
714 KUNIT_EXPECT_EQ(test, parent_rate, new_parent_rate); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_drop_range()
721 * Test that, for a mux that started orphan but got switched to a valid
725 clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate() argument
727 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
735 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
738 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
741 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
744 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
745 KUNIT_EXPECT_EQ(test, parent_rate, rate); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_get_rate()
752 * Test that, for a mux that started orphan but got switched to a valid
756 clk_test_orphan_transparent_multiple_parent_mux_set_parent_put(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put() argument
758 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
764 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
767 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, clk); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
770 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
773 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
778 KUNIT_ASSERT_GT(test, new_parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
779 KUNIT_EXPECT_EQ(test, parent_rate, new_parent_rate); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_put()
785 * Test that, for a mux that started orphan but got switched to a valid
790 clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified() argument
792 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
800 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
803 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
806 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
809 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
810 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
811 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_modified()
818 * Test that, for a mux that started orphan but got switched to a valid
823 clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched() argument
825 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
833 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
836 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
839 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
844 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
847 KUNIT_ASSERT_GT(test, new_parent_rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
848 KUNIT_EXPECT_EQ(test, parent_rate, new_parent_rate); in clk_test_orphan_transparent_multiple_parent_mux_set_parent_set_range_untouched()
855 * Test that, for a mux whose current parent hasn't been registered yet,
860 clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate() argument
862 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate()
869 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate()
872 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate()
873 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate()
874 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_orphan_transparent_multiple_parent_mux_set_range_round_rate()
880 * Test that, for a mux that started orphan, was assigned and rate and
889 clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(struct kunit *test) in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate() argument
891 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
893 struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
898 kunit_skip(test, "This needs to be fixed in the core."); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
902 parent = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[1].hw, NULL); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
903 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
906 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
909 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
910 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
911 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate()
928 * Test suite for a basic mux clock with two parents. The default parent
937 .name = "clk-orphan-transparent-multiple-parent-mux-test",
947 static int clk_single_parent_mux_test_init(struct kunit *test) in clk_single_parent_mux_test_init() argument
952 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_single_parent_mux_test_init()
955 test->priv = ctx; in clk_single_parent_mux_test_init()
963 ret = clk_hw_register_kunit(test, NULL, &ctx->parent_ctx.hw); in clk_single_parent_mux_test_init()
967 ctx->hw.init = CLK_HW_INIT("test-clk", "parent-clk", in clk_single_parent_mux_test_init()
971 ret = clk_hw_register_kunit(test, NULL, &ctx->hw); in clk_single_parent_mux_test_init()
979 clk_single_parent_mux_test_exit(struct kunit *test) in clk_single_parent_mux_test_exit() argument
981 struct clk_single_parent_ctx *ctx = test->priv; in clk_single_parent_mux_test_exit()
988 * Test that for a clock with a single parent, clk_get_parent() actually
992 clk_test_single_parent_mux_get_parent(struct kunit *test) in clk_test_single_parent_mux_get_parent() argument
994 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_get_parent()
999 KUNIT_EXPECT_TRUE(test, clk_is_match(clk_get_parent(clk), parent)); in clk_test_single_parent_mux_get_parent()
1006 * Test that for a clock with a single parent, clk_has_parent() actually
1010 clk_test_single_parent_mux_has_parent(struct kunit *test) in clk_test_single_parent_mux_has_parent() argument
1012 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_has_parent()
1017 KUNIT_EXPECT_TRUE(test, clk_has_parent(clk, parent)); in clk_test_single_parent_mux_has_parent()
1024 * Test that for a clock that can't modify its rate and with a single
1033 clk_test_single_parent_mux_set_range_disjoint_child_last(struct kunit *test) in clk_test_single_parent_mux_set_range_disjoint_child_last() argument
1035 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_set_range_disjoint_child_last()
1037 struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL); in clk_test_single_parent_mux_set_range_disjoint_child_last()
1041 kunit_skip(test, "This needs to be fixed in the core."); in clk_test_single_parent_mux_set_range_disjoint_child_last()
1044 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_test_single_parent_mux_set_range_disjoint_child_last()
1047 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_disjoint_child_last()
1050 KUNIT_EXPECT_LT(test, ret, 0); in clk_test_single_parent_mux_set_range_disjoint_child_last()
1054 * Test that for a clock that can't modify its rate and with a single
1063 clk_test_single_parent_mux_set_range_disjoint_parent_last(struct kunit *test) in clk_test_single_parent_mux_set_range_disjoint_parent_last() argument
1065 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1067 struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL); in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1071 kunit_skip(test, "This needs to be fixed in the core."); in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1074 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1077 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1080 KUNIT_EXPECT_LT(test, ret, 0); in clk_test_single_parent_mux_set_range_disjoint_parent_last()
1084 * Test that for a clock that can't modify its rate and with a single
1090 clk_test_single_parent_mux_set_range_round_rate_parent_only(struct kunit *test) in clk_test_single_parent_mux_set_range_round_rate_parent_only() argument
1092 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1100 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1103 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1106 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1107 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1108 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_single_parent_mux_set_range_round_rate_parent_only()
1114 * Test that for a clock that can't modify its rate and with a single
1120 clk_test_single_parent_mux_set_range_round_rate_child_smaller(struct kunit *test) in clk_test_single_parent_mux_set_range_round_rate_child_smaller() argument
1122 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1130 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1133 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1136 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1139 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1140 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1141 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1144 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1145 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1146 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_test_single_parent_mux_set_range_round_rate_child_smaller()
1152 * Test that for a clock that can't modify its rate and with a single
1158 clk_test_single_parent_mux_set_range_round_rate_parent_smaller(struct kunit *test) in clk_test_single_parent_mux_set_range_round_rate_parent_smaller() argument
1160 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1168 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1171 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1174 KUNIT_ASSERT_EQ(test, ret, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1177 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1178 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1179 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1182 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1183 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1184 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_test_single_parent_mux_set_range_round_rate_parent_smaller()
1201 * Test suite for a basic mux clock with one parent, with
1209 .name = "clk-single-parent-mux-test",
1214 static int clk_orphan_transparent_single_parent_mux_test_init(struct kunit *test) in clk_orphan_transparent_single_parent_mux_test_init() argument
1221 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_orphan_transparent_single_parent_mux_test_init()
1224 test->priv = ctx; in clk_orphan_transparent_single_parent_mux_test_init()
1251 * Test that a mux-only clock, with an initial rate within a range,
1257 static void clk_test_orphan_transparent_parent_mux_set_range(struct kunit *test) in clk_test_orphan_transparent_parent_mux_set_range() argument
1259 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_parent_mux_set_range()
1265 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_parent_mux_set_range()
1267 KUNIT_ASSERT_EQ(test, in clk_test_orphan_transparent_parent_mux_set_range()
1274 KUNIT_ASSERT_GT(test, new_rate, 0); in clk_test_orphan_transparent_parent_mux_set_range()
1275 KUNIT_EXPECT_EQ(test, rate, new_rate); in clk_test_orphan_transparent_parent_mux_set_range()
1286 * Test suite for a basic mux clock with one parent. The parent is
1294 .name = "clk-orphan-transparent-single-parent-test",
1307 clk_orphan_two_level_root_last_test_init(struct kunit *test) in clk_orphan_two_level_root_last_test_init() argument
1312 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_orphan_two_level_root_last_test_init()
1315 test->priv = ctx; in clk_orphan_two_level_root_last_test_init()
1327 CLK_HW_INIT("test-clk", "intermediate-parent", in clk_orphan_two_level_root_last_test_init()
1347 clk_orphan_two_level_root_last_test_exit(struct kunit *test) in clk_orphan_two_level_root_last_test_exit() argument
1349 struct clk_single_parent_two_lvl_ctx *ctx = test->priv; in clk_orphan_two_level_root_last_test_exit()
1357 * Test that, for a clock whose parent used to be orphan, clk_get_rate()
1361 clk_orphan_two_level_root_last_test_get_rate(struct kunit *test) in clk_orphan_two_level_root_last_test_get_rate() argument
1363 struct clk_single_parent_two_lvl_ctx *ctx = test->priv; in clk_orphan_two_level_root_last_test_get_rate()
1369 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_INIT_RATE); in clk_orphan_two_level_root_last_test_get_rate()
1375 * Test that, for a clock whose parent used to be orphan,
1383 clk_orphan_two_level_root_last_test_set_range(struct kunit *test) in clk_orphan_two_level_root_last_test_set_range() argument
1385 struct clk_single_parent_two_lvl_ctx *ctx = test->priv; in clk_orphan_two_level_root_last_test_set_range()
1394 KUNIT_ASSERT_EQ(test, ret, 0); in clk_orphan_two_level_root_last_test_set_range()
1397 KUNIT_ASSERT_GT(test, rate, 0); in clk_orphan_two_level_root_last_test_set_range()
1398 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_INIT_RATE); in clk_orphan_two_level_root_last_test_set_range()
1411 * Test suite for a basic, transparent, clock with a parent that is also
1424 .name = "clk-orphan-two-level-root-last-test",
1431 * Test that clk_set_rate_range won't return an error for a valid range
1435 static void clk_range_test_set_range(struct kunit *test) in clk_range_test_set_range() argument
1437 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range()
1442 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range()
1449 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range()
1450 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range()
1451 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range()
1457 * Test that calling clk_set_rate_range with a minimum rate higher than
1460 static void clk_range_test_set_range_invalid(struct kunit *test) in clk_range_test_set_range_invalid() argument
1462 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_invalid()
1466 KUNIT_EXPECT_LT(test, in clk_range_test_set_range_invalid()
1476 * Test that users can't set multiple, disjoints, range that would be
1479 static void clk_range_test_multiple_disjoints_range(struct kunit *test) in clk_range_test_multiple_disjoints_range() argument
1481 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_disjoints_range()
1486 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_disjoints_range()
1489 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_disjoints_range()
1491 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_disjoints_range()
1495 KUNIT_EXPECT_LT(test, in clk_range_test_multiple_disjoints_range()
1504 * Test that if our clock has some boundaries and we try to round a rate
1507 static void clk_range_test_set_range_round_rate_lower(struct kunit *test) in clk_range_test_set_range_round_rate_lower() argument
1509 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_round_rate_lower()
1514 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_round_rate_lower()
1521 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_round_rate_lower()
1522 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_round_rate_lower()
1523 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_round_rate_lower()
1529 * Test that if our clock has some boundaries and we try to set a rate
1532 static void clk_range_test_set_range_set_rate_lower(struct kunit *test) in clk_range_test_set_range_set_rate_lower() argument
1534 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_rate_lower()
1539 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_lower()
1545 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_lower()
1550 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_set_rate_lower()
1551 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_set_rate_lower()
1552 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_set_rate_lower()
1558 * Test that if our clock has some boundaries and we try to round and
1563 static void clk_range_test_set_range_set_round_rate_consistent_lower(struct kunit *test) in clk_range_test_set_range_set_round_rate_consistent_lower() argument
1565 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_round_rate_consistent_lower()
1570 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_lower()
1577 KUNIT_ASSERT_GT(test, rounded, 0); in clk_range_test_set_range_set_round_rate_consistent_lower()
1579 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_lower()
1583 KUNIT_EXPECT_EQ(test, rounded, clk_get_rate(clk)); in clk_range_test_set_range_set_round_rate_consistent_lower()
1589 * Test that if our clock has some boundaries and we try to round a rate
1592 static void clk_range_test_set_range_round_rate_higher(struct kunit *test) in clk_range_test_set_range_round_rate_higher() argument
1594 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_round_rate_higher()
1599 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_round_rate_higher()
1606 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_round_rate_higher()
1607 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_round_rate_higher()
1608 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_round_rate_higher()
1614 * Test that if our clock has some boundaries and we try to set a rate
1617 static void clk_range_test_set_range_set_rate_higher(struct kunit *test) in clk_range_test_set_range_set_rate_higher() argument
1619 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_rate_higher()
1624 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_higher()
1630 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_higher()
1635 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_set_rate_higher()
1636 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_set_rate_higher()
1637 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_set_rate_higher()
1643 * Test that if our clock has some boundaries and we try to round and
1648 static void clk_range_test_set_range_set_round_rate_consistent_higher(struct kunit *test) in clk_range_test_set_range_set_round_rate_consistent_higher() argument
1650 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_round_rate_consistent_higher()
1655 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_higher()
1662 KUNIT_ASSERT_GT(test, rounded, 0); in clk_range_test_set_range_set_round_rate_consistent_higher()
1664 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_higher()
1668 KUNIT_EXPECT_EQ(test, rounded, clk_get_rate(clk)); in clk_range_test_set_range_set_round_rate_consistent_higher()
1674 * Test that if our clock has a rate lower than the minimum set by a
1681 static void clk_range_test_set_range_get_rate_raised(struct kunit *test) in clk_range_test_set_range_get_rate_raised() argument
1683 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_get_rate_raised()
1688 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_raised()
1692 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_raised()
1699 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_get_rate_raised()
1700 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_get_rate_raised()
1706 * Test that if our clock has a rate higher than the maximum set by a
1713 static void clk_range_test_set_range_get_rate_lowered(struct kunit *test) in clk_range_test_set_range_get_rate_lowered() argument
1715 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_get_rate_lowered()
1720 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_lowered()
1724 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_lowered()
1731 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_get_rate_lowered()
1732 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_get_rate_lowered()
1753 * Test suite for a basic rate clock, without any parent.
1759 .name = "clk-range-test",
1766 * Test that if we have several subsequent calls to
1773 static void clk_range_test_set_range_rate_maximized(struct kunit *test) in clk_range_test_set_range_rate_maximized() argument
1775 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_rate_maximized()
1780 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
1784 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
1791 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
1792 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_rate_maximized()
1794 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
1801 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
1802 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_range_test_set_range_rate_maximized()
1804 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
1811 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
1812 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_rate_maximized()
1818 * Test that if we have several subsequent calls to
1825 static void clk_range_test_multiple_set_range_rate_maximized(struct kunit *test) in clk_range_test_multiple_set_range_rate_maximized() argument
1827 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_maximized()
1834 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_maximized()
1837 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_maximized()
1839 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
1843 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
1850 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
1851 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_maximized()
1853 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
1860 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
1861 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_maximized()
1863 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
1868 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
1869 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_maximized()
1877 * Test that if we have several subsequent calls to
1884 static void clk_range_test_multiple_set_range_rate_put_maximized(struct kunit *test) in clk_range_test_multiple_set_range_rate_put_maximized() argument
1886 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_put_maximized()
1893 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_put_maximized()
1896 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_put_maximized()
1898 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_put_maximized()
1902 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_put_maximized()
1909 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_maximized()
1910 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_put_maximized()
1912 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_put_maximized()
1919 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_maximized()
1920 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_put_maximized()
1925 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_maximized()
1926 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_put_maximized()
1940 * Test suite for a basic rate clock, without any parent.
1947 .name = "clk-range-maximize-test",
1954 * Test that if we have several subsequent calls to
1961 static void clk_range_test_set_range_rate_minimized(struct kunit *test) in clk_range_test_set_range_rate_minimized() argument
1963 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_rate_minimized()
1968 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
1972 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
1979 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
1980 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_rate_minimized()
1982 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
1989 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
1990 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_range_test_set_range_rate_minimized()
1992 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
1999 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
2000 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_rate_minimized()
2006 * Test that if we have several subsequent calls to
2013 static void clk_range_test_multiple_set_range_rate_minimized(struct kunit *test) in clk_range_test_multiple_set_range_rate_minimized() argument
2015 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_minimized()
2022 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_minimized()
2025 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_minimized()
2027 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
2034 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
2035 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_minimized()
2037 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
2044 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
2045 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_minimized()
2047 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
2052 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
2053 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_minimized()
2061 * Test that if we have several subsequent calls to
2068 static void clk_range_test_multiple_set_range_rate_put_minimized(struct kunit *test) in clk_range_test_multiple_set_range_rate_put_minimized() argument
2070 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_put_minimized()
2077 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_put_minimized()
2080 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_put_minimized()
2082 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_put_minimized()
2089 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_minimized()
2090 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_put_minimized()
2092 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_put_minimized()
2099 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_minimized()
2100 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_put_minimized()
2105 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_put_minimized()
2106 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_put_minimized()
2120 * Test suite for a basic rate clock, without any parent.
2127 .name = "clk-range-minimize-test",
2164 clk_leaf_mux_set_rate_parent_test_init(struct kunit *test) in clk_leaf_mux_set_rate_parent_test_init() argument
2170 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_leaf_mux_set_rate_parent_test_init()
2173 test->priv = ctx; in clk_leaf_mux_set_rate_parent_test_init()
2192 ctx->mux_ctx.hw.init = CLK_HW_INIT_PARENTS("test-mux", top_parents, in clk_leaf_mux_set_rate_parent_test_init()
2199 ctx->parent.init = CLK_HW_INIT_HW("test-parent", &ctx->mux_ctx.hw, in clk_leaf_mux_set_rate_parent_test_init()
2205 ctx->hw.init = CLK_HW_INIT_HW("test-clock", &ctx->parent, in clk_leaf_mux_set_rate_parent_test_init()
2215 static void clk_leaf_mux_set_rate_parent_test_exit(struct kunit *test) in clk_leaf_mux_set_rate_parent_test_exit() argument
2217 struct clk_leaf_mux_ctx *ctx = test->priv; in clk_leaf_mux_set_rate_parent_test_exit()
2242 * Test that __clk_determine_rate() on the parent that can't
2251 * Test that __clk_mux_determine_rate() on the parent that
2261 * Test that __clk_mux_determine_rate_closest() on the parent
2271 * Test that clk_hw_determine_rate_no_reparent() on the parent
2286 * Test that when a clk that can't change rate itself calls a function like in KUNIT_ARRAY_PARAM()
2292 static void clk_leaf_mux_set_rate_parent_determine_rate_test(struct kunit *test) in KUNIT_ARRAY_PARAM()
2294 struct clk_leaf_mux_ctx *ctx = test->priv; in KUNIT_ARRAY_PARAM()
2301 test_param = test->param_value; in KUNIT_ARRAY_PARAM()
2306 KUNIT_ASSERT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in KUNIT_ARRAY_PARAM()
2307 KUNIT_ASSERT_EQ(test, DUMMY_CLOCK_RATE_2, clk_round_rate(clk, DUMMY_CLOCK_RATE_2)); in KUNIT_ARRAY_PARAM()
2309 KUNIT_EXPECT_EQ(test, req.rate, DUMMY_CLOCK_RATE_2); in KUNIT_ARRAY_PARAM()
2310 KUNIT_EXPECT_EQ(test, req.best_parent_rate, DUMMY_CLOCK_RATE_2); in KUNIT_ARRAY_PARAM()
2311 KUNIT_EXPECT_PTR_EQ(test, req.best_parent_hw, &ctx->mux_ctx.hw); in KUNIT_ARRAY_PARAM()
2323 * Test suite for a clock whose parent is a pass-through clk whose parent is a
2380 static int clk_mux_notifier_test_init(struct kunit *test) in clk_mux_notifier_test_init() argument
2386 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_mux_notifier_test_init()
2389 test->priv = ctx; in clk_mux_notifier_test_init()
2411 ctx->mux_ctx.hw.init = CLK_HW_INIT_PARENTS("test-mux", top_parents, in clk_mux_notifier_test_init()
2426 static void clk_mux_notifier_test_exit(struct kunit *test) in clk_mux_notifier_test_exit() argument
2428 struct clk_mux_notifier_ctx *ctx = test->priv; in clk_mux_notifier_test_exit()
2440 * Test that if the we have a notifier registered on a mux, the core
2444 static void clk_mux_notifier_set_parent_test(struct kunit *test) in clk_mux_notifier_set_parent_test() argument
2446 struct clk_mux_notifier_ctx *ctx = test->priv; in clk_mux_notifier_set_parent_test()
2453 KUNIT_ASSERT_EQ(test, ret, 0); in clk_mux_notifier_set_parent_test()
2458 KUNIT_ASSERT_GT(test, ret, 0); in clk_mux_notifier_set_parent_test()
2460 KUNIT_EXPECT_EQ(test, ctx->pre_rate_change.old_rate, DUMMY_CLOCK_RATE_1); in clk_mux_notifier_set_parent_test()
2461 KUNIT_EXPECT_EQ(test, ctx->pre_rate_change.new_rate, DUMMY_CLOCK_RATE_2); in clk_mux_notifier_set_parent_test()
2466 KUNIT_ASSERT_GT(test, ret, 0); in clk_mux_notifier_set_parent_test()
2468 KUNIT_EXPECT_EQ(test, ctx->post_rate_change.old_rate, DUMMY_CLOCK_RATE_1); in clk_mux_notifier_set_parent_test()
2469 KUNIT_EXPECT_EQ(test, ctx->post_rate_change.new_rate, DUMMY_CLOCK_RATE_2); in clk_mux_notifier_set_parent_test()
2481 * Test suite for a mux with multiple parents, and a notifier registered
2494 clk_mux_no_reparent_test_init(struct kunit *test) in clk_mux_no_reparent_test_init() argument
2500 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_mux_no_reparent_test_init()
2503 test->priv = ctx; in clk_mux_no_reparent_test_init()
2522 ctx->hw.init = CLK_HW_INIT_PARENTS("test-mux", parents, in clk_mux_no_reparent_test_init()
2533 clk_mux_no_reparent_test_exit(struct kunit *test) in clk_mux_no_reparent_test_exit() argument
2535 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_mux_no_reparent_test_exit()
2543 * Test that if the we have a mux that cannot change parent and we call
2547 static void clk_mux_no_reparent_round_rate(struct kunit *test) in clk_mux_no_reparent_round_rate() argument
2549 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_mux_no_reparent_round_rate()
2558 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_mux_no_reparent_round_rate()
2561 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_mux_no_reparent_round_rate()
2564 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, other_parent); in clk_mux_no_reparent_round_rate()
2565 KUNIT_ASSERT_FALSE(test, clk_is_match(parent, other_parent)); in clk_mux_no_reparent_round_rate()
2568 KUNIT_ASSERT_GT(test, other_parent_rate, 0); in clk_mux_no_reparent_round_rate()
2572 KUNIT_ASSERT_GT(test, rounded_rate, 0); in clk_mux_no_reparent_round_rate()
2573 KUNIT_EXPECT_EQ(test, rounded_rate, parent_rate); in clk_mux_no_reparent_round_rate()
2579 * Test that if the we have a mux that cannot change parent and we call
2583 static void clk_mux_no_reparent_set_rate(struct kunit *test) in clk_mux_no_reparent_set_rate() argument
2585 struct clk_multiple_parent_ctx *ctx = test->priv; in clk_mux_no_reparent_set_rate()
2595 KUNIT_ASSERT_PTR_NE(test, parent, NULL); in clk_mux_no_reparent_set_rate()
2598 KUNIT_ASSERT_GT(test, parent_rate, 0); in clk_mux_no_reparent_set_rate()
2601 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, other_parent); in clk_mux_no_reparent_set_rate()
2602 KUNIT_ASSERT_FALSE(test, clk_is_match(parent, other_parent)); in clk_mux_no_reparent_set_rate()
2605 KUNIT_ASSERT_GT(test, other_parent_rate, 0); in clk_mux_no_reparent_set_rate()
2609 KUNIT_ASSERT_EQ(test, ret, 0); in clk_mux_no_reparent_set_rate()
2612 KUNIT_ASSERT_GT(test, rate, 0); in clk_mux_no_reparent_set_rate()
2613 KUNIT_EXPECT_EQ(test, rate, parent_rate); in clk_mux_no_reparent_set_rate()
2625 * Test suite for a clock mux that isn't allowed to change parent, using
2654 * Test that a clk registered with a struct device_node can
2662 * Test that a clk registered with a struct device_node can
2670 * Test that a clk registered with a struct device_node can
2680 * Test that a clk registered with a struct device_node can
2690 * Test that a clk registered with a struct device_node can
2700 * Test that a clk registered with a struct device_node can
2717 * @np: device node of clk under test
2718 * @hw: clk_hw for clk under test
2725 static int clk_register_clk_parent_data_of_test_init(struct kunit *test) in clk_register_clk_parent_data_of_test_init() argument
2729 KUNIT_ASSERT_EQ(test, 0, in clk_register_clk_parent_data_of_test_init()
2730 of_overlay_apply_kunit(test, kunit_clk_parent_data_test)); in clk_register_clk_parent_data_of_test_init()
2732 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_register_clk_parent_data_of_test_init()
2735 test->priv = ctx; in clk_register_clk_parent_data_of_test_init()
2737 ctx->np = of_find_compatible_node(NULL, NULL, "test,clk-parent-data"); in clk_register_clk_parent_data_of_test_init()
2741 of_node_put_kunit(test, ctx->np); in clk_register_clk_parent_data_of_test_init()
2747 * Test that a clk registered with a struct device_node can find a parent based on
2750 static void clk_register_clk_parent_data_of_test(struct kunit *test) in clk_register_clk_parent_data_of_test() argument
2752 struct clk_register_clk_parent_data_of_ctx *ctx = test->priv; in clk_register_clk_parent_data_of_test()
2758 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np); in clk_register_clk_parent_data_of_test()
2760 expected_parent = of_clk_get_kunit(test, ctx->np, 0); in clk_register_clk_parent_data_of_test()
2761 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, expected_parent); in clk_register_clk_parent_data_of_test()
2763 test_param = test->param_value; in clk_register_clk_parent_data_of_test()
2769 KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, ctx->np, &ctx->hw)); in clk_register_clk_parent_data_of_test()
2772 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent_hw); in clk_register_clk_parent_data_of_test()
2774 actual_parent = clk_hw_get_clk_kunit(test, parent_hw, __func__); in clk_register_clk_parent_data_of_test()
2775 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, actual_parent); in clk_register_clk_parent_data_of_test()
2777 KUNIT_EXPECT_TRUE(test, clk_is_match(expected_parent, actual_parent)); in clk_register_clk_parent_data_of_test()
2787 * Test suite for registering clks with struct clk_parent_data and a struct
2798 * @dev: device of clk under test
2799 * @hw: clk_hw for clk under test
2825 static void clk_register_clk_parent_data_device_driver(struct kunit *test) in clk_register_clk_parent_data_device_driver() argument
2827 struct clk_register_clk_parent_data_device_ctx *ctx = test->priv; in clk_register_clk_parent_data_device_driver()
2829 { .compatible = "test,clk-parent-data" }, in clk_register_clk_parent_data_device_driver()
2838 KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); in clk_register_clk_parent_data_device_driver()
2839 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->dev); in clk_register_clk_parent_data_device_driver()
2846 * Test that a clk registered with a struct device can find a
2854 * Test that a clk registered with a struct device can find a
2862 * Test that a clk registered with a struct device can find a
2872 * Test that a clk registered with a struct device can find a
2881 * Test that a clk registered with a struct device can find a
2891 * Test that a clk registered with a struct device can find a
2907 * Test that a clk registered with a struct device can find a parent based on in KUNIT_ARRAY_PARAM()
2910 static void clk_register_clk_parent_data_device_test(struct kunit *test) in KUNIT_ARRAY_PARAM()
2918 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in KUNIT_ARRAY_PARAM()
2919 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in KUNIT_ARRAY_PARAM()
2920 test->priv = ctx; in KUNIT_ARRAY_PARAM()
2922 clk_register_clk_parent_data_device_driver(test); in KUNIT_ARRAY_PARAM()
2924 expected_parent = clk_get_kunit(test, ctx->dev, "50"); in KUNIT_ARRAY_PARAM()
2925 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, expected_parent); in KUNIT_ARRAY_PARAM()
2927 test_param = test->param_value; in KUNIT_ARRAY_PARAM()
2933 KUNIT_ASSERT_EQ(test, 0, clk_hw_register_kunit(test, ctx->dev, &ctx->hw)); in KUNIT_ARRAY_PARAM()
2936 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent_hw); in KUNIT_ARRAY_PARAM()
2938 actual_parent = clk_hw_get_clk_kunit(test, parent_hw, __func__); in KUNIT_ARRAY_PARAM()
2939 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, actual_parent); in KUNIT_ARRAY_PARAM()
2941 KUNIT_EXPECT_TRUE(test, clk_is_match(expected_parent, actual_parent)); in KUNIT_ARRAY_PARAM()
2948 * Test that a clk registered with a struct device can find a
2957 * Test that a clk registered with a struct device can find a
2966 * Test that a clk registered with a struct device can find a
2977 * Test that a clk registered with a struct device can find a
2987 * Test that a clk registered with a struct device can find a
2997 * Test that a clk registered with a struct device can find a
3014 * Test that a clk registered with a struct device can find a in KUNIT_ARRAY_PARAM()
3017 static void clk_register_clk_parent_data_device_hw_test(struct kunit *test) in KUNIT_ARRAY_PARAM()
3026 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in KUNIT_ARRAY_PARAM()
3027 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in KUNIT_ARRAY_PARAM()
3028 test->priv = ctx; in KUNIT_ARRAY_PARAM()
3030 clk_register_clk_parent_data_device_driver(test); in KUNIT_ARRAY_PARAM()
3032 parent = kunit_kzalloc(test, sizeof(*parent), GFP_KERNEL); in KUNIT_ARRAY_PARAM()
3033 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in KUNIT_ARRAY_PARAM()
3039 KUNIT_ASSERT_EQ(test, 0, clk_hw_register_kunit(test, ctx->dev, parent_hw)); in KUNIT_ARRAY_PARAM()
3041 test_param = test->param_value; in KUNIT_ARRAY_PARAM()
3049 KUNIT_ASSERT_EQ(test, 0, clk_hw_register_kunit(test, ctx->dev, &ctx->hw)); in KUNIT_ARRAY_PARAM()
3051 KUNIT_EXPECT_PTR_EQ(test, parent_hw, clk_hw_get_parent(&ctx->hw)); in KUNIT_ARRAY_PARAM()
3062 static int clk_register_clk_parent_data_device_init(struct kunit *test) in clk_register_clk_parent_data_device_init() argument
3064 KUNIT_ASSERT_EQ(test, 0, in clk_register_clk_parent_data_device_init()
3065 of_overlay_apply_kunit(test, kunit_clk_parent_data_test)); in clk_register_clk_parent_data_device_init()
3071 * Test suite for registering clks with struct clk_parent_data and a struct
3086 * struct clk_assigned_rates_test_param - Test parameters for clk_assigned_rates test
3087 * @desc: Test description
3088 * @overlay_begin: Pointer to start of DT overlay to apply for test
3089 * @overlay_end: Pointer to end of DT overlay to apply for test
3108 clk_assigned_rates_register_clk(struct kunit *test, in clk_assigned_rates_register_clk() argument
3120 KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, np, &ctx->hw)); in clk_assigned_rates_register_clk()
3121 KUNIT_ASSERT_EQ(test, ctx->rate, rate); in clk_assigned_rates_register_clk()
3125 * Does most of the work of the test:
3127 * 1. Apply the overlay to test
3128 * 2. Register the clk or clks to test
3130 * 4. Apply clk defaults to the consumer device if this is a consumer test
3132 * The tests will set different test_param values to test different scenarios
3133 * and validate that in their test functions.
3135 static int clk_assigned_rates_test_init(struct kunit *test) in clk_assigned_rates_test_init() argument
3143 test_param = test->param_value; in clk_assigned_rates_test_init()
3145 KUNIT_ASSERT_EQ(test, 0, __of_overlay_apply_kunit(test, in clk_assigned_rates_test_init()
3149 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, in clk_assigned_rates_test_init()
3150 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL)); in clk_assigned_rates_test_init()
3151 test->priv = ctx; in clk_assigned_rates_test_init()
3153 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, in clk_assigned_rates_test_init()
3154 np = of_find_compatible_node(NULL, NULL, "test,clk-assigned-rates")); in clk_assigned_rates_test_init()
3155 of_node_put_kunit(test, np); in clk_assigned_rates_test_init()
3157 KUNIT_ASSERT_EQ(test, 0, of_property_read_u32(np, "#clock-cells", &clk_cells)); in clk_assigned_rates_test_init()
3159 KUNIT_ASSERT_LT(test, clk_cells, 2); in clk_assigned_rates_test_init()
3161 clk_assigned_rates_register_clk(test, &ctx->clk0, np, in clk_assigned_rates_test_init()
3164 KUNIT_ASSERT_EQ(test, 0, in clk_assigned_rates_test_init()
3165 of_clk_add_hw_provider_kunit(test, np, of_clk_hw_simple_get, in clk_assigned_rates_test_init()
3168 clk_assigned_rates_register_clk(test, &ctx->clk1, np, in clk_assigned_rates_test_init()
3171 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, in clk_assigned_rates_test_init()
3172 data = kunit_kzalloc(test, struct_size(data, hws, 2), GFP_KERNEL)); in clk_assigned_rates_test_init()
3177 KUNIT_ASSERT_EQ(test, 0, in clk_assigned_rates_test_init()
3178 of_clk_add_hw_provider_kunit(test, np, of_clk_hw_onecell_get, data)); in clk_assigned_rates_test_init()
3183 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, in clk_assigned_rates_test_init()
3184 consumer = of_find_compatible_node(NULL, NULL, "test,clk-consumer")); in clk_assigned_rates_test_init()
3185 of_node_put_kunit(test, consumer); in clk_assigned_rates_test_init()
3187 KUNIT_ASSERT_EQ(test, 0, of_clk_set_defaults(consumer, false)); in clk_assigned_rates_test_init()
3193 static void clk_assigned_rates_assigns_one(struct kunit *test) in clk_assigned_rates_assigns_one() argument
3195 struct clk_assigned_rates_context *ctx = test->priv; in clk_assigned_rates_assigns_one()
3197 KUNIT_EXPECT_EQ(test, ctx->clk0.rate, ASSIGNED_RATES_0_RATE); in clk_assigned_rates_assigns_one()
3200 static void clk_assigned_rates_assigns_multiple(struct kunit *test) in clk_assigned_rates_assigns_multiple() argument
3202 struct clk_assigned_rates_context *ctx = test->priv; in clk_assigned_rates_assigns_multiple()
3204 KUNIT_EXPECT_EQ(test, ctx->clk0.rate, ASSIGNED_RATES_0_RATE); in clk_assigned_rates_assigns_multiple()
3205 KUNIT_EXPECT_EQ(test, ctx->clk1.rate, ASSIGNED_RATES_1_RATE); in clk_assigned_rates_assigns_multiple()
3208 static void clk_assigned_rates_skips(struct kunit *test) in clk_assigned_rates_skips() argument
3210 struct clk_assigned_rates_context *ctx = test->priv; in clk_assigned_rates_skips()
3211 const struct clk_assigned_rates_test_param *test_param = test->param_value; in clk_assigned_rates_skips()
3213 KUNIT_EXPECT_NE(test, ctx->clk0.rate, ASSIGNED_RATES_0_RATE); in clk_assigned_rates_skips()
3214 KUNIT_EXPECT_EQ(test, ctx->clk0.rate, test_param->rate0); in clk_assigned_rates_skips()
3222 /* Test cases that assign one rate */
3226 * Test that a single cell assigned-clock-rates property
3234 * Test that a single cell assigned-clock-rates property
3243 * Test that a single cell assigned-clock-rates-u64 property
3251 * Test that a single cell assigned-clock-rates-u64 property
3267 /* Test cases that assign multiple rates */
3271 * Test that a multiple cell assigned-clock-rates property
3279 * Test that a multiple cell assigned-clock-rates property
3288 * Test that a single cell assigned-clock-rates-u64 property
3296 * Test that a multiple cell assigned-clock-rates-u64 property
3315 /* Test cases that skip changing the rate due to malformed DT */
3319 * Test that an assigned-clock-rates property without an assigned-clocks
3328 * Test that an assigned-clock-rates property without an assigned-clocks
3338 * Test that an assigned-clock-rates property of zero doesn't
3347 * Test that an assigned-clock-rates property of zero doesn't
3357 * Test that an assigned-clocks property with a null phandle
3366 * Test that an assigned-clocks property with a null phandle
3390 * Test suite for assigned-clock-rates{-u64} DT property.