Lines Matching refs:test

111 static int clk_test_init_with_ops(struct kunit *test, const struct clk_ops *ops)  in clk_test_init_with_ops()  argument
117 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_test_init_with_ops()
121 test->priv = ctx; in clk_test_init_with_ops()
134 static int clk_test_init(struct kunit *test) in clk_test_init() argument
136 return clk_test_init_with_ops(test, &clk_dummy_rate_ops); in clk_test_init()
139 static int clk_maximize_test_init(struct kunit *test) in clk_maximize_test_init() argument
141 return clk_test_init_with_ops(test, &clk_dummy_maximize_rate_ops); in clk_maximize_test_init()
144 static int clk_minimize_test_init(struct kunit *test) in clk_minimize_test_init() argument
146 return clk_test_init_with_ops(test, &clk_dummy_minimize_rate_ops); in clk_minimize_test_init()
149 static void clk_test_exit(struct kunit *test) in clk_test_exit() argument
151 struct clk_dummy_context *ctx = test->priv; in clk_test_exit()
159 static void clk_test_get_rate(struct kunit *test) in clk_test_get_rate() argument
161 struct clk_dummy_context *ctx = test->priv; in clk_test_get_rate()
167 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_get_rate()
168 KUNIT_EXPECT_EQ(test, rate, ctx->rate); in clk_test_get_rate()
178 static void clk_test_set_get_rate(struct kunit *test) in clk_test_set_get_rate() argument
180 struct clk_dummy_context *ctx = test->priv; in clk_test_set_get_rate()
185 KUNIT_ASSERT_EQ(test, in clk_test_set_get_rate()
190 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_set_get_rate()
191 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_test_set_get_rate()
201 static void clk_test_set_set_get_rate(struct kunit *test) in clk_test_set_set_get_rate() argument
203 struct clk_dummy_context *ctx = test->priv; in clk_test_set_set_get_rate()
208 KUNIT_ASSERT_EQ(test, in clk_test_set_set_get_rate()
212 KUNIT_ASSERT_EQ(test, in clk_test_set_set_get_rate()
217 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_set_set_get_rate()
218 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_test_set_set_get_rate()
225 static void clk_test_round_set_get_rate(struct kunit *test) in clk_test_round_set_get_rate() argument
227 struct clk_dummy_context *ctx = test->priv; in clk_test_round_set_get_rate()
233 KUNIT_ASSERT_GT(test, rounded_rate, 0); in clk_test_round_set_get_rate()
234 KUNIT_EXPECT_EQ(test, rounded_rate, DUMMY_CLOCK_RATE_1); in clk_test_round_set_get_rate()
236 KUNIT_ASSERT_EQ(test, in clk_test_round_set_get_rate()
241 KUNIT_ASSERT_GT(test, set_rate, 0); in clk_test_round_set_get_rate()
242 KUNIT_EXPECT_EQ(test, rounded_rate, set_rate); in clk_test_round_set_get_rate()
265 static int clk_orphan_transparent_single_parent_mux_test_init(struct kunit *test) in clk_orphan_transparent_single_parent_mux_test_init() argument
272 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_orphan_transparent_single_parent_mux_test_init()
275 test->priv = ctx; in clk_orphan_transparent_single_parent_mux_test_init()
301 static void clk_orphan_transparent_single_parent_mux_test_exit(struct kunit *test) in clk_orphan_transparent_single_parent_mux_test_exit() argument
303 struct clk_single_parent_ctx *ctx = test->priv; in clk_orphan_transparent_single_parent_mux_test_exit()
313 static void clk_test_orphan_transparent_parent_mux_set_range(struct kunit *test) in clk_test_orphan_transparent_parent_mux_set_range() argument
315 struct clk_single_parent_ctx *ctx = test->priv; in clk_test_orphan_transparent_parent_mux_set_range()
321 KUNIT_ASSERT_GT(test, rate, 0); in clk_test_orphan_transparent_parent_mux_set_range()
323 KUNIT_ASSERT_EQ(test, in clk_test_orphan_transparent_parent_mux_set_range()
330 KUNIT_ASSERT_GT(test, new_rate, 0); in clk_test_orphan_transparent_parent_mux_set_range()
331 KUNIT_EXPECT_EQ(test, rate, new_rate); in clk_test_orphan_transparent_parent_mux_set_range()
351 static void clk_range_test_set_range(struct kunit *test) in clk_range_test_set_range() argument
353 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range()
358 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range()
365 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range()
366 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range()
367 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range()
374 static void clk_range_test_set_range_invalid(struct kunit *test) in clk_range_test_set_range_invalid() argument
376 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_invalid()
380 KUNIT_EXPECT_LT(test, in clk_range_test_set_range_invalid()
391 static void clk_range_test_multiple_disjoints_range(struct kunit *test) in clk_range_test_multiple_disjoints_range() argument
393 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_disjoints_range()
398 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_disjoints_range()
401 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_disjoints_range()
403 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_disjoints_range()
407 KUNIT_EXPECT_LT(test, in clk_range_test_multiple_disjoints_range()
419 static void clk_range_test_set_range_round_rate_lower(struct kunit *test) in clk_range_test_set_range_round_rate_lower() argument
421 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_round_rate_lower()
426 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_round_rate_lower()
433 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_round_rate_lower()
434 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_round_rate_lower()
435 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_round_rate_lower()
442 static void clk_range_test_set_range_set_rate_lower(struct kunit *test) in clk_range_test_set_range_set_rate_lower() argument
444 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_rate_lower()
449 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_lower()
455 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_lower()
460 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_set_rate_lower()
461 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_set_rate_lower()
462 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_set_rate_lower()
471 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
473 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_round_rate_consistent_lower()
478 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_lower()
485 KUNIT_ASSERT_GT(test, rounded, 0); in clk_range_test_set_range_set_round_rate_consistent_lower()
487 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_lower()
491 KUNIT_EXPECT_EQ(test, rounded, clk_get_rate(clk)); in clk_range_test_set_range_set_round_rate_consistent_lower()
498 static void clk_range_test_set_range_round_rate_higher(struct kunit *test) in clk_range_test_set_range_round_rate_higher() argument
500 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_round_rate_higher()
505 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_round_rate_higher()
512 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_round_rate_higher()
513 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_round_rate_higher()
514 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_round_rate_higher()
521 static void clk_range_test_set_range_set_rate_higher(struct kunit *test) in clk_range_test_set_range_set_rate_higher() argument
523 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_rate_higher()
528 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_higher()
534 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_rate_higher()
539 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_set_rate_higher()
540 KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_set_rate_higher()
541 KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_set_rate_higher()
550 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
552 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_set_round_rate_consistent_higher()
557 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_higher()
564 KUNIT_ASSERT_GT(test, rounded, 0); in clk_range_test_set_range_set_round_rate_consistent_higher()
566 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_set_round_rate_consistent_higher()
570 KUNIT_EXPECT_EQ(test, rounded, clk_get_rate(clk)); in clk_range_test_set_range_set_round_rate_consistent_higher()
581 static void clk_range_test_set_range_get_rate_raised(struct kunit *test) in clk_range_test_set_range_get_rate_raised() argument
583 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_get_rate_raised()
588 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_raised()
592 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_raised()
599 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_get_rate_raised()
600 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_get_rate_raised()
611 static void clk_range_test_set_range_get_rate_lowered(struct kunit *test) in clk_range_test_set_range_get_rate_lowered() argument
613 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_get_rate_lowered()
618 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_lowered()
622 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_get_rate_lowered()
629 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_get_rate_lowered()
630 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_get_rate_lowered()
663 static void clk_range_test_set_range_rate_maximized(struct kunit *test) in clk_range_test_set_range_rate_maximized() argument
665 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_rate_maximized()
670 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
674 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
681 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
682 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_rate_maximized()
684 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
691 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
692 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2 - 1000); in clk_range_test_set_range_rate_maximized()
694 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_maximized()
701 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_maximized()
702 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_set_range_rate_maximized()
713 static void clk_range_test_multiple_set_range_rate_maximized(struct kunit *test) in clk_range_test_multiple_set_range_rate_maximized() argument
715 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_maximized()
722 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_maximized()
725 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_maximized()
727 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
731 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
738 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
739 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_maximized()
741 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
748 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
749 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_maximized()
751 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_maximized()
756 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_maximized()
757 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_maximized()
784 static void clk_range_test_set_range_rate_minimized(struct kunit *test) in clk_range_test_set_range_rate_minimized() argument
786 struct clk_dummy_context *ctx = test->priv; in clk_range_test_set_range_rate_minimized()
791 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
795 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
802 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
803 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_rate_minimized()
805 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
812 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
813 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1 + 1000); in clk_range_test_set_range_rate_minimized()
815 KUNIT_ASSERT_EQ(test, in clk_range_test_set_range_rate_minimized()
822 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_set_range_rate_minimized()
823 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_set_range_rate_minimized()
834 static void clk_range_test_multiple_set_range_rate_minimized(struct kunit *test) in clk_range_test_multiple_set_range_rate_minimized() argument
836 struct clk_dummy_context *ctx = test->priv; in clk_range_test_multiple_set_range_rate_minimized()
843 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user1); in clk_range_test_multiple_set_range_rate_minimized()
846 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, user2); in clk_range_test_multiple_set_range_rate_minimized()
848 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
855 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
856 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_minimized()
858 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
865 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
866 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2); in clk_range_test_multiple_set_range_rate_minimized()
868 KUNIT_ASSERT_EQ(test, in clk_range_test_multiple_set_range_rate_minimized()
873 KUNIT_ASSERT_GT(test, rate, 0); in clk_range_test_multiple_set_range_rate_minimized()
874 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1); in clk_range_test_multiple_set_range_rate_minimized()