[PATCH v2 1/2] rtc: mcp795: Add support for weekday.

2016-12-25 Thread Emil Bartczak
This patch adds support for saving/loading weekday value from the chip. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index ce75e42..8107fc0 100644

[PATCH v2 2/2] rtc: mcp795: add alarm support.

2016-12-25 Thread Emil Bartczak
This patch adds alarm support. This allows to configure the chip to generate an interrupt when the alarm matches current time value. Alarm can be programmed up to one year in the future and is accurate to the second. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 171

[PATCH v2 0/2] Provides support for alarm.

2016-12-25 Thread Emil Bartczak
This patchset provides support for weekday and alarm in the file driver/rtc/rtc-mcp795.c. Please review the changes and consider to apply them to the main kernel tree. Changes from v1: - Cover letter added. Emil Bartczak (2): rtc: mcp795: Add support for weekday. rtc: mcp795: add alarm

[PATCH 2/2] rtc: mcp795: add alarm support.

2016-12-25 Thread Emil Bartczak
This patch adds alarm support. This allows to configure the chip to generate an interrupt when the alarm matches current time value. Alarm can be programmed up to one year in the future and is accurate to the second. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 171

[PATCH 1/2] rtc: mcp795: Add support for weekday.

2016-12-25 Thread Emil Bartczak
This patch adds support for saving/loading weekday value from the chip. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index ce75e42..8107fc0 100644

[PATCH v2 2/6] rtc: mcp795: fix bitmask value for leap year (LP).

2016-12-07 Thread Emil Bartczak
According the datasheet the leap year is a fifth bit in month register. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index 0389ee0..5fbdb4c 100644 --- a/drivers

[PATCH v2 5/6] rtc: mcp795: Prefer using the BIT() macro.

2016-12-07 Thread Emil Bartczak
This patch doesn't change the code but replaces all bitmask values with the BIT(x) macro. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index 89b0ffa..8e

[PATCH v2 6/6] rtc: mcp795: Fix whitespace and indentation.

2016-12-07 Thread Emil Bartczak
Fix whitespace and indentation errors and the following checkpatch warnings: - line 15: Block comments use a trailing */ on a separate line - line 256: Line over 80 characters No code change. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 12 ++-- 1 file changed, 6

[PATCH v2 3/6] rtc: mcp795: fix time range difference between linux and RTC chip.

2016-12-07 Thread Emil Bartczak
In linux rtc_time struct, tm_mon range is 0~11, while in RTC HW REG, month range is 1~12. This patch adjusts difference of them. Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers

[PATCH v2 4/6] rtc: mcp795: fix month write resetting date to 1.

2016-12-07 Thread Emil Bartczak
Write command after loading the date and begin a new command to write the month. In addition, disable the oscillator before loading the new values. This is done by ensuring both the ST and EXTOSC bits are cleared and waiting for the OSCON bit to clear. Signed-off-by: Emil Bartczak --- drivers/rtc

[PATCH v2 0/6] Provides bug fixes for rtc-mcp795.c

2016-12-07 Thread Emil Bartczak
values with the BIT(x) macro. Emil Bartczak (6): rtc: mcp795: use bcd2bin/bin2bcd. rtc: mcp795: fix bitmask value for leap year (LP). rtc: mcp795: fix time range difference between linux and RTC chip. rtc: mcp795: fix month write resetting date to 1. rtc: mcp795: Prefer using the BIT

[PATCH v2 1/6] rtc: mcp795: use bcd2bin/bin2bcd.

2016-12-07 Thread Emil Bartczak
Change rtc-mcp795.c to use the bcd2bin/bin2bcd functions. This change fixes the wrong conversion of month value from binary to BCD (missing right shift operation for 10 month). Signed-off-by: Emil Bartczak --- drivers/rtc/rtc-mcp795.c | 25 + 1 file changed, 13

Re: [PATCH 1/4] rtc: mcp795: fix invalid month setting.

2016-12-05 Thread Emil Bartczak
On Mon, Dec 05, 2016 at 11:15:59PM +0100, Alexandre Belloni wrote: > On 05/12/2016 at 23:03:52 +0100, Emil Bartczak wrote : > > > > > > > #define MCP795_WRITE 0x12 > > > > #define MCP795_UNLOCK 0x14 > > > > #define MCP795_IDWRITE 0x32 >

Re: [PATCH 3/4] rtc: mcp795: fix month write resetting date to 1.

2016-12-05 Thread Emil Bartczak
Hi, On Mon, Dec 05, 2016 at 04:24:10PM +0100, Alexandre Belloni wrote: > On 05/12/2016 at 14:11:52 +0100, Emil Bartczak wrote : > > According to Microchip errata some combinations of date and month > > values may result in the date being reset to 1, even if the date > > is

Re: [PATCH 1/4] rtc: mcp795: fix invalid month setting.

2016-12-05 Thread Emil Bartczak
Hi, On Mon, Dec 05, 2016 at 04:09:59PM +0100, Alexandre Belloni wrote: > Hi, > > On 05/12/2016 at 14:11:50 +0100, Emil Bartczak wrote : > > The 10 month register was always set to value 0 in the RTC hardware. > > Due to the bug month November or December became February.

[PATCH 3/4] rtc: mcp795: fix month write resetting date to 1.

2016-12-05 Thread Emil Bartczak
According to Microchip errata some combinations of date and month values may result in the date being reset to 1, even if the date is also written with the month (for example 31-07 or 31-08). As a workaround avoid writing date and month values within the same Write command. Instead, terminate the W

[PATCH 2/4] rtc: mcp795: fix time range difference between linux and RTC chip

2016-12-05 Thread Emil Bartczak
In linux rtc_time struct, tm_mon range is 0~11, while in RTC HW REG, month range is 1~12. This patch adjusts difference of them. --- drivers/rtc/rtc-mcp795.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index 266328b.

[PATCH 4/4] rtc: mcp795: use bcd2bin/bin2bcd.

2016-12-05 Thread Emil Bartczak
Change rtc-mcp795.c to use the bcd2bin/bin2bcd functions. --- drivers/rtc/rtc-mcp795.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index c9ad46c..1d823f9 100644 --- a/drivers/rtc/rtc-mcp795.c

[PATCH 0/4] Provides bug fixes for rtc-mcp795.c

2016-12-05 Thread Emil Bartczak
This patchset provides 3 bug fixes (patch 1, 2 and 3) and one improvement (patch 4) in the file driver/rtc/rtc-mcp795.c. Please review the changes and consider to apply them to the main kernel tree. Emil Bartczak (4): rtc: mcp795: fix invalid month setting. rtc: mcp795: fix time range

[PATCH 1/4] rtc: mcp795: fix invalid month setting.

2016-12-05 Thread Emil Bartczak
The 10 month register was always set to value 0 in the RTC hardware. Due to the bug month November or December became February. --- drivers/rtc/rtc-mcp795.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index 40

[PATCH] drivers/rtc/rtc-mcp795.c: add devicetree support

2016-03-20 Thread Emil Bartczak
Add device tree support to the rtc-mcp795 driver. Signed-off-by: Emil Bartczak --- Documentation/devicetree/bindings/rtc/maxim,mcp795.txt | 11 +++ drivers/rtc/rtc-mcp795.c | 10 ++ 2 files changed, 21 insertions(+) create mode 100644 Documentation