Skip to content
  • Jerome Brunet's avatar
    clk: add duty cycle support · 9fba738a
    Jerome Brunet authored
    
    
    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: default avatarJerome Brunet <jbrunet@baylibre.com>
    Signed-off-by: default avatarMichael Turquette <mturquette@baylibre.com>
    Link: lkml.kernel.org/r/20180619144141.8506-1-jbrunet@baylibre.com
    9fba738a