Duty cycle support for the clk api and drivers.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE1E8+bQtUhlZXGcO+ojqcm8MlpNQFAltg218ACgkQojqcm8Ml
pNRvCQ/+NxCXZb27GggqqwWEecdClTIigqStCcxbpp35kDlD4SvRBrpD12RzRMJZ
jdz3jtF2asWXRBJ+C5aB8n1mxH55rE+hxKFSh3ScKyxRExdLApBoPcbvjxP4wUGR
vTV+H90YvbpwaFLu6xV19W4i70sy21oNNAaUXPqrDp3cMiCpAayLofQFYYvxSycS
cz9uz9sVLEqi18v1UazgiWUnWb3Zrtwav1jrlN7QoB2332U7QZSLZwW495w+B+VE
urvg6RIIuW2zMjrsJQ74FuelLl6nza/T26e3xERGospxmyzu51g97xOr+F240mZ3
gtCMzk3cvN2+zkbKHDqjT1SMSFHek/RkRZQnVcq7XBfC1bIdaaK9rxev25tXeBAW
YFfhjagVstVYpYy0fRgt3wvtA9TKAHwEYp6LL0VBTDeylZ04C9DrwvG6lFgr9Fm9
WD7hpCKmEKrk+f5yYbePwjwtEdPHmZNhr0PKaU8O+KbE1r03nIbPFBMBEPo1VKUe
1oCh5KkDoRMfu1mZHc4AHZNHA3eFGmb/1LbtpqVr6Ktg16hkRe9+nZzr9Nz0VA5R
ETu8BlJTNl6Z1Kg0D8ltl7VJX8tHbPFtwM73zLdhWOwxqVX6KFlfbZcYgzdAISKn
ilVBycposI2JHHeMt4Nsiev3Kzvvcsv8S8h1FPye/kYA8u5YQ3E=
=v24K
-----END PGP SIGNATURE-----
clk: add duty cycle support

Add the possibility to apply and query the clock signal duty cycle ratio.

This is useful when the duty cycle of the clock signal depends on some
other parameters controlled by the clock framework.

For example, the duty cycle of a divider may depends on the raw divider
setting (ratio = N / div) , which is controlled by the CCF. In such case,
going through the pwm framework to control the duty cycle ratio of this
clock would be a burden.

A clock provider is not required to implement the operation to set and get
the duty cycle. If it does not implement .get_duty_cycle(), the ratio is
assumed to be 50%.

This change also adds a new flag, CLK_DUTY_CYCLE_PARENT. This flag should
be used to indicate that a clock, such as gates and muxes, may inherit
the duty cycle ratio of its parent clock. If a clock does not provide a
get_duty_cycle() callback and has CLK_DUTY_CYCLE_PARENT, then the call
will be directly forwarded to its parent clock, if any. For
set_duty_cycle(), the clock should also have CLK_SET_RATE_PARENT for the
call to be forwarded

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/20180619144141.8506-1-jbrunet@baylibre.com
4 files changed