| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * An rtc/i2c driver for the EM Microelectronic EM3027 |
|---|
| 3 | 4 | * Copyright 2011 CompuLab, Ltd. |
|---|
| .. | .. |
|---|
| 5 | 6 | * Author: Mike Rapoport <mike@compulab.co.il> |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Based on rtc-ds1672.c by Alessandro Zummo <a.zummo@towertech.it> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | 9 | */ |
|---|
| 13 | 10 | |
|---|
| 14 | 11 | #include <linux/i2c.h> |
|---|
| .. | .. |
|---|
| 74 | 71 | tm->tm_hour = bcd2bin(buf[2]); |
|---|
| 75 | 72 | tm->tm_mday = bcd2bin(buf[3]); |
|---|
| 76 | 73 | tm->tm_wday = bcd2bin(buf[4]); |
|---|
| 77 | | - tm->tm_mon = bcd2bin(buf[5]); |
|---|
| 74 | + tm->tm_mon = bcd2bin(buf[5]) - 1; |
|---|
| 78 | 75 | tm->tm_year = bcd2bin(buf[6]) + 100; |
|---|
| 79 | 76 | |
|---|
| 80 | 77 | return 0; |
|---|
| .. | .. |
|---|
| 97 | 94 | buf[3] = bin2bcd(tm->tm_hour); |
|---|
| 98 | 95 | buf[4] = bin2bcd(tm->tm_mday); |
|---|
| 99 | 96 | buf[5] = bin2bcd(tm->tm_wday); |
|---|
| 100 | | - buf[6] = bin2bcd(tm->tm_mon); |
|---|
| 97 | + buf[6] = bin2bcd(tm->tm_mon + 1); |
|---|
| 101 | 98 | buf[7] = bin2bcd(tm->tm_year % 100); |
|---|
| 102 | 99 | |
|---|
| 103 | 100 | /* write time/date registers */ |
|---|