]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.9/rtc-hym8563-fix-invalid-year-calculation.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.9 / rtc-hym8563-fix-invalid-year-calculation.patch
1 From d5861262210067fc01b2fb4f7af2fd85a3453f15 Mon Sep 17 00:00:00 2001
2 From: Alexander Kochetkov <al.kochet@gmail.com>
3 Date: Sun, 6 Mar 2016 12:43:57 +0300
4 Subject: rtc: hym8563: fix invalid year calculation
5
6 From: Alexander Kochetkov <al.kochet@gmail.com>
7
8 commit d5861262210067fc01b2fb4f7af2fd85a3453f15 upstream.
9
10 Year field must be in BCD format, according to
11 hym8563 datasheet.
12
13 Due to the bug year 2016 became 2010.
14
15 Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
16 Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
17 Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/rtc/rtc-hym8563.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/rtc/rtc-hym8563.c
25 +++ b/drivers/rtc/rtc-hym8563.c
26 @@ -144,7 +144,7 @@ static int hym8563_rtc_set_time(struct d
27 * it does not seem to carry it over a subsequent write/read.
28 * So we'll limit ourself to 100 years, starting at 2000 for now.
29 */
30 - buf[6] = tm->tm_year - 100;
31 + buf[6] = bin2bcd(tm->tm_year - 100);
32
33 /*
34 * CTL1 only contains TEST-mode bits apart from stop,