Lines Matching +full:fixed +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0
3 * KUnit test for clk fixed rate basic type
6 #include <linux/clk-provider.h>
17 #include "clk-fixed-rate_test.h"
20 * struct clk_hw_fixed_rate_kunit_params - Parameters to pass to __clk_hw_register_fixed_rate()
30 * @clk_fixed_flags: fixed rate specific clk flags
51 hw = __clk_hw_register_fixed_rate(params->dev, params->np, in clk_hw_register_fixed_rate_kunit_init()
52 params->name, in clk_hw_register_fixed_rate_kunit_init()
53 params->parent_name, in clk_hw_register_fixed_rate_kunit_init()
54 params->parent_hw, in clk_hw_register_fixed_rate_kunit_init()
55 params->parent_data, in clk_hw_register_fixed_rate_kunit_init()
56 params->flags, in clk_hw_register_fixed_rate_kunit_init()
57 params->fixed_rate, in clk_hw_register_fixed_rate_kunit_init()
58 params->fixed_accuracy, in clk_hw_register_fixed_rate_kunit_init()
59 params->clk_fixed_flags, in clk_hw_register_fixed_rate_kunit_init()
64 res->data = hw; in clk_hw_register_fixed_rate_kunit_init()
71 struct clk_hw *hw = res->data; in clk_hw_register_fixed_rate_kunit_exit()
77 * clk_hw_register_fixed_rate_kunit() - Test managed __clk_hw_register_fixed_rate()
81 * Return: Registered fixed rate clk_hw or ERR_PTR on failure
94 return ERR_PTR(-EINVAL); in clk_hw_register_fixed_rate_kunit()
100 * clk_hw_unregister_fixed_rate_kunit() - Test managed clk_hw_unregister_fixed_rate()
102 * @hw: fixed rate clk to unregister upon test completion
114 return -ENOMEM; in clk_hw_unregister_fixed_rate_kunit()
120 * Test that clk_get_rate() on a fixed rate clk registered with
129 hw = clk_hw_register_fixed_rate(NULL, "test-fixed-rate", NULL, 0, fixed_rate); in clk_fixed_rate_rate_test()
140 * Test that clk_get_accuracy() on a fixed rate clk registered via
149 hw = clk_hw_register_fixed_rate_with_accuracy(NULL, "test-fixed-rate", in clk_fixed_rate_accuracy_test()
161 /* Test suite for a fixed rate clk without any parent */
174 * Test that clk_get_parent() on a fixed rate clk gets the proper parent.
181 const char *parent_name = "test-fixed-rate-parent"; in clk_fixed_rate_parent_test()
193 hw = clk_hw_register_fixed_rate(NULL, "test-fixed-rate", parent_name, 0, 0); in clk_fixed_rate_parent_test()
205 * Test that clk_get_rate() on a fixed rate clk ignores the parent rate.
213 const char *parent_name = "test-fixed-rate-parent"; in clk_fixed_rate_parent_rate_test()
223 hw = clk_hw_register_fixed_rate(NULL, "test-fixed-rate", parent_name, 0, in clk_fixed_rate_parent_rate_test()
235 * Test that clk_get_accuracy() on a fixed rate clk ignores the parent accuracy.
243 const char *parent_name = "test-fixed-rate-parent"; in clk_fixed_rate_parent_accuracy_test()
253 hw = clk_hw_register_fixed_rate_with_accuracy(NULL, "test-fixed-rate", in clk_fixed_rate_parent_accuracy_test()
265 /* Test suite for a fixed rate clk with a parent */
287 return container_of(to_platform_driver(pdev->dev.driver), in pdev_to_clk_fixed_rate_of_test_context()
293 * Test that of_fixed_clk_setup() registers a fixed rate clk with the proper
294 * rate.
298 struct clk_fixed_rate_of_test_context *ctx = test->priv; in clk_fixed_rate_of_probe_test()
299 struct device *dev = ctx->dev; in clk_fixed_rate_of_probe_test()
310 * Test that of_fixed_clk_setup() registers a fixed rate clk with the proper
315 struct clk_fixed_rate_of_test_context *ctx = test->priv; in clk_fixed_rate_of_accuracy_test()
316 struct device *dev = ctx->dev; in clk_fixed_rate_of_accuracy_test()
336 ctx->dev = &pdev->dev; in clk_fixed_rate_of_test_probe()
337 complete(&ctx->probed); in clk_fixed_rate_of_test_probe()
346 { .compatible = "test,single-clk-consumer" }, in clk_fixed_rate_of_init()
354 test->priv = ctx; in clk_fixed_rate_of_init()
356 ctx->pdrv.probe = clk_fixed_rate_of_test_probe; in clk_fixed_rate_of_init()
357 ctx->pdrv.driver.of_match_table = match_table; in clk_fixed_rate_of_init()
358 ctx->pdrv.driver.name = __func__; in clk_fixed_rate_of_init()
359 ctx->pdrv.driver.owner = THIS_MODULE; in clk_fixed_rate_of_init()
360 init_completion(&ctx->probed); in clk_fixed_rate_of_init()
362 KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); in clk_fixed_rate_of_init()
363 KUNIT_ASSERT_NE(test, 0, wait_for_completion_timeout(&ctx->probed, HZ)); in clk_fixed_rate_of_init()
380 MODULE_DESCRIPTION("KUnit test for clk fixed rate basic type");