rtc: add RTC driver for TPS6586x
PATCH v2 1/1 rtc: add RTC driver for TPS6586x
Add an RTC driver for TPS6586X chips by TI.
This driver supports:
- Setting and getting time and date.
- Setting and reading alarm time.
- Alarm and interrupt functionlity.
---
Changes from V1:
- Remove WARN flag, just returning error is fine.
- Register interrupt after rtc device register.
drivers/rtc/Kconfig | 8 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-tps6586x.c | 356 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 365 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-tps6586x.c
drivers/rtc/Kconfig +8 -0
@@ -352,6 +352,14 @@ config RTC_DRV_TWL4030 This driver can also be built as a module. If so, the module will be called rtc-twl. +config RTC_DRV_TPS6586X + tristate "TI TPS6586X RTC driver" + depends on MFD_TPS6586X + help + TI Power Managment IC TPS6586X supports RTC functionality + along with alarm. This driver supports the RTC driver for + the TPS6586X RTC module. + config RTC_DRV_TPS65910 tristate "TI TPS65910 RTC driver" depends on RTC_CLASS && MFD_TPS65910
drivers/rtc/Makefile +1 -0
@@ -111,6 +111,7 @@ obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o +obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
drivers/rtc/rtc-tps6586x.c new file +356 -0
356 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Hi Laxman,
Quoted 19 lines · On Friday 21 December 2012 20:42:28 you wrote:
Add an RTC driver for TPS6586X chips by TI.
This driver supports:
- Setting and getting time and date.
- Setting and reading alarm time.
- Alarm and interrupt functionlity.Signed-off-by Laxman Dewangan <[email protected]>---
Changes from V1:
- Remove WARN flag, just returning error is fine.
- Register interrupt after rtc device register.drivers/rtc/Kconfig | 8 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-tps6586x.c | 356 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 365 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-tps6586x.c
....
Quoted 6 lines
drivers/rtc/rtc-tps6586x.c new file +0
-0
....
Quoted 6 lines
drivers/rtc/rtc-tps6586x.c new file +5
-0+static int tps6586x_rtc_probe (struct platform_device *pdev) +{ +struct device *tps_dev =to_tps6586x_dev (&pdev->dev); +struct tps6586x_rtc *rtc; +int ret;
drivers/rtc/rtc-tps6586x.c line 264
Quoted 10 lines
drivers/rtc/rtc-tps6586x.c new file +10
-0+ + rtc =devm_kzalloc (&pdev->dev,sizeof (*rtc),GFP_KERNEL ); +if (!rtc) +return -ENOMEM ; + + rtc->dev = &pdev->dev; + rtc->irq =platform_get_irq (pdev,0 ); + +/* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start =mktime (2000 ,1 ,1 ,0 ,0 ,0 );
any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
Marc
Quoted 10 lines · Marc Dietrich
Hi Laxman,
drivers/rtc/rtc-tps6586x.c line 264
Quoted 3 lines · On Friday 21 December 2012 20:42:28 you wrote:
drivers/rtc/rtc-tps6586x.c new file +3
-0+ +/* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start =mktime (2000 ,1 ,1 ,0 ,0 ,0 );any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
No specific reason. If 2009 should be default then I can push patch to set it as 2009.
Quoted 11 lines · On Thursday 27 December 2012 20:29:14 Laxman Dewangan wrote:
Quoted 9 lines · Marc Dietrich
Hi Laxman,
drivers/rtc/rtc-tps6586x.c line 264
Quoted 3 lines · On Friday 21 December 2012 20:42:28 you wrote:
drivers/rtc/rtc-tps6586x.c new file +3
-0+ +/* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start =mktime (2000 ,1 ,1 ,0 ,0 ,0 );any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
Quoted 2 lines
No specific reason. If 2009 should be default then I can push patch to set it as 2009.
At least myself would appreciate this.
Stephen said on IRC, that this could be configurable via a property node from device tree (and also the IRQ which now comes from platform_data). Maybe this can be added later on. I really like to see this driver in mainline now.
You can also add a "Tested-By: Marc Dietrich <[email protected]>"
Thanks
Marc
Quoted 10 lines · Marc Dietrich
Quoted 9 lines · On Thursday 27 December 2012 20:29:14 Laxman Dewangan wrote:
Quoted 8 lines · Marc Dietrich
Hi Laxman,
drivers/rtc/rtc-tps6586x.c line 264
Quoted 3 lines · On Friday 21 December 2012 20:42:28 you wrote:
drivers/rtc/rtc-tps6586x.c new file +3
-0+ +/* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start =mktime (2000 ,1 ,1 ,0 ,0 ,0 );any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
Quoted 7 lines
Quoted 2 lines
No specific reason. If 2009 should be default then I can push patch to set it as 2009.
At least myself would appreciate this.
Stephen said on IRC, that this could be configurable via a property node from device tree (and also the IRQ which now comes from
platform_data). Maybe this can be added later on. I really like to see this driver in mainline now.
I have not added platform data for setting epoch start time. I think we should be fine to hardcode in probe itself.
The irq support is there as the mfd driver put proper alarm irq for rtc when it adds mfd sub devices. The ultimate irq number allocated run time through ird domain. I tested with RTC test wwhich is part of Documentation/rtc.txt.
Quoted 12 lines · On Thu, 27 Dec 2012 20:29:14 +0530 Laxman Dewangan <[email protected]> wrote:
Quoted 10 lines · Marc Dietrich
Hi Laxman,
Review
Quoted 3 lines · On Friday 21 December 2012 20:42:28 you wrote:
(quoted diff) +3
-0+ + /* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start = mktime(2000, 1, 1, 0, 0, 0);any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
Quoted 2 lines
No specific reason. If 2009 should be default then I can push patch to set it as 2009.
I'd like to get this into Linus soon so let's get it finished. I assume it's merely this?
drivers/rtc/rtc-tps6586x.c renamed from drivers/rtc/rtc-tps6586x.c~rtc-add-rtc-driver-for-tps6586x-fix2 +2 -2
@@ -260,8 +260,8 @@ static int tps6586x_rtc_probe(struct pla rtc->dev = &pdev->dev; rtc->irq =platform_get_irq (pdev,0 ); -/* Set epoch start as 00:00:00:01:01:2000 */ - rtc->epoch_start =mktime (2000 ,1 ,1 ,0 ,0 ,0 ); +/* Set epoch start as 00:00:00:01:01:2009 */ + rtc->epoch_start =mktime (2009 ,1 ,1 ,0 ,0 ,0 );/* 1 kHz tick mode, enable tick counting */ ret = tps6586x_update(tps_dev, RTC_CTRL,
_
Quoted 14 lines · Andrew Morton
Quoted 11 lines · On Thu, 27 Dec 2012 20:29:14 +0530 Laxman Dewangan <[email protected]> wrote:
Quoted 10 lines · Marc Dietrich
Hi Laxman,
Review
Quoted 3 lines · On Friday 21 December 2012 20:42:28 you wrote:
(quoted diff) +3
-0+ + /* Set epoch start as 00:00:00:01:01:2000 */ + rtc->epoch_start = mktime(2000, 1, 1, 0, 0, 0);any reason why you hard coded it to 2000? All boards I know use 2009, so with this patch, everyone needs to set his clock again.
Quoted 4 lines
Quoted 2 lines
No specific reason. If 2009 should be default then I can push patch to set it as 2009.
I'd like to get this into Linus soon so let's get it finished. I assume it's merely this?
Yes, the following change is only require. I was waiting for driver to be avilable on linux-next before sending patch to avoid any conflict. Thanks a lot for taking care.