OSDN Git Service

clk: add duty cycle support
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 19 Jun 2018 14:41:41 +0000 (16:41 +0200)
committerMichael Turquette <mturquette@baylibre.com>
Tue, 19 Jun 2018 17:06:29 +0000 (10:06 -0700)
commit9fba738a53dda20e748d6ee240b6c017c8146b4b
tree5f5844246fa0ae69bfb5ae6f532207fc344f4ecc
parentce397d215ccd07b8ae3f71db689aedb85d56ab40
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
drivers/clk/clk.c
include/linux/clk-provider.h
include/linux/clk.h
include/trace/events/clk.h