• Martin Sperl's avatar
    clk: bcm2835: correctly enable fractional clock support · 3f3befd0
    Martin Sperl authored
    commit 959ca92a upstream.
    
    The current driver calculates the clock divider with
    fractional support enabled.
    
    But it does not enable fractional support in the
    control register itself resulting in an integer only divider,
    but in clk_set_rate responds back the fractionally divided
    clock frequency.
    
    This patch enables fractional support in the control register
    whenever there is a fractional bit set in the requested clock divider.
    
    Mash clock limits are are also handled for the PWM clock
    applying the correct divider limits (2 and max_int) applicable to
    basic fractional divider support (mash order of 1).
    
    It also adds locking to protect the read/modify/write cycle of
    the register modification.
    
    Fixes: 41691b88 ("clk: bcm2835: Add support for programming the
    audio domain clocks")
    Signed-off-by: default avatarMartin Sperl <kernel@martin.sperl.org>
    Signed-off-by: default avatarEric Anholt <eric@anholt.net>
    Reviewed-by: default avatarEric Anholt <eric@anholt.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    3f3befd0
clk-bcm2835.c 45.4 KB