clk: bcm2835: correctly enable fractional clock support
authorMartin Sperl <kernel@martin.sperl.org>
Mon, 29 Feb 2016 11:39:21 +0000 (11:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Jun 2016 01:18:50 +0000 (18:18 -0700)
commit3d6661b2043581b9ce1e2e359033098d87140bae
tree754019b8ed3f1ca4028bb4ff9795cd03340eb3e4
parentd43f1f993c8d0af8b2aac740b068c316d874c299
clk: bcm2835: correctly enable fractional clock support

commit 959ca92a3235fc4b17c1e18483fc390b3d612254 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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/clk/bcm/clk-bcm2835.c