xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/media/v4l2-clocks.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunV4L2 clocks
4*4882a593Smuzhiyun-----------
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun.. attention::
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun	This is a temporary API and it shall be replaced by the generic
9*4882a593Smuzhiyun	clock API, when the latter becomes widely available.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunMany subdevices, like camera sensors, TV decoders and encoders, need a clock
12*4882a593Smuzhiyunsignal to be supplied by the system. Often this clock is supplied by the
13*4882a593Smuzhiyunrespective bridge device. The Linux kernel provides a Common Clock Framework for
14*4882a593Smuzhiyunthis purpose. However, it is not (yet) available on all architectures. Besides,
15*4882a593Smuzhiyunthe nature of the multi-functional (clock, data + synchronisation, I2C control)
16*4882a593Smuzhiyunconnection of subdevices to the system might impose special requirements on the
17*4882a593Smuzhiyunclock API usage. E.g. V4L2 has to support clock provider driver unregistration
18*4882a593Smuzhiyunwhile a subdevice driver is holding a reference to the clock. For these reasons
19*4882a593Smuzhiyuna V4L2 clock helper API has been developed and is provided to bridge and
20*4882a593Smuzhiyunsubdevice drivers.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunThe API consists of two parts: two functions to register and unregister a V4L2
23*4882a593Smuzhiyunclock source: v4l2_clk_register() and v4l2_clk_unregister() and calls to control
24*4882a593Smuzhiyuna clock object, similar to the respective generic clock API calls:
25*4882a593Smuzhiyunv4l2_clk_get(), v4l2_clk_put(), v4l2_clk_enable(), v4l2_clk_disable(),
26*4882a593Smuzhiyunv4l2_clk_get_rate(), and v4l2_clk_set_rate(). Clock suppliers have to provide
27*4882a593Smuzhiyunclock operations that will be called when clock users invoke respective API
28*4882a593Smuzhiyunmethods.
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunIt is expected that once the CCF becomes available on all relevant
31*4882a593Smuzhiyunarchitectures this API will be removed.
32