All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-23 16:15 ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

Hi,

Here is the revamp of the patch posted eariler to support wakeupirq.
This series does a few cleanups as well prior to introducing the
generic apis required to support the wakeirq mechanism used on certain
TI SoCs. Cleanups done here are just minimal set of the cleanups we
discussed in [2].

Series is based on next-20150623

Test log: http://pastebin.ubuntu.com/11763002/

NOTE1: I have only tested in mcp79410 device, and not on other
ds1307-rtc driver compatbile devices as I dont have any other.
additional testing might be nice to have.
NOTE2: there are additional fixes that linux-next seems to need but
those are in omap-rtc, cpufreq etc, but those are not related by the
ds-1307.

V1: https://patchwork.kernel.org/patch/4759171/

NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
be reposted along with other wakeup sources to be enabled once the
driver changes are accepted.

Felipe Balbi (1):
  drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ

Nishanth Menon (4):
  drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
  drivers/rtc/rtc-ds1307.c: Sort the headers
  drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  (TMP) ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 +-
 drivers/rtc/rtc-ds1307.c                |  110 +++++++++++++++++--------------
 2 files changed, 63 insertions(+), 50 deletions(-)

-- 
1.7.9.5

[2] https://patchwork.kernel.org/patch/6245101/

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

* [rtc-linux] [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-23 16:15 ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

Hi,

Here is the revamp of the patch posted eariler to support wakeupirq.
This series does a few cleanups as well prior to introducing the
generic apis required to support the wakeirq mechanism used on certain
TI SoCs. Cleanups done here are just minimal set of the cleanups we
discussed in [2].

Series is based on next-20150623

Test log: http://pastebin.ubuntu.com/11763002/

NOTE1: I have only tested in mcp79410 device, and not on other
ds1307-rtc driver compatbile devices as I dont have any other.
additional testing might be nice to have.
NOTE2: there are additional fixes that linux-next seems to need but
those are in omap-rtc, cpufreq etc, but those are not related by the
ds-1307.

V1: https://patchwork.kernel.org/patch/4759171/

NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
be reposted along with other wakeup sources to be enabled once the
driver changes are accepted.

Felipe Balbi (1):
  drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ

Nishanth Menon (4):
  drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
  drivers/rtc/rtc-ds1307.c: Sort the headers
  drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  (TMP) ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 +-
 drivers/rtc/rtc-ds1307.c                |  110 +++++++++++++++++--------------
 2 files changed, 63 insertions(+), 50 deletions(-)

-- 
1.7.9.5

[2] https://patchwork.kernel.org/patch/6245101/

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-23 16:15 ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: Nishanth Menon, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, linux-omap, linux-arm-kernel

Hi,

Here is the revamp of the patch posted eariler to support wakeupirq.
This series does a few cleanups as well prior to introducing the
generic apis required to support the wakeirq mechanism used on certain
TI SoCs. Cleanups done here are just minimal set of the cleanups we
discussed in [2].

Series is based on next-20150623

Test log: http://pastebin.ubuntu.com/11763002/

NOTE1: I have only tested in mcp79410 device, and not on other
ds1307-rtc driver compatbile devices as I dont have any other.
additional testing might be nice to have.
NOTE2: there are additional fixes that linux-next seems to need but
those are in omap-rtc, cpufreq etc, but those are not related by the
ds-1307.

V1: https://patchwork.kernel.org/patch/4759171/

NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
be reposted along with other wakeup sources to be enabled once the
driver changes are accepted.

Felipe Balbi (1):
  drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ

Nishanth Menon (4):
  drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
  drivers/rtc/rtc-ds1307.c: Sort the headers
  drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  (TMP) ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 +-
 drivers/rtc/rtc-ds1307.c                |  110 +++++++++++++++++--------------
 2 files changed, 63 insertions(+), 50 deletions(-)

-- 
1.7.9.5

[2] https://patchwork.kernel.org/patch/6245101/

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

* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-23 16:15 ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Here is the revamp of the patch posted eariler to support wakeupirq.
This series does a few cleanups as well prior to introducing the
generic apis required to support the wakeirq mechanism used on certain
TI SoCs. Cleanups done here are just minimal set of the cleanups we
discussed in [2].

Series is based on next-20150623

Test log: http://pastebin.ubuntu.com/11763002/

NOTE1: I have only tested in mcp79410 device, and not on other
ds1307-rtc driver compatbile devices as I dont have any other.
additional testing might be nice to have.
NOTE2: there are additional fixes that linux-next seems to need but
those are in omap-rtc, cpufreq etc, but those are not related by the
ds-1307.

V1: https://patchwork.kernel.org/patch/4759171/

NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
be reposted along with other wakeup sources to be enabled once the
driver changes are accepted.

Felipe Balbi (1):
  drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ

Nishanth Menon (4):
  drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
  drivers/rtc/rtc-ds1307.c: Sort the headers
  drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  (TMP) ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 +-
 drivers/rtc/rtc-ds1307.c                |  110 +++++++++++++++++--------------
 2 files changed, 63 insertions(+), 50 deletions(-)

-- 
1.7.9.5

[2] https://patchwork.kernel.org/patch/6245101/

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

* [PATCH V2 1/5] drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-23 16:15   ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

From: Felipe Balbi <balbi@ti.com>

The driver currently emulates the concept of threaded IRQ using a
workqueue, which it really does not need to. Instead, switch over to
threaded_irq handlers which is meant precisely for the same purpose.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   59 +++++++++++++++-------------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 6e76de1856fc..8ea496e54a2e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -114,7 +114,6 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
-	struct work_struct	work;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -311,27 +310,17 @@ static s32 ds1307_native_smbus_read_block_data(const struct i2c_client *client,
 /*----------------------------------------------------------------------*/
 
 /*
- * The IRQ logic includes a "real" handler running in IRQ context just
- * long enough to schedule this workqueue entry.   We need a task context
- * to talk to the RTC, since I2C I/O calls require that; and disable the
- * IRQ until we clear its status on the chip, so that this handler can
- * work with any type of triggering (not just falling edge).
- *
  * The ds1337 and ds1339 both have two alarms, but we only use the first
  * one (with a "seconds" field).  For ds1337 we expect nINTA is our alarm
  * signal; ds1339 chips have only one alarm signal.
  */
-static void ds1307_work(struct work_struct *work)
+static irqreturn_t ds1307_irq(int irq, void *dev_id)
 {
-	struct ds1307		*ds1307;
-	struct i2c_client	*client;
-	struct mutex		*lock;
+	struct i2c_client	*client = dev_id;
+	struct ds1307		*ds1307 = i2c_get_clientdata(client);
+	struct mutex		*lock = &ds1307->rtc->ops_lock;
 	int			stat, control;
 
-	ds1307 = container_of(work, struct ds1307, work);
-	client = ds1307->client;
-	lock = &ds1307->rtc->ops_lock;
-
 	mutex_lock(lock);
 	stat = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
 	if (stat < 0)
@@ -352,18 +341,8 @@ static void ds1307_work(struct work_struct *work)
 	}
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
 	mutex_unlock(lock);
-}
-
-static irqreturn_t ds1307_irq(int irq, void *dev_id)
-{
-	struct i2c_client	*client = dev_id;
-	struct ds1307		*ds1307 = i2c_get_clientdata(client);
 
-	disable_irq_nosync(irq);
-	schedule_work(&ds1307->work);
 	return IRQ_HANDLED;
 }
 
@@ -634,13 +613,14 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
 					 MCP794XX_BIT_ALMX_C1 | \
 					 MCP794XX_BIT_ALMX_C2)
 
-static void mcp794xx_work(struct work_struct *work)
+static irqreturn_t mcp794xx_irq(int irq, void *dev_id)
 {
-	struct ds1307 *ds1307 = container_of(work, struct ds1307, work);
-	struct i2c_client *client = ds1307->client;
+	struct i2c_client       *client = dev_id;
+	struct ds1307           *ds1307 = i2c_get_clientdata(client);
+	struct mutex            *lock = &ds1307->rtc->ops_lock;
 	int reg, ret;
 
-	mutex_lock(&ds1307->rtc->ops_lock);
+	mutex_lock(lock);
 
 	/* Check and clear alarm 0 interrupt flag. */
 	reg = i2c_smbus_read_byte_data(client, MCP794XX_REG_ALARM0_CTRL);
@@ -665,9 +645,9 @@ static void mcp794xx_work(struct work_struct *work)
 	rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
-	mutex_unlock(&ds1307->rtc->ops_lock);
+	mutex_unlock(lock);
+
+	return IRQ_HANDLED;
 }
 
 static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t)
@@ -896,6 +876,8 @@ static int ds1307_probe(struct i2c_client *client,
 	bool			want_irq = false;
 	unsigned char		*buf;
 	struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
+	irq_handler_t	irq_handler = ds1307_irq;
+
 	static const int	bbsqi_bitpos[] = {
 		[ds_1337] = 0,
 		[ds_1339] = DS1339_BIT_BBSQI,
@@ -962,8 +944,6 @@ static int ds1307_probe(struct i2c_client *client,
 		 * running on Vbackup (BBSQI/BBSQW)
 		 */
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, ds1307_work);
-
 			ds1307->regs[0] |= DS1337_BIT_INTCN
 					| bbsqi_bitpos[ds1307->type];
 			ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
@@ -1053,7 +1033,7 @@ static int ds1307_probe(struct i2c_client *client,
 	case mcp794xx:
 		rtc_ops = &mcp794xx_rtc_ops;
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, mcp794xx_work);
+			irq_handler = mcp794xx_irq;
 			want_irq = true;
 		}
 		break;
@@ -1176,8 +1156,9 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_irq(client->irq, ds1307_irq, IRQF_SHARED,
-			  ds1307->rtc->name, client);
+		err = request_threaded_irq(client->irq, NULL, irq_handler,
+					   IRQF_SHARED | IRQF_ONESHOT,
+					   ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1231,10 +1212,8 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) {
+	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
 		free_irq(client->irq, client);
-		cancel_work_sync(&ds1307->work);
-	}
 
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
-- 
1.7.9.5


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

* [rtc-linux] [PATCH V2 1/5] drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

From: Felipe Balbi <balbi@ti.com>

The driver currently emulates the concept of threaded IRQ using a
workqueue, which it really does not need to. Instead, switch over to
threaded_irq handlers which is meant precisely for the same purpose.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   59 +++++++++++++++-------------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 6e76de1856fc..8ea496e54a2e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -114,7 +114,6 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
-	struct work_struct	work;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -311,27 +310,17 @@ static s32 ds1307_native_smbus_read_block_data(const struct i2c_client *client,
 /*----------------------------------------------------------------------*/
 
 /*
- * The IRQ logic includes a "real" handler running in IRQ context just
- * long enough to schedule this workqueue entry.   We need a task context
- * to talk to the RTC, since I2C I/O calls require that; and disable the
- * IRQ until we clear its status on the chip, so that this handler can
- * work with any type of triggering (not just falling edge).
- *
  * The ds1337 and ds1339 both have two alarms, but we only use the first
  * one (with a "seconds" field).  For ds1337 we expect nINTA is our alarm
  * signal; ds1339 chips have only one alarm signal.
  */
-static void ds1307_work(struct work_struct *work)
+static irqreturn_t ds1307_irq(int irq, void *dev_id)
 {
-	struct ds1307		*ds1307;
-	struct i2c_client	*client;
-	struct mutex		*lock;
+	struct i2c_client	*client = dev_id;
+	struct ds1307		*ds1307 = i2c_get_clientdata(client);
+	struct mutex		*lock = &ds1307->rtc->ops_lock;
 	int			stat, control;
 
-	ds1307 = container_of(work, struct ds1307, work);
-	client = ds1307->client;
-	lock = &ds1307->rtc->ops_lock;
-
 	mutex_lock(lock);
 	stat = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
 	if (stat < 0)
@@ -352,18 +341,8 @@ static void ds1307_work(struct work_struct *work)
 	}
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
 	mutex_unlock(lock);
-}
-
-static irqreturn_t ds1307_irq(int irq, void *dev_id)
-{
-	struct i2c_client	*client = dev_id;
-	struct ds1307		*ds1307 = i2c_get_clientdata(client);
 
-	disable_irq_nosync(irq);
-	schedule_work(&ds1307->work);
 	return IRQ_HANDLED;
 }
 
@@ -634,13 +613,14 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
 					 MCP794XX_BIT_ALMX_C1 | \
 					 MCP794XX_BIT_ALMX_C2)
 
-static void mcp794xx_work(struct work_struct *work)
+static irqreturn_t mcp794xx_irq(int irq, void *dev_id)
 {
-	struct ds1307 *ds1307 = container_of(work, struct ds1307, work);
-	struct i2c_client *client = ds1307->client;
+	struct i2c_client       *client = dev_id;
+	struct ds1307           *ds1307 = i2c_get_clientdata(client);
+	struct mutex            *lock = &ds1307->rtc->ops_lock;
 	int reg, ret;
 
-	mutex_lock(&ds1307->rtc->ops_lock);
+	mutex_lock(lock);
 
 	/* Check and clear alarm 0 interrupt flag. */
 	reg = i2c_smbus_read_byte_data(client, MCP794XX_REG_ALARM0_CTRL);
@@ -665,9 +645,9 @@ static void mcp794xx_work(struct work_struct *work)
 	rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
-	mutex_unlock(&ds1307->rtc->ops_lock);
+	mutex_unlock(lock);
+
+	return IRQ_HANDLED;
 }
 
 static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t)
@@ -896,6 +876,8 @@ static int ds1307_probe(struct i2c_client *client,
 	bool			want_irq = false;
 	unsigned char		*buf;
 	struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
+	irq_handler_t	irq_handler = ds1307_irq;
+
 	static const int	bbsqi_bitpos[] = {
 		[ds_1337] = 0,
 		[ds_1339] = DS1339_BIT_BBSQI,
@@ -962,8 +944,6 @@ static int ds1307_probe(struct i2c_client *client,
 		 * running on Vbackup (BBSQI/BBSQW)
 		 */
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, ds1307_work);
-
 			ds1307->regs[0] |= DS1337_BIT_INTCN
 					| bbsqi_bitpos[ds1307->type];
 			ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
@@ -1053,7 +1033,7 @@ static int ds1307_probe(struct i2c_client *client,
 	case mcp794xx:
 		rtc_ops = &mcp794xx_rtc_ops;
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, mcp794xx_work);
+			irq_handler = mcp794xx_irq;
 			want_irq = true;
 		}
 		break;
@@ -1176,8 +1156,9 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_irq(client->irq, ds1307_irq, IRQF_SHARED,
-			  ds1307->rtc->name, client);
+		err = request_threaded_irq(client->irq, NULL, irq_handler,
+					   IRQF_SHARED | IRQF_ONESHOT,
+					   ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1231,10 +1212,8 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) {
+	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
 		free_irq(client->irq, client);
-		cancel_work_sync(&ds1307->work);
-	}
 
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
-- 
1.7.9.5

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 1/5] drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: Nishanth Menon, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, linux-omap, linux-arm-kernel

From: Felipe Balbi <balbi@ti.com>

The driver currently emulates the concept of threaded IRQ using a
workqueue, which it really does not need to. Instead, switch over to
threaded_irq handlers which is meant precisely for the same purpose.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   59 +++++++++++++++-------------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 6e76de1856fc..8ea496e54a2e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -114,7 +114,6 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
-	struct work_struct	work;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -311,27 +310,17 @@ static s32 ds1307_native_smbus_read_block_data(const struct i2c_client *client,
 /*----------------------------------------------------------------------*/
 
 /*
- * The IRQ logic includes a "real" handler running in IRQ context just
- * long enough to schedule this workqueue entry.   We need a task context
- * to talk to the RTC, since I2C I/O calls require that; and disable the
- * IRQ until we clear its status on the chip, so that this handler can
- * work with any type of triggering (not just falling edge).
- *
  * The ds1337 and ds1339 both have two alarms, but we only use the first
  * one (with a "seconds" field).  For ds1337 we expect nINTA is our alarm
  * signal; ds1339 chips have only one alarm signal.
  */
-static void ds1307_work(struct work_struct *work)
+static irqreturn_t ds1307_irq(int irq, void *dev_id)
 {
-	struct ds1307		*ds1307;
-	struct i2c_client	*client;
-	struct mutex		*lock;
+	struct i2c_client	*client = dev_id;
+	struct ds1307		*ds1307 = i2c_get_clientdata(client);
+	struct mutex		*lock = &ds1307->rtc->ops_lock;
 	int			stat, control;
 
-	ds1307 = container_of(work, struct ds1307, work);
-	client = ds1307->client;
-	lock = &ds1307->rtc->ops_lock;
-
 	mutex_lock(lock);
 	stat = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
 	if (stat < 0)
@@ -352,18 +341,8 @@ static void ds1307_work(struct work_struct *work)
 	}
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
 	mutex_unlock(lock);
-}
-
-static irqreturn_t ds1307_irq(int irq, void *dev_id)
-{
-	struct i2c_client	*client = dev_id;
-	struct ds1307		*ds1307 = i2c_get_clientdata(client);
 
-	disable_irq_nosync(irq);
-	schedule_work(&ds1307->work);
 	return IRQ_HANDLED;
 }
 
@@ -634,13 +613,14 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
 					 MCP794XX_BIT_ALMX_C1 | \
 					 MCP794XX_BIT_ALMX_C2)
 
-static void mcp794xx_work(struct work_struct *work)
+static irqreturn_t mcp794xx_irq(int irq, void *dev_id)
 {
-	struct ds1307 *ds1307 = container_of(work, struct ds1307, work);
-	struct i2c_client *client = ds1307->client;
+	struct i2c_client       *client = dev_id;
+	struct ds1307           *ds1307 = i2c_get_clientdata(client);
+	struct mutex            *lock = &ds1307->rtc->ops_lock;
 	int reg, ret;
 
-	mutex_lock(&ds1307->rtc->ops_lock);
+	mutex_lock(lock);
 
 	/* Check and clear alarm 0 interrupt flag. */
 	reg = i2c_smbus_read_byte_data(client, MCP794XX_REG_ALARM0_CTRL);
@@ -665,9 +645,9 @@ static void mcp794xx_work(struct work_struct *work)
 	rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
-	mutex_unlock(&ds1307->rtc->ops_lock);
+	mutex_unlock(lock);
+
+	return IRQ_HANDLED;
 }
 
 static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t)
@@ -896,6 +876,8 @@ static int ds1307_probe(struct i2c_client *client,
 	bool			want_irq = false;
 	unsigned char		*buf;
 	struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
+	irq_handler_t	irq_handler = ds1307_irq;
+
 	static const int	bbsqi_bitpos[] = {
 		[ds_1337] = 0,
 		[ds_1339] = DS1339_BIT_BBSQI,
@@ -962,8 +944,6 @@ static int ds1307_probe(struct i2c_client *client,
 		 * running on Vbackup (BBSQI/BBSQW)
 		 */
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, ds1307_work);
-
 			ds1307->regs[0] |= DS1337_BIT_INTCN
 					| bbsqi_bitpos[ds1307->type];
 			ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
@@ -1053,7 +1033,7 @@ static int ds1307_probe(struct i2c_client *client,
 	case mcp794xx:
 		rtc_ops = &mcp794xx_rtc_ops;
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, mcp794xx_work);
+			irq_handler = mcp794xx_irq;
 			want_irq = true;
 		}
 		break;
@@ -1176,8 +1156,9 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_irq(client->irq, ds1307_irq, IRQF_SHARED,
-			  ds1307->rtc->name, client);
+		err = request_threaded_irq(client->irq, NULL, irq_handler,
+					   IRQF_SHARED | IRQF_ONESHOT,
+					   ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1231,10 +1212,8 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) {
+	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
 		free_irq(client->irq, client);
-		cancel_work_sync(&ds1307->work);
-	}
 
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
-- 
1.7.9.5

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

* [PATCH V2 1/5] drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Felipe Balbi <balbi@ti.com>

The driver currently emulates the concept of threaded IRQ using a
workqueue, which it really does not need to. Instead, switch over to
threaded_irq handlers which is meant precisely for the same purpose.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   59 +++++++++++++++-------------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 6e76de1856fc..8ea496e54a2e 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -114,7 +114,6 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
-	struct work_struct	work;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -311,27 +310,17 @@ static s32 ds1307_native_smbus_read_block_data(const struct i2c_client *client,
 /*----------------------------------------------------------------------*/
 
 /*
- * The IRQ logic includes a "real" handler running in IRQ context just
- * long enough to schedule this workqueue entry.   We need a task context
- * to talk to the RTC, since I2C I/O calls require that; and disable the
- * IRQ until we clear its status on the chip, so that this handler can
- * work with any type of triggering (not just falling edge).
- *
  * The ds1337 and ds1339 both have two alarms, but we only use the first
  * one (with a "seconds" field).  For ds1337 we expect nINTA is our alarm
  * signal; ds1339 chips have only one alarm signal.
  */
-static void ds1307_work(struct work_struct *work)
+static irqreturn_t ds1307_irq(int irq, void *dev_id)
 {
-	struct ds1307		*ds1307;
-	struct i2c_client	*client;
-	struct mutex		*lock;
+	struct i2c_client	*client = dev_id;
+	struct ds1307		*ds1307 = i2c_get_clientdata(client);
+	struct mutex		*lock = &ds1307->rtc->ops_lock;
 	int			stat, control;
 
-	ds1307 = container_of(work, struct ds1307, work);
-	client = ds1307->client;
-	lock = &ds1307->rtc->ops_lock;
-
 	mutex_lock(lock);
 	stat = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
 	if (stat < 0)
@@ -352,18 +341,8 @@ static void ds1307_work(struct work_struct *work)
 	}
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
 	mutex_unlock(lock);
-}
-
-static irqreturn_t ds1307_irq(int irq, void *dev_id)
-{
-	struct i2c_client	*client = dev_id;
-	struct ds1307		*ds1307 = i2c_get_clientdata(client);
 
-	disable_irq_nosync(irq);
-	schedule_work(&ds1307->work);
 	return IRQ_HANDLED;
 }
 
@@ -634,13 +613,14 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
 					 MCP794XX_BIT_ALMX_C1 | \
 					 MCP794XX_BIT_ALMX_C2)
 
-static void mcp794xx_work(struct work_struct *work)
+static irqreturn_t mcp794xx_irq(int irq, void *dev_id)
 {
-	struct ds1307 *ds1307 = container_of(work, struct ds1307, work);
-	struct i2c_client *client = ds1307->client;
+	struct i2c_client       *client = dev_id;
+	struct ds1307           *ds1307 = i2c_get_clientdata(client);
+	struct mutex            *lock = &ds1307->rtc->ops_lock;
 	int reg, ret;
 
-	mutex_lock(&ds1307->rtc->ops_lock);
+	mutex_lock(lock);
 
 	/* Check and clear alarm 0 interrupt flag. */
 	reg = i2c_smbus_read_byte_data(client, MCP794XX_REG_ALARM0_CTRL);
@@ -665,9 +645,9 @@ static void mcp794xx_work(struct work_struct *work)
 	rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);
 
 out:
-	if (test_bit(HAS_ALARM, &ds1307->flags))
-		enable_irq(client->irq);
-	mutex_unlock(&ds1307->rtc->ops_lock);
+	mutex_unlock(lock);
+
+	return IRQ_HANDLED;
 }
 
 static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t)
@@ -896,6 +876,8 @@ static int ds1307_probe(struct i2c_client *client,
 	bool			want_irq = false;
 	unsigned char		*buf;
 	struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
+	irq_handler_t	irq_handler = ds1307_irq;
+
 	static const int	bbsqi_bitpos[] = {
 		[ds_1337] = 0,
 		[ds_1339] = DS1339_BIT_BBSQI,
@@ -962,8 +944,6 @@ static int ds1307_probe(struct i2c_client *client,
 		 * running on Vbackup (BBSQI/BBSQW)
 		 */
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, ds1307_work);
-
 			ds1307->regs[0] |= DS1337_BIT_INTCN
 					| bbsqi_bitpos[ds1307->type];
 			ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
@@ -1053,7 +1033,7 @@ static int ds1307_probe(struct i2c_client *client,
 	case mcp794xx:
 		rtc_ops = &mcp794xx_rtc_ops;
 		if (ds1307->client->irq > 0 && chip->alarm) {
-			INIT_WORK(&ds1307->work, mcp794xx_work);
+			irq_handler = mcp794xx_irq;
 			want_irq = true;
 		}
 		break;
@@ -1176,8 +1156,9 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_irq(client->irq, ds1307_irq, IRQF_SHARED,
-			  ds1307->rtc->name, client);
+		err = request_threaded_irq(client->irq, NULL, irq_handler,
+					   IRQF_SHARED | IRQF_ONESHOT,
+					   ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1231,10 +1212,8 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) {
+	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
 		free_irq(client->irq, client);
-		cancel_work_sync(&ds1307->work);
-	}
 
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
-- 
1.7.9.5

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

* [PATCH V2 2/5] drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-23 16:15   ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

Since we are not doing anything fancy in remove function that requires
us to sequence IRQ free operation, we might as well switch over to devm_
equivalent of managed IRQ allocation and remove the explicit free_irq
since it'd be done automatically at remove.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8ea496e54a2e..0a98d8a52791 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1156,9 +1156,10 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_threaded_irq(client->irq, NULL, irq_handler,
-					   IRQF_SHARED | IRQF_ONESHOT,
-					   ds1307->rtc->name, client);
+		err = devm_request_threaded_irq(&client->dev,
+						client->irq, NULL, irq_handler,
+						IRQF_SHARED | IRQF_ONESHOT,
+						ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1212,9 +1213,6 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
-		free_irq(client->irq, client);
-
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5


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

* [rtc-linux] [PATCH V2 2/5] drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

Since we are not doing anything fancy in remove function that requires
us to sequence IRQ free operation, we might as well switch over to devm_
equivalent of managed IRQ allocation and remove the explicit free_irq
since it'd be done automatically at remove.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8ea496e54a2e..0a98d8a52791 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1156,9 +1156,10 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_threaded_irq(client->irq, NULL, irq_handler,
-					   IRQF_SHARED | IRQF_ONESHOT,
-					   ds1307->rtc->name, client);
+		err = devm_request_threaded_irq(&client->dev,
+						client->irq, NULL, irq_handler,
+						IRQF_SHARED | IRQF_ONESHOT,
+						ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1212,9 +1213,6 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
-		free_irq(client->irq, client);
-
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 2/5] drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

Since we are not doing anything fancy in remove function that requires
us to sequence IRQ free operation, we might as well switch over to devm_
equivalent of managed IRQ allocation and remove the explicit free_irq
since it'd be done automatically at remove.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8ea496e54a2e..0a98d8a52791 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1156,9 +1156,10 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_threaded_irq(client->irq, NULL, irq_handler,
-					   IRQF_SHARED | IRQF_ONESHOT,
-					   ds1307->rtc->name, client);
+		err = devm_request_threaded_irq(&client->dev,
+						client->irq, NULL, irq_handler,
+						IRQF_SHARED | IRQF_ONESHOT,
+						ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1212,9 +1213,6 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
-		free_irq(client->irq, client);
-
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

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

* [PATCH V2 2/5] drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Since we are not doing anything fancy in remove function that requires
us to sequence IRQ free operation, we might as well switch over to devm_
equivalent of managed IRQ allocation and remove the explicit free_irq
since it'd be done automatically at remove.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8ea496e54a2e..0a98d8a52791 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1156,9 +1156,10 @@ read_rtc:
 	}
 
 	if (want_irq) {
-		err = request_threaded_irq(client->irq, NULL, irq_handler,
-					   IRQF_SHARED | IRQF_ONESHOT,
-					   ds1307->rtc->name, client);
+		err = devm_request_threaded_irq(&client->dev,
+						client->irq, NULL, irq_handler,
+						IRQF_SHARED | IRQF_ONESHOT,
+						ds1307->rtc->name, client);
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
@@ -1212,9 +1213,6 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
-	if (test_and_clear_bit(HAS_ALARM, &ds1307->flags))
-		free_irq(client->irq, client);
-
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

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

* [PATCH V2 3/5] drivers/rtc/rtc-ds1307.c: Sort the headers
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-23 16:15   ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

It is always a good practice to keep the #includes sorted

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 0a98d8a52791..b03880fc32b5 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -11,14 +11,14 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/bcd.h>
+#include <linux/i2c.h>
 #include <linux/init.h>
+#include <linux/module.h>
+#include <linux/rtc/ds1307.h>
+#include <linux/rtc.h>
 #include <linux/slab.h>
-#include <linux/i2c.h>
 #include <linux/string.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/rtc/ds1307.h>
 
 /*
  * We can't determine type by probing, but if we expect pre-Linux code
-- 
1.7.9.5


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

* [rtc-linux] [PATCH V2 3/5] drivers/rtc/rtc-ds1307.c: Sort the headers
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

It is always a good practice to keep the #includes sorted

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 0a98d8a52791..b03880fc32b5 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -11,14 +11,14 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/bcd.h>
+#include <linux/i2c.h>
 #include <linux/init.h>
+#include <linux/module.h>
+#include <linux/rtc/ds1307.h>
+#include <linux/rtc.h>
 #include <linux/slab.h>
-#include <linux/i2c.h>
 #include <linux/string.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/rtc/ds1307.h>
 
 /*
  * We can't determine type by probing, but if we expect pre-Linux code
-- 
1.7.9.5

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 3/5] drivers/rtc/rtc-ds1307.c: Sort the headers
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: Nishanth Menon, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, linux-omap, linux-arm-kernel

It is always a good practice to keep the #includes sorted

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 0a98d8a52791..b03880fc32b5 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -11,14 +11,14 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/bcd.h>
+#include <linux/i2c.h>
 #include <linux/init.h>
+#include <linux/module.h>
+#include <linux/rtc/ds1307.h>
+#include <linux/rtc.h>
 #include <linux/slab.h>
-#include <linux/i2c.h>
 #include <linux/string.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/rtc/ds1307.h>
 
 /*
  * We can't determine type by probing, but if we expect pre-Linux code
-- 
1.7.9.5

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

* [PATCH V2 3/5] drivers/rtc/rtc-ds1307.c: Sort the headers
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

It is always a good practice to keep the #includes sorted

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 0a98d8a52791..b03880fc32b5 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -11,14 +11,14 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/bcd.h>
+#include <linux/i2c.h>
 #include <linux/init.h>
+#include <linux/module.h>
+#include <linux/rtc/ds1307.h>
+#include <linux/rtc.h>
 #include <linux/slab.h>
-#include <linux/i2c.h>
 #include <linux/string.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/rtc/ds1307.h>
 
 /*
  * We can't determine type by probing, but if we expect pre-Linux code
-- 
1.7.9.5

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-23 16:15   ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes since V1:
	- dropped the need for specific suspend-resume handlers generic api
	  has adequate hooks for those
	- little more code flow cleanups.

V1: https://patchwork.kernel.org/patch/4759171/

 drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..b00d97dbf955 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,36 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
+
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		ds1307->wakeirq = of_irq_get(node, 1);
+		if (ds1307->wakeirq <= 0) {
+			if (ds1307->wakeirq == -EPROBE_DEFER) {
+				err = ds1307->wakeirq;
+				goto exit;
+			}
+			ds1307->wakeirq = 0;
+			goto no_irq;
+		}
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1206,6 +1235,9 @@ read_rtc:
 	return 0;
 
 exit:
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	return err;
 }
 
@@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5


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

* [rtc-linux] [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes since V1:
	- dropped the need for specific suspend-resume handlers generic api
	  has adequate hooks for those
	- little more code flow cleanups.

V1: https://patchwork.kernel.org/patch/4759171/

 drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..b00d97dbf955 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,36 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
+
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		ds1307->wakeirq = of_irq_get(node, 1);
+		if (ds1307->wakeirq <= 0) {
+			if (ds1307->wakeirq == -EPROBE_DEFER) {
+				err = ds1307->wakeirq;
+				goto exit;
+			}
+			ds1307->wakeirq = 0;
+			goto no_irq;
+		}
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1206,6 +1235,9 @@ read_rtc:
 	return 0;
 
 exit:
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	return err;
 }
 
@@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: Nishanth Menon, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, linux-omap, linux-arm-kernel

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes since V1:
	- dropped the need for specific suspend-resume handlers generic api
	  has adequate hooks for those
	- little more code flow cleanups.

V1: https://patchwork.kernel.org/patch/4759171/

 drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..b00d97dbf955 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,36 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
+
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		ds1307->wakeirq = of_irq_get(node, 1);
+		if (ds1307->wakeirq <= 0) {
+			if (ds1307->wakeirq == -EPROBE_DEFER) {
+				err = ds1307->wakeirq;
+				goto exit;
+			}
+			ds1307->wakeirq = 0;
+			goto no_irq;
+		}
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1206,6 +1235,9 @@ read_rtc:
 	return 0;
 
 exit:
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	return err;
 }
 
@@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes since V1:
	- dropped the need for specific suspend-resume handlers generic api
	  has adequate hooks for those
	- little more code flow cleanups.

V1: https://patchwork.kernel.org/patch/4759171/

 drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..b00d97dbf955 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,36 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
+
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		ds1307->wakeirq = of_irq_get(node, 1);
+		if (ds1307->wakeirq <= 0) {
+			if (ds1307->wakeirq == -EPROBE_DEFER) {
+				err = ds1307->wakeirq;
+				goto exit;
+			}
+			ds1307->wakeirq = 0;
+			goto no_irq;
+		}
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1206,6 +1235,9 @@ read_rtc:
 	return 0;
 
 exit:
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	return err;
 }
 
@@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

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

* [TMP PATCH V2 5/5] ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-23 16:15   ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

With the support in the generic PM framework for wakeirq and capability
added to the rtc-ds1307 driver to support this, we can now define the
optional wakeup irq to allow the RTC to wakeup the system from low power
modes as part of suspend.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

Please do not merge this patch -> since this needs to come via linux-omap
tree and also needs to be done with a few other changes on other peripherals.
This is meant for illustration only.

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index a42cc377a862..5c9ce2df260a 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -517,7 +517,8 @@
 	mcp_rtc: rtc@6f {
 		compatible = "microchip,mcp7941x";
 		reg = <0x6f>;
-		interrupts = <GIC_SPI 2 IRQ_TYPE_EDGE_RISING>;  /* IRQ_SYS_1N */
+		interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
+				      <&dra7_pmx_core 0x424>;
 
 		pinctrl-names = "default";
 		pinctrl-0 = <&mcp79410_pins_default>;
-- 
1.7.9.5


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

* [rtc-linux] [TMP PATCH V2 5/5] ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi,
	grygorii.strashko, Nishanth Menon

With the support in the generic PM framework for wakeirq and capability
added to the rtc-ds1307 driver to support this, we can now define the
optional wakeup irq to allow the RTC to wakeup the system from low power
modes as part of suspend.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

Please do not merge this patch -> since this needs to come via linux-omap
tree and also needs to be done with a few other changes on other peripherals.
This is meant for illustration only.

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index a42cc377a862..5c9ce2df260a 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -517,7 +517,8 @@
 	mcp_rtc: rtc@6f {
 		compatible = "microchip,mcp7941x";
 		reg = <0x6f>;
-		interrupts = <GIC_SPI 2 IRQ_TYPE_EDGE_RISING>;  /* IRQ_SYS_1N */
+		interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
+				      <&dra7_pmx_core 0x424>;
 
 		pinctrl-names = "default";
 		pinctrl-0 = <&mcp79410_pins_default>;
-- 
1.7.9.5

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [TMP PATCH V2 5/5] ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: Nishanth Menon, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, linux-omap, linux-arm-kernel

With the support in the generic PM framework for wakeirq and capability
added to the rtc-ds1307 driver to support this, we can now define the
optional wakeup irq to allow the RTC to wakeup the system from low power
modes as part of suspend.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

Please do not merge this patch -> since this needs to come via linux-omap
tree and also needs to be done with a few other changes on other peripherals.
This is meant for illustration only.

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index a42cc377a862..5c9ce2df260a 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -517,7 +517,8 @@
 	mcp_rtc: rtc@6f {
 		compatible = "microchip,mcp7941x";
 		reg = <0x6f>;
-		interrupts = <GIC_SPI 2 IRQ_TYPE_EDGE_RISING>;  /* IRQ_SYS_1N */
+		interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
+				      <&dra7_pmx_core 0x424>;
 
 		pinctrl-names = "default";
 		pinctrl-0 = <&mcp79410_pins_default>;
-- 
1.7.9.5

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

* [TMP PATCH V2 5/5] ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410
@ 2015-06-23 16:15   ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-23 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

With the support in the generic PM framework for wakeirq and capability
added to the rtc-ds1307 driver to support this, we can now define the
optional wakeup irq to allow the RTC to wakeup the system from low power
modes as part of suspend.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

Please do not merge this patch -> since this needs to come via linux-omap
tree and also needs to be done with a few other changes on other peripherals.
This is meant for illustration only.

 arch/arm/boot/dts/am57xx-beagle-x15.dts |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
index a42cc377a862..5c9ce2df260a 100644
--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -517,7 +517,8 @@
 	mcp_rtc: rtc at 6f {
 		compatible = "microchip,mcp7941x";
 		reg = <0x6f>;
-		interrupts = <GIC_SPI 2 IRQ_TYPE_EDGE_RISING>;  /* IRQ_SYS_1N */
+		interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
+				      <&dra7_pmx_core 0x424>;
 
 		pinctrl-names = "default";
 		pinctrl-0 = <&mcp79410_pins_default>;
-- 
1.7.9.5

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
  (?)
@ 2015-06-24 10:54     ` Tony Lindgren
  -1 siblings, 0 replies; 61+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:54 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi, grygorii.strashko

* Nishanth Menon <nm@ti.com> [150623 09:21]:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")

The wakeirq related changes look good to me:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 10:54     ` Tony Lindgren
  0 siblings, 0 replies; 61+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:54 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi, grygorii.strashko

* Nishanth Menon <nm@ti.com> [150623 09:21]:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")

The wakeirq related changes look good to me:

Acked-by: Tony Lindgren <tony@atomide.com>

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 10:54     ` Tony Lindgren
  0 siblings, 0 replies; 61+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

* Nishanth Menon <nm@ti.com> [150623 09:21]:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")

The wakeirq related changes look good to me:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-24 14:34   ` Felipe Balbi
  -1 siblings, 0 replies; 61+ messages in thread
From: Felipe Balbi @ 2015-06-24 14:34 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi, grygorii.strashko

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

Hi,

On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
> Hi,
> 
> Here is the revamp of the patch posted eariler to support wakeupirq.
> This series does a few cleanups as well prior to introducing the
> generic apis required to support the wakeirq mechanism used on certain
> TI SoCs. Cleanups done here are just minimal set of the cleanups we
> discussed in [2].
> 
> Series is based on next-20150623
> 
> Test log: http://pastebin.ubuntu.com/11763002/
> 
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.
> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 
> Felipe Balbi (1):
>   drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
> 
> Nishanth Menon (4):
>   drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>   drivers/rtc/rtc-ds1307.c: Sort the headers
>   drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source

for the series, except the patch which I wrote :

Acked-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

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

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

* [rtc-linux] Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 14:34   ` Felipe Balbi
  0 siblings, 0 replies; 61+ messages in thread
From: Felipe Balbi @ 2015-06-24 14:34 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi, grygorii.strashko

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

Hi,

On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
> Hi,
> 
> Here is the revamp of the patch posted eariler to support wakeupirq.
> This series does a few cleanups as well prior to introducing the
> generic apis required to support the wakeirq mechanism used on certain
> TI SoCs. Cleanups done here are just minimal set of the cleanups we
> discussed in [2].
> 
> Series is based on next-20150623
> 
> Test log: http://pastebin.ubuntu.com/11763002/
> 
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.
> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 
> Felipe Balbi (1):
>   drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
> 
> Nishanth Menon (4):
>   drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>   drivers/rtc/rtc-ds1307.c: Sort the headers
>   drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source

for the series, except the patch which I wrote :

Acked-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 14:34   ` Felipe Balbi
  0 siblings, 0 replies; 61+ messages in thread
From: Felipe Balbi @ 2015-06-24 14:34 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alessandro Zummo, grygorii.strashko, rtc-linux, linux-kernel,
	balbi, Alexandre Belloni, linux-omap, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1452 bytes --]

Hi,

On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
> Hi,
> 
> Here is the revamp of the patch posted eariler to support wakeupirq.
> This series does a few cleanups as well prior to introducing the
> generic apis required to support the wakeirq mechanism used on certain
> TI SoCs. Cleanups done here are just minimal set of the cleanups we
> discussed in [2].
> 
> Series is based on next-20150623
> 
> Test log: http://pastebin.ubuntu.com/11763002/
> 
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.
> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 
> Felipe Balbi (1):
>   drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
> 
> Nishanth Menon (4):
>   drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>   drivers/rtc/rtc-ds1307.c: Sort the headers
>   drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source

for the series, except the patch which I wrote :

Acked-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 14:34   ` Felipe Balbi
  0 siblings, 0 replies; 61+ messages in thread
From: Felipe Balbi @ 2015-06-24 14:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
> Hi,
> 
> Here is the revamp of the patch posted eariler to support wakeupirq.
> This series does a few cleanups as well prior to introducing the
> generic apis required to support the wakeirq mechanism used on certain
> TI SoCs. Cleanups done here are just minimal set of the cleanups we
> discussed in [2].
> 
> Series is based on next-20150623
> 
> Test log: http://pastebin.ubuntu.com/11763002/
> 
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.
> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 
> Felipe Balbi (1):
>   drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
> 
> Nishanth Menon (4):
>   drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>   drivers/rtc/rtc-ds1307.c: Sort the headers
>   drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source

for the series, except the patch which I wrote :

Acked-by: Felipe Balbi <balbi@ti.com>

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150624/b96e0f2f/attachment.sig>

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-24 15:36     ` Grygorii Strashko
  -1 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:36 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes since V1:
> 	- dropped the need for specific suspend-resume handlers generic api
> 	  has adequate hooks for those
> 	- little more code flow cleanups.
>
> V1: https://patchwork.kernel.org/patch/4759171/
>
>   drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..b00d97dbf955 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,36 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
> +
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		ds1307->wakeirq = of_irq_get(node, 1);
> +		if (ds1307->wakeirq <= 0) {
> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> +				err = ds1307->wakeirq;
> +				goto exit;
> +			}
> +			ds1307->wakeirq = 0;
> +			goto no_irq;
> +		}

Might be above code could be done a little bit simpler?

		err = of_irq_get(node, 1);
		if (err <= 0) {
			if (err == -EPROBE_DEFER)
				goto exit;
			goto no_irq;
		}
		ds1307->wakeirq = err;

> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1206,6 +1235,9 @@ read_rtc:
>   	return 0;
>
>   exit:
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	return err;
>   }
>
> @@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 15:36     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:36 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes since V1:
> 	- dropped the need for specific suspend-resume handlers generic api
> 	  has adequate hooks for those
> 	- little more code flow cleanups.
>
> V1: https://patchwork.kernel.org/patch/4759171/
>
>   drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..b00d97dbf955 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,36 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
> +
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		ds1307->wakeirq = of_irq_get(node, 1);
> +		if (ds1307->wakeirq <= 0) {
> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> +				err = ds1307->wakeirq;
> +				goto exit;
> +			}
> +			ds1307->wakeirq = 0;
> +			goto no_irq;
> +		}

Might be above code could be done a little bit simpler?

		err = of_irq_get(node, 1);
		if (err <= 0) {
			if (err == -EPROBE_DEFER)
				goto exit;
			goto no_irq;
		}
		ds1307->wakeirq = err;

> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1206,6 +1235,9 @@ read_rtc:
>   	return 0;
>
>   exit:
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	return err;
>   }
>
> @@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 15:36     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:36 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes since V1:
> 	- dropped the need for specific suspend-resume handlers generic api
> 	  has adequate hooks for those
> 	- little more code flow cleanups.
>
> V1: https://patchwork.kernel.org/patch/4759171/
>
>   drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..b00d97dbf955 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,36 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
> +
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		ds1307->wakeirq = of_irq_get(node, 1);
> +		if (ds1307->wakeirq <= 0) {
> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> +				err = ds1307->wakeirq;
> +				goto exit;
> +			}
> +			ds1307->wakeirq = 0;
> +			goto no_irq;
> +		}

Might be above code could be done a little bit simpler?

		err = of_irq_get(node, 1);
		if (err <= 0) {
			if (err == -EPROBE_DEFER)
				goto exit;
			goto no_irq;
		}
		ds1307->wakeirq = err;

> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1206,6 +1235,9 @@ read_rtc:
>   	return 0;
>
>   exit:
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	return err;
>   }
>
> @@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 15:36     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes since V1:
> 	- dropped the need for specific suspend-resume handlers generic api
> 	  has adequate hooks for those
> 	- little more code flow cleanups.
>
> V1: https://patchwork.kernel.org/patch/4759171/
>
>   drivers/rtc/rtc-ds1307.c |   41 ++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..b00d97dbf955 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,36 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
> +
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		ds1307->wakeirq = of_irq_get(node, 1);
> +		if (ds1307->wakeirq <= 0) {
> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> +				err = ds1307->wakeirq;
> +				goto exit;
> +			}
> +			ds1307->wakeirq = 0;
> +			goto no_irq;
> +		}

Might be above code could be done a little bit simpler?

		err = of_irq_get(node, 1);
		if (err <= 0) {
			if (err == -EPROBE_DEFER)
				goto exit;
			goto no_irq;
		}
		ds1307->wakeirq = err;

> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1206,6 +1235,9 @@ read_rtc:
>   	return 0;
>
>   exit:
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	return err;
>   }
>
> @@ -1213,6 +1245,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
  2015-06-24 14:34   ` [rtc-linux] " Felipe Balbi
  (?)
  (?)
@ 2015-06-24 15:37     ` Grygorii Strashko
  -1 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:37 UTC (permalink / raw)
  To: balbi, Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel

On 06/24/2015 05:34 PM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
>> Hi,
>>
>> Here is the revamp of the patch posted eariler to support wakeupirq.
>> This series does a few cleanups as well prior to introducing the
>> generic apis required to support the wakeirq mechanism used on certain
>> TI SoCs. Cleanups done here are just minimal set of the cleanups we
>> discussed in [2].
>>
>> Series is based on next-20150623
>>
>> Test log: http://pastebin.ubuntu.com/11763002/
>>
>> NOTE1: I have only tested in mcp79410 device, and not on other
>> ds1307-rtc driver compatbile devices as I dont have any other.
>> additional testing might be nice to have.
>> NOTE2: there are additional fixes that linux-next seems to need but
>> those are in omap-rtc, cpufreq etc, but those are not related by the
>> ds-1307.
>>
>> V1: https://patchwork.kernel.org/patch/4759171/
>>
>> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
>> be reposted along with other wakeup sources to be enabled once the
>> driver changes are accepted.
>>
>> Felipe Balbi (1):
>>    drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
>>
>> Nishanth Menon (4):
>>    drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>>    drivers/rtc/rtc-ds1307.c: Sort the headers
>>    drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
>
> for the series, except the patch which I wrote :
>
> Acked-by: Felipe Balbi <balbi@ti.com>
>

With minor comment to patch 4:
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

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

* [rtc-linux] Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 15:37     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:37 UTC (permalink / raw)
  To: balbi, Nishanth Menon
  Cc: Alexandre Belloni, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel

On 06/24/2015 05:34 PM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
>> Hi,
>>
>> Here is the revamp of the patch posted eariler to support wakeupirq.
>> This series does a few cleanups as well prior to introducing the
>> generic apis required to support the wakeirq mechanism used on certain
>> TI SoCs. Cleanups done here are just minimal set of the cleanups we
>> discussed in [2].
>>
>> Series is based on next-20150623
>>
>> Test log: http://pastebin.ubuntu.com/11763002/
>>
>> NOTE1: I have only tested in mcp79410 device, and not on other
>> ds1307-rtc driver compatbile devices as I dont have any other.
>> additional testing might be nice to have.
>> NOTE2: there are additional fixes that linux-next seems to need but
>> those are in omap-rtc, cpufreq etc, but those are not related by the
>> ds-1307.
>>
>> V1: https://patchwork.kernel.org/patch/4759171/
>>
>> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
>> be reposted along with other wakeup sources to be enabled once the
>> driver changes are accepted.
>>
>> Felipe Balbi (1):
>>    drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
>>
>> Nishanth Menon (4):
>>    drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>>    drivers/rtc/rtc-ds1307.c: Sort the headers
>>    drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
>
> for the series, except the patch which I wrote :
>
> Acked-by: Felipe Balbi <balbi@ti.com>
>

With minor comment to patch 4:
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 15:37     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:37 UTC (permalink / raw)
  To: balbi, Nishanth Menon
  Cc: Alessandro Zummo, rtc-linux, linux-kernel, Alexandre Belloni,
	linux-omap, linux-arm-kernel

On 06/24/2015 05:34 PM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
>> Hi,
>>
>> Here is the revamp of the patch posted eariler to support wakeupirq.
>> This series does a few cleanups as well prior to introducing the
>> generic apis required to support the wakeirq mechanism used on certain
>> TI SoCs. Cleanups done here are just minimal set of the cleanups we
>> discussed in [2].
>>
>> Series is based on next-20150623
>>
>> Test log: http://pastebin.ubuntu.com/11763002/
>>
>> NOTE1: I have only tested in mcp79410 device, and not on other
>> ds1307-rtc driver compatbile devices as I dont have any other.
>> additional testing might be nice to have.
>> NOTE2: there are additional fixes that linux-next seems to need but
>> those are in omap-rtc, cpufreq etc, but those are not related by the
>> ds-1307.
>>
>> V1: https://patchwork.kernel.org/patch/4759171/
>>
>> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
>> be reposted along with other wakeup sources to be enabled once the
>> driver changes are accepted.
>>
>> Felipe Balbi (1):
>>    drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
>>
>> Nishanth Menon (4):
>>    drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>>    drivers/rtc/rtc-ds1307.c: Sort the headers
>>    drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
>
> for the series, except the patch which I wrote :
>
> Acked-by: Felipe Balbi <balbi@ti.com>
>

With minor comment to patch 4:
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

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

* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-06-24 15:37     ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 15:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/24/2015 05:34 PM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 23, 2015 at 11:15:09AM -0500, Nishanth Menon wrote:
>> Hi,
>>
>> Here is the revamp of the patch posted eariler to support wakeupirq.
>> This series does a few cleanups as well prior to introducing the
>> generic apis required to support the wakeirq mechanism used on certain
>> TI SoCs. Cleanups done here are just minimal set of the cleanups we
>> discussed in [2].
>>
>> Series is based on next-20150623
>>
>> Test log: http://pastebin.ubuntu.com/11763002/
>>
>> NOTE1: I have only tested in mcp79410 device, and not on other
>> ds1307-rtc driver compatbile devices as I dont have any other.
>> additional testing might be nice to have.
>> NOTE2: there are additional fixes that linux-next seems to need but
>> those are in omap-rtc, cpufreq etc, but those are not related by the
>> ds-1307.
>>
>> V1: https://patchwork.kernel.org/patch/4759171/
>>
>> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
>> be reposted along with other wakeup sources to be enabled once the
>> driver changes are accepted.
>>
>> Felipe Balbi (1):
>>    drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ
>>
>> Nishanth Menon (4):
>>    drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation
>>    drivers/rtc/rtc-ds1307.c: Sort the headers
>>    drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
>
> for the series, except the patch which I wrote :
>
> Acked-by: Felipe Balbi <balbi@ti.com>
>

With minor comment to patch 4:
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-24 15:36     ` [rtc-linux] " Grygorii Strashko
  (?)
  (?)
@ 2015-06-24 16:07       ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:07 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
[...]

>> +		ds1307->wakeirq = of_irq_get(node, 1);
>> +		if (ds1307->wakeirq <= 0) {
>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>> +				err = ds1307->wakeirq;
>> +				goto exit;
>> +			}
>> +			ds1307->wakeirq = 0;
>> +			goto no_irq;
>> +		}
> 
> Might be above code could be done a little bit simpler?
> 
> 		err = of_irq_get(node, 1);
> 		if (err <= 0) {
> 			if (err == -EPROBE_DEFER)
> 				goto exit;
> 			goto no_irq;

I had considered it, but problem with this approach is that is err
does not get reset back to 0 and probe will fail as it flows through
the rest of the code.. which is not our intent.

> 		}
> 		ds1307->wakeirq = err;
> 





-- 
Regards,
Nishanth Menon

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:07       ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:07 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
[...]

>> +		ds1307->wakeirq = of_irq_get(node, 1);
>> +		if (ds1307->wakeirq <= 0) {
>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>> +				err = ds1307->wakeirq;
>> +				goto exit;
>> +			}
>> +			ds1307->wakeirq = 0;
>> +			goto no_irq;
>> +		}
> 
> Might be above code could be done a little bit simpler?
> 
> 		err = of_irq_get(node, 1);
> 		if (err <= 0) {
> 			if (err == -EPROBE_DEFER)
> 				goto exit;
> 			goto no_irq;

I had considered it, but problem with this approach is that is err
does not get reset back to 0 and probe will fail as it flows through
the rest of the code.. which is not our intent.

> 		}
> 		ds1307->wakeirq = err;
> 





-- 
Regards,
Nishanth Menon

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:07       ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:07 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-arm-kernel, linux-omap, balbi, linux-kernel, rtc-linux

On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
[...]

>> +		ds1307->wakeirq = of_irq_get(node, 1);
>> +		if (ds1307->wakeirq <= 0) {
>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>> +				err = ds1307->wakeirq;
>> +				goto exit;
>> +			}
>> +			ds1307->wakeirq = 0;
>> +			goto no_irq;
>> +		}
> 
> Might be above code could be done a little bit simpler?
> 
> 		err = of_irq_get(node, 1);
> 		if (err <= 0) {
> 			if (err == -EPROBE_DEFER)
> 				goto exit;
> 			goto no_irq;

I had considered it, but problem with this approach is that is err
does not get reset back to 0 and probe will fail as it flows through
the rest of the code.. which is not our intent.

> 		}
> 		ds1307->wakeirq = err;
> 





-- 
Regards,
Nishanth Menon

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:07       ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
[...]

>> +		ds1307->wakeirq = of_irq_get(node, 1);
>> +		if (ds1307->wakeirq <= 0) {
>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>> +				err = ds1307->wakeirq;
>> +				goto exit;
>> +			}
>> +			ds1307->wakeirq = 0;
>> +			goto no_irq;
>> +		}
> 
> Might be above code could be done a little bit simpler?
> 
> 		err = of_irq_get(node, 1);
> 		if (err <= 0) {
> 			if (err == -EPROBE_DEFER)
> 				goto exit;
> 			goto no_irq;

I had considered it, but problem with this approach is that is err
does not get reset back to 0 and probe will fail as it flows through
the rest of the code.. which is not our intent.

> 		}
> 		ds1307->wakeirq = err;
> 





-- 
Regards,
Nishanth Menon

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-24 16:07       ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-24 16:25         ` Grygorii Strashko
  -1 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 16:25 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 07:07 PM, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>> +		if (ds1307->wakeirq <= 0) {
>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>> +				err = ds1307->wakeirq;
>>> +				goto exit;
>>> +			}
>>> +			ds1307->wakeirq = 0;
>>> +			goto no_irq;
>>> +		}
>>
>> Might be above code could be done a little bit simpler?
>>
>> 		err = of_irq_get(node, 1);
>> 		if (err <= 0) {
>> 			if (err == -EPROBE_DEFER)
>> 				goto exit;
>> 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.
> 
>> 		}
>> 		ds1307->wakeirq = err;

As I can see from final code (after applying all patches) - It should work.
But I will not insist :)

-- 
regards,
-grygorii

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:25         ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 16:25 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 07:07 PM, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>> +		if (ds1307->wakeirq <= 0) {
>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>> +				err = ds1307->wakeirq;
>>> +				goto exit;
>>> +			}
>>> +			ds1307->wakeirq = 0;
>>> +			goto no_irq;
>>> +		}
>>
>> Might be above code could be done a little bit simpler?
>>
>> 		err = of_irq_get(node, 1);
>> 		if (err <= 0) {
>> 			if (err == -EPROBE_DEFER)
>> 				goto exit;
>> 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.
> 
>> 		}
>> 		ds1307->wakeirq = err;

As I can see from final code (after applying all patches) - It should work.
But I will not insist :)

-- 
regards,
-grygorii

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:25         ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 16:25 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 07:07 PM, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>> +		if (ds1307->wakeirq <= 0) {
>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>> +				err = ds1307->wakeirq;
>>> +				goto exit;
>>> +			}
>>> +			ds1307->wakeirq = 0;
>>> +			goto no_irq;
>>> +		}
>>
>> Might be above code could be done a little bit simpler?
>>
>> 		err = of_irq_get(node, 1);
>> 		if (err <= 0) {
>> 			if (err == -EPROBE_DEFER)
>> 				goto exit;
>> 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.
> 
>> 		}
>> 		ds1307->wakeirq = err;

As I can see from final code (after applying all patches) - It should work.
But I will not insist :)

-- 
regards,
-grygorii

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:25         ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-24 16:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/24/2015 07:07 PM, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>> +		if (ds1307->wakeirq <= 0) {
>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>> +				err = ds1307->wakeirq;
>>> +				goto exit;
>>> +			}
>>> +			ds1307->wakeirq = 0;
>>> +			goto no_irq;
>>> +		}
>>
>> Might be above code could be done a little bit simpler?
>>
>> 		err = of_irq_get(node, 1);
>> 		if (err <= 0) {
>> 			if (err == -EPROBE_DEFER)
>> 				goto exit;
>> 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.
> 
>> 		}
>> 		ds1307->wakeirq = err;

As I can see from final code (after applying all patches) - It should work.
But I will not insist :)

-- 
regards,
-grygorii

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-24 16:07       ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-24 16:26         ` Nishanth Menon
  -1 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:26 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 11:07-20150624, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> > On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
> >> +		ds1307->wakeirq = of_irq_get(node, 1);
> >> +		if (ds1307->wakeirq <= 0) {
> >> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> >> +				err = ds1307->wakeirq;
> >> +				goto exit;
> >> +			}
> >> +			ds1307->wakeirq = 0;
> >> +			goto no_irq;
> >> +		}
> > 
> > Might be above code could be done a little bit simpler?
> > 
> > 		err = of_irq_get(node, 1);
> > 		if (err <= 0) {
> > 			if (err == -EPROBE_DEFER)
> > 				goto exit;
> > 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.

I am wrong here - code just returns 0 and ignores err. So, how about
the following patch instead: (Alexandre, please do let me know if the
entire series needs to be reposted):
 - improvement as suggested
 - Picked up previous acks
 - cleanup in probe does not need dev_pm_clear_wake_irq.
-->8<---
>From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Mon, 22 Jun 2015 14:13:19 -0500
Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
 source

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..e16989c48a90 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,34 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		err = of_irq_get(node, 1);
+		if (err <= 0) {
+			if (err == -EPROBE_DEFER)
+				goto exit;
+			goto no_irq;
+		}
+		ds1307->wakeirq = err;
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
Regards,
Nishanth Menon

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:26         ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:26 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 11:07-20150624, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> > On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
> >> +		ds1307->wakeirq = of_irq_get(node, 1);
> >> +		if (ds1307->wakeirq <= 0) {
> >> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> >> +				err = ds1307->wakeirq;
> >> +				goto exit;
> >> +			}
> >> +			ds1307->wakeirq = 0;
> >> +			goto no_irq;
> >> +		}
> > 
> > Might be above code could be done a little bit simpler?
> > 
> > 		err = of_irq_get(node, 1);
> > 		if (err <= 0) {
> > 			if (err == -EPROBE_DEFER)
> > 				goto exit;
> > 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.

I am wrong here - code just returns 0 and ignores err. So, how about
the following patch instead: (Alexandre, please do let me know if the
entire series needs to be reposted):
 - improvement as suggested
 - Picked up previous acks
 - cleanup in probe does not need dev_pm_clear_wake_irq.
-->8<---
>From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Mon, 22 Jun 2015 14:13:19 -0500
Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
 source

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..e16989c48a90 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,34 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		err = of_irq_get(node, 1);
+		if (err <= 0) {
+			if (err == -EPROBE_DEFER)
+				goto exit;
+			goto no_irq;
+		}
+		ds1307->wakeirq = err;
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
Regards,
Nishanth Menon

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:26         ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:26 UTC (permalink / raw)
  To: Grygorii Strashko, Alexandre Belloni, Alessandro Zummo
  Cc: linux-arm-kernel, linux-omap, balbi, linux-kernel, rtc-linux

On 11:07-20150624, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> > On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
> >> +		ds1307->wakeirq = of_irq_get(node, 1);
> >> +		if (ds1307->wakeirq <= 0) {
> >> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> >> +				err = ds1307->wakeirq;
> >> +				goto exit;
> >> +			}
> >> +			ds1307->wakeirq = 0;
> >> +			goto no_irq;
> >> +		}
> > 
> > Might be above code could be done a little bit simpler?
> > 
> > 		err = of_irq_get(node, 1);
> > 		if (err <= 0) {
> > 			if (err == -EPROBE_DEFER)
> > 				goto exit;
> > 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.

I am wrong here - code just returns 0 and ignores err. So, how about
the following patch instead: (Alexandre, please do let me know if the
entire series needs to be reposted):
 - improvement as suggested
 - Picked up previous acks
 - cleanup in probe does not need dev_pm_clear_wake_irq.
-->8<---
>From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Mon, 22 Jun 2015 14:13:19 -0500
Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
 source

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..e16989c48a90 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,34 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		err = of_irq_get(node, 1);
+		if (err <= 0) {
+			if (err == -EPROBE_DEFER)
+				goto exit;
+			goto no_irq;
+		}
+		ds1307->wakeirq = err;
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
Regards,
Nishanth Menon

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-24 16:26         ` Nishanth Menon
  0 siblings, 0 replies; 61+ messages in thread
From: Nishanth Menon @ 2015-06-24 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 11:07-20150624, Nishanth Menon wrote:
> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
> > On 06/23/2015 07:15 PM, Nishanth Menon wrote:
> [...]
> 
> >> +		ds1307->wakeirq = of_irq_get(node, 1);
> >> +		if (ds1307->wakeirq <= 0) {
> >> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
> >> +				err = ds1307->wakeirq;
> >> +				goto exit;
> >> +			}
> >> +			ds1307->wakeirq = 0;
> >> +			goto no_irq;
> >> +		}
> > 
> > Might be above code could be done a little bit simpler?
> > 
> > 		err = of_irq_get(node, 1);
> > 		if (err <= 0) {
> > 			if (err == -EPROBE_DEFER)
> > 				goto exit;
> > 			goto no_irq;
> 
> I had considered it, but problem with this approach is that is err
> does not get reset back to 0 and probe will fail as it flows through
> the rest of the code.. which is not our intent.

I am wrong here - code just returns 0 and ignores err. So, how about
the following patch instead: (Alexandre, please do let me know if the
entire series needs to be reposted):
 - improvement as suggested
 - Picked up previous acks
 - cleanup in probe does not need dev_pm_clear_wake_irq.
-->8<---
>From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Mon, 22 Jun 2015 14:13:19 -0500
Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
 source

With the recent pinctrl-single changes, SoCs such as Texas
Instrument's OMAP processors can treat wake-up events from deeper idle
states as interrupts.

Let's add support for the optional second interrupt for wake-up using
the generic wakeirq support added in commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling")

Finally, to pass the wake-up interrupt in the dts file,
interrupts-extended property needs to be passed.

This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
wake-up interrupt to generic wakeirq")

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index b03880fc32b5..e16989c48a90 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -15,6 +15,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/rtc/ds1307.h>
 #include <linux/rtc.h>
 #include <linux/slab.h>
@@ -114,6 +117,7 @@ struct ds1307 {
 #define HAS_ALARM	1		/* bit 1 == irq claimed */
 	struct i2c_client	*client;
 	struct rtc_device	*rtc;
+	int			wakeirq;
 	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
 			       u8 length, u8 *values);
 	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1156,6 +1160,8 @@ read_rtc:
 	}
 
 	if (want_irq) {
+		struct device_node *node = client->dev.of_node;
+
 		err = devm_request_threaded_irq(&client->dev,
 						client->irq, NULL, irq_handler,
 						IRQF_SHARED | IRQF_ONESHOT,
@@ -1163,13 +1169,34 @@ read_rtc:
 		if (err) {
 			client->irq = 0;
 			dev_err(&client->dev, "unable to request IRQ!\n");
-		} else {
+			goto no_irq;
+		}
 
-			set_bit(HAS_ALARM, &ds1307->flags);
-			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+		set_bit(HAS_ALARM, &ds1307->flags);
+		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
+
+		/* Currently supported by OF code only! */
+		if (!node)
+			goto no_irq;
+
+		err = of_irq_get(node, 1);
+		if (err <= 0) {
+			if (err == -EPROBE_DEFER)
+				goto exit;
+			goto no_irq;
+		}
+		ds1307->wakeirq = err;
+
+		err = dev_pm_set_dedicated_wake_irq(&client->dev,
+						    ds1307->wakeirq);
+		if (err) {
+			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
+				err);
+			goto exit;
 		}
 	}
 
+no_irq:
 	if (chip->nvram_size) {
 
 		ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
 {
 	struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
+	if (ds1307->wakeirq)
+		dev_pm_clear_wake_irq(&client->dev);
+
 	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
 		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
 
-- 
1.7.9.5

-- 
Regards,
Nishanth Menon

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-24 16:26         ` [rtc-linux] " Nishanth Menon
  (?)
  (?)
@ 2015-06-25 17:23           ` Grygorii Strashko
  -1 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-25 17:23 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 07:26 PM, Nishanth Menon wrote:
> On 11:07-20150624, Nishanth Menon wrote:
>> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
>> [...]
>>
>>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>>> +		if (ds1307->wakeirq <= 0) {
>>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>>> +				err = ds1307->wakeirq;
>>>> +				goto exit;
>>>> +			}
>>>> +			ds1307->wakeirq = 0;
>>>> +			goto no_irq;
>>>> +		}
>>>
>>> Might be above code could be done a little bit simpler?
>>>
>>> 		err = of_irq_get(node, 1);
>>> 		if (err <= 0) {
>>> 			if (err == -EPROBE_DEFER)
>>> 				goto exit;
>>> 			goto no_irq;
>>
>> I had considered it, but problem with this approach is that is err
>> does not get reset back to 0 and probe will fail as it flows through
>> the rest of the code.. which is not our intent.
>
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):
>   - improvement as suggested
>   - Picked up previous acks
>   - cleanup in probe does not need dev_pm_clear_wake_irq.


Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

> -->8<---
>  From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>   source
>
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>   drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-25 17:23           ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-25 17:23 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-kernel, rtc-linux, linux-omap, linux-arm-kernel, balbi

On 06/24/2015 07:26 PM, Nishanth Menon wrote:
> On 11:07-20150624, Nishanth Menon wrote:
>> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
>> [...]
>>
>>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>>> +		if (ds1307->wakeirq <= 0) {
>>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>>> +				err = ds1307->wakeirq;
>>>> +				goto exit;
>>>> +			}
>>>> +			ds1307->wakeirq = 0;
>>>> +			goto no_irq;
>>>> +		}
>>>
>>> Might be above code could be done a little bit simpler?
>>>
>>> 		err = of_irq_get(node, 1);
>>> 		if (err <= 0) {
>>> 			if (err == -EPROBE_DEFER)
>>> 				goto exit;
>>> 			goto no_irq;
>>
>> I had considered it, but problem with this approach is that is err
>> does not get reset back to 0 and probe will fail as it flows through
>> the rest of the code.. which is not our intent.
>
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):
>   - improvement as suggested
>   - Picked up previous acks
>   - cleanup in probe does not need dev_pm_clear_wake_irq.


Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

> -->8<---
>  From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>   source
>
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>   drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-25 17:23           ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-25 17:23 UTC (permalink / raw)
  To: Nishanth Menon, Alexandre Belloni, Alessandro Zummo
  Cc: linux-arm-kernel, linux-omap, balbi, linux-kernel, rtc-linux

On 06/24/2015 07:26 PM, Nishanth Menon wrote:
> On 11:07-20150624, Nishanth Menon wrote:
>> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
>> [...]
>>
>>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>>> +		if (ds1307->wakeirq <= 0) {
>>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>>> +				err = ds1307->wakeirq;
>>>> +				goto exit;
>>>> +			}
>>>> +			ds1307->wakeirq = 0;
>>>> +			goto no_irq;
>>>> +		}
>>>
>>> Might be above code could be done a little bit simpler?
>>>
>>> 		err = of_irq_get(node, 1);
>>> 		if (err <= 0) {
>>> 			if (err == -EPROBE_DEFER)
>>> 				goto exit;
>>> 			goto no_irq;
>>
>> I had considered it, but problem with this approach is that is err
>> does not get reset back to 0 and probe will fail as it flows through
>> the rest of the code.. which is not our intent.
>
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):
>   - improvement as suggested
>   - Picked up previous acks
>   - cleanup in probe does not need dev_pm_clear_wake_irq.


Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

> -->8<---
>  From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>   source
>
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>   drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-06-25 17:23           ` Grygorii Strashko
  0 siblings, 0 replies; 61+ messages in thread
From: Grygorii Strashko @ 2015-06-25 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/24/2015 07:26 PM, Nishanth Menon wrote:
> On 11:07-20150624, Nishanth Menon wrote:
>> On 06/24/2015 10:36 AM, Grygorii Strashko wrote:
>>> On 06/23/2015 07:15 PM, Nishanth Menon wrote:
>> [...]
>>
>>>> +		ds1307->wakeirq = of_irq_get(node, 1);
>>>> +		if (ds1307->wakeirq <= 0) {
>>>> +			if (ds1307->wakeirq == -EPROBE_DEFER) {
>>>> +				err = ds1307->wakeirq;
>>>> +				goto exit;
>>>> +			}
>>>> +			ds1307->wakeirq = 0;
>>>> +			goto no_irq;
>>>> +		}
>>>
>>> Might be above code could be done a little bit simpler?
>>>
>>> 		err = of_irq_get(node, 1);
>>> 		if (err <= 0) {
>>> 			if (err == -EPROBE_DEFER)
>>> 				goto exit;
>>> 			goto no_irq;
>>
>> I had considered it, but problem with this approach is that is err
>> does not get reset back to 0 and probe will fail as it flows through
>> the rest of the code.. which is not our intent.
>
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):
>   - improvement as suggested
>   - Picked up previous acks
>   - cleanup in probe does not need dev_pm_clear_wake_irq.


Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

> -->8<---
>  From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>   source
>
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
>
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
>
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
>
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>   drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>   #include <linux/i2c.h>
>   #include <linux/init.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>   #include <linux/rtc/ds1307.h>
>   #include <linux/rtc.h>
>   #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>   #define HAS_ALARM	1		/* bit 1 == irq claimed */
>   	struct i2c_client	*client;
>   	struct rtc_device	*rtc;
> +	int			wakeirq;
>   	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>   			       u8 length, u8 *values);
>   	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>   	}
>
>   	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>   		err = devm_request_threaded_irq(&client->dev,
>   						client->irq, NULL, irq_handler,
>   						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>   		if (err) {
>   			client->irq = 0;
>   			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>   		}
>   	}
>
> +no_irq:
>   	if (chip->nvram_size) {
>
>   		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>   {
>   	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>   	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>   		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>
>


-- 
regards,
-grygorii

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

* Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
  2015-06-24 16:26         ` [rtc-linux] " Nishanth Menon
  (?)
@ 2015-07-01 12:54           ` Alexandre Belloni
  -1 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-01 12:54 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Grygorii Strashko, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi

Hi,

On 24/06/2015 at 11:26:54 -0500, Nishanth Menon wrote :
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):

Can you resend just that one as v3? I'll take it right away. Thanks!

>  - improvement as suggested
>  - Picked up previous acks
>  - cleanup in probe does not need dev_pm_clear_wake_irq.
> -->8<---
> From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>  source
> 
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
> 
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>  1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>  #include <linux/rtc/ds1307.h>
>  #include <linux/rtc.h>
>  #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>  #define HAS_ALARM	1		/* bit 1 == irq claimed */
>  	struct i2c_client	*client;
>  	struct rtc_device	*rtc;
> +	int			wakeirq;
>  	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>  			       u8 length, u8 *values);
>  	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>  	}
>  
>  	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>  		err = devm_request_threaded_irq(&client->dev,
>  						client->irq, NULL, irq_handler,
>  						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>  		if (err) {
>  			client->irq = 0;
>  			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>  
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>  		}
>  	}
>  
> +no_irq:
>  	if (chip->nvram_size) {
>  
>  		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>  {
>  	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>  
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>  	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>  		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>  
> -- 
> 1.7.9.5
> 
> -- 
> Regards,
> Nishanth Menon

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-07-01 12:54           ` Alexandre Belloni
  0 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-01 12:54 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Grygorii Strashko, Alessandro Zummo, linux-kernel, rtc-linux,
	linux-omap, linux-arm-kernel, balbi

Hi,

On 24/06/2015 at 11:26:54 -0500, Nishanth Menon wrote :
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):

Can you resend just that one as v3? I'll take it right away. Thanks!

>  - improvement as suggested
>  - Picked up previous acks
>  - cleanup in probe does not need dev_pm_clear_wake_irq.
> -->8<---
> From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>  source
> 
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
> 
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>  1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>  #include <linux/rtc/ds1307.h>
>  #include <linux/rtc.h>
>  #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>  #define HAS_ALARM	1		/* bit 1 == irq claimed */
>  	struct i2c_client	*client;
>  	struct rtc_device	*rtc;
> +	int			wakeirq;
>  	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>  			       u8 length, u8 *values);
>  	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>  	}
>  
>  	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>  		err = devm_request_threaded_irq(&client->dev,
>  						client->irq, NULL, irq_handler,
>  						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>  		if (err) {
>  			client->irq = 0;
>  			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>  
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>  		}
>  	}
>  
> +no_irq:
>  	if (chip->nvram_size) {
>  
>  		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>  {
>  	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>  
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>  	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>  		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>  
> -- 
> 1.7.9.5
> 
> -- 
> Regards,
> Nishanth Menon

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source
@ 2015-07-01 12:54           ` Alexandre Belloni
  0 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-01 12:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 24/06/2015 at 11:26:54 -0500, Nishanth Menon wrote :
> I am wrong here - code just returns 0 and ignores err. So, how about
> the following patch instead: (Alexandre, please do let me know if the
> entire series needs to be reposted):

Can you resend just that one as v3? I'll take it right away. Thanks!

>  - improvement as suggested
>  - Picked up previous acks
>  - cleanup in probe does not need dev_pm_clear_wake_irq.
> -->8<---
> From 12367f8edffc25613f6f920d9bd7b69dfed57ce1 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Mon, 22 Jun 2015 14:13:19 -0500
> Subject: [PATCH V3] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt
>  source
> 
> With the recent pinctrl-single changes, SoCs such as Texas
> Instrument's OMAP processors can treat wake-up events from deeper idle
> states as interrupts.
> 
> Let's add support for the optional second interrupt for wake-up using
> the generic wakeirq support added in commit 4990d4fe327b ("PM /
> Wakeirq: Add automated device wake IRQ handling")
> 
> Finally, to pass the wake-up interrupt in the dts file,
> interrupts-extended property needs to be passed.
> 
> This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
> support for optional wake-up") + ee83bd3b6483 ("serial: omap: Switch
> wake-up interrupt to generic wakeirq")
> 
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  drivers/rtc/rtc-ds1307.c |   36 +++++++++++++++++++++++++++++++++---
>  1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index b03880fc32b5..e16989c48a90 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -15,6 +15,9 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
>  #include <linux/rtc/ds1307.h>
>  #include <linux/rtc.h>
>  #include <linux/slab.h>
> @@ -114,6 +117,7 @@ struct ds1307 {
>  #define HAS_ALARM	1		/* bit 1 == irq claimed */
>  	struct i2c_client	*client;
>  	struct rtc_device	*rtc;
> +	int			wakeirq;
>  	s32 (*read_block_data)(const struct i2c_client *client, u8 command,
>  			       u8 length, u8 *values);
>  	s32 (*write_block_data)(const struct i2c_client *client, u8 command,
> @@ -1156,6 +1160,8 @@ read_rtc:
>  	}
>  
>  	if (want_irq) {
> +		struct device_node *node = client->dev.of_node;
> +
>  		err = devm_request_threaded_irq(&client->dev,
>  						client->irq, NULL, irq_handler,
>  						IRQF_SHARED | IRQF_ONESHOT,
> @@ -1163,13 +1169,34 @@ read_rtc:
>  		if (err) {
>  			client->irq = 0;
>  			dev_err(&client->dev, "unable to request IRQ!\n");
> -		} else {
> +			goto no_irq;
> +		}
>  
> -			set_bit(HAS_ALARM, &ds1307->flags);
> -			dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +		set_bit(HAS_ALARM, &ds1307->flags);
> +		dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> +
> +		/* Currently supported by OF code only! */
> +		if (!node)
> +			goto no_irq;
> +
> +		err = of_irq_get(node, 1);
> +		if (err <= 0) {
> +			if (err == -EPROBE_DEFER)
> +				goto exit;
> +			goto no_irq;
> +		}
> +		ds1307->wakeirq = err;
> +
> +		err = dev_pm_set_dedicated_wake_irq(&client->dev,
> +						    ds1307->wakeirq);
> +		if (err) {
> +			dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
> +				err);
> +			goto exit;
>  		}
>  	}
>  
> +no_irq:
>  	if (chip->nvram_size) {
>  
>  		ds1307->nvram = devm_kzalloc(&client->dev,
> @@ -1213,6 +1240,9 @@ static int ds1307_remove(struct i2c_client *client)
>  {
>  	struct ds1307 *ds1307 = i2c_get_clientdata(client);
>  
> +	if (ds1307->wakeirq)
> +		dev_pm_clear_wake_irq(&client->dev);
> +
>  	if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
>  		sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
>  
> -- 
> 1.7.9.5
> 
> -- 
> Regards,
> Nishanth Menon

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
  2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
  (?)
@ 2015-07-02 22:47   ` Alexandre Belloni
  -1 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-02 22:47 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alessandro Zummo, linux-kernel, rtc-linux, linux-omap,
	linux-arm-kernel, balbi, grygorii.strashko

Hi,

On 23/06/2015 at 11:15:09 -0500, Nishanth Menon wrote :
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.

Patchwork picked up V3 of 4/5 correctly so I have applied the series and
pushed it in rtc-next. It will land in linux-next tomorrow so hopefully,
this will see more testing.

> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 

I've left that one out so you can send it to the omap maintainers when
ready.

Thanks!

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-07-02 22:47   ` Alexandre Belloni
  0 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-02 22:47 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Alessandro Zummo, linux-kernel, rtc-linux, linux-omap,
	linux-arm-kernel, balbi, grygorii.strashko

Hi,

On 23/06/2015 at 11:15:09 -0500, Nishanth Menon wrote :
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.

Patchwork picked up V3 of 4/5 correctly so I have applied the series and
pushed it in rtc-next. It will land in linux-next tomorrow so hopefully,
this will see more testing.

> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 

I've left that one out so you can send it to the omap maintainers when
ready.

Thanks!

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq
@ 2015-07-02 22:47   ` Alexandre Belloni
  0 siblings, 0 replies; 61+ messages in thread
From: Alexandre Belloni @ 2015-07-02 22:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 23/06/2015 at 11:15:09 -0500, Nishanth Menon wrote :
> NOTE1: I have only tested in mcp79410 device, and not on other
> ds1307-rtc driver compatbile devices as I dont have any other.
> additional testing might be nice to have.

Patchwork picked up V3 of 4/5 correctly so I have applied the series and
pushed it in rtc-next. It will land in linux-next tomorrow so hopefully,
this will see more testing.

> NOTE2: there are additional fixes that linux-next seems to need but
> those are in omap-rtc, cpufreq etc, but those are not related by the
> ds-1307.
> 
> V1: https://patchwork.kernel.org/patch/4759171/
> 
> NOTE: Patch 5/5 of the series is meant to indicate the usage, and will
> be reposted along with other wakeup sources to be enabled once the
> driver changes are accepted.
> 

I've left that one out so you can send it to the omap maintainers when
ready.

Thanks!

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-07-02 22:47 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 16:15 [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq Nishanth Menon
2015-06-23 16:15 ` Nishanth Menon
2015-06-23 16:15 ` Nishanth Menon
2015-06-23 16:15 ` [rtc-linux] " Nishanth Menon
2015-06-23 16:15 ` [PATCH V2 1/5] drivers/rtc/rtc-ds1307.c: Convert to threaded IRQ Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
2015-06-23 16:15 ` [PATCH V2 2/5] drivers/rtc/rtc-ds1307.c: Switch to managed irq allocation Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
2015-06-23 16:15 ` [PATCH V2 3/5] drivers/rtc/rtc-ds1307.c: Sort the headers Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
2015-06-23 16:15 ` [PATCH V2 4/5] drivers/rtc/rtc-ds1307.c: Support optional wakeup interrupt source Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
2015-06-24 10:54   ` Tony Lindgren
2015-06-24 10:54     ` Tony Lindgren
2015-06-24 10:54     ` [rtc-linux] " Tony Lindgren
2015-06-24 15:36   ` Grygorii Strashko
2015-06-24 15:36     ` Grygorii Strashko
2015-06-24 15:36     ` Grygorii Strashko
2015-06-24 15:36     ` [rtc-linux] " Grygorii Strashko
2015-06-24 16:07     ` Nishanth Menon
2015-06-24 16:07       ` Nishanth Menon
2015-06-24 16:07       ` Nishanth Menon
2015-06-24 16:07       ` [rtc-linux] " Nishanth Menon
2015-06-24 16:25       ` Grygorii Strashko
2015-06-24 16:25         ` Grygorii Strashko
2015-06-24 16:25         ` Grygorii Strashko
2015-06-24 16:25         ` [rtc-linux] " Grygorii Strashko
2015-06-24 16:26       ` Nishanth Menon
2015-06-24 16:26         ` Nishanth Menon
2015-06-24 16:26         ` Nishanth Menon
2015-06-24 16:26         ` [rtc-linux] " Nishanth Menon
2015-06-25 17:23         ` Grygorii Strashko
2015-06-25 17:23           ` Grygorii Strashko
2015-06-25 17:23           ` Grygorii Strashko
2015-06-25 17:23           ` [rtc-linux] " Grygorii Strashko
2015-07-01 12:54         ` Alexandre Belloni
2015-07-01 12:54           ` Alexandre Belloni
2015-07-01 12:54           ` [rtc-linux] " Alexandre Belloni
2015-06-23 16:15 ` [TMP PATCH V2 5/5] ARM: dts: am57xx-beagle-x15: Add wakeup irq for mcp79410 Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` Nishanth Menon
2015-06-23 16:15   ` [rtc-linux] " Nishanth Menon
2015-06-24 14:34 ` [PATCH V2 0/5] drivers/rtc/rtc-ds1307.c: Basic cleanups and support for wakeupirq Felipe Balbi
2015-06-24 14:34   ` Felipe Balbi
2015-06-24 14:34   ` Felipe Balbi
2015-06-24 14:34   ` [rtc-linux] " Felipe Balbi
2015-06-24 15:37   ` Grygorii Strashko
2015-06-24 15:37     ` Grygorii Strashko
2015-06-24 15:37     ` Grygorii Strashko
2015-06-24 15:37     ` [rtc-linux] " Grygorii Strashko
2015-07-02 22:47 ` Alexandre Belloni
2015-07-02 22:47   ` Alexandre Belloni
2015-07-02 22:47   ` [rtc-linux] " Alexandre Belloni

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.