Clk API¶
The KUnit clk API is used to test clk providers and clk consumers.
Parameters
structkunit*testThe test context
structclk*clkclk to prepare and enable
Return
0 on success, or negative errno on failure.
Parameters
structkunit*testThe test context
structdevice*devdevice for clock “consumer”
constchar*con_idclock consumer ID
Description
Just likeclk_get(), except the clk is managed by the test case and isautomatically put withclk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
Parameters
structkunit*testThe test context
structdevice_node*npdevice_node for clock “consumer”
intindexindex in ‘clocks’ property ofnp
Description
Just likeof_clk_get(), except the clk is managed by the test case and isautomatically put withclk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
- structclk*clk_hw_get_clk_kunit(structkunit*test,structclk_hw*hw,constchar*con_id)¶
Test managed
clk_hw_get_clk()
Parameters
structkunit*testThe test context
structclk_hw*hwclk_hw associated with the clk being consumed
constchar*con_idconnection ID string on device
Description
Just likeclk_hw_get_clk(), except the clk is managed by the test case andis automatically put withclk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
- structclk*clk_hw_get_clk_prepared_enabled_kunit(structkunit*test,structclk_hw*hw,constchar*con_id)¶
Test managed
clk_hw_get_clk()+clk_prepare_enable()
Parameters
structkunit*testThe test context
structclk_hw*hwclk_hw associated with the clk being consumed
constchar*con_idconnection ID string on device
Description
Just like
structclk*clk=clk_hw_get_clk(...);clk_prepare_enable(clk);
except the clk is managed by the test case and is automatically disabled andunprepared withclk_disable_unprepare() and put withclk_put() after thetest case concludes.
Return
new clk consumer that is prepared and enabled or ERR_PTR on failure.
- intclk_hw_register_kunit(structkunit*test,structdevice*dev,structclk_hw*hw)¶
Test managed
clk_hw_register()
Parameters
structkunit*testThe test context
structdevice*devdevice that is registering this clock
structclk_hw*hwlink to hardware-specific clock data
Description
Just likeclk_hw_register(), except the clk registration is managed by thetest case and is automatically unregistered after the test case concludes.
Return
0 on success or a negative errno value on failure.
- intof_clk_hw_register_kunit(structkunit*test,structdevice_node*node,structclk_hw*hw)¶
Test managed
of_clk_hw_register()
Parameters
structkunit*testThe test context
structdevice_node*nodedevice_node of device that is registering this clock
structclk_hw*hwlink to hardware-specific clock data
Description
Just likeof_clk_hw_register(), except the clk registration is managed bythe test case and is automatically unregistered after the test caseconcludes.
Return
0 on success or a negative errno value on failure.
- intof_clk_add_hw_provider_kunit(structkunit*test,structdevice_node*np,structclk_hw*(*get)(structof_phandle_args*clkspec,void*data),void*data)¶
Test managed
of_clk_add_hw_provider()
Parameters
structkunit*testThe test context
structdevice_node*npDevice node pointer associated with clock provider
structclk_hw*(*get)(structof_phandle_args*clkspec,void*data)Callback for decoding clk_hw
void*dataContext pointer forget callback.
Description
Just likeof_clk_add_hw_provider(), except the clk_hw provider is managed bythe test case and is automatically unregistered after the test caseconcludes.
Return
0 on success or a negative errno value on failure.