linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data
@ 2012-08-01 17:40 Stephen Warren
  2012-08-01 17:40 ` [PATCH 2/3] regmap: name irq_chip based on regmap_irq_chip's name Stephen Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Warren @ 2012-08-01 17:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

This will allow later patches to adjust portions of the irq_chip
individually for each regmap_irq_chip that is created.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/base/regmap/regmap-irq.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 75b6939..07fae4c 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -22,6 +22,7 @@
 
 struct regmap_irq_chip_data {
 	struct mutex lock;
+	struct irq_chip irq_chip;
 
 	struct regmap *map;
 	const struct regmap_irq_chip *chip;
@@ -129,7 +130,7 @@ static int regmap_irq_set_wake(struct irq_data *data, unsigned int on)
 	return 0;
 }
 
-static struct irq_chip regmap_irq_chip = {
+static const struct irq_chip regmap_irq_chip = {
 	.name			= "regmap",
 	.irq_bus_lock		= regmap_irq_lock,
 	.irq_bus_sync_unlock	= regmap_irq_sync_unlock,
@@ -197,7 +198,7 @@ static int regmap_irq_map(struct irq_domain *h, unsigned int virq,
 	struct regmap_irq_chip_data *data = h->host_data;
 
 	irq_set_chip_data(virq, data);
-	irq_set_chip_and_handler(virq, &regmap_irq_chip, handle_edge_irq);
+	irq_set_chip_and_handler(virq, &data->irq_chip, handle_edge_irq);
 	irq_set_nested_thread(virq, 1);
 
 	/* ARM needs us to explicitly flag the IRQ as valid
@@ -285,6 +286,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 			goto err_alloc;
 	}
 
+	d->irq_chip = regmap_irq_chip;
 	d->irq = irq;
 	d->map = map;
 	d->chip = chip;
-- 
1.7.0.4


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

* [PATCH 2/3] regmap: name irq_chip based on regmap_irq_chip's name
  2012-08-01 17:40 [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Stephen Warren
@ 2012-08-01 17:40 ` Stephen Warren
  2012-08-01 17:40 ` [PATCH 3/3] regmap: set MASK_ON_SUSPEND/SKIP_SET_WAKE if no wake_base Stephen Warren
  2012-08-01 19:33 ` [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2012-08-01 17:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

This is intended to give each irq_chip a useful name, rather than hard-
coding them all as "regmap".

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/base/regmap/regmap-irq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 07fae4c..5a3624f 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -131,7 +131,6 @@ static int regmap_irq_set_wake(struct irq_data *data, unsigned int on)
 }
 
 static const struct irq_chip regmap_irq_chip = {
-	.name			= "regmap",
 	.irq_bus_lock		= regmap_irq_lock,
 	.irq_bus_sync_unlock	= regmap_irq_sync_unlock,
 	.irq_disable		= regmap_irq_disable,
@@ -287,6 +286,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 	}
 
 	d->irq_chip = regmap_irq_chip;
+	d->irq_chip.name = chip->name;
 	d->irq = irq;
 	d->map = map;
 	d->chip = chip;
-- 
1.7.0.4


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

* [PATCH 3/3] regmap: set MASK_ON_SUSPEND/SKIP_SET_WAKE if no wake_base
  2012-08-01 17:40 [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Stephen Warren
  2012-08-01 17:40 ` [PATCH 2/3] regmap: name irq_chip based on regmap_irq_chip's name Stephen Warren
@ 2012-08-01 17:40 ` Stephen Warren
  2012-08-01 19:33 ` [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2012-08-01 17:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

If a regmap-irq chip has no wake base:

* There's no point calling .irq_set_wake, hence IRQCHIP_SKIP_SET_WAKE.

* If some IRQs in the chip are enabled for wake and some aren't, we
  should mask those interrupts that are not wake enabled, so that if
  they occur during suspend, the system is not awoken. Hence,
  IRQCHIP_MASK_ON_SUSPEND.

Note that IRQCHIP_MASK_ON_SUSPEND is handled by check_wakeup_irqs(),
which always iterates over every single interrupt in the system,
irrespective of whether an interrupt is a child of a controller whose
output interrupt has no wake-enabled inputs and hence is presumably
masked itself. Hence this change might cause interrupt unnecessary
masking operations and associated register I/O.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/base/regmap/regmap-irq.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 5a3624f..da8aae7 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -287,6 +287,11 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 
 	d->irq_chip = regmap_irq_chip;
 	d->irq_chip.name = chip->name;
+	if (!chip->wake_base) {
+		d->irq_chip.irq_set_wake = NULL;
+		d->irq_chip.flags |= IRQCHIP_MASK_ON_SUSPEND |
+				     IRQCHIP_SKIP_SET_WAKE;
+	}
 	d->irq = irq;
 	d->map = map;
 	d->chip = chip;
-- 
1.7.0.4


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

* Re: [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data
  2012-08-01 17:40 [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Stephen Warren
  2012-08-01 17:40 ` [PATCH 2/3] regmap: name irq_chip based on regmap_irq_chip's name Stephen Warren
  2012-08-01 17:40 ` [PATCH 3/3] regmap: set MASK_ON_SUSPEND/SKIP_SET_WAKE if no wake_base Stephen Warren
@ 2012-08-01 19:33 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-08-01 19:33 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-kernel, Stephen Warren

On Wed, Aug 01, 2012 at 11:40:47AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> This will allow later patches to adjust portions of the irq_chip
> individually for each regmap_irq_chip that is created.

Applied all, thanks.

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

end of thread, other threads:[~2012-08-01 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 17:40 [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Stephen Warren
2012-08-01 17:40 ` [PATCH 2/3] regmap: name irq_chip based on regmap_irq_chip's name Stephen Warren
2012-08-01 17:40 ` [PATCH 3/3] regmap: set MASK_ON_SUSPEND/SKIP_SET_WAKE if no wake_base Stephen Warren
2012-08-01 19:33 ` [PATCH 1/3] regmap: store irq_chip inside regmap_irq_chip_data Mark Brown

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