clk: bcm2835: correctly enable fractional clock support
authorMartin Sperl <kernel@martin.sperl.org>
Mon, 29 Feb 2016 11:39:21 +0000 (11:39 +0000)
committerEric Anholt <eric@anholt.net>
Thu, 17 Mar 2016 17:42:17 +0000 (10:42 -0700)
commit959ca92a3235fc4b17c1e18483fc390b3d612254
treed508bfd33842db3b5cf5fa60a6aa34d2ded2868b
parent997f16bd5d2e9b3456027f96fcadfe1e2bf12f4e
clk: bcm2835: correctly enable fractional clock support

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: 41691b8862e2 ("clk: bcm2835: Add support for programming the
audio domain clocks")

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
drivers/clk/bcm/clk-bcm2835.c