Skip to contentSkip to conversation

RTC: RTC module of DA9052 PMIC driver

PATCH In review Ashish Jangam 3 participants 5 messages Apr 6, 2011 – Apr 14, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/11 RTC: RTC module of DA9052 PMIC driver

Hi Paul,

RTC Driver for Dialog Semiconductor DA9052 PMICs.

Changes made since last submission:
. read and write operation moved to MFD

Linux Kernel Version: 2.6.37

---

drivers/rtc/Kconfig +7 -0
diff -Naur orig_linux-2.6.37/drivers/rtc/Kconfig linux-2.6.37/drivers/rtc/Kconfig
@@ -664,6 +664,13 @@
 	help
 	  If you say yes here you get support for the RTC subsystem of the
 	  NUC910/NUC920 used in embedded systems.
+
+config RTC_DRV_DA9052
+	tristate "Dialog DA9052 RTC"
+	depends on PMIC_DA9052
+	help
+	  Say y here to support the RTC driver for
+	  Dialog Semiconductor DA9052 PMIC.
 
 comment "on-CPU RTC drivers"
 
drivers/rtc/Makefile +1 -0
diff -Naur orig_linux-2.6.37/drivers/rtc/Makefile linux-2.6.37/drivers/rtc/Makefile
@@ -28,6 +28,7 @@
 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_DS1216)		+= rtc-ds1216.o
drivers/rtc/rtc-da9052.c +338 -0

338 lines not on this page · raw message

Regards,
Ashish

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#1 lore raw
Quoted 8 lines · On Wed, 6 Apr 2011 18:47:29 +0530 Ashish Jangam…

Hi Paul,

RTC Driver for Dialog Semiconductor DA9052 PMICs.

Changes made since last submission:
. read and write operation moved to MFD

Linux Kernel Version: 2.6.37

The patch looks OK(ish) to me from a quick read.

drivers/rtc/Kconfig line 673

Quoted 13 lines
drivers/rtc/Kconfig +7 -0
@@ -664,6 +664,13 @@
 	help
 	  If you say yes here you get support for the RTC subsystem of the
 	  NUC910/NUC920 used in embedded systems.
+
+config RTC_DRV_DA9052
+	tristate "Dialog DA9052 RTC"
+	depends on PMIC_DA9052
+	help
+	  Say y here to support the RTC driver for
+	  Dialog Semiconductor DA9052 PMIC.

But there's not much I can do with it because PMIC_DA9052 does not exist in mainline or in linux-next.

What is a PMIC_DA9052, anyway? What CPU architectures support it, etc?

Have you identified a maintainer who will be merging the main patch which enables PMIC_DA9052?

Please feed all the patches through scritps/checkpatch.pl if you haven't already done so, to clean up lots of trivial errors.

For example, "MFD: MFD module of DA9052 PMIC driver":

	total: 449 errors, 832 warnings, 2326 lines checked

A couple of minor comments:

Quoted 7 lines
drivers/rtc/Kconfig +7 -0
+static int da9052_rtc_enable_alarm(struct da9052 *da9052, unsigned char flag)
+{
+	int ret = 0;
+	if (flag) {
+		ret = da9052_set_bits(da9052, DA9052_ALARM_Y_REG,
+					DA9052_ALARM_Y_ALARM_ON);
+		if (ret != 0)

drivers/rtc/Kconfig

Quoted 10 lines
drivers/rtc/Kconfig +10 -0
+			dev_err(da9052->dev, "Failed to enable ALM: %d\n", ret);
+	} else {
+		ret = da9052_clear_bits(da9052, DA9052_ALARM_Y_REG,
+					DA9052_ALARM_Y_ALARM_ON);
+		if (ret != 0)
+			dev_err(da9052->dev, "da9052_rtc_enable_alarm -> \
+					da9052_clear_bits error %d\n", ret);
+	}
+	return ret;
+}

"flag" is a poor identifier - it's largely meaningless. Perhaps "enable" would be a better choice in this case. Making it have the bool type wouild make sense also.

drivers/rtc/Kconfig

Quoted 3 lines
drivers/rtc/Kconfig +3 -0
+static irqreturn_t da9052_rtc_irq(int irq, void *data)
+{
+	struct da9052_rtc *rtc = (struct da9052_rtc *)data;

typecasting a void* like this is unneeded and is in fact undesirable, as it will suppress possibly-useful warnings.

Quoted 13 lines
drivers/rtc/Kconfig +13 -0
+	int ret = 0;
+
+	ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_MI_REG);
+	if (ret < 0) {
+		dev_err(rtc->da9052->dev, "da9052_rtc_notifier -> \
+					da9052_reg_read error %d\n", ret);
+		return IRQ_NONE;
+	}
+	if (ret & DA9052_ALARMMI_ALARMTYPE)
+		da9052_rtc_enable_alarm(rtc->da9052, 0);
+
+	return IRQ_HANDLED;
+}
maintainer
#2 lore raw
Quoted 6 lines · Andrew Morton

On Wed, 6 Apr 2011 18:47:29 +0530
Ashish Jangam <[email protected]> wrote:
Please feed all the patches through scritps/checkpatch.pl if you haven't already done so, to clean up lots of trivial errors.
For example, "MFD: MFD module of DA9052 PMIC driver":

	total: 449 errors, 832 warnings, 2326 lines checked

And a couple of more comments...

Quoted 1 line
Quoted 1 line

+static int da9052_rtc_enable_alarm(struct da9052 *da9052, unsigned char flag)

[]

Quoted 3 lines

drivers/rtc/rtc-da9052.c line 40

Quoted 3 lines
drivers/rtc/rtc-da9052.c +3 -0
+		if (ret != 0)
+			dev_err(da9052->dev, "da9052_rtc_enable_alarm -> \
+					da9052_clear_bits error %d\n", ret);

[]

Quoted 4 lines

drivers/rtc/rtc-da9052.c line 53

Quoted 4 lines
drivers/rtc/rtc-da9052.c +4 -0
+	ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_MI_REG);
+	if (ret < 0) {
+		dev_err(rtc->da9052->dev, "da9052_rtc_notifier -> \
+					da9052_reg_read error %d\n", ret);

Line continuations in the middle a format string are very error prone to whitespace errors, just like these introduce bad whitespace after the ->.

These are better as:

		dev_err(rtc->da9052->dev, "%s: da9052_reg_read error: %d\n",
			__func__, ret);

Or maybe use some new macro/function(s) like

#define rtc_err(rtc, fmt, ...)	\
	dev_err((rtc)->da9052->dev, "%s: " fmt, __func__, ##__VA_ARGS__)

so these can be:

		rtc_err(rtc, "da9052_reg_read error: %d\n, ret);
maintainer
#3 lore raw

PATCH 1/1 checkpatch: Add check for line continuations in quoted strings

In reply to Andrew Morton

Add a warning for unterminated quoted strings with line continuations as these frequently add unwanted whitespace.

---

 scripts/checkpatch.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
scripts/checkpatch.pl +5 -0
index d867081..f3f907b 100755
@@ -2748,6 +2748,11 @@ sub process {
 			WARN("sizeof(& should be avoided\n" . $herecurr);
 		}
 
+# check for line continuations in quoted strings with odd counts of "
+		if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
+			WARN("Avoid line continuations in quoted strings\n" . $herecurr);
+		}
+
 # check for new externs in .c files.
 		if ($realfile =~ /\.c$/ && defined $stat &&
 		    $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
#4 lore raw
In reply to Andrew Morton

Hi Andrew,

Thanks for the review comments. We have addresses most of the comments in the posting done recently. For some of your queries, kindly see our response below.

Regards,
Ashish J

Quoted 23 lines

-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Wednesday, April 13, 2011 5:08 AM
To: Ashish Jangam
Cc: Paul Gortmaker; [email protected]
Subject: Re: [PATCHv1 3/11] RTC: RTC module of DA9052 PMIC driver

Quoted 8 lines · On Wed, 6 Apr 2011 18:47:29 +0530 Ashish Jangam…

Hi Paul,

RTC Driver for Dialog Semiconductor DA9052 PMICs.

Changes made since last submission:
. read and write operation moved to MFD

Linux Kernel Version: 2.6.37

The patch looks OK(ish) to me from a quick read.

Quoted 1 line

--- orig_linux-2.6.37/drivers/rtc/Kconfig 2011-01-05 05:50:19.000000000

+0500

Quoted 15 lines

drivers/rtc/Kconfig line 673

Quoted 12 lines

+++ linux-2.6.37/drivers/rtc/Kconfig 2011-03-31 21:07:39.000000000 +0500

drivers/rtc/Kconfig +7 -0
@@ -664,6 +664,13 @@
 	help
 	  If you say yes here you get support for the RTC subsystem of the
 	  NUC910/NUC920 used in embedded systems.
+
+config RTC_DRV_DA9052
+	tristate "Dialog DA9052 RTC"
+	depends on PMIC_DA9052
+	help
+	  Say y here to support the RTC driver for
+	  Dialog Semiconductor DA9052 PMIC.

But there's not much I can do with it because PMIC_DA9052 does not exist in mainline or in linux-next.

DA9052 RTC has been placed under the "comment "Platform RTC drivers" section of drivers\rtc\Kconfig as the DA9052 MFD supports both the SPI and I2C serial protocols.

Quoted 2 lines

What is a PMIC_DA9052, anyway? What CPU architectures support it, etc?

The DA9052 are designed to support application processors and associated peripherals. The DA9052 provides 11 LDO's and 4 high efficiency programmable Buck Converters which deliver high efficiency across a wide range of line and load conditions. DA9052 PMIC is widely used in portable navigation devices and other handhelds for efficient power management.

Quoted 2 lines

Have you identified a maintainer who will be merging the main patch which enables PMIC_DA9052?

We have sent the DA9052 MFD patch which will enable the PMIC DA9052 for review comments to Mark Brown and the LKML mailing list community for their views on it.

Quoted 43 lines

Please feed all the patches through scritps/checkpatch.pl if you haven't already done so, to clean up lots of trivial errors.

For example, "MFD: MFD module of DA9052 PMIC driver":

	total: 449 errors, 832 warnings, 2326 lines checked

A couple of minor comments:

Review line 674

Quoted 1 line
(quoted diff) +1 -0
+static int da9052_rtc_enable_alarm(struct da9052 *da9052, unsigned char

flag)

Quoted 6 lines
drivers/rtc/rtc-da9052.c +6 -0
+{
+	int ret = 0;
+	if (flag) {
+		ret = da9052_set_bits(da9052, DA9052_ALARM_Y_REG,
+					DA9052_ALARM_Y_ALARM_ON);
+		if (ret != 0)

drivers/rtc/rtc-da9052.c line 43

Quoted 10 lines
drivers/rtc/rtc-da9052.c +10 -0
+			dev_err(da9052->dev, "Failed to enable ALM: %d\n", ret);
+	} else {
+		ret = da9052_clear_bits(da9052, DA9052_ALARM_Y_REG,
+					DA9052_ALARM_Y_ALARM_ON);
+		if (ret != 0)
+			dev_err(da9052->dev, "da9052_rtc_enable_alarm -> \
+					da9052_clear_bits error %d\n", ret);
+	}
+	return ret;
+}

"flag" is a poor identifier - it's largely meaningless. Perhaps "enable" would be a better choice in this case. Making it have the bool type wouild make sense also.

drivers/rtc/rtc-da9052.c line 47

Quoted 3 lines
drivers/rtc/rtc-da9052.c +3 -0
+static irqreturn_t da9052_rtc_irq(int irq, void *data)
+{
+	struct da9052_rtc *rtc = (struct da9052_rtc *)data;

typecasting a void* like this is unneeded and is in fact undesirable, as it will suppress possibly-useful warnings.

Quoted 14 lines

drivers/rtc/rtc-da9052.c line 60

Quoted 13 lines
drivers/rtc/rtc-da9052.c +13 -0
+	int ret = 0;
+
+	ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_MI_REG);
+	if (ret < 0) {
+		dev_err(rtc->da9052->dev, "da9052_rtc_notifier -> \
+					da9052_reg_read error %d\n", ret);
+		return IRQ_NONE;
+	}
+	if (ret & DA9052_ALARMMI_ALARMTYPE)
+		da9052_rtc_enable_alarm(rtc->da9052, 0);
+
+	return IRQ_HANDLED;
+}

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�