All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] twl4030-pwrbutton patches
@ 2009-02-19 13:29 Felipe Balbi
  2009-02-19 13:29 ` [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Felipe Balbi
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2009-02-19 13:29 UTC (permalink / raw)
  To: linux-omap; +Cc: Felipe Balbi

Moving out of drivers/i2c/chips

Felipe Balbi (2):
  i2c: move twl4030-pwrbutton to child registration style
  twl4030: move twl4030-pwrbutton to drivers/input/misc

 drivers/i2c/chips/Kconfig                          |    4 -
 drivers/i2c/chips/Makefile                         |    1 -
 drivers/input/misc/Kconfig                         |    4 +
 drivers/input/misc/Makefile                        |    1 +
 .../{i2c/chips => input/misc}/twl4030-pwrbutton.c  |   59 +++++++++++++------
 drivers/mfd/twl4030-core.c                         |   13 ++++
 6 files changed, 58 insertions(+), 24 deletions(-)
 rename drivers/{i2c/chips => input/misc}/twl4030-pwrbutton.c (70%)


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

* [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style
  2009-02-19 13:29 [PATCH 0/2] twl4030-pwrbutton patches Felipe Balbi
@ 2009-02-19 13:29 ` Felipe Balbi
  2009-02-19 13:29   ` [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Felipe Balbi
  2009-02-27 18:42   ` [APPLIED] [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Tony Lindgren
  0 siblings, 2 replies; 15+ messages in thread
From: Felipe Balbi @ 2009-02-19 13:29 UTC (permalink / raw)
  To: linux-omap; +Cc: Felipe Balbi, David Brownell, Samuel Ortiz

This patch is *compile tested only*. It moves twl4030-pwrbutton
to a platform_driver so it can be registered as a child of
twl4030-core.c.

Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Samuel Ortiz <sameo@openedhand.com>
Signed-off-by: Felipe Balbi <me@felipebalbi.com>
---
 drivers/i2c/chips/twl4030-pwrbutton.c |   59 ++++++++++++++++++++++----------
 drivers/mfd/twl4030-core.c            |   12 +++++++
 2 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/chips/twl4030-pwrbutton.c b/drivers/i2c/chips/twl4030-pwrbutton.c
index 1d9cb90..b0a9c9f 100644
--- a/drivers/i2c/chips/twl4030-pwrbutton.c
+++ b/drivers/i2c/chips/twl4030-pwrbutton.c
@@ -27,20 +27,15 @@
 #include <linux/errno.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
 #include <linux/i2c/twl4030.h>
 
-
-#define PWR_PWRON_IRQ (1<<0)
+#define PWR_PWRON_IRQ (1 << 0)
 
 #define STS_HW_CONDITIONS 0xf
 
-
-/* FIXME have this constant delivered to us as part of the
- * twl4030-core setup ...
- */
-#define TWL4030_PWRIRQ_PWRBTN	(TWL4030_PWR_IRQ_BASE + 0)
-
 static struct input_dev *powerbutton_dev;
+static struct device *dbg_dev;
 
 static irqreturn_t powerbutton_irq(int irq, void *dev_id)
 {
@@ -61,29 +56,32 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id)
 		input_report_key(powerbutton_dev, KEY_POWER,
 				 value & PWR_PWRON_IRQ);
 	} else {
-		pr_err("twl4030: i2c error %d while reading TWL4030"
+		dev_err(dbg_dev, "twl4030: i2c error %d while reading TWL4030"
 			" PM_MASTER STS_HW_CONDITIONS register\n", err);
 	}
 
 	return IRQ_HANDLED;
 }
 
-static int __init twl4030_pwrbutton_init(void)
+static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
 {
 	int err = 0;
+	int irq = platform_get_irq(pdev, 0);
+
+	dbg_dev = &pdev->dev;
 
 	/* PWRBTN == PWRON */
-	err = request_irq(TWL4030_PWRIRQ_PWRBTN, powerbutton_irq,
+	err = request_irq(irq, powerbutton_irq,
 			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-			"PwrButton", NULL);
+			"twl4030-pwrbutton", NULL);
 	if (err < 0) {
-		pr_debug("Can't get IRQ for power button: %d\n", err);
+		dev_dbg(&pdev->dev, "Can't get IRQ for power button: %d\n", err);
 		goto out;
 	}
 
 	powerbutton_dev = input_allocate_device();
 	if (!powerbutton_dev) {
-		pr_debug("Can't allocate power button\n");
+		dev_dbg(&pdev->dev, "Can't allocate power button\n");
 		err = -ENOMEM;
 		goto free_irq_and_out;
 	}
@@ -94,11 +92,11 @@ static int __init twl4030_pwrbutton_init(void)
 
 	err = input_register_device(powerbutton_dev);
 	if (err) {
-		pr_debug("Can't register power button: %d\n", err);
+		dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
 		goto free_input_dev;
 	}
 
-	printk(KERN_INFO "triton2 power button driver initialized\n");
+	dev_info(&pdev->dev, "triton2 power button driver initialized\n");
 
 	return 0;
 
@@ -110,13 +108,36 @@ free_irq_and_out:
 out:
 	return err;
 }
-module_init(twl4030_pwrbutton_init);
 
-static void __exit twl4030_pwrbutton_exit(void)
+static int __devexit twl4030_pwrbutton_remove(struct platform_device *pdev)
 {
-	free_irq(TWL4030_PWRIRQ_PWRBTN, NULL);
+	int irq = platform_get_irq(pdev, 0);
+
+	free_irq(irq, NULL);
 	input_unregister_device(powerbutton_dev);
 	input_free_device(powerbutton_dev);
+
+	return 0;
+}
+
+struct platform_driver twl4030_pwrbutton_driver = {
+	.probe		= twl4030_pwrbutton_probe,
+	.remove		= twl4030_pwrbutton_remove,
+	.driver		= {
+		.name	= "twl4030-pwrbutton",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init twl4030_pwrbutton_init(void)
+{
+	return platform_driver_register(&twl4030_pwrbutton_driver);
+}
+module_init(twl4030_pwrbutton_init);
+
+static void __exit twl4030_pwrbutton_exit(void)
+{
+	platform_driver_unregister(&twl4030_pwrbutton_driver);
 }
 module_exit(twl4030_pwrbutton_exit);
 
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index 19ee29b..1552296 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -107,6 +107,11 @@
 #define twl_has_usb()	false
 #endif
 
+#if defined(CONFIG_TWL4030_PWRBUTTON) || defined(CONFIG_TWL4030_PWBUTTON_MODULE)
+#define twl_has_pwrbutton()	true
+#else
+#define twl_has_pwrbutton()	false
+#endif
 
 /* Triton Core internal information (BEGIN) */
 
@@ -534,6 +539,13 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
 		usb_transceiver = child;
 	}
 
+	if (twl_has_pwrbutton()) {
+		child = add_child(1, "twl4030_pwrbutton",
+				NULL, 0, true, pdata->irq_base + 8 + 0, 0);
+		if (IS_ERR(child))
+			return PTR_ERR(child);
+	}
+
 	if (twl_has_regulator()) {
 		/*
 		child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
-- 
1.6.1.3


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

* [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-19 13:29 ` [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Felipe Balbi
@ 2009-02-19 13:29   ` Felipe Balbi
  2009-02-19 20:08     ` David Brownell
  2009-02-27 18:43     ` [APPLIED] [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Tony Lindgren
  2009-02-27 18:42   ` [APPLIED] [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Tony Lindgren
  1 sibling, 2 replies; 15+ messages in thread
From: Felipe Balbi @ 2009-02-19 13:29 UTC (permalink / raw)
  To: linux-omap; +Cc: Felipe Balbi, David Brownell, Samuel Ortiz

Take it out of drivers/i2c/chips as requested by Jean Delvare
that all drivers move out of there.

Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Samuel Ortiz <sameo@openedhand.com>
Signed-off-by: Felipe Balbi <me@felipebalbi.com>
---
 drivers/i2c/chips/Kconfig                          |    4 ----
 drivers/i2c/chips/Makefile                         |    1 -
 drivers/input/misc/Kconfig                         |    4 ++++
 drivers/input/misc/Makefile                        |    1 +
 .../{i2c/chips => input/misc}/twl4030-pwrbutton.c  |    0
 drivers/mfd/twl4030-core.c                         |    3 ++-
 6 files changed, 7 insertions(+), 6 deletions(-)
 rename drivers/{i2c/chips => input/misc}/twl4030-pwrbutton.c (100%)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index e4831e1..bf7bd1b 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -98,10 +98,6 @@ config TWL4030_MADC
 	  to build it as a dinamically loadable module. The module will be
 	  called twl4030-madc.ko
 
-config TWL4030_PWRBUTTON
-	tristate "TWL4030 Power button Driver"
-	depends on TWL4030_CORE
-
 config TWL4030_POWEROFF
 	tristate "TWL4030 device poweroff"
 	depends on TWL4030_CORE
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 1c94712..8da23ee 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_PCF8575)		+= pcf8575.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
 obj-$(CONFIG_SENSORS_TSL2550)	+= tsl2550.o
 obj-$(CONFIG_TWL4030_POWEROFF)	+= twl4030-poweroff.o
-obj-$(CONFIG_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
 obj-$(CONFIG_TWL4030_MADC)	+= twl4030-madc.o
 obj-$(CONFIG_RTC_X1205_I2C)	+= x1205.o
 
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 67e5553..9667b50 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -193,6 +193,10 @@ config INPUT_CM109
 	  To compile this driver as a module, choose M here: the module will be
 	  called cm109.
 
+config INPUT_TWL4030_PWRBUTTON
+	tristate "TWL4030 Power button Driver"
+	depends on TWL4030_CORE
+
 config INPUT_UINPUT
 	tristate "User level driver support"
 	help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index bb62e6e..2fabcdb 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
 obj-$(CONFIG_INPUT_CM109)		+= cm109.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
+obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
 obj-$(CONFIG_INPUT_APANEL)		+= apanel.o
 obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
 obj-$(CONFIG_INPUT_PCF50633_PMU)	+= pcf50633-input.o
diff --git a/drivers/i2c/chips/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
similarity index 100%
rename from drivers/i2c/chips/twl4030-pwrbutton.c
rename to drivers/input/misc/twl4030-pwrbutton.c
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index 1552296..bb25a4f 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -107,7 +107,8 @@
 #define twl_has_usb()	false
 #endif
 
-#if defined(CONFIG_TWL4030_PWRBUTTON) || defined(CONFIG_TWL4030_PWBUTTON_MODULE)
+#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \
+	|| defined(CONFIG_INPUT_TWL4030_PWBUTTON_MODULE)
 #define twl_has_pwrbutton()	true
 #else
 #define twl_has_pwrbutton()	false
-- 
1.6.1.3


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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-19 13:29   ` [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Felipe Balbi
@ 2009-02-19 20:08     ` David Brownell
  2009-02-19 20:30       ` Felipe Balbi
  2009-02-27 18:43     ` [APPLIED] [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Tony Lindgren
  1 sibling, 1 reply; 15+ messages in thread
From: David Brownell @ 2009-02-19 20:08 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-omap, Samuel Ortiz

On Thursday 19 February 2009, Felipe Balbi wrote:
> Take it out of drivers/i2c/chips as requested by Jean Delvare
> that all drivers move out of there.
> 
> Cc: David Brownell <dbrownell@users.sourceforge.net>
> Cc: Samuel Ortiz <sameo@openedhand.com>
> Signed-off-by: Felipe Balbi <me@felipebalbi.com>

You're cc'ing Sam on these patches to the OMAP tree ... are you
suggesting this code merge to mainline?

If so, you'll need to send the input driver to the input list
as a patch against mainline, for review.  The snippet from
your patch 1/2 affecting the twl4030 MFD core might reasonably
be merged with that, assuming Sam's OK with that going though
the input tree.

- Dave


> ---
>  drivers/i2c/chips/Kconfig                          |    4 ----
>  drivers/i2c/chips/Makefile                         |    1 -
>  drivers/input/misc/Kconfig                         |    4 ++++
>  drivers/input/misc/Makefile                        |    1 +
>  .../{i2c/chips => input/misc}/twl4030-pwrbutton.c  |    0
>  drivers/mfd/twl4030-core.c                         |    3 ++-
>  6 files changed, 7 insertions(+), 6 deletions(-)
>  rename drivers/{i2c/chips => input/misc}/twl4030-pwrbutton.c (100%)
> 


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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-19 20:08     ` David Brownell
@ 2009-02-19 20:30       ` Felipe Balbi
  2009-02-25 21:05         ` Felipe Balbi
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2009-02-19 20:30 UTC (permalink / raw)
  To: David Brownell; +Cc: Felipe Balbi, linux-omap, Samuel Ortiz

On Thu, Feb 19, 2009 at 12:08:45PM -0800, David Brownell wrote:
> On Thursday 19 February 2009, Felipe Balbi wrote:
> > Take it out of drivers/i2c/chips as requested by Jean Delvare
> > that all drivers move out of there.
> > 
> > Cc: David Brownell <dbrownell@users.sourceforge.net>
> > Cc: Samuel Ortiz <sameo@openedhand.com>
> > Signed-off-by: Felipe Balbi <me@felipebalbi.com>
> 
> You're cc'ing Sam on these patches to the OMAP tree ... are you
> suggesting this code merge to mainline?

Just so he knows I'm willing to add a few more changes to
twl4030-core.c, If you're ok with these patches, I'll send the final
version to Sam, mainline and linux-input.

> If so, you'll need to send the input driver to the input list
> as a patch against mainline, for review.  The snippet from
> your patch 1/2 affecting the twl4030 MFD core might reasonably
> be merged with that, assuming Sam's OK with that going though
> the input tree.

I could also make them separate. Send the final
drivers/input/misc/twl4030-pwrbutton.c to linux-input and the
twl4030-core.c to be merged via Sam.

-- 
balbi

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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-19 20:30       ` Felipe Balbi
@ 2009-02-25 21:05         ` Felipe Balbi
  2009-02-27 18:44           ` Tony Lindgren
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2009-02-25 21:05 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: David Brownell, linux-omap, Samuel Ortiz

On Thu, Feb 19, 2009 at 10:30:30PM +0200, Felipe Balbi wrote:
> On Thu, Feb 19, 2009 at 12:08:45PM -0800, David Brownell wrote:
> > On Thursday 19 February 2009, Felipe Balbi wrote:
> > > Take it out of drivers/i2c/chips as requested by Jean Delvare
> > > that all drivers move out of there.
> > > 
> > > Cc: David Brownell <dbrownell@users.sourceforge.net>
> > > Cc: Samuel Ortiz <sameo@openedhand.com>
> > > Signed-off-by: Felipe Balbi <me@felipebalbi.com>
> > 
> > You're cc'ing Sam on these patches to the OMAP tree ... are you
> > suggesting this code merge to mainline?
> 
> Just so he knows I'm willing to add a few more changes to
> twl4030-core.c, If you're ok with these patches, I'll send the final
> version to Sam, mainline and linux-input.
> 
> > If so, you'll need to send the input driver to the input list
> > as a patch against mainline, for review.  The snippet from
> > your patch 1/2 affecting the twl4030 MFD core might reasonably
> > be merged with that, assuming Sam's OK with that going though
> > the input tree.
> 
> I could also make them separate. Send the final
> drivers/input/misc/twl4030-pwrbutton.c to linux-input and the
> twl4030-core.c to be merged via Sam.

Does anyone have anything against this patch ? If not, I guess it should
be applied and I'll generate the patch against mainline for input + mfd
maintainers.

-- 
balbi

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

* [APPLIED] [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style
  2009-02-19 13:29 ` [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Felipe Balbi
  2009-02-19 13:29   ` [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Felipe Balbi
@ 2009-02-27 18:42   ` Tony Lindgren
  1 sibling, 0 replies; 15+ messages in thread
From: Tony Lindgren @ 2009-02-27 18:42 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Commit: ef054d40bfc61d4d4bbfa53c706fd5ca2a54786c

PatchWorks
http://patchwork.kernel.org/patch/7974/

Git
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=ef054d40bfc61d4d4bbfa53c706fd5ca2a54786c



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

* [APPLIED] [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-19 13:29   ` [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Felipe Balbi
  2009-02-19 20:08     ` David Brownell
@ 2009-02-27 18:43     ` Tony Lindgren
  1 sibling, 0 replies; 15+ messages in thread
From: Tony Lindgren @ 2009-02-27 18:43 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Commit: 855fdeaa9f4012839627a5e83e21a4b5a5811cc9

PatchWorks
http://patchwork.kernel.org/patch/7975/

Git
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=855fdeaa9f4012839627a5e83e21a4b5a5811cc9



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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-25 21:05         ` Felipe Balbi
@ 2009-02-27 18:44           ` Tony Lindgren
  2009-02-27 19:31             ` Felipe Balbi
  0 siblings, 1 reply; 15+ messages in thread
From: Tony Lindgren @ 2009-02-27 18:44 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: David Brownell, linux-omap, Samuel Ortiz

* Felipe Balbi <me@felipebalbi.com> [090225 13:07]:
> On Thu, Feb 19, 2009 at 10:30:30PM +0200, Felipe Balbi wrote:
> > On Thu, Feb 19, 2009 at 12:08:45PM -0800, David Brownell wrote:
> > > On Thursday 19 February 2009, Felipe Balbi wrote:
> > > > Take it out of drivers/i2c/chips as requested by Jean Delvare
> > > > that all drivers move out of there.
> > > > 
> > > > Cc: David Brownell <dbrownell@users.sourceforge.net>
> > > > Cc: Samuel Ortiz <sameo@openedhand.com>
> > > > Signed-off-by: Felipe Balbi <me@felipebalbi.com>
> > > 
> > > You're cc'ing Sam on these patches to the OMAP tree ... are you
> > > suggesting this code merge to mainline?
> > 
> > Just so he knows I'm willing to add a few more changes to
> > twl4030-core.c, If you're ok with these patches, I'll send the final
> > version to Sam, mainline and linux-input.
> > 
> > > If so, you'll need to send the input driver to the input list
> > > as a patch against mainline, for review.  The snippet from
> > > your patch 1/2 affecting the twl4030 MFD core might reasonably
> > > be merged with that, assuming Sam's OK with that going though
> > > the input tree.
> > 
> > I could also make them separate. Send the final
> > drivers/input/misc/twl4030-pwrbutton.c to linux-input and the
> > twl4030-core.c to be merged via Sam.
> 
> Does anyone have anything against this patch ? If not, I guess it should
> be applied and I'll generate the patch against mainline for input + mfd
> maintainers.

OK, pushed. These are currently also scheduled for getting reset to
mainline twl code after v2.6.29-omap1 is tagged.

Regards,

Tony

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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-27 18:44           ` Tony Lindgren
@ 2009-02-27 19:31             ` Felipe Balbi
  2009-02-27 19:49               ` Tony Lindgren
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2009-02-27 19:31 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Felipe Balbi, David Brownell, linux-omap, Samuel Ortiz

On Fri, Feb 27, 2009 at 10:44:45AM -0800, Tony Lindgren wrote:
> OK, pushed. These are currently also scheduled for getting reset to
> mainline twl code after v2.6.29-omap1 is tagged.

Just pushed to lkml, there will be one discrepancy with a debugging
message easily fixable in a merge if you just use mainline's version, or
I can send a fixup patch, if you wish.

-- 
balbi

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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-27 19:31             ` Felipe Balbi
@ 2009-02-27 19:49               ` Tony Lindgren
  2009-02-27 20:00                 ` Felipe Balbi
  0 siblings, 1 reply; 15+ messages in thread
From: Tony Lindgren @ 2009-02-27 19:49 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: David Brownell, linux-omap, Samuel Ortiz

* Felipe Balbi <me@felipebalbi.com> [090227 11:31]:
> On Fri, Feb 27, 2009 at 10:44:45AM -0800, Tony Lindgren wrote:
> > OK, pushed. These are currently also scheduled for getting reset to
> > mainline twl code after v2.6.29-omap1 is tagged.
> 
> Just pushed to lkml, there will be one discrepancy with a debugging
> message easily fixable in a merge if you just use mainline's version, or
> I can send a fixup patch, if you wish.

Well if you can send the patch, then that would be easiest. Patching
based on the description usually cause something to go wrong :)

Tony

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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-27 19:49               ` Tony Lindgren
@ 2009-02-27 20:00                 ` Felipe Balbi
  2009-02-27 21:20                   ` Tony Lindgren
  2009-03-05 19:27                   ` [PATCH] input: twl4030-pwrbutton: avoid merge conflicts Felipe Balbi
  0 siblings, 2 replies; 15+ messages in thread
From: Felipe Balbi @ 2009-02-27 20:00 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Felipe Balbi, David Brownell, linux-omap, Samuel Ortiz

On Fri, Feb 27, 2009 at 11:49:17AM -0800, Tony Lindgren wrote:
> * Felipe Balbi <me@felipebalbi.com> [090227 11:31]:
> > On Fri, Feb 27, 2009 at 10:44:45AM -0800, Tony Lindgren wrote:
> > > OK, pushed. These are currently also scheduled for getting reset to
> > > mainline twl code after v2.6.29-omap1 is tagged.
> > 
> > Just pushed to lkml, there will be one discrepancy with a debugging
> > message easily fixable in a merge if you just use mainline's version, or
> > I can send a fixup patch, if you wish.
> 
> Well if you can send the patch, then that would be easiest. Patching
> based on the description usually cause something to go wrong :)

Let's then wait a bit longer and see if Sam or Dmitry will have anything
to say about the driver, after that I can send one patch only.

-- 
balbi

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

* Re: [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc
  2009-02-27 20:00                 ` Felipe Balbi
@ 2009-02-27 21:20                   ` Tony Lindgren
  2009-03-05 19:27                   ` [PATCH] input: twl4030-pwrbutton: avoid merge conflicts Felipe Balbi
  1 sibling, 0 replies; 15+ messages in thread
From: Tony Lindgren @ 2009-02-27 21:20 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: David Brownell, linux-omap, Samuel Ortiz

* Felipe Balbi <me@felipebalbi.com> [090227 12:00]:
> On Fri, Feb 27, 2009 at 11:49:17AM -0800, Tony Lindgren wrote:
> > * Felipe Balbi <me@felipebalbi.com> [090227 11:31]:
> > > On Fri, Feb 27, 2009 at 10:44:45AM -0800, Tony Lindgren wrote:
> > > > OK, pushed. These are currently also scheduled for getting reset to
> > > > mainline twl code after v2.6.29-omap1 is tagged.
> > > 
> > > Just pushed to lkml, there will be one discrepancy with a debugging
> > > message easily fixable in a merge if you just use mainline's version, or
> > > I can send a fixup patch, if you wish.
> > 
> > Well if you can send the patch, then that would be easiest. Patching
> > based on the description usually cause something to go wrong :)
> 
> Let's then wait a bit longer and see if Sam or Dmitry will have anything
> to say about the driver, after that I can send one patch only.

OK

Tony

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

* [PATCH] input: twl4030-pwrbutton: avoid merge conflicts
  2009-02-27 20:00                 ` Felipe Balbi
  2009-02-27 21:20                   ` Tony Lindgren
@ 2009-03-05 19:27                   ` Felipe Balbi
  2009-03-05 23:52                     ` [APPLIED] " Tony Lindgren
  1 sibling, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2009-03-05 19:27 UTC (permalink / raw)
  To: Tony Lindgren, linux-omap; +Cc: Felipe Balbi

sync up with the version going upstream.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
This patch is syncing with the fixed up version accepted in
mainline. Should be applied to avoid merge conflicts
on the next merge window.

 drivers/input/misc/Kconfig             |    6 ++
 drivers/input/misc/twl4030-pwrbutton.c |   87 ++++++++++++++++----------------
 2 files changed, 49 insertions(+), 44 deletions(-)

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 9667b50..6fa9e38 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -196,6 +196,12 @@ config INPUT_CM109
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
+	help
+	  Say Y here if you want to enable power key reporting via the
+	  TWL4030 family of chips.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called twl4030_pwrbutton.
 
 config INPUT_UINPUT
 	tristate "User level driver support"
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b0a9c9f..7150830 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -1,11 +1,10 @@
 /**
- * drivers/i2c/chips/twl4030-pwrbutton.c
+ * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
  *
- * Driver for sending triton2 power button event to input-layer
- *
- * Copyright (C) 2008 Nokia Corporation
+ * Copyright (C) 2008-2009 Nokia Corporation
  *
  * Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
+ * Several fixes by Felipe Balbi <felipe.balbi@nokia.com>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License. See the file "COPYING" in the main directory of this
@@ -34,18 +33,18 @@
 
 #define STS_HW_CONDITIONS 0xf
 
-static struct input_dev *powerbutton_dev;
-static struct device *dbg_dev;
-
-static irqreturn_t powerbutton_irq(int irq, void *dev_id)
+static irqreturn_t powerbutton_irq(int irq, void *_pwr)
 {
+	struct input_dev *pwr = _pwr;
 	int err;
 	u8 value;
 
 #ifdef CONFIG_LOCKDEP
 	/* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
-	 * we don't want and can't tolerate.  Although it might be
-	 * friendlier not to borrow this thread context...
+	 * we don't want and can't tolerate since this is a threaded
+	 * IRQ and can sleep due to the i2c reads it has to issue.
+	 * Although it might be friendlier not to borrow this thread
+	 * context...
 	 */
 	local_irq_enable();
 #endif
@@ -53,11 +52,11 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id)
 	err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
 				  STS_HW_CONDITIONS);
 	if (!err)  {
-		input_report_key(powerbutton_dev, KEY_POWER,
-				 value & PWR_PWRON_IRQ);
+		input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
+		input_sync(pwr);
 	} else {
-		dev_err(dbg_dev, "twl4030: i2c error %d while reading TWL4030"
-			" PM_MASTER STS_HW_CONDITIONS register\n", err);
+		dev_err(pwr->dev.parent, "twl4030: i2c error %d while reading"
+			" TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
 	}
 
 	return IRQ_HANDLED;
@@ -65,66 +64,64 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id)
 
 static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
 {
-	int err = 0;
+	struct input_dev *pwr;
 	int irq = platform_get_irq(pdev, 0);
+	int err;
 
-	dbg_dev = &pdev->dev;
+	pwr = input_allocate_device();
+	if (!pwr) {
+		dev_dbg(&pdev->dev, "Can't allocate power button\n");
+		err = -ENOMEM;
+		goto out;
+	}
 
-	/* PWRBTN == PWRON */
 	err = request_irq(irq, powerbutton_irq,
 			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-			"twl4030-pwrbutton", NULL);
+			"twl4030_pwrbutton", pwr);
 	if (err < 0) {
-		dev_dbg(&pdev->dev, "Can't get IRQ for power button: %d\n", err);
-		goto out;
-	}
-
-	powerbutton_dev = input_allocate_device();
-	if (!powerbutton_dev) {
-		dev_dbg(&pdev->dev, "Can't allocate power button\n");
-		err = -ENOMEM;
-		goto free_irq_and_out;
+		dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+		goto free_input_dev;
 	}
 
-	powerbutton_dev->evbit[0] = BIT_MASK(EV_KEY);
-	powerbutton_dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
-	powerbutton_dev->name = "triton2-pwrbutton";
+	pwr->evbit[0] = BIT_MASK(EV_KEY);
+	pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+	pwr->name = "twl4030_pwrbutton";
+	pwr->phys = "twl4030_pwrbutton/input0";
+	pwr->dev.parent = &pdev->dev;
+	platform_set_drvdata(pdev, pwr);
 
-	err = input_register_device(powerbutton_dev);
+	err = input_register_device(pwr);
 	if (err) {
 		dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
-		goto free_input_dev;
+		goto free_irq_and_out;
 	}
 
-	dev_info(&pdev->dev, "triton2 power button driver initialized\n");
-
 	return 0;
 
-
-free_input_dev:
-	input_free_device(powerbutton_dev);
 free_irq_and_out:
-	free_irq(TWL4030_PWRIRQ_PWRBTN, NULL);
+	free_irq(irq, NULL);
+free_input_dev:
+	input_free_device(pwr);
 out:
 	return err;
 }
 
 static int __devexit twl4030_pwrbutton_remove(struct platform_device *pdev)
 {
+	struct input_dev *pwr = platform_get_drvdata(pdev);
 	int irq = platform_get_irq(pdev, 0);
 
-	free_irq(irq, NULL);
-	input_unregister_device(powerbutton_dev);
-	input_free_device(powerbutton_dev);
+	free_irq(irq, pwr);
+	input_unregister_device(pwr);
 
 	return 0;
 }
 
 struct platform_driver twl4030_pwrbutton_driver = {
 	.probe		= twl4030_pwrbutton_probe,
-	.remove		= twl4030_pwrbutton_remove,
+	.remove		= __devexit_p(twl4030_pwrbutton_remove),
 	.driver		= {
-		.name	= "twl4030-pwrbutton",
+		.name	= "twl4030_pwrbutton",
 		.owner	= THIS_MODULE,
 	},
 };
@@ -141,7 +138,9 @@ static void __exit twl4030_pwrbutton_exit(void)
 }
 module_exit(twl4030_pwrbutton_exit);
 
+MODULE_ALIAS("platform:twl4030_pwrbutton");
 MODULE_DESCRIPTION("Triton2 Power Button");
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Peter De Schrijver");
+MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
+MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
 
-- 
1.6.2.rc0.61.g5cd12


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

* [APPLIED] [PATCH] input: twl4030-pwrbutton: avoid merge conflicts
  2009-03-05 19:27                   ` [PATCH] input: twl4030-pwrbutton: avoid merge conflicts Felipe Balbi
@ 2009-03-05 23:52                     ` Tony Lindgren
  0 siblings, 0 replies; 15+ messages in thread
From: Tony Lindgren @ 2009-03-05 23:52 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Commit: 1e2ac5195c19b440b0b095262e11b54c093916ee

PatchWorks
http://patchwork.kernel.org/patch/10147/

Git
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=1e2ac5195c19b440b0b095262e11b54c093916ee



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

end of thread, other threads:[~2009-03-05 23:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-19 13:29 [PATCH 0/2] twl4030-pwrbutton patches Felipe Balbi
2009-02-19 13:29 ` [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Felipe Balbi
2009-02-19 13:29   ` [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Felipe Balbi
2009-02-19 20:08     ` David Brownell
2009-02-19 20:30       ` Felipe Balbi
2009-02-25 21:05         ` Felipe Balbi
2009-02-27 18:44           ` Tony Lindgren
2009-02-27 19:31             ` Felipe Balbi
2009-02-27 19:49               ` Tony Lindgren
2009-02-27 20:00                 ` Felipe Balbi
2009-02-27 21:20                   ` Tony Lindgren
2009-03-05 19:27                   ` [PATCH] input: twl4030-pwrbutton: avoid merge conflicts Felipe Balbi
2009-03-05 23:52                     ` [APPLIED] " Tony Lindgren
2009-02-27 18:43     ` [APPLIED] [PATCH 2/2] twl4030: move twl4030-pwrbutton to drivers/input/misc Tony Lindgren
2009-02-27 18:42   ` [APPLIED] [PATCH 1/2] i2c: move twl4030-pwrbutton to child registration style Tony Lindgren

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.