All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable
@ 2014-03-10 18:44 Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 1/6] rtc: pm8xxx: fixup checkpatch/style issues Josh Cartwright
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo, linux-kernel; +Cc: linux-arm-msm, rtc-linux

This patchset is based on Stephen Boyd's PM8921 modernization/cleanups[1], and
allows for this RTC driver to be usable again.

Changes since v1:
  * Further style cleanups as suggested by Stephen Boyd
  * Dropped the use of reg-names/interrupt-names properties entirely

[1]: http://lkml.kernel.org/g/1393441166-32692-1-git-send-email-sboyd@codeaurora.org

Josh Cartwright (6):
  rtc: pm8xxx: fixup checkpatch/style issues
  rtc: pm8xxx: use regmap API for register accesses
  rtc: pm8xxx: use devm_request_any_context_irq
  rtc: pm8xxx: add support for devicetree
  rtc: pm8xxx: move device_init_wakeup() before rtc_register
  documentation: bindings: document PMIC8921/8058 RTC

 .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt    |  21 ++
 drivers/rtc/rtc-pm8xxx.c                           | 284 ++++++++++-----------
 include/linux/mfd/pm8xxx/rtc.h                     |  25 --
 3 files changed, 150 insertions(+), 180 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
 delete mode 100644 include/linux/mfd/pm8xxx/rtc.h

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/6] rtc: pm8xxx: fixup checkpatch/style issues
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses Josh Cartwright
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo; +Cc: linux-arm-msm, rtc-linux, linux-kernel

Before performing additional cleanups to this driver, do the easy
cleanups first.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/rtc/rtc-pm8xxx.c | 97 ++++++++++++++++++++++++++----------------------
 1 file changed, 53 insertions(+), 44 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index bd76ffe9..af60ee4 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -53,7 +53,7 @@ struct pm8xxx_rtc {
 	int rtc_read_base;
 	int rtc_write_base;
 	int alarm_rw_base;
-	u8  ctrl_reg;
+	u8 ctrl_reg;
 	struct device *rtc_dev;
 	spinlock_t ctrl_reg_lock;
 };
@@ -63,7 +63,7 @@ struct pm8xxx_rtc {
  * hardware limitation.
  */
 static int pm8xxx_read_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
-		int base, int count)
+			       int base, int count)
 {
 	int i, rc;
 	struct device *parent = rtc_dd->rtc_dev->parent;
@@ -80,7 +80,7 @@ static int pm8xxx_read_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
 }
 
 static int pm8xxx_write_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
-		int base, int count)
+				int base, int count)
 {
 	int i, rc;
 	struct device *parent = rtc_dd->rtc_dev->parent;
@@ -126,15 +126,15 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 		alarm_enabled = 1;
 		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
-				1);
+					  1);
 		if (rc < 0) {
-			dev_err(dev, "Write to RTC control register "
-								"failed\n");
+			dev_err(dev, "Write to RTC control register failed\n");
 			goto rtc_rw_fail;
 		}
 		rtc_dd->ctrl_reg = ctrl_reg;
-	} else
+	} else {
 		spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
+	}
 
 	/* Write 0 to Byte[0] */
 	reg = 0;
@@ -146,7 +146,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 
 	/* Write Byte[1], Byte[2], Byte[3] */
 	rc = pm8xxx_write_wrapper(rtc_dd, value + 1,
-					rtc_dd->rtc_write_base + 1, 3);
+				  rtc_dd->rtc_write_base + 1, 3);
 	if (rc < 0) {
 		dev_err(dev, "Write to RTC write data register failed\n");
 		goto rtc_rw_fail;
@@ -162,10 +162,9 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	if (alarm_enabled) {
 		ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
 		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
-									1);
+					  1);
 		if (rc < 0) {
-			dev_err(dev, "Write to RTC control register "
-								"failed\n");
+			dev_err(dev, "Write to RTC control register failed\n");
 			goto rtc_rw_fail;
 		}
 		rtc_dd->ctrl_reg = ctrl_reg;
@@ -186,7 +185,7 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
 	rc = pm8xxx_read_wrapper(rtc_dd, value, rtc_dd->rtc_read_base,
-							NUM_8_BIT_RTC_REGS);
+				 NUM_8_BIT_RTC_REGS);
 	if (rc < 0) {
 		dev_err(dev, "RTC read data register failed\n");
 		return rc;
@@ -204,7 +203,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 	if (unlikely(reg < value[0])) {
 		rc = pm8xxx_read_wrapper(rtc_dd, value,
-				rtc_dd->rtc_read_base, NUM_8_BIT_RTC_REGS);
+					 rtc_dd->rtc_read_base,
+					 NUM_8_BIT_RTC_REGS);
 		if (rc < 0) {
 			dev_err(dev, "RTC read data register failed\n");
 			return rc;
@@ -222,8 +222,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	}
 
 	dev_dbg(dev, "secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n",
-				secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
-				tm->tm_mday, tm->tm_mon, tm->tm_year);
+		secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
+		tm->tm_mday, tm->tm_mon, tm->tm_year);
 
 	return 0;
 }
@@ -245,15 +245,18 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
 
 	rc = pm8xxx_write_wrapper(rtc_dd, value, rtc_dd->alarm_rw_base,
-							NUM_8_BIT_RTC_REGS);
+				  NUM_8_BIT_RTC_REGS);
 	if (rc < 0) {
 		dev_err(dev, "Write to RTC ALARM register failed\n");
 		goto rtc_rw_fail;
 	}
 
 	ctrl_reg = rtc_dd->ctrl_reg;
-	ctrl_reg = alarm->enabled ? (ctrl_reg | PM8xxx_RTC_ALARM_ENABLE) :
-					(ctrl_reg & ~PM8xxx_RTC_ALARM_ENABLE);
+
+	if (alarm->enabled)
+		ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
+	else
+		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 
 	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
 	if (rc < 0) {
@@ -264,9 +267,9 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	rtc_dd->ctrl_reg = ctrl_reg;
 
 	dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
-				alarm->time.tm_hour, alarm->time.tm_min,
-				alarm->time.tm_sec, alarm->time.tm_mday,
-				alarm->time.tm_mon, alarm->time.tm_year);
+		alarm->time.tm_hour, alarm->time.tm_min,
+		alarm->time.tm_sec, alarm->time.tm_mday,
+		alarm->time.tm_mon, alarm->time.tm_year);
 rtc_rw_fail:
 	spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
 	return rc;
@@ -280,7 +283,7 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
 	rc = pm8xxx_read_wrapper(rtc_dd, value, rtc_dd->alarm_rw_base,
-			NUM_8_BIT_RTC_REGS);
+				 NUM_8_BIT_RTC_REGS);
 	if (rc < 0) {
 		dev_err(dev, "RTC alarm time read failed\n");
 		return rc;
@@ -297,9 +300,9 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	}
 
 	dev_dbg(dev, "Alarm set for - h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
-				alarm->time.tm_hour, alarm->time.tm_min,
-				alarm->time.tm_sec, alarm->time.tm_mday,
-				alarm->time.tm_mon, alarm->time.tm_year);
+		alarm->time.tm_hour, alarm->time.tm_min,
+		alarm->time.tm_sec, alarm->time.tm_mday,
+		alarm->time.tm_mon, alarm->time.tm_year);
 
 	return 0;
 }
@@ -312,9 +315,13 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 	u8 ctrl_reg;
 
 	spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
+
 	ctrl_reg = rtc_dd->ctrl_reg;
-	ctrl_reg = (enable) ? (ctrl_reg | PM8xxx_RTC_ALARM_ENABLE) :
-				(ctrl_reg & ~PM8xxx_RTC_ALARM_ENABLE);
+
+	if (enable)
+		ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
+	else
+		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 
 	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
 	if (rc < 0) {
@@ -354,8 +361,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
 	if (rc < 0) {
 		spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
-		dev_err(rtc_dd->rtc_dev, "Write to RTC control register "
-								"failed\n");
+		dev_err(rtc_dd->rtc_dev,
+			"Write to RTC control register failed\n");
 		goto rtc_alarm_handled;
 	}
 
@@ -364,19 +371,19 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 
 	/* Clear RTC alarm register */
 	rc = pm8xxx_read_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
-						PM8XXX_ALARM_CTRL_OFFSET, 1);
+				 PM8XXX_ALARM_CTRL_OFFSET, 1);
 	if (rc < 0) {
-		dev_err(rtc_dd->rtc_dev, "RTC Alarm control register read "
-								"failed\n");
+		dev_err(rtc_dd->rtc_dev,
+			"RTC Alarm control register read failed\n");
 		goto rtc_alarm_handled;
 	}
 
 	ctrl_reg &= ~PM8xxx_RTC_ALARM_CLEAR;
 	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
-						PM8XXX_ALARM_CTRL_OFFSET, 1);
+				  PM8XXX_ALARM_CTRL_OFFSET, 1);
 	if (rc < 0)
-		dev_err(rtc_dd->rtc_dev, "Write to RTC Alarm control register"
-								" failed\n");
+		dev_err(rtc_dd->rtc_dev,
+			"Write to RTC Alarm control register failed\n");
 
 rtc_alarm_handled:
 	return IRQ_HANDLED;
@@ -409,7 +416,7 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	}
 
 	rtc_resource = platform_get_resource_byname(pdev, IORESOURCE_IO,
-							"pmic_rtc_base");
+						    "pmic_rtc_base");
 	if (!(rtc_resource && rtc_resource->start)) {
 		dev_err(&pdev->dev, "RTC IO resource absent!\n");
 		return -ENXIO;
@@ -436,31 +443,31 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
 									1);
 		if (rc < 0) {
-			dev_err(&pdev->dev, "Write to RTC control register "
-								"failed\n");
+			dev_err(&pdev->dev,
+				"Write to RTC control register failed\n");
 			return rc;
 		}
 	}
 
 	rtc_dd->ctrl_reg = ctrl_reg;
-	if (rtc_write_enable == true)
+	if (rtc_write_enable)
 		pm8xxx_rtc_ops.set_time = pm8xxx_rtc_set_time;
 
 	platform_set_drvdata(pdev, rtc_dd);
 
 	/* Register the RTC device */
 	rtc_dd->rtc = devm_rtc_device_register(&pdev->dev, "pm8xxx_rtc",
-				&pm8xxx_rtc_ops, THIS_MODULE);
+					       &pm8xxx_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc_dd->rtc)) {
 		dev_err(&pdev->dev, "%s: RTC registration failed (%ld)\n",
-					__func__, PTR_ERR(rtc_dd->rtc));
+			__func__, PTR_ERR(rtc_dd->rtc));
 		return PTR_ERR(rtc_dd->rtc);
 	}
 
 	/* Request the alarm IRQ */
 	rc = request_any_context_irq(rtc_dd->rtc_alarm_irq,
-				 pm8xxx_alarm_trigger, IRQF_TRIGGER_RISING,
-				 "pm8xxx_rtc_alarm", rtc_dd);
+				     pm8xxx_alarm_trigger, IRQF_TRIGGER_RISING,
+				     "pm8xxx_rtc_alarm", rtc_dd);
 	if (rc < 0) {
 		dev_err(&pdev->dev, "Request IRQ failed (%d)\n", rc);
 		return rc;
@@ -505,7 +512,9 @@ static int pm8xxx_rtc_suspend(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume);
+static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops,
+			 pm8xxx_rtc_suspend,
+			 pm8xxx_rtc_resume);
 
 static struct platform_driver pm8xxx_rtc_driver = {
 	.probe		= pm8xxx_rtc_probe,
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 1/6] rtc: pm8xxx: fixup checkpatch/style issues Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 20:47   ` Andrew Morton
  2014-03-10 18:44 ` [PATCH v2 3/6] rtc: pm8xxx: use devm_request_any_context_irq Josh Cartwright
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo; +Cc: linux-arm-msm, rtc-linux, linux-kernel

Now that the parent mfd driver has been made to work again, and has been
reworked to create a regmap instance intended for it's children to use,
rework the pm8xxx driver to use the regmap API for it's register
accesses.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
 drivers/rtc/rtc-pm8xxx.c | 145 +++++++++++++++++++----------------------------
 1 file changed, 57 insertions(+), 88 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index af60ee4..cdc9dc2 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -13,11 +13,12 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/rtc.h>
+#include <linux/platform_device.h>
 #include <linux/pm.h>
+#include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
-#include <linux/mfd/pm8xxx/core.h>
 #include <linux/mfd/pm8xxx/rtc.h>
 
 
@@ -37,6 +38,7 @@
 /**
  * struct pm8xxx_rtc -  rtc driver internal structure
  * @rtc:		rtc device for this driver.
+ * @regmap:		regmap used to access RTC registers
  * @rtc_alarm_irq:	rtc alarm irq number.
  * @rtc_base:		address of rtc control register.
  * @rtc_read_base:	base address of read registers.
@@ -48,6 +50,7 @@
  */
 struct pm8xxx_rtc {
 	struct rtc_device *rtc;
+	struct regmap *regmap;
 	int rtc_alarm_irq;
 	int rtc_base;
 	int rtc_read_base;
@@ -59,44 +62,6 @@ struct pm8xxx_rtc {
 };
 
 /*
- * The RTC registers need to be read/written one byte at a time. This is a
- * hardware limitation.
- */
-static int pm8xxx_read_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
-			       int base, int count)
-{
-	int i, rc;
-	struct device *parent = rtc_dd->rtc_dev->parent;
-
-	for (i = 0; i < count; i++) {
-		rc = pm8xxx_readb(parent, base + i, &rtc_val[i]);
-		if (rc < 0) {
-			dev_err(rtc_dd->rtc_dev, "PMIC read failed\n");
-			return rc;
-		}
-	}
-
-	return 0;
-}
-
-static int pm8xxx_write_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
-				int base, int count)
-{
-	int i, rc;
-	struct device *parent = rtc_dd->rtc_dev->parent;
-
-	for (i = 0; i < count; i++) {
-		rc = pm8xxx_writeb(parent, base + i, rtc_val[i]);
-		if (rc < 0) {
-			dev_err(rtc_dd->rtc_dev, "PMIC write failed\n");
-			return rc;
-		}
-	}
-
-	return 0;
-}
-
-/*
  * Steps to write the RTC registers.
  * 1. Disable alarm if enabled.
  * 2. Write 0x00 to LSB.
@@ -107,7 +72,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
 	int rc, i;
 	unsigned long secs, irq_flags;
-	u8 value[NUM_8_BIT_RTC_REGS], reg = 0, alarm_enabled = 0, ctrl_reg;
+	u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, ctrl_reg;
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
 	rtc_tm_to_time(tm, &secs);
@@ -125,9 +90,8 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	if (ctrl_reg & PM8xxx_RTC_ALARM_ENABLE) {
 		alarm_enabled = 1;
 		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
-		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
-					  1);
-		if (rc < 0) {
+		rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+		if (rc) {
 			dev_err(dev, "Write to RTC control register failed\n");
 			goto rtc_rw_fail;
 		}
@@ -137,33 +101,31 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	}
 
 	/* Write 0 to Byte[0] */
-	reg = 0;
-	rc = pm8xxx_write_wrapper(rtc_dd, &reg, rtc_dd->rtc_write_base, 1);
-	if (rc < 0) {
+	rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, 0);
+	if (rc) {
 		dev_err(dev, "Write to RTC write data register failed\n");
 		goto rtc_rw_fail;
 	}
 
 	/* Write Byte[1], Byte[2], Byte[3] */
-	rc = pm8xxx_write_wrapper(rtc_dd, value + 1,
-				  rtc_dd->rtc_write_base + 1, 3);
-	if (rc < 0) {
+	rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->rtc_write_base + 1,
+			       &value[1], sizeof(value) - 1);
+	if (rc) {
 		dev_err(dev, "Write to RTC write data register failed\n");
 		goto rtc_rw_fail;
 	}
 
 	/* Write Byte[0] */
-	rc = pm8xxx_write_wrapper(rtc_dd, value, rtc_dd->rtc_write_base, 1);
-	if (rc < 0) {
+	rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, value[0]);
+	if (rc) {
 		dev_err(dev, "Write to RTC write data register failed\n");
 		goto rtc_rw_fail;
 	}
 
 	if (alarm_enabled) {
 		ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
-		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
-					  1);
-		if (rc < 0) {
+		rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+		if (rc) {
 			dev_err(dev, "Write to RTC control register failed\n");
 			goto rtc_rw_fail;
 		}
@@ -180,13 +142,14 @@ rtc_rw_fail:
 static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	int rc;
-	u8 value[NUM_8_BIT_RTC_REGS], reg;
+	u8 value[NUM_8_BIT_RTC_REGS];
 	unsigned long secs;
+	unsigned int reg;
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
-	rc = pm8xxx_read_wrapper(rtc_dd, value, rtc_dd->rtc_read_base,
-				 NUM_8_BIT_RTC_REGS);
-	if (rc < 0) {
+	rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base,
+			      value, sizeof(value));
+	if (rc) {
 		dev_err(dev, "RTC read data register failed\n");
 		return rc;
 	}
@@ -195,17 +158,16 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	 * Read the LSB again and check if there has been a carry over.
 	 * If there is, redo the read operation.
 	 */
-	rc = pm8xxx_read_wrapper(rtc_dd, &reg, rtc_dd->rtc_read_base, 1);
+	rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_read_base, &reg);
 	if (rc < 0) {
 		dev_err(dev, "RTC read data register failed\n");
 		return rc;
 	}
 
 	if (unlikely(reg < value[0])) {
-		rc = pm8xxx_read_wrapper(rtc_dd, value,
-					 rtc_dd->rtc_read_base,
-					 NUM_8_BIT_RTC_REGS);
-		if (rc < 0) {
+		rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base,
+				      value, sizeof(value));
+		if (rc) {
 			dev_err(dev, "RTC read data register failed\n");
 			return rc;
 		}
@@ -244,9 +206,9 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 
 	spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
 
-	rc = pm8xxx_write_wrapper(rtc_dd, value, rtc_dd->alarm_rw_base,
-				  NUM_8_BIT_RTC_REGS);
-	if (rc < 0) {
+	rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->alarm_rw_base, value,
+			       sizeof(value));
+	if (rc) {
 		dev_err(dev, "Write to RTC ALARM register failed\n");
 		goto rtc_rw_fail;
 	}
@@ -258,8 +220,8 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	else
 		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 
-	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
-	if (rc < 0) {
+	rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+	if (rc) {
 		dev_err(dev, "Write to RTC control register failed\n");
 		goto rtc_rw_fail;
 	}
@@ -282,9 +244,9 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	unsigned long secs;
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
-	rc = pm8xxx_read_wrapper(rtc_dd, value, rtc_dd->alarm_rw_base,
-				 NUM_8_BIT_RTC_REGS);
-	if (rc < 0) {
+	rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->alarm_rw_base, value,
+			      sizeof(value));
+	if (rc) {
 		dev_err(dev, "RTC alarm time read failed\n");
 		return rc;
 	}
@@ -323,8 +285,8 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 	else
 		ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 
-	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
-	if (rc < 0) {
+	rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+	if (rc) {
 		dev_err(dev, "Write to RTC control register failed\n");
 		goto rtc_rw_fail;
 	}
@@ -346,7 +308,7 @@ static struct rtc_class_ops pm8xxx_rtc_ops = {
 static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 {
 	struct pm8xxx_rtc *rtc_dd = dev_id;
-	u8 ctrl_reg;
+	unsigned int ctrl_reg;
 	int rc;
 	unsigned long irq_flags;
 
@@ -358,8 +320,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 	ctrl_reg = rtc_dd->ctrl_reg;
 	ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
 
-	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
-	if (rc < 0) {
+	rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+	if (rc) {
 		spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
 		dev_err(rtc_dd->rtc_dev,
 			"Write to RTC control register failed\n");
@@ -370,18 +332,20 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 	spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
 
 	/* Clear RTC alarm register */
-	rc = pm8xxx_read_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
-				 PM8XXX_ALARM_CTRL_OFFSET, 1);
-	if (rc < 0) {
+	rc = regmap_read(rtc_dd->regmap,
+			 rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET,
+			 &ctrl_reg);
+	if (rc) {
 		dev_err(rtc_dd->rtc_dev,
 			"RTC Alarm control register read failed\n");
 		goto rtc_alarm_handled;
 	}
 
 	ctrl_reg &= ~PM8xxx_RTC_ALARM_CLEAR;
-	rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
-				  PM8XXX_ALARM_CTRL_OFFSET, 1);
-	if (rc < 0)
+	rc = regmap_write(rtc_dd->regmap,
+			  rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET,
+			  ctrl_reg);
+	if (rc)
 		dev_err(rtc_dd->rtc_dev,
 			"Write to RTC Alarm control register failed\n");
 
@@ -392,7 +356,7 @@ rtc_alarm_handled:
 static int pm8xxx_rtc_probe(struct platform_device *pdev)
 {
 	int rc;
-	u8 ctrl_reg;
+	unsigned int ctrl_reg;
 	bool rtc_write_enable = false;
 	struct pm8xxx_rtc *rtc_dd;
 	struct resource *rtc_resource;
@@ -409,6 +373,12 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	/* Initialise spinlock to protect RTC control register */
 	spin_lock_init(&rtc_dd->ctrl_reg_lock);
 
+	rtc_dd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!rtc_dd->regmap) {
+		dev_err(&pdev->dev, "Parent regmap unavailable.\n");
+		return -ENXIO;
+	}
+
 	rtc_dd->rtc_alarm_irq = platform_get_irq(pdev, 0);
 	if (rtc_dd->rtc_alarm_irq < 0) {
 		dev_err(&pdev->dev, "Alarm IRQ resource absent!\n");
@@ -432,17 +402,16 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	rtc_dd->rtc_dev = &pdev->dev;
 
 	/* Check if the RTC is on, else turn it on */
-	rc = pm8xxx_read_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
-	if (rc < 0) {
+	rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_base, &ctrl_reg);
+	if (rc) {
 		dev_err(&pdev->dev, "RTC control register read failed!\n");
 		return rc;
 	}
 
 	if (!(ctrl_reg & PM8xxx_RTC_ENABLE)) {
 		ctrl_reg |= PM8xxx_RTC_ENABLE;
-		rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
-									1);
-		if (rc < 0) {
+		rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg);
+		if (rc) {
 			dev_err(&pdev->dev,
 				"Write to RTC control register failed\n");
 			return rc;
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 3/6] rtc: pm8xxx: use devm_request_any_context_irq
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 1/6] rtc: pm8xxx: fixup checkpatch/style issues Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo; +Cc: linux-arm-msm, rtc-linux, linux-kernel

Make use of the devm_* variant of request_any_context_irq to allow for
elimination of remove().

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/rtc/rtc-pm8xxx.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index cdc9dc2..91ac2e3 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -434,9 +434,10 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	}
 
 	/* Request the alarm IRQ */
-	rc = request_any_context_irq(rtc_dd->rtc_alarm_irq,
-				     pm8xxx_alarm_trigger, IRQF_TRIGGER_RISING,
-				     "pm8xxx_rtc_alarm", rtc_dd);
+	rc = devm_request_any_context_irq(&pdev->dev, rtc_dd->rtc_alarm_irq,
+					  pm8xxx_alarm_trigger,
+					  IRQF_TRIGGER_RISING,
+					  "pm8xxx_rtc_alarm", rtc_dd);
 	if (rc < 0) {
 		dev_err(&pdev->dev, "Request IRQ failed (%d)\n", rc);
 		return rc;
@@ -449,16 +450,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int pm8xxx_rtc_remove(struct platform_device *pdev)
-{
-	struct pm8xxx_rtc *rtc_dd = platform_get_drvdata(pdev);
-
-	device_init_wakeup(&pdev->dev, 0);
-	free_irq(rtc_dd->rtc_alarm_irq, rtc_dd);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int pm8xxx_rtc_resume(struct device *dev)
 {
@@ -487,7 +478,6 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops,
 
 static struct platform_driver pm8xxx_rtc_driver = {
 	.probe		= pm8xxx_rtc_probe,
-	.remove		= pm8xxx_rtc_remove,
 	.driver	= {
 		.name	= PM8XXX_RTC_DEV_NAME,
 		.owner	= THIS_MODULE,
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
                   ` (2 preceding siblings ...)
  2014-03-10 18:44 ` [PATCH v2 3/6] rtc: pm8xxx: use devm_request_any_context_irq Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 20:47   ` Andrew Morton
  2014-03-10 18:44 ` [PATCH v2 5/6] rtc: pm8xxx: move device_init_wakeup() before rtc_register Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
  5 siblings, 1 reply; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo, David Brown, Daniel Walker,
	Bryan Huntsman, Grant Likely, Rob Herring
  Cc: linux-arm-msm, rtc-linux, Samuel Ortiz, Lee Jones, linux-kernel,
	devicetree

Add support for describing the PM8921/PM8058 RTC in device tree.

Additionally:
   - drop support for describing the RTC using platform data,
     as there are no current in tree users who do so.
   - make allow_set_time a device-specific flag, instead of mucking
     with the rtc_ops

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/rtc/rtc-pm8xxx.c       | 52 +++++++++++++++++++++++-------------------
 include/linux/mfd/pm8xxx/rtc.h | 25 --------------------
 2 files changed, 29 insertions(+), 48 deletions(-)
 delete mode 100644 include/linux/mfd/pm8xxx/rtc.h

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 91ac2e3..6e3cd34 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -9,7 +9,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
+#include <linux/of.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/rtc.h>
@@ -19,9 +19,6 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
-#include <linux/mfd/pm8xxx/rtc.h>
-
-
 /* RTC Register offsets from RTC CTRL REG */
 #define PM8XXX_ALARM_CTRL_OFFSET	0x01
 #define PM8XXX_RTC_WRITE_OFFSET		0x02
@@ -39,6 +36,7 @@
  * struct pm8xxx_rtc -  rtc driver internal structure
  * @rtc:		rtc device for this driver.
  * @regmap:		regmap used to access RTC registers
+ * @allow_set_time:	indicates whether writing to the RTC is allowed
  * @rtc_alarm_irq:	rtc alarm irq number.
  * @rtc_base:		address of rtc control register.
  * @rtc_read_base:	base address of read registers.
@@ -51,6 +49,7 @@
 struct pm8xxx_rtc {
 	struct rtc_device *rtc;
 	struct regmap *regmap;
+	bool allow_set_time;
 	int rtc_alarm_irq;
 	int rtc_base;
 	int rtc_read_base;
@@ -75,6 +74,9 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, ctrl_reg;
 	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
 
+	if (!rtc_dd->allow_set_time)
+		return -EACCES;
+
 	rtc_tm_to_time(tm, &secs);
 
 	for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) {
@@ -298,8 +300,9 @@ rtc_rw_fail:
 	return rc;
 }
 
-static struct rtc_class_ops pm8xxx_rtc_ops = {
+static const struct rtc_class_ops pm8xxx_rtc_ops = {
 	.read_time	= pm8xxx_rtc_read_time,
+	.set_time	= pm8xxx_rtc_set_time,
 	.set_alarm	= pm8xxx_rtc_set_alarm,
 	.read_alarm	= pm8xxx_rtc_read_alarm,
 	.alarm_irq_enable = pm8xxx_rtc_alarm_irq_enable,
@@ -353,18 +356,26 @@ rtc_alarm_handled:
 	return IRQ_HANDLED;
 }
 
+/*
+ * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out
+ */
+static const struct of_device_id pm8xxx_id_table[] = {
+	{ .compatible = "qcom,pm8921-rtc", .data = (void *) 0x11D },
+	{ .compatible = "qcom,pm8058-rtc", .data = (void *) 0x1E8 },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, pm8xxx_id_table);
+
 static int pm8xxx_rtc_probe(struct platform_device *pdev)
 {
 	int rc;
 	unsigned int ctrl_reg;
-	bool rtc_write_enable = false;
 	struct pm8xxx_rtc *rtc_dd;
-	struct resource *rtc_resource;
-	const struct pm8xxx_rtc_platform_data *pdata =
-						dev_get_platdata(&pdev->dev);
+	const struct of_device_id *match;
 
-	if (pdata != NULL)
-		rtc_write_enable = pdata->rtc_write_enable;
+	match = of_match_node(pm8xxx_id_table, pdev->dev.of_node);
+	if (!match)
+		return -ENXIO;
 
 	rtc_dd = devm_kzalloc(&pdev->dev, sizeof(*rtc_dd), GFP_KERNEL);
 	if (rtc_dd == NULL)
@@ -385,14 +396,10 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	rtc_resource = platform_get_resource_byname(pdev, IORESOURCE_IO,
-						    "pmic_rtc_base");
-	if (!(rtc_resource && rtc_resource->start)) {
-		dev_err(&pdev->dev, "RTC IO resource absent!\n");
-		return -ENXIO;
-	}
+	rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node,
+						      "allow-set-time");
 
-	rtc_dd->rtc_base = rtc_resource->start;
+	rtc_dd->rtc_base = (long) match->data;
 
 	/* Setup RTC register addresses */
 	rtc_dd->rtc_write_base = rtc_dd->rtc_base + PM8XXX_RTC_WRITE_OFFSET;
@@ -419,8 +426,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	}
 
 	rtc_dd->ctrl_reg = ctrl_reg;
-	if (rtc_write_enable)
-		pm8xxx_rtc_ops.set_time = pm8xxx_rtc_set_time;
 
 	platform_set_drvdata(pdev, rtc_dd);
 
@@ -479,9 +484,10 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops,
 static struct platform_driver pm8xxx_rtc_driver = {
 	.probe		= pm8xxx_rtc_probe,
 	.driver	= {
-		.name	= PM8XXX_RTC_DEV_NAME,
-		.owner	= THIS_MODULE,
-		.pm	= &pm8xxx_rtc_pm_ops,
+		.name		= "rtc-pm8xxx",
+		.owner		= THIS_MODULE,
+		.pm		= &pm8xxx_rtc_pm_ops,
+		.of_match_table	= pm8xxx_id_table,
 	},
 };
 
diff --git a/include/linux/mfd/pm8xxx/rtc.h b/include/linux/mfd/pm8xxx/rtc.h
deleted file mode 100644
index 14f1983..0000000
--- a/include/linux/mfd/pm8xxx/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __RTC_PM8XXX_H__
-#define __RTC_PM8XXX_H__
-
-#define PM8XXX_RTC_DEV_NAME     "rtc-pm8xxx"
-/**
- * struct pm8xxx_rtc_pdata - RTC driver platform data
- * @rtc_write_enable: variable stating RTC write capability
- */
-struct pm8xxx_rtc_platform_data {
-	bool rtc_write_enable;
-};
-
-#endif /* __RTC_PM8XXX_H__ */
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 5/6] rtc: pm8xxx: move device_init_wakeup() before rtc_register
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
                   ` (3 preceding siblings ...)
  2014-03-10 18:44 ` [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 18:44 ` [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
  5 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo; +Cc: linux-arm-msm, rtc-linux, linux-kernel

Setup wakeup capability before rtc_register to ensure the rtc class core
properly sets up our 'wakealarm' sysfs attribute.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/rtc/rtc-pm8xxx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 6e3cd34..197699f 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -429,6 +429,8 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, rtc_dd);
 
+	device_init_wakeup(&pdev->dev, 1);
+
 	/* Register the RTC device */
 	rtc_dd->rtc = devm_rtc_device_register(&pdev->dev, "pm8xxx_rtc",
 					       &pm8xxx_rtc_ops, THIS_MODULE);
@@ -448,8 +450,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	device_init_wakeup(&pdev->dev, 1);
-
 	dev_dbg(&pdev->dev, "Probe success !!\n");
 
 	return 0;
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC
  2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
                   ` (4 preceding siblings ...)
  2014-03-10 18:44 ` [PATCH v2 5/6] rtc: pm8xxx: move device_init_wakeup() before rtc_register Josh Cartwright
@ 2014-03-10 18:44 ` Josh Cartwright
  2014-03-10 21:22   ` Rob Herring
  5 siblings, 1 reply; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 18:44 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo, linux-kernel
  Cc: linux-arm-msm, rtc-linux, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, devicetree, linux-doc

This RTC is found on the Qualcomm 8921 and 8058 PMICs.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
 .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt

diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
new file mode 100644
index 0000000..3eaa582
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
@@ -0,0 +1,21 @@
+* Real-Time Clock for Qualcomm 8058/8921 PMICs
+
+Required properties:
+- compatible: should be one of the following.
+    * "qcom,pm8058-rtc"
+    * "qcom,pm8921-rtc"
+- reg: base address of the register region
+- interrupts: interrupt list for the RTC, must contain a single interrupt
+              specifier for the alarm interrupt
+
+Optional properties:
+- allow-set-time: indicates that the setting of RTC time is allowed by
+                  the host CPU
+
+Example:
+
+	rtc@11d {
+		compatible = "qcom,pm8921-rtc";
+		reg = <0x11d>;
+		interrupts = <0x27 0>;
+	};
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses
  2014-03-10 18:44 ` [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses Josh Cartwright
@ 2014-03-10 20:47   ` Andrew Morton
  2014-03-10 21:35     ` Josh Cartwright
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2014-03-10 20:47 UTC (permalink / raw
  To: Josh Cartwright; +Cc: Alessandro Zummo, linux-arm-msm, rtc-linux, linux-kernel

On Mon, 10 Mar 2014 13:44:45 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:

> Now that the parent mfd driver has been made to work again, and has been
> reworked to create a regmap instance intended for it's children to use,
> rework the pm8xxx driver to use the regmap API for it's register
> accesses.

Do we need a 

	depends on REGMAP

in Kconfig?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree
  2014-03-10 18:44 ` [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
@ 2014-03-10 20:47   ` Andrew Morton
  2014-03-10 21:56     ` Josh Cartwright
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2014-03-10 20:47 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Alessandro Zummo, David Brown, Daniel Walker, Bryan Huntsman,
	Grant Likely, Rob Herring, linux-arm-msm, rtc-linux, Samuel Ortiz,
	Lee Jones, linux-kernel, devicetree

On Mon, 10 Mar 2014 13:44:47 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:

> Add support for describing the PM8921/PM8058 RTC in device tree.
> 
> Additionally:
>    - drop support for describing the RTC using platform data,
>      as there are no current in tree users who do so.
>    - make allow_set_time a device-specific flag, instead of mucking
>      with the rtc_ops

Is this tested with and without CONFIG_OF?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC
  2014-03-10 18:44 ` [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
@ 2014-03-10 21:22   ` Rob Herring
  2014-03-10 22:11       ` Josh Cartwright
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2014-03-10 21:22 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Andrew Morton, Alessandro Zummo, linux-kernel@vger.kernel.org,
	linux-arm-msm, rtc-linux, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org

On Mon, Mar 10, 2014 at 1:44 PM, Josh Cartwright <joshc@codeaurora.org> wrote:
> This RTC is found on the Qualcomm 8921 and 8058 PMICs.
>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
>  .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt     | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
>
> diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> new file mode 100644
> index 0000000..3eaa582
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> @@ -0,0 +1,21 @@
> +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> +
> +Required properties:
> +- compatible: should be one of the following.
> +    * "qcom,pm8058-rtc"
> +    * "qcom,pm8921-rtc"
> +- reg: base address of the register region

Wait a second. This is all part of an MFD device. I think this whole
binding does not make sense on it's own. The DT should describe the
PMIC, not necessarily some sub-component of it. Perhaps there are sub
nodes of the PMIC node, but that would be all part of the PMIC
binding. Having sub drivers for an MFD is really a Linux problem that
doesn't belong in DT.

Rob

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses
  2014-03-10 20:47   ` Andrew Morton
@ 2014-03-10 21:35     ` Josh Cartwright
  2014-03-10 21:43       ` Andrew Morton
  2014-03-10 23:32       ` Mark Brown
  0 siblings, 2 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 21:35 UTC (permalink / raw
  To: Andrew Morton
  Cc: Alessandro Zummo, linux-arm-msm, rtc-linux, linux-kernel,
	Mark Brown

On Mon, Mar 10, 2014 at 01:47:41PM -0700, Andrew Morton wrote:
> On Mon, 10 Mar 2014 13:44:45 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:
> > Now that the parent mfd driver has been made to work again, and has been
> > reworked to create a regmap instance intended for it's children to use,
> > rework the pm8xxx driver to use the regmap API for it's register
> > accesses.
> 
> Do we need a 
> 
> 	depends on REGMAP
> 
> in Kconfig?

Good question.  This driver already gets the REGMAP dependency through
it's parent (MFD_PM8XXX), which does 'select REGMAP'.

I recall there being some history as to why individual drivers shouldn't
explicitly depend on REGMAP, as it's the parent drivers/subsystem
responsibility to select it when needed, however I can't recall details.
Perhaps it's due to REGMAP not being a user-selectable option.

(FWIW, I did force a build of this driver with !REGMAP, and it builds
just fine with the regmap_write()/_read() stubs, but of course it
wouldn't do anything meaningful at runtime)

Thanks,
  Josh

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses
  2014-03-10 21:35     ` Josh Cartwright
@ 2014-03-10 21:43       ` Andrew Morton
  2014-03-10 23:32       ` Mark Brown
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2014-03-10 21:43 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Alessandro Zummo, linux-arm-msm, rtc-linux, linux-kernel,
	Mark Brown

On Mon, 10 Mar 2014 16:35:24 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:

> On Mon, Mar 10, 2014 at 01:47:41PM -0700, Andrew Morton wrote:
> > On Mon, 10 Mar 2014 13:44:45 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:
> > > Now that the parent mfd driver has been made to work again, and has been
> > > reworked to create a regmap instance intended for it's children to use,
> > > rework the pm8xxx driver to use the regmap API for it's register
> > > accesses.
> > 
> > Do we need a 
> > 
> > 	depends on REGMAP
> > 
> > in Kconfig?
> 
> Good question.  This driver already gets the REGMAP dependency through
> it's parent (MFD_PM8XXX), which does 'select REGMAP'.

OK, thanks, that sounds sufficient.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree
  2014-03-10 20:47   ` Andrew Morton
@ 2014-03-10 21:56     ` Josh Cartwright
  0 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 21:56 UTC (permalink / raw
  To: Andrew Morton
  Cc: Alessandro Zummo, David Brown, Daniel Walker, Bryan Huntsman,
	Grant Likely, Rob Herring, linux-arm-msm, rtc-linux, Samuel Ortiz,
	Lee Jones, linux-kernel, devicetree

On Mon, Mar 10, 2014 at 01:47:48PM -0700, Andrew Morton wrote:
> On Mon, 10 Mar 2014 13:44:47 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:
> 
> > Add support for describing the PM8921/PM8058 RTC in device tree.
> > 
> > Additionally:
> >    - drop support for describing the RTC using platform data,
> >      as there are no current in tree users who do so.
> >    - make allow_set_time a device-specific flag, instead of mucking
> >      with the rtc_ops
> 
> Is this tested with and without CONFIG_OF?

It's been runtime tested with CONFIG_OF and I ensured it at least built
when !CONFIG_OF, although the drivers useless in that configuration.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC
@ 2014-03-10 22:11       ` Josh Cartwright
  0 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 22:11 UTC (permalink / raw
  To: Rob Herring
  Cc: Andrew Morton, Alessandro Zummo, linux-kernel@vger.kernel.org,
	linux-arm-msm, rtc-linux, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, Lee Jones

On Mon, Mar 10, 2014 at 04:22:51PM -0500, Rob Herring wrote:
> On Mon, Mar 10, 2014 at 1:44 PM, Josh Cartwright <joshc@codeaurora.org> wrote:
> > This RTC is found on the Qualcomm 8921 and 8058 PMICs.
> >
> > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > ---
> >  .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt     | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > new file mode 100644
> > index 0000000..3eaa582
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > @@ -0,0 +1,21 @@
> > +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> > +
> > +Required properties:
> > +- compatible: should be one of the following.
> > +    * "qcom,pm8058-rtc"
> > +    * "qcom,pm8921-rtc"
> > +- reg: base address of the register region
> 
> Wait a second. This is all part of an MFD device. I think this whole
> binding does not make sense on it's own. The DT should describe the
> PMIC, not necessarily some sub-component of it. Perhaps there are sub
> nodes of the PMIC node, but that would be all part of the PMIC
> binding. Having sub drivers for an MFD is really a Linux problem that
> doesn't belong in DT.

Okay, this makes sense, I can move this documentation to
Documentation/bindings/mfd/qcom,pm8xxx.txt where the PMIC binding
currently is.

Note that this does introduce a dependency on Lee Jones' mfd tree, where
DT support for the parent pm8921 driver is pending for 3.15.

Andrew, how would you prefer I proceed?  Would you like me to respin
this patch?  The whole series?  An incremental patch?

Thanks,
  Josh

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC
@ 2014-03-10 22:11       ` Josh Cartwright
  0 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-10 22:11 UTC (permalink / raw
  To: Rob Herring
  Cc: Andrew Morton, Alessandro Zummo,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-msm, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Lee Jones

On Mon, Mar 10, 2014 at 04:22:51PM -0500, Rob Herring wrote:
> On Mon, Mar 10, 2014 at 1:44 PM, Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> wrote:
> > This RTC is found on the Qualcomm 8921 and 8058 PMICs.
> >
> > Signed-off-by: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > ---
> >  .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt     | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > new file mode 100644
> > index 0000000..3eaa582
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > @@ -0,0 +1,21 @@
> > +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> > +
> > +Required properties:
> > +- compatible: should be one of the following.
> > +    * "qcom,pm8058-rtc"
> > +    * "qcom,pm8921-rtc"
> > +- reg: base address of the register region
> 
> Wait a second. This is all part of an MFD device. I think this whole
> binding does not make sense on it's own. The DT should describe the
> PMIC, not necessarily some sub-component of it. Perhaps there are sub
> nodes of the PMIC node, but that would be all part of the PMIC
> binding. Having sub drivers for an MFD is really a Linux problem that
> doesn't belong in DT.

Okay, this makes sense, I can move this documentation to
Documentation/bindings/mfd/qcom,pm8xxx.txt where the PMIC binding
currently is.

Note that this does introduce a dependency on Lee Jones' mfd tree, where
DT support for the parent pm8921 driver is pending for 3.15.

Andrew, how would you prefer I proceed?  Would you like me to respin
this patch?  The whole series?  An incremental patch?

Thanks,
  Josh

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC
  2014-03-10 22:11       ` Josh Cartwright
  (?)
@ 2014-03-10 22:18       ` Andrew Morton
  2014-03-12 17:17           ` Josh Cartwright
  -1 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2014-03-10 22:18 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Rob Herring, Alessandro Zummo, linux-kernel@vger.kernel.org,
	linux-arm-msm, rtc-linux, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, Lee Jones

On Mon, 10 Mar 2014 17:11:32 -0500 Josh Cartwright <joshc@codeaurora.org> wrote:

> On Mon, Mar 10, 2014 at 04:22:51PM -0500, Rob Herring wrote:
> > On Mon, Mar 10, 2014 at 1:44 PM, Josh Cartwright <joshc@codeaurora.org> wrote:
> > > This RTC is found on the Qualcomm 8921 and 8058 PMICs.
> > >
> > > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > > ---
> > >  .../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt     | 21 +++++++++++++++++++++
> > >  1 file changed, 21 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > >
> > > diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > > new file mode 100644
> > > index 0000000..3eaa582
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > > @@ -0,0 +1,21 @@
> > > +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> > > +
> > > +Required properties:
> > > +- compatible: should be one of the following.
> > > +    * "qcom,pm8058-rtc"
> > > +    * "qcom,pm8921-rtc"
> > > +- reg: base address of the register region
> > 
> > Wait a second. This is all part of an MFD device. I think this whole
> > binding does not make sense on it's own. The DT should describe the
> > PMIC, not necessarily some sub-component of it. Perhaps there are sub
> > nodes of the PMIC node, but that would be all part of the PMIC
> > binding. Having sub drivers for an MFD is really a Linux problem that
> > doesn't belong in DT.
> 
> Okay, this makes sense, I can move this documentation to
> Documentation/bindings/mfd/qcom,pm8xxx.txt where the PMIC binding
> currently is.
> 
> Note that this does introduce a dependency on Lee Jones' mfd tree, where
> DT support for the parent pm8921 driver is pending for 3.15.
> 
> Andrew, how would you prefer I proceed?  Would you like me to respin
> this patch?  The whole series?  An incremental patch?

A new version of [6/6] sounds appropriate.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses
  2014-03-10 21:35     ` Josh Cartwright
  2014-03-10 21:43       ` Andrew Morton
@ 2014-03-10 23:32       ` Mark Brown
  1 sibling, 0 replies; 20+ messages in thread
From: Mark Brown @ 2014-03-10 23:32 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Andrew Morton, Alessandro Zummo, linux-arm-msm, rtc-linux,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

On Mon, Mar 10, 2014 at 04:35:24PM -0500, Josh Cartwright wrote:
> On Mon, Mar 10, 2014 at 01:47:41PM -0700, Andrew Morton wrote:

> > Do we need a 

> > 	depends on REGMAP

> > in Kconfig?

> Good question.  This driver already gets the REGMAP dependency through
> it's parent (MFD_PM8XXX), which does 'select REGMAP'.

> I recall there being some history as to why individual drivers shouldn't
> explicitly depend on REGMAP, as it's the parent drivers/subsystem
> responsibility to select it when needed, however I can't recall details.
> Perhaps it's due to REGMAP not being a user-selectable option.

Yeah, it should be a select of regmap because it's more of a helper
library than a user visible feature and it's usually only on the MFD
because you can't enable the function device without the core anyway.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v3 6/6] mfd: devicetree: bindings: add pm8xxx RTC description
@ 2014-03-12 17:17           ` Josh Cartwright
  0 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-12 17:17 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo, linux-kernel, Lee Jones
  Cc: linux-arm-msm, rtc-linux, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, devicetree, linux-doc,
	Samuel Ortiz

The PM8xxx family of PMICs contain an RTC.  This RTC is described as a
subnode of the PM8xxx.  Document these bindings, and replace the pwrkey
node in the example with the RTC, which is now described in this
document.

While we're here, add a short description to the device tree bindings
describing what the the PM8xxx devices are and how they are expected to
be used.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
Andrew-

Here's a new 6/6.  Like mentioned earlier, this is based on the current MFD
document that's in Lee's tree pending for 3.15.  It may be best to get yours
and Rob's Ack and have Lee take it through his tree.

Thanks,
   Josh

 .../devicetree/bindings/mfd/qcom,pm8xxx.txt        | 45 +++++++++++++++++++---
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt b/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
index e3fe625..03518dc 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
@@ -1,6 +1,9 @@
 Qualcomm PM8xxx PMIC multi-function devices
 
-PROPERTIES
+The PM8xxx family of Power Management ICs are used to provide regulated
+voltages and other various functionality to Qualcomm SoCs.
+
+= PROPERTIES
 
 - compatible:
 	Usage: required
@@ -45,7 +48,37 @@ PROPERTIES
 	Value type: <empty>
 	Definition: identifies this node as an interrupt controller
 
-EXAMPLE
+= SUBCOMPONENTS
+
+The PMIC contains multiple independent functions, each described in a subnode.
+The below bindings specify the set of valid subnodes.
+
+== Real-Time Clock
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,pm8058-rtc"
+		    "qcom,pm8921-rtc"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: single entry specifying the base address of the RTC registers
+
+- interrupts:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: single entry specifying the RTC's alarm interrupt
+
+- allow-set-time:
+	Usage: optional
+	Value type: <empty>
+	Definition: indicates that the setting of RTC time is allowed by
+		    the host CPU
+
+= EXAMPLE
 
 	pmicintc: pmic@0 {
 		compatible = "qcom,pm8921";
@@ -55,9 +88,9 @@ EXAMPLE
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		pwrkey {
-			compatible = "qcom,pm8921-pwrkey";
-			interrupt-parent = <&pmicintc>;
-			interrupts = <50 1>, <51 1>;
+		rtc@11d {
+			compatible = "qcom,pm8921-rtc";
+			reg = <0x11d>;
+			interrupts = <0x27 0>;
 		};
 	};
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 6/6] mfd: devicetree: bindings: add pm8xxx RTC description
@ 2014-03-12 17:17           ` Josh Cartwright
  0 siblings, 0 replies; 20+ messages in thread
From: Josh Cartwright @ 2014-03-12 17:17 UTC (permalink / raw
  To: Andrew Morton, Alessandro Zummo,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Lee Jones
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Samuel Ortiz

The PM8xxx family of PMICs contain an RTC.  This RTC is described as a
subnode of the PM8xxx.  Document these bindings, and replace the pwrkey
node in the example with the RTC, which is now described in this
document.

While we're here, add a short description to the device tree bindings
describing what the the PM8xxx devices are and how they are expected to
be used.

Signed-off-by: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
Andrew-

Here's a new 6/6.  Like mentioned earlier, this is based on the current MFD
document that's in Lee's tree pending for 3.15.  It may be best to get yours
and Rob's Ack and have Lee take it through his tree.

Thanks,
   Josh

 .../devicetree/bindings/mfd/qcom,pm8xxx.txt        | 45 +++++++++++++++++++---
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt b/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
index e3fe625..03518dc 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/qcom,pm8xxx.txt
@@ -1,6 +1,9 @@
 Qualcomm PM8xxx PMIC multi-function devices
 
-PROPERTIES
+The PM8xxx family of Power Management ICs are used to provide regulated
+voltages and other various functionality to Qualcomm SoCs.
+
+= PROPERTIES
 
 - compatible:
 	Usage: required
@@ -45,7 +48,37 @@ PROPERTIES
 	Value type: <empty>
 	Definition: identifies this node as an interrupt controller
 
-EXAMPLE
+= SUBCOMPONENTS
+
+The PMIC contains multiple independent functions, each described in a subnode.
+The below bindings specify the set of valid subnodes.
+
+== Real-Time Clock
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,pm8058-rtc"
+		    "qcom,pm8921-rtc"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: single entry specifying the base address of the RTC registers
+
+- interrupts:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: single entry specifying the RTC's alarm interrupt
+
+- allow-set-time:
+	Usage: optional
+	Value type: <empty>
+	Definition: indicates that the setting of RTC time is allowed by
+		    the host CPU
+
+= EXAMPLE
 
 	pmicintc: pmic@0 {
 		compatible = "qcom,pm8921";
@@ -55,9 +88,9 @@ EXAMPLE
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		pwrkey {
-			compatible = "qcom,pm8921-pwrkey";
-			interrupt-parent = <&pmicintc>;
-			interrupts = <50 1>, <51 1>;
+		rtc@11d {
+			compatible = "qcom,pm8921-rtc";
+			reg = <0x11d>;
+			interrupts = <0x27 0>;
 		};
 	};
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 6/6] mfd: devicetree: bindings: add pm8xxx RTC description
  2014-03-12 17:17           ` Josh Cartwright
  (?)
@ 2014-03-21  8:12           ` Lee Jones
  -1 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2014-03-21  8:12 UTC (permalink / raw
  To: Josh Cartwright
  Cc: Andrew Morton, Alessandro Zummo, linux-kernel, linux-arm-msm,
	rtc-linux, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Rob Landley, devicetree, linux-doc, Samuel Ortiz

> The PM8xxx family of PMICs contain an RTC.  This RTC is described as a
> subnode of the PM8xxx.  Document these bindings, and replace the pwrkey
> node in the example with the RTC, which is now described in this
> document.
> 
> While we're here, add a short description to the device tree bindings
> describing what the the PM8xxx devices are and how they are expected to
> be used.
> 
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
> Andrew-
> 
> Here's a new 6/6.  Like mentioned earlier, this is based on the current MFD
> document that's in Lee's tree pending for 3.15.  It may be best to get yours
> and Rob's Ack and have Lee take it through his tree.

After discussing with Andrew, I think this is better to go through my
tree as you suggested, in order to mitigate any merge conflicts during
the merge window.

Patch applied to the MFD tree with Andrew's Ack, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-03-21  8:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 18:44 [PATCH v2 0/6] rtc: make the pm8xxx RTC driver usable Josh Cartwright
2014-03-10 18:44 ` [PATCH v2 1/6] rtc: pm8xxx: fixup checkpatch/style issues Josh Cartwright
2014-03-10 18:44 ` [PATCH v2 2/6] rtc: pm8xxx: use regmap API for register accesses Josh Cartwright
2014-03-10 20:47   ` Andrew Morton
2014-03-10 21:35     ` Josh Cartwright
2014-03-10 21:43       ` Andrew Morton
2014-03-10 23:32       ` Mark Brown
2014-03-10 18:44 ` [PATCH v2 3/6] rtc: pm8xxx: use devm_request_any_context_irq Josh Cartwright
2014-03-10 18:44 ` [PATCH v2 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
2014-03-10 20:47   ` Andrew Morton
2014-03-10 21:56     ` Josh Cartwright
2014-03-10 18:44 ` [PATCH v2 5/6] rtc: pm8xxx: move device_init_wakeup() before rtc_register Josh Cartwright
2014-03-10 18:44 ` [PATCH v2 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
2014-03-10 21:22   ` Rob Herring
2014-03-10 22:11     ` Josh Cartwright
2014-03-10 22:11       ` Josh Cartwright
2014-03-10 22:18       ` Andrew Morton
2014-03-12 17:17         ` [PATCH v3 6/6] mfd: devicetree: bindings: add pm8xxx RTC description Josh Cartwright
2014-03-12 17:17           ` Josh Cartwright
2014-03-21  8:12           ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.