linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests
@ 2013-11-28  8:09 Krzysztof Kozlowski
  2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

Hi,


This is a second version of patchset of small but important fixes for rtc-s5m
driver. Last patches also add waking up on RTC alarm interrupts.

The patchset is based on v3.13-rc1-229-ge7c0d3d and depends on patch from 
Geert Uytterhoeven:
 - rtc: s5m-rtc: Fix info->rtc assignment
   http://article.gmane.org/gmane.linux.kernel/1595905


Changes since v2:
-----------------
1. Applied suggestions from Geert Uytterhoeven (add const, regmap member
   rename).
2. Added patch "mfd: sec: Constify regmap configs and regmap irqs".
3. Removed "mfd: sec: Add PM ops and make it a wake up source" from patchset
   as this was applied by Lee Jones.


Best regards,
Krzysztof Kozlowski

Krzysztof Kozlowski (5):
  mfd/rtc: s5m: Fix register updating by adding regmap for RTC
  rtc: s5m: Fix unsuccesful IRQ request during probe
  rtc: s5m: Limit endless loop waiting for register update
  rtc: s5m: Enable IRQ wake during suspend
  mfd: sec: Constify regmap configs and regmap irqs

 drivers/mfd/sec-core.c           |   38 ++++++++++++++-------
 drivers/mfd/sec-irq.c            |   18 +++++-----
 drivers/regulator/s5m8767.c      |    2 +-
 drivers/rtc/rtc-s5m.c            |   70 +++++++++++++++++++++++++++++++++-----
 include/linux/mfd/samsung/core.h |    3 +-
 5 files changed, 99 insertions(+), 32 deletions(-)

-- 
1.7.9.5


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

* [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
@ 2013-11-28  8:09 ` Krzysztof Kozlowski
  2013-11-28 13:50   ` Mark Brown
  2013-11-29  9:04   ` Lee Jones
  2013-11-28  8:09 ` [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

Rename old regmap field of "struct sec_pmic_dev" to "regmap_pmic" and
add new regmap for RTC.

On S5M8767A registers were not properly updated and read due to usage of
the same regmap as the PMIC. This could be observed in various hangs,
e.g. in infinite loop during waiting for UDR field change.

On this chip family the RTC has different I2C address than PMIC so
additional regmap is needed.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mfd/sec-core.c           |   30 ++++++++++++++++++++++--------
 drivers/mfd/sec-irq.c            |    6 +++---
 drivers/regulator/s5m8767.c      |    2 +-
 drivers/rtc/rtc-s5m.c            |    2 +-
 include/linux/mfd/samsung/core.h |    3 ++-
 5 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 34c18fb..54cc255 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = {
 
 int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
 {
-	return regmap_read(sec_pmic->regmap, reg, dest);
+	return regmap_read(sec_pmic->regmap_pmic, reg, dest);
 }
 EXPORT_SYMBOL_GPL(sec_reg_read);
 
 int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
 {
-	return regmap_bulk_read(sec_pmic->regmap, reg, buf, count);
+	return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count);
 }
 EXPORT_SYMBOL_GPL(sec_bulk_read);
 
 int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
 {
-	return regmap_write(sec_pmic->regmap, reg, value);
+	return regmap_write(sec_pmic->regmap_pmic, reg, value);
 }
 EXPORT_SYMBOL_GPL(sec_reg_write);
 
 int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
 {
-	return regmap_raw_write(sec_pmic->regmap, reg, buf, count);
+	return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count);
 }
 EXPORT_SYMBOL_GPL(sec_bulk_write);
 
 int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
 {
-	return regmap_update_bits(sec_pmic->regmap, reg, mask, val);
+	return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val);
 }
 EXPORT_SYMBOL_GPL(sec_reg_update);
 
@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = {
 	.cache_type = REGCACHE_FLAT,
 };
 
+static const struct regmap_config sec_rtc_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+};
+
 #ifdef CONFIG_OF
 /*
  * Only the common platform data elements for s5m8767 are parsed here from the
@@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 		break;
 	}
 
-	sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap);
-	if (IS_ERR(sec_pmic->regmap)) {
-		ret = PTR_ERR(sec_pmic->regmap);
+	sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap);
+	if (IS_ERR(sec_pmic->regmap_pmic)) {
+		ret = PTR_ERR(sec_pmic->regmap_pmic);
 		dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
 			ret);
 		return ret;
@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR);
 	i2c_set_clientdata(sec_pmic->rtc, sec_pmic);
 
+	sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc,
+			&sec_rtc_regmap_config);
+	if (IS_ERR(sec_pmic->regmap_rtc)) {
+		ret = PTR_ERR(sec_pmic->regmap_rtc);
+		dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
+			ret);
+		return ret;
+	}
+
 	if (pdata && pdata->cfg_pmic_irq)
 		pdata->cfg_pmic_irq();
 
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index 0dd84e9..b441b1b 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 
 	switch (type) {
 	case S5M8763X:
-		ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq,
+		ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
 				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 				  sec_pmic->irq_base, &s5m8763_irq_chip,
 				  &sec_pmic->irq_data);
 		break;
 	case S5M8767X:
-		ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq,
+		ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
 				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 				  sec_pmic->irq_base, &s5m8767_irq_chip,
 				  &sec_pmic->irq_data);
 		break;
 	case S2MPS11X:
-		ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq,
+		ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
 				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 				  sec_pmic->irq_base, &s2mps11_irq_chip,
 				  &sec_pmic->irq_data);
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index cbf91e2..aeb40aa 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		config.dev = s5m8767->dev;
 		config.init_data = pdata->regulators[i].initdata;
 		config.driver_data = s5m8767;
-		config.regmap = iodev->regmap;
+		config.regmap = iodev->regmap_pmic;
 		config.of_node = pdata->regulators[i].reg_node;
 
 		rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 1dfa488..088cf3a 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -542,7 +542,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
 
 	info->dev = &pdev->dev;
 	info->s5m87xx = s5m87xx;
-	info->regmap = s5m87xx->regmap;
+	info->regmap = s5m87xx->regmap_rtc;
 	info->device_type = s5m87xx->device_type;
 	info->wtsr_smpl = s5m87xx->wtsr_smpl;
 
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 2d0c907..cab2dd2 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -39,7 +39,8 @@ enum sec_device_type {
 struct sec_pmic_dev {
 	struct device *dev;
 	struct sec_platform_data *pdata;
-	struct regmap *regmap;
+	struct regmap *regmap_pmic;
+	struct regmap *regmap_rtc;
 	struct i2c_client *i2c;
 	struct i2c_client *rtc;
 
-- 
1.7.9.5


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

* [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
  2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
@ 2013-11-28  8:09 ` Krzysztof Kozlowski
  2013-11-28 13:46   ` Mark Brown
  2013-11-28  8:09 ` [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

Probe failed for rtc-s5m:
	s5m-rtc s5m-rtc: Failed to request alarm IRQ: 12: -22
	s5m-rtc: probe of s5m-rtc failed with error -22

Fix rtc-s5m interrupt request by using regmap_irq_get_virq() for mapping
the IRQ.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/rtc/rtc-s5m.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 088cf3a..66686d9 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -548,11 +548,13 @@ static int s5m_rtc_probe(struct platform_device *pdev)
 
 	switch (pdata->device_type) {
 	case S5M8763X:
-		info->irq = s5m87xx->irq_base + S5M8763_IRQ_ALARM0;
+		info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
+				S5M8763_IRQ_ALARM0);
 		break;
 
 	case S5M8767X:
-		info->irq = s5m87xx->irq_base + S5M8767_IRQ_RTCA1;
+		info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
+				S5M8767_IRQ_RTCA1);
 		break;
 
 	default:
-- 
1.7.9.5


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

* [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
  2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
  2013-11-28  8:09 ` [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe Krzysztof Kozlowski
@ 2013-11-28  8:09 ` Krzysztof Kozlowski
  2013-11-28 13:47   ` Mark Brown
  2013-11-28  8:09 ` [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

After setting alarm or time the driver is waiting for UDR register to be
cleared indicating that registers data have been transferred.

Limit the endless loop to only 5 retries.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/rtc/rtc-s5m.c |   37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 66686d9..51471c1 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -28,6 +28,16 @@
 #include <linux/mfd/samsung/irq.h>
 #include <linux/mfd/samsung/rtc.h>
 
+/*
+ * Maximum number of retries for checking changes in UDR field
+ * of SEC_RTC_UDR_CON register (to limit possible endless loop).
+ *
+ * After writing to RTC registers (setting time or alarm) read the UDR field
+ * in SEC_RTC_UDR_CON register. UDR is auto-cleared when data have
+ * been transferred.
+ */
+#define UDR_READ_RETRY_CNT	5
+
 struct s5m_rtc_info {
 	struct device *dev;
 	struct sec_pmic_dev *s5m87xx;
@@ -84,6 +94,25 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data)
 	}
 }
 
+/*
+ * Read RTC_UDR_CON register and wait till UDR field is cleared.
+ * This indicates that time/alarm update ended.
+ */
+static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info)
+{
+	int ret, retry = UDR_READ_RETRY_CNT;
+	unsigned int data;
+
+	do {
+		ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
+	} while (--retry && (data & RTC_UDR_MASK) && !ret);
+
+	if (!retry)
+		dev_err(info->dev, "waiting for UDR update, reached max number of retries\n");
+
+	return ret;
+}
+
 static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info)
 {
 	int ret;
@@ -104,9 +133,7 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info)
 		return ret;
 	}
 
-	do {
-		ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
-	} while ((data & RTC_UDR_MASK) && !ret);
+	ret = s5m8767_wait_for_udr_update(info);
 
 	return ret;
 }
@@ -133,9 +160,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
 		return ret;
 	}
 
-	do {
-		ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
-	} while ((data & RTC_UDR_MASK) && !ret);
+	ret = s5m8767_wait_for_udr_update(info);
 
 	return ret;
 }
-- 
1.7.9.5


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

* [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2013-11-28  8:09 ` [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update Krzysztof Kozlowski
@ 2013-11-28  8:09 ` Krzysztof Kozlowski
  2013-11-29  0:15   ` Sangbeom Kim
  2013-11-28  8:09 ` [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs Krzysztof Kozlowski
  2013-12-02 23:10 ` [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Andrew Morton
  5 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

Add PM suspend/resume ops to rtc-s5m driver and enable IRQ wake during
suspend so the RTC would act like a wake up source. This allows waking
up from suspend to RAM on RTC alarm interrupt.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/rtc/rtc-s5m.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 51471c1..ae8119d 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -639,6 +639,30 @@ static void s5m_rtc_shutdown(struct platform_device *pdev)
 	s5m_rtc_enable_smpl(info, false);
 }
 
+static int s5m_rtc_resume(struct device *dev)
+{
+	struct s5m_rtc_info *info = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (device_may_wakeup(dev))
+		ret = disable_irq_wake(info->irq);
+
+	return ret;
+}
+
+static int s5m_rtc_suspend(struct device *dev)
+{
+	struct s5m_rtc_info *info = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (device_may_wakeup(dev))
+		ret = enable_irq_wake(info->irq);
+
+	return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
+
 static const struct platform_device_id s5m_rtc_id[] = {
 	{ "s5m-rtc", 0 },
 };
@@ -647,6 +671,7 @@ static struct platform_driver s5m_rtc_driver = {
 	.driver		= {
 		.name	= "s5m-rtc",
 		.owner	= THIS_MODULE,
+		.pm	= &s5m_rtc_pm_ops,
 	},
 	.probe		= s5m_rtc_probe,
 	.shutdown	= s5m_rtc_shutdown,
-- 
1.7.9.5


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

* [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2013-11-28  8:09 ` [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend Krzysztof Kozlowski
@ 2013-11-28  8:09 ` Krzysztof Kozlowski
  2013-11-28 17:14   ` Mark Brown
  2013-12-02 23:10 ` [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Andrew Morton
  5 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-28  8:09 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux
  Cc: Marek Szyprowski, Geert Uytterhoeven, Kyungmin Park, Krzysztof Kozlowski

Add "const" to "static struct regmap_irq" and "static struct
regmap_config".

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/mfd/sec-core.c |    8 ++++----
 drivers/mfd/sec-irq.c  |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 54cc255..207a9dc 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -134,12 +134,12 @@ static bool s5m8763_volatile(struct device *dev, unsigned int reg)
 	}
 }
 
-static struct regmap_config sec_regmap_config = {
+static const struct regmap_config sec_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 };
 
-static struct regmap_config s2mps11_regmap_config = {
+static const struct regmap_config s2mps11_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 
@@ -148,7 +148,7 @@ static struct regmap_config s2mps11_regmap_config = {
 	.cache_type = REGCACHE_FLAT,
 };
 
-static struct regmap_config s5m8763_regmap_config = {
+static const struct regmap_config s5m8763_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 
@@ -157,7 +157,7 @@ static struct regmap_config s5m8763_regmap_config = {
 	.cache_type = REGCACHE_FLAT,
 };
 
-static struct regmap_config s5m8767_regmap_config = {
+static const struct regmap_config s5m8767_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index b441b1b..4de494f 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -22,7 +22,7 @@
 #include <linux/mfd/samsung/s5m8763.h>
 #include <linux/mfd/samsung/s5m8767.h>
 
-static struct regmap_irq s2mps11_irqs[] = {
+static const struct regmap_irq s2mps11_irqs[] = {
 	[S2MPS11_IRQ_PWRONF] = {
 		.reg_offset = 0,
 		.mask = S2MPS11_IRQ_PWRONF_MASK,
@@ -90,7 +90,7 @@ static struct regmap_irq s2mps11_irqs[] = {
 };
 
 
-static struct regmap_irq s5m8767_irqs[] = {
+static const struct regmap_irq s5m8767_irqs[] = {
 	[S5M8767_IRQ_PWRR] = {
 		.reg_offset = 0,
 		.mask = S5M8767_IRQ_PWRR_MASK,
@@ -161,7 +161,7 @@ static struct regmap_irq s5m8767_irqs[] = {
 	},
 };
 
-static struct regmap_irq s5m8763_irqs[] = {
+static const struct regmap_irq s5m8763_irqs[] = {
 	[S5M8763_IRQ_DCINF] = {
 		.reg_offset = 0,
 		.mask = S5M8763_IRQ_DCINF_MASK,
@@ -236,7 +236,7 @@ static struct regmap_irq s5m8763_irqs[] = {
 	},
 };
 
-static struct regmap_irq_chip s2mps11_irq_chip = {
+static const struct regmap_irq_chip s2mps11_irq_chip = {
 	.name = "s2mps11",
 	.irqs = s2mps11_irqs,
 	.num_irqs = ARRAY_SIZE(s2mps11_irqs),
@@ -246,7 +246,7 @@ static struct regmap_irq_chip s2mps11_irq_chip = {
 	.ack_base = S2MPS11_REG_INT1,
 };
 
-static struct regmap_irq_chip s5m8767_irq_chip = {
+static const struct regmap_irq_chip s5m8767_irq_chip = {
 	.name = "s5m8767",
 	.irqs = s5m8767_irqs,
 	.num_irqs = ARRAY_SIZE(s5m8767_irqs),
@@ -256,7 +256,7 @@ static struct regmap_irq_chip s5m8767_irq_chip = {
 	.ack_base = S5M8767_REG_INT1,
 };
 
-static struct regmap_irq_chip s5m8763_irq_chip = {
+static const struct regmap_irq_chip s5m8763_irq_chip = {
 	.name = "s5m8763",
 	.irqs = s5m8763_irqs,
 	.num_irqs = ARRAY_SIZE(s5m8763_irqs),
-- 
1.7.9.5


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

* Re: [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe
  2013-11-28  8:09 ` [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe Krzysztof Kozlowski
@ 2013-11-28 13:46   ` Mark Brown
  2013-11-29  0:10     ` Sangbeom Kim
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-11-28 13:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

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

On Thu, Nov 28, 2013 at 09:09:40AM +0100, Krzysztof Kozlowski wrote:
> Probe failed for rtc-s5m:
> 	s5m-rtc s5m-rtc: Failed to request alarm IRQ: 12: -22
> 	s5m-rtc: probe of s5m-rtc failed with error -22
> 
> Fix rtc-s5m interrupt request by using regmap_irq_get_virq() for mapping
> the IRQ.

Reviwed-by: Mark Brown <broonie@linaro.org>

Presumably should CC stable.

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

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

* Re: [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update
  2013-11-28  8:09 ` [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update Krzysztof Kozlowski
@ 2013-11-28 13:47   ` Mark Brown
  2013-11-29  0:13     ` Sangbeom Kim
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-11-28 13:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

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

On Thu, Nov 28, 2013 at 09:09:41AM +0100, Krzysztof Kozlowski wrote:
> After setting alarm or time the driver is waiting for UDR register to be
> cleared indicating that registers data have been transferred.
> 
> Limit the endless loop to only 5 retries.

Reviwed-by: Mark Brown <broonie@linaro.org>

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

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

* Re: [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC
  2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
@ 2013-11-28 13:50   ` Mark Brown
  2013-11-29  0:08     ` Sangbeom Kim
  2013-11-29  9:04   ` Lee Jones
  1 sibling, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-11-28 13:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

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

On Thu, Nov 28, 2013 at 09:09:39AM +0100, Krzysztof Kozlowski wrote:
> Rename old regmap field of "struct sec_pmic_dev" to "regmap_pmic" and
> add new regmap for RTC.
> 
> On S5M8767A registers were not properly updated and read due to usage of
> the same regmap as the PMIC. This could be observed in various hangs,
> e.g. in infinite loop during waiting for UDR field change.

Reviwed-by: Mark Brown <broonie@linaro.org>

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

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

* Re: [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs
  2013-11-28  8:09 ` [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs Krzysztof Kozlowski
@ 2013-11-28 17:14   ` Mark Brown
  2013-11-29  0:18     ` Sangbeom Kim
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-11-28 17:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

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

On Thu, Nov 28, 2013 at 09:09:43AM +0100, Krzysztof Kozlowski wrote:
> Add "const" to "static struct regmap_irq" and "static struct
> regmap_config".

Reviewed-by: Mark Brown <broonie@linaro.org>

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

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

* RE: [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC
  2013-11-28 13:50   ` Mark Brown
@ 2013-11-29  0:08     ` Sangbeom Kim
  0 siblings, 0 replies; 19+ messages in thread
From: Sangbeom Kim @ 2013-11-29  0:08 UTC (permalink / raw)
  To: 'Mark Brown', 'Krzysztof Kozlowski'
  Cc: 'Samuel Ortiz', 'Lee Jones',
	'Liam Girdwood', 'Alessandro Zummo',
	linux-kernel, rtc-linux, 'Marek Szyprowski',
	'Geert Uytterhoeven', 'Kyungmin Park'

On Thursday, November 28, 2013 10:51 PM, Mark Brown wrote:
> > On S5M8767A registers were not properly updated and read due to usage
> > of the same regmap as the PMIC. This could be observed in various
> > hangs, e.g. in infinite loop during waiting for UDR field change.
> 
> Reviwed-by: Mark Brown <broonie@linaro.org>

Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Thanks,
Sangbeom.


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

* RE: [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe
  2013-11-28 13:46   ` Mark Brown
@ 2013-11-29  0:10     ` Sangbeom Kim
  0 siblings, 0 replies; 19+ messages in thread
From: Sangbeom Kim @ 2013-11-29  0:10 UTC (permalink / raw)
  To: 'Mark Brown', 'Krzysztof Kozlowski'
  Cc: 'Samuel Ortiz', 'Lee Jones',
	'Liam Girdwood', 'Alessandro Zummo',
	linux-kernel, rtc-linux, 'Marek Szyprowski',
	'Geert Uytterhoeven', 'Kyungmin Park'

On Thursday, November 28, 2013 10:47 PM, Mark Brown wrote:
> > Fix rtc-s5m interrupt request by using regmap_irq_get_virq() for mapping
> > the IRQ.
> 
> Reviwed-by: Mark Brown <broonie@linaro.org>

Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Thanks,
Sangbeom.


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

* RE: [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update
  2013-11-28 13:47   ` Mark Brown
@ 2013-11-29  0:13     ` Sangbeom Kim
  0 siblings, 0 replies; 19+ messages in thread
From: Sangbeom Kim @ 2013-11-29  0:13 UTC (permalink / raw)
  To: 'Mark Brown', 'Krzysztof Kozlowski'
  Cc: 'Samuel Ortiz', 'Lee Jones',
	'Liam Girdwood', 'Alessandro Zummo',
	linux-kernel, rtc-linux, 'Marek Szyprowski',
	'Geert Uytterhoeven', 'Kyungmin Park'

On Thursday, November 28, 2013 10:48 PM, Mark Brown wrote:
> > After setting alarm or time the driver is waiting for UDR register to be
> > cleared indicating that registers data have been transferred.
> >
> > Limit the endless loop to only 5 retries.
> 
> Reviwed-by: Mark Brown <broonie@linaro.org>

Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Thanks,
Sangbeom.


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

* RE: [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend
  2013-11-28  8:09 ` [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend Krzysztof Kozlowski
@ 2013-11-29  0:15   ` Sangbeom Kim
  0 siblings, 0 replies; 19+ messages in thread
From: Sangbeom Kim @ 2013-11-29  0:15 UTC (permalink / raw)
  To: 'Krzysztof Kozlowski', 'Samuel Ortiz',
	'Lee Jones', 'Liam Girdwood',
	'Mark Brown', 'Alessandro Zummo',
	linux-kernel, rtc-linux
  Cc: 'Marek Szyprowski', 'Geert Uytterhoeven',
	'Kyungmin Park'

On Thursday, November 28, 2013 5:10 PM, Krzysztof Kozlowski wrote:
> Add PM suspend/resume ops to rtc-s5m driver and enable IRQ wake during
> suspend so the RTC would act like a wake up source. This allows waking
> up from suspend to RAM on RTC alarm interrupt.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Thanks,
Sangbeom.


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

* RE: [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs
  2013-11-28 17:14   ` Mark Brown
@ 2013-11-29  0:18     ` Sangbeom Kim
  2013-11-29  8:53       ` Lee Jones
  0 siblings, 1 reply; 19+ messages in thread
From: Sangbeom Kim @ 2013-11-29  0:18 UTC (permalink / raw)
  To: 'Mark Brown', 'Krzysztof Kozlowski'
  Cc: 'Samuel Ortiz', 'Lee Jones',
	'Liam Girdwood', 'Alessandro Zummo',
	linux-kernel, rtc-linux, 'Marek Szyprowski',
	'Geert Uytterhoeven', 'Kyungmin Park'

On Friday, November 29, 2013 2:15 AM, Mark Brown wrote:
> > Add "const" to "static struct regmap_irq" and "static struct
> > regmap_config".
> 
> Reviewed-by: Mark Brown <broonie@linaro.org>

Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Thanks,
Sangbeom.


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

* Re: [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs
  2013-11-29  0:18     ` Sangbeom Kim
@ 2013-11-29  8:53       ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2013-11-29  8:53 UTC (permalink / raw)
  To: Sangbeom Kim
  Cc: 'Mark Brown', 'Krzysztof Kozlowski',
	'Samuel Ortiz', 'Liam Girdwood',
	'Alessandro Zummo',
	linux-kernel, rtc-linux, 'Marek Szyprowski',
	'Geert Uytterhoeven', 'Kyungmin Park'

On Fri, 29 Nov 2013, Sangbeom Kim wrote:

> On Friday, November 29, 2013 2:15 AM, Mark Brown wrote:
> > > Add "const" to "static struct regmap_irq" and "static struct
> > > regmap_config".
> > 
> > Reviewed-by: Mark Brown <broonie@linaro.org>
> 
> Acked-by: Sangbeom Kim <sbkim73@samsung.com>

Applied with Reviews and Acks.

-- 
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] 19+ messages in thread

* Re: [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC
  2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
  2013-11-28 13:50   ` Mark Brown
@ 2013-11-29  9:04   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Lee Jones @ 2013-11-29  9:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

On Thu, 28 Nov 2013, Krzysztof Kozlowski wrote:

> Rename old regmap field of "struct sec_pmic_dev" to "regmap_pmic" and
> add new regmap for RTC.
> 
> On S5M8767A registers were not properly updated and read due to usage of
> the same regmap as the PMIC. This could be observed in various hangs,
> e.g. in infinite loop during waiting for UDR field change.
> 
> On this chip family the RTC has different I2C address than PMIC so
> additional regmap is needed.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/sec-core.c           |   30 ++++++++++++++++++++++--------
>  drivers/mfd/sec-irq.c            |    6 +++---
>  drivers/regulator/s5m8767.c      |    2 +-
>  drivers/rtc/rtc-s5m.c            |    2 +-
>  include/linux/mfd/samsung/core.h |    3 ++-
>  5 files changed, 29 insertions(+), 14 deletions(-)

The MFD parts look fine to me. I just need the Acks from the other
maintainers before I can apply it:

Acked-by: Lee Jones <lee.jones@lianro.org>

-- 
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] 19+ messages in thread

* Re: [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests
  2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2013-11-28  8:09 ` [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs Krzysztof Kozlowski
@ 2013-12-02 23:10 ` Andrew Morton
  2013-12-03  8:34   ` Krzysztof Kozlowski
  5 siblings, 1 reply; 19+ messages in thread
From: Andrew Morton @ 2013-12-02 23:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park, Geert Uytterhoeven

On Thu, 28 Nov 2013 09:09:38 +0100 Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:

> This is a second version of patchset of small but important fixes for rtc-s5m
> driver. Last patches also add waking up on RTC alarm interrupts.
> 
> The patchset is based on v3.13-rc1-229-ge7c0d3d and depends on patch from 
> Geert Uytterhoeven:
>  - rtc: s5m-rtc: Fix info->rtc assignment
>    http://article.gmane.org/gmane.linux.kernel/1595905

When Geert sent that patch he said "I would be really surprised if this
driver didn't just crash...  Please test.".  I've been waiting for
someone to test it!  Can I take it that you have done so?

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

* Re: [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests
  2013-12-02 23:10 ` [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Andrew Morton
@ 2013-12-03  8:34   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2013-12-03  8:34 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Alessandro Zummo, linux-kernel, rtc-linux, Marek Szyprowski,
	Geert Uytterhoeven, Kyungmin Park

On Mon, 2013-12-02 at 15:10 -0800, Andrew Morton wrote:
> On Thu, 28 Nov 2013 09:09:38 +0100 Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> 
> > This is a second version of patchset of small but important fixes for rtc-s5m
> > driver. Last patches also add waking up on RTC alarm interrupts.
> > 
> > The patchset is based on v3.13-rc1-229-ge7c0d3d and depends on patch from 
> > Geert Uytterhoeven:
> >  - rtc: s5m-rtc: Fix info->rtc assignment
> >    http://article.gmane.org/gmane.linux.kernel/1595905
> 
> When Geert sent that patch he said "I would be really surprised if this
> driver didn't just crash...  Please test.".  I've been waiting for
> someone to test it!  Can I take it that you have done so?

Yes, I tested the driver with these patches.

Best regards,
Krzysztof


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

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

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-28  8:09 [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Krzysztof Kozlowski
2013-11-28  8:09 ` [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC Krzysztof Kozlowski
2013-11-28 13:50   ` Mark Brown
2013-11-29  0:08     ` Sangbeom Kim
2013-11-29  9:04   ` Lee Jones
2013-11-28  8:09 ` [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe Krzysztof Kozlowski
2013-11-28 13:46   ` Mark Brown
2013-11-29  0:10     ` Sangbeom Kim
2013-11-28  8:09 ` [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update Krzysztof Kozlowski
2013-11-28 13:47   ` Mark Brown
2013-11-29  0:13     ` Sangbeom Kim
2013-11-28  8:09 ` [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend Krzysztof Kozlowski
2013-11-29  0:15   ` Sangbeom Kim
2013-11-28  8:09 ` [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs Krzysztof Kozlowski
2013-11-28 17:14   ` Mark Brown
2013-11-29  0:18     ` Sangbeom Kim
2013-11-29  8:53       ` Lee Jones
2013-12-02 23:10 ` [PATCH v2 0/5] rtc: s5m: Bug fixes of the driver after tests Andrew Morton
2013-12-03  8:34   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).