Lines Matching +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0
3 * KUnit helpers for clk providers and consumers
5 #include <linux/clk.h>
6 #include <linux/clk-provider.h>
11 #include <kunit/clk.h>
15 clk_disable_unprepare, struct clk *);
17 * clk_prepare_enable_kunit() - Test managed clk_prepare_enable()
19 * @clk: clk to prepare and enable
23 int clk_prepare_enable_kunit(struct kunit *test, struct clk *clk) in clk_prepare_enable_kunit() argument
27 ret = clk_prepare_enable(clk); in clk_prepare_enable_kunit()
32 clk); in clk_prepare_enable_kunit()
36 KUNIT_DEFINE_ACTION_WRAPPER(clk_put_wrapper, clk_put, struct clk *);
38 static struct clk *__clk_get_kunit(struct kunit *test, struct clk *clk) in __clk_get_kunit() argument
42 if (IS_ERR(clk)) in __clk_get_kunit()
43 return clk; in __clk_get_kunit()
45 ret = kunit_add_action_or_reset(test, clk_put_wrapper, clk); in __clk_get_kunit()
49 return clk; in __clk_get_kunit()
53 * clk_get_kunit() - Test managed clk_get()
58 * Just like clk_get(), except the clk is managed by the test case and is
61 * Return: new clk consumer or ERR_PTR on failure.
63 struct clk *
66 struct clk *clk; in clk_get_kunit() local
68 clk = clk_get(dev, con_id); in clk_get_kunit()
70 return __clk_get_kunit(test, clk); in clk_get_kunit()
75 * of_clk_get_kunit() - Test managed of_clk_get()
80 * Just like of_clk_get(), except the clk is managed by the test case and is
83 * Return: new clk consumer or ERR_PTR on failure.
85 struct clk *
88 struct clk *clk; in of_clk_get_kunit() local
90 clk = of_clk_get(np, index); in of_clk_get_kunit()
92 return __clk_get_kunit(test, clk); in of_clk_get_kunit()
97 * clk_hw_get_clk_kunit() - Test managed clk_hw_get_clk()
99 * @hw: clk_hw associated with the clk being consumed
102 * Just like clk_hw_get_clk(), except the clk is managed by the test case and
105 * Return: new clk consumer or ERR_PTR on failure.
107 struct clk *
110 struct clk *clk; in clk_hw_get_clk_kunit() local
112 clk = clk_hw_get_clk(hw, con_id); in clk_hw_get_clk_kunit()
114 return __clk_get_kunit(test, clk); in clk_hw_get_clk_kunit()
119 * clk_hw_get_clk_prepared_enabled_kunit() - Test managed clk_hw_get_clk() + clk_prepare_enable()
121 * @hw: clk_hw associated with the clk being consumed
126 * .. code-block:: c
128 * struct clk *clk = clk_hw_get_clk(...);
129 * clk_prepare_enable(clk);
131 * except the clk is managed by the test case and is automatically disabled and
135 * Return: new clk consumer that is prepared and enabled or ERR_PTR on failure.
137 struct clk *
142 struct clk *clk; in clk_hw_get_clk_prepared_enabled_kunit() local
144 clk = clk_hw_get_clk_kunit(test, hw, con_id); in clk_hw_get_clk_prepared_enabled_kunit()
145 if (IS_ERR(clk)) in clk_hw_get_clk_prepared_enabled_kunit()
146 return clk; in clk_hw_get_clk_prepared_enabled_kunit()
148 ret = clk_prepare_enable_kunit(test, clk); in clk_hw_get_clk_prepared_enabled_kunit()
152 return clk; in clk_hw_get_clk_prepared_enabled_kunit()
160 * clk_hw_register_kunit() - Test managed clk_hw_register()
163 * @hw: link to hardware-specific clock data
165 * Just like clk_hw_register(), except the clk registration is managed by the
183 * of_clk_hw_register_kunit() - Test managed of_clk_hw_register()
186 * @hw: link to hardware-specific clock data
188 * Just like of_clk_hw_register(), except the clk registration is managed by
207 MODULE_DESCRIPTION("KUnit helpers for clk providers and consumers");