RTC: RTC driver for DA9052/53 PMIC v1
Subsystems (2)
PATCH 6/7 RTC: RTC driver for DA9052/53 PMIC v1
RTC Driver for Dialog Semiconductor DA9052/53 PMICs.
This patch is functionally tested on Samsung SMDKV6410.
--- drivers/rtc/Kconfig | 7 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-da9052.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 301 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-da9052.c
drivers/rtc/Kconfig +7 -0
@@ -554,6 +554,13 @@ config RTC_DRV_DS1742 This driver can also be built as a module. If so, the module will be called rtc-ds1742. +config RTC_DRV_DA9052 + tristate "Dialog DA9052/DA9053 RTC" + depends on PMIC_DA9052 + help + Say y here to support the RTC driver for Dialog Semiconductor + DA9052-BC and DA9053-AA/Bx PMICs. + config RTC_DRV_EFI tristate "EFI RTC" depends on IA64
drivers/rtc/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o +obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
drivers/rtc/rtc-da9052.c new file +293 -0
293 lines not on this page · raw message
Quoted 10 lines · On Mon, 6 Feb 2012 18:19:05 +0530 Ashish Jangam…
RTC Driver for Dialog Semiconductor DA9052/53 PMICs.
This patch is functionally tested on Samsung SMDKV6410.
...
drivers/rtc/Kconfig | 7 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-da9052.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 301 insertions(+), 0 deletions(-)
I assume that this patch is mergeable without any of the other six patches in this series. It compiles OK...
Review
Quoted 7 lines
...
(quoted diff) +4
-0+static int da9052_read_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm) +{ + int ret; + uint8_t v[5] = {0, 0, 0, 0, 0};
These initalised local arrays are expensive. The below patch reduces the module's text size by over 100 bytes.
The arrays whcih are passed to da9052_group_write() surely didn't need initalisation, and I trust that's also the case with the arrays which are passed to da9052_group_read()?
Quoted 3 lines
...
From: Andrew Morton <[email protected]>
Subject: rtc-rtc-driver-for-da9052-53-pmic-v1-fix
- clean up file header layout
- remove unneeded initialisation of local arrays
---
drivers/rtc/rtc-da9052.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/rtc/rtc-da9052.c renamed from drivers/rtc/rtc-da9052.c~rtc-rtc-driver-for-da9052-53-pmic-v1-fix +6 -6
@@ -1,9 +1,9 @@/* * Real time clock driver for DA9052 * -*Copyright(c) 2012 Dialog Semiconductor Ltd. +* Copyright(c) 2012 Dialog Semiconductor Ltd. * -*Author: Dajun Dajun Chen <[email protected]> +* Author: Dajun Dajun Chen <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ static irqreturn_t da9052_rtc_irq(int irstatic int da9052_read_alarm (struct da9052 *da9052,struct rtc_time *rtc_tm) {int ret; -uint8_t v[5 ] = {0 ,0 ,0 ,0 ,0 }; +uint8_t v[5 ]; ret =da9052_group_read (da9052,DA9052_ALARM_MI_REG ,5 , v);if (ret !=0 ) {
@@ -92,7 +92,7 @@ static int da9052_read_alarm(struct da90static int da9052_set_alarm (struct da9052 *da9052,struct rtc_time *rtc_tm) {int ret; -uint8_t v[3 ] = {0 ,0 ,0 }; +uint8_t v[3 ]; rtc_tm->tm_year -=100 ; rtc_tm->tm_mon +=1 ;
@@ -136,7 +136,7 @@ static int da9052_rtc_get_alarm_status(sstatic int da9052_rtc_read_time (struct device *dev,struct rtc_time *rtc_tm) {struct da9052_rtc *rtc =dev_get_drvdata (dev); -uint8_t v[6 ] = {0 ,0 ,0 ,0 ,0 ,0 }; +uint8_t v[6 ];int ret; ret =da9052_group_read (rtc->da9052,DA9052_COUNT_S_REG ,6 , v);
@@ -164,7 +164,7 @@ static int da9052_rtc_read_time(struct dstatic int da9052_rtc_set_time (struct device *dev,struct rtc_time *tm) {struct da9052_rtc *rtc; -uint8_t v[6 ] = {0 ,0 ,0 ,0 ,0 ,0 }; +uint8_t v[6 ]; rtc =dev_get_drvdata (dev);
_