diff mbox series

rtc: pcf8563: fix output clock rate

Message ID 20171107121217.31309-1-p.zabel@pengutronix.de
State Accepted
Headers show
Series rtc: pcf8563: fix output clock rate | expand

Commit Message

Philipp Zabel Nov. 7, 2017, 12:12 p.m. UTC
The pcf8563_clkout_recalc_rate function erroneously ignores the
frequency index read from the CLKO register and always returns
32768 Hz.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/rtc/rtc-pcf8563.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Belloni Nov. 8, 2017, 3:47 a.m. UTC | #1
On 07/11/2017 at 13:12:17 +0100, Philipp Zabel wrote:
> The pcf8563_clkout_recalc_rate function erroneously ignores the
> frequency index read from the CLKO register and always returns
> 32768 Hz.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/rtc/rtc-pcf8563.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index cea6ea4df970f..8c836c51a508f 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -419,13 +419,13 @@  static unsigned long pcf8563_clkout_recalc_rate(struct clk_hw *hw,
 	int ret = pcf8563_read_block_data(client, PCF8563_REG_CLKO, 1, &buf);
 
 	if (ret < 0)
 		return 0;
 
 	buf &= PCF8563_REG_CLKO_F_MASK;
-	return clkout_rates[ret];
+	return clkout_rates[buf];
 }
 
 static long pcf8563_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 				      unsigned long *prate)
 {
 	int i;