diff options
author | Heiko Stübner <heiko@sntech.de> | 2015-04-16 15:46:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:02 -0400 |
commit | f539a8acf1070557aef9c5df682751ba2af1005f (patch) | |
tree | 33fb2c970dd0c91e5f0539e0643ed8ff7d2be99b /drivers/rtc | |
parent | 492da68c8c3babc573208e057a9011d9489f2b5a (diff) |
drivers/rtc/rtc-hym8563.c: fix swapped enable/disable of clockout control bit
The hym8563 datasheet describes the clock output control-bit as "when set
to logic 0, the square wave output is enable, when set to logic 1, the
CLKOUT output is inhibited". But in reality the setting is exactly
opposite.
Before now, the clock output was not really used, but on the rk3288 soc
this generated clock is used to supply the temperature sensor block and
the swapped bit value prevented it from working. With the corrected
value, the tsadc now reports correct values.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-hym8563.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index d4a65619ef14..0f710e98538f 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #define HYM8563_ALM_BIT_DISABLE BIT(7) | 66 | #define HYM8563_ALM_BIT_DISABLE BIT(7) |
67 | 67 | ||
68 | #define HYM8563_CLKOUT 0x0d | 68 | #define HYM8563_CLKOUT 0x0d |
69 | #define HYM8563_CLKOUT_DISABLE BIT(7) | 69 | #define HYM8563_CLKOUT_ENABLE BIT(7) |
70 | #define HYM8563_CLKOUT_32768 0 | 70 | #define HYM8563_CLKOUT_32768 0 |
71 | #define HYM8563_CLKOUT_1024 1 | 71 | #define HYM8563_CLKOUT_1024 1 |
72 | #define HYM8563_CLKOUT_32 2 | 72 | #define HYM8563_CLKOUT_32 2 |
@@ -360,9 +360,9 @@ static int hym8563_clkout_control(struct clk_hw *hw, bool enable) | |||
360 | return ret; | 360 | return ret; |
361 | 361 | ||
362 | if (enable) | 362 | if (enable) |
363 | ret &= ~HYM8563_CLKOUT_DISABLE; | 363 | ret |= HYM8563_CLKOUT_ENABLE; |
364 | else | 364 | else |
365 | ret |= HYM8563_CLKOUT_DISABLE; | 365 | ret &= ~HYM8563_CLKOUT_ENABLE; |
366 | 366 | ||
367 | return i2c_smbus_write_byte_data(client, HYM8563_CLKOUT, ret); | 367 | return i2c_smbus_write_byte_data(client, HYM8563_CLKOUT, ret); |
368 | } | 368 | } |
@@ -386,7 +386,7 @@ static int hym8563_clkout_is_prepared(struct clk_hw *hw) | |||
386 | if (ret < 0) | 386 | if (ret < 0) |
387 | return ret; | 387 | return ret; |
388 | 388 | ||
389 | return !(ret & HYM8563_CLKOUT_DISABLE); | 389 | return !!(ret & HYM8563_CLKOUT_ENABLE); |
390 | } | 390 | } |
391 | 391 | ||
392 | static const struct clk_ops hym8563_clkout_ops = { | 392 | static const struct clk_ops hym8563_clkout_ops = { |
@@ -407,7 +407,7 @@ static struct clk *hym8563_clkout_register_clk(struct hym8563 *hym8563) | |||
407 | int ret; | 407 | int ret; |
408 | 408 | ||
409 | ret = i2c_smbus_write_byte_data(client, HYM8563_CLKOUT, | 409 | ret = i2c_smbus_write_byte_data(client, HYM8563_CLKOUT, |
410 | HYM8563_CLKOUT_DISABLE); | 410 | 0); |
411 | if (ret < 0) | 411 | if (ret < 0) |
412 | return ERR_PTR(ret); | 412 | return ERR_PTR(ret); |
413 | 413 | ||