All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org
Subject: [PATCH 07/17] Input: omap-keypad: Remove dependencies to mach includes
Date: Mon, 10 Sep 2012 22:30:59 -0700	[thread overview]
Message-ID: <20120911053059.29637.22108.stgit@muffinssi.local> (raw)
In-Reply-To: <20120911052934.29637.9190.stgit@muffinssi.local>

We can't build CONFIG_ARCH_OMAP1 set with ARCH_OMAP2PLUS because
of different compiler flags needed, so we can define omap_kp_24xx()
instead of using cpu_is_omap24xx(). This way we can remove
depency to plat and mach headers which is needed for ARM common
zImage support.

Also remove INT_KEYBOARD by using omap_kp->irq.

Note that this patch depends on an earlier patch
"ARM: OMAP: Move gpio.h to include/linux/platform_data".

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/input/keyboard/omap-keypad.c |   34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index a0222db..171d739 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -35,16 +35,19 @@
 #include <linux/mutex.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <asm/gpio.h>
+#include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 #include <plat/keypad.h>
-#include <plat/menelaus.h>
-#include <asm/irq.h>
-#include <mach/hardware.h>
-#include <asm/io.h>
-#include <plat/mux.h>
 
 #undef NEW_BOARD_LEARNING_MODE
 
+#ifdef CONFIG_ARCH_OMAP1
+#define omap_kp_24xx()		0
+#else
+#define omap_kp_24xx()		1
+#endif
+
+static struct omap_kp *omap_kp;
 static void omap_kp_tasklet(unsigned long);
 static void omap_kp_timer(unsigned long);
 
@@ -99,7 +102,7 @@ static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
 	struct omap_kp *omap_kp = dev_id;
 
 	/* disable keyboard interrupt and schedule for handling */
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		int i;
 
 		for (i = 0; i < omap_kp->rows; i++) {
@@ -134,7 +137,7 @@ static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
 	int col = 0;
 
 	/* read the keypad status */
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		/* read the keypad status */
 		for (col = 0; col < omap_kp->cols; col++) {
 			set_col_gpio_val(omap_kp, ~(1 << col));
@@ -222,7 +225,7 @@ static void omap_kp_tasklet(unsigned long data)
 		mod_timer(&omap_kp_data->timer, jiffies + delay);
 	} else {
 		/* enable interrupts */
-		if (cpu_is_omap24xx()) {
+		if (omap_kp_24xx()) {
 			int i;
 			for (i = 0; i < omap_kp_data->rows; i++)
 				enable_irq(gpio_to_irq(row_gpios[i]));
@@ -253,9 +256,9 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute
 	mutex_lock(&kp_enable_mutex);
 	if (state != kp_enable) {
 		if (state)
-			enable_irq(INT_KEYBOARD);
+			enable_irq(omap_kp->irq);
 		else
-			disable_irq(INT_KEYBOARD);
+			disable_irq(omap_kp->irq);
 		kp_enable = state;
 	}
 	mutex_unlock(&kp_enable_mutex);
@@ -286,7 +289,6 @@ static int omap_kp_resume(struct platform_device *dev)
 
 static int __devinit omap_kp_probe(struct platform_device *pdev)
 {
-	struct omap_kp *omap_kp;
 	struct input_dev *input_dev;
 	struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
 	int i, col_idx, row_idx, irq_idx, ret;
@@ -314,7 +316,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 	omap_kp->input = input_dev;
 
 	/* Disable the interrupt for the MPUIO keyboard */
-	if (!cpu_is_omap24xx())
+	if (!omap_kp_24xx())
 		omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
 
 	if (pdata->delay)
@@ -328,7 +330,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 	omap_kp->rows = pdata->rows;
 	omap_kp->cols = pdata->cols;
 
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		/* Cols: outputs */
 		for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
 			if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
@@ -394,7 +396,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 
 	/* scan current status and enable interrupt */
 	omap_kp_scan_keypad(omap_kp, keypad_state);
-	if (!cpu_is_omap24xx()) {
+	if (!omap_kp_24xx()) {
 		omap_kp->irq = platform_get_irq(pdev, 0);
 		if (omap_kp->irq >= 0) {
 			if (request_irq(omap_kp->irq, omap_kp_interrupt, 0,
@@ -439,7 +441,7 @@ static int __devexit omap_kp_remove(struct platform_device *pdev)
 
 	/* disable keypad interrupt handling */
 	tasklet_disable(&kp_tasklet);
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		int i;
 		for (i = 0; i < omap_kp->cols; i++)
 			gpio_free(col_gpios[i]);


WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/17] Input: omap-keypad: Remove dependencies to mach includes
Date: Mon, 10 Sep 2012 22:30:59 -0700	[thread overview]
Message-ID: <20120911053059.29637.22108.stgit@muffinssi.local> (raw)
In-Reply-To: <20120911052934.29637.9190.stgit@muffinssi.local>

We can't build CONFIG_ARCH_OMAP1 set with ARCH_OMAP2PLUS because
of different compiler flags needed, so we can define omap_kp_24xx()
instead of using cpu_is_omap24xx(). This way we can remove
depency to plat and mach headers which is needed for ARM common
zImage support.

Also remove INT_KEYBOARD by using omap_kp->irq.

Note that this patch depends on an earlier patch
"ARM: OMAP: Move gpio.h to include/linux/platform_data".

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input at vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/input/keyboard/omap-keypad.c |   34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index a0222db..171d739 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -35,16 +35,19 @@
 #include <linux/mutex.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <asm/gpio.h>
+#include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 #include <plat/keypad.h>
-#include <plat/menelaus.h>
-#include <asm/irq.h>
-#include <mach/hardware.h>
-#include <asm/io.h>
-#include <plat/mux.h>
 
 #undef NEW_BOARD_LEARNING_MODE
 
+#ifdef CONFIG_ARCH_OMAP1
+#define omap_kp_24xx()		0
+#else
+#define omap_kp_24xx()		1
+#endif
+
+static struct omap_kp *omap_kp;
 static void omap_kp_tasklet(unsigned long);
 static void omap_kp_timer(unsigned long);
 
@@ -99,7 +102,7 @@ static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
 	struct omap_kp *omap_kp = dev_id;
 
 	/* disable keyboard interrupt and schedule for handling */
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		int i;
 
 		for (i = 0; i < omap_kp->rows; i++) {
@@ -134,7 +137,7 @@ static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
 	int col = 0;
 
 	/* read the keypad status */
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		/* read the keypad status */
 		for (col = 0; col < omap_kp->cols; col++) {
 			set_col_gpio_val(omap_kp, ~(1 << col));
@@ -222,7 +225,7 @@ static void omap_kp_tasklet(unsigned long data)
 		mod_timer(&omap_kp_data->timer, jiffies + delay);
 	} else {
 		/* enable interrupts */
-		if (cpu_is_omap24xx()) {
+		if (omap_kp_24xx()) {
 			int i;
 			for (i = 0; i < omap_kp_data->rows; i++)
 				enable_irq(gpio_to_irq(row_gpios[i]));
@@ -253,9 +256,9 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute
 	mutex_lock(&kp_enable_mutex);
 	if (state != kp_enable) {
 		if (state)
-			enable_irq(INT_KEYBOARD);
+			enable_irq(omap_kp->irq);
 		else
-			disable_irq(INT_KEYBOARD);
+			disable_irq(omap_kp->irq);
 		kp_enable = state;
 	}
 	mutex_unlock(&kp_enable_mutex);
@@ -286,7 +289,6 @@ static int omap_kp_resume(struct platform_device *dev)
 
 static int __devinit omap_kp_probe(struct platform_device *pdev)
 {
-	struct omap_kp *omap_kp;
 	struct input_dev *input_dev;
 	struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
 	int i, col_idx, row_idx, irq_idx, ret;
@@ -314,7 +316,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 	omap_kp->input = input_dev;
 
 	/* Disable the interrupt for the MPUIO keyboard */
-	if (!cpu_is_omap24xx())
+	if (!omap_kp_24xx())
 		omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
 
 	if (pdata->delay)
@@ -328,7 +330,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 	omap_kp->rows = pdata->rows;
 	omap_kp->cols = pdata->cols;
 
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		/* Cols: outputs */
 		for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
 			if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
@@ -394,7 +396,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
 
 	/* scan current status and enable interrupt */
 	omap_kp_scan_keypad(omap_kp, keypad_state);
-	if (!cpu_is_omap24xx()) {
+	if (!omap_kp_24xx()) {
 		omap_kp->irq = platform_get_irq(pdev, 0);
 		if (omap_kp->irq >= 0) {
 			if (request_irq(omap_kp->irq, omap_kp_interrupt, 0,
@@ -439,7 +441,7 @@ static int __devexit omap_kp_remove(struct platform_device *pdev)
 
 	/* disable keypad interrupt handling */
 	tasklet_disable(&kp_tasklet);
-	if (cpu_is_omap24xx()) {
+	if (omap_kp_24xx()) {
 		int i;
 		for (i = 0; i < omap_kp->cols; i++)
 			gpio_free(col_gpios[i]);

  parent reply	other threads:[~2012-09-11  5:31 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11  5:30 [PATCH 00/17] Resend of mach-omap2 sparse IRQ and hardware.h cleanup Tony Lindgren
2012-09-11  5:30 ` Tony Lindgren
2012-09-11  5:30 ` [PATCH 01/17] ARM: OMAP1: Move define of OMAP_LCD_DMA to dma.h Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:30 ` [PATCH 02/17] ARM: OMAP1: Define OMAP1_INT_I2C locally Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:30 ` [PATCH 03/17] ARM: OMAP2+: Make INTCPS_NR_IRQS local for mach-omap2/irq.c Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:30 ` [PATCH 04/17] ARM: OMAP2+: Remove unused nand_irq for GPMC Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:30 ` [PATCH 05/17] ARM: OMAP2+: Remove hardcoded twl4030 gpio_base, irq_base and irq_end Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:51   ` Felipe Balbi
2012-09-11  5:51     ` Felipe Balbi
2012-09-11  5:30 ` [PATCH 06/17] ARM: OMAP: Move gpio.h to include/linux/platform_data Tony Lindgren
2012-09-11  5:30   ` Tony Lindgren
2012-09-11  5:30 ` Tony Lindgren [this message]
2012-09-11  5:30   ` [PATCH 07/17] Input: omap-keypad: Remove dependencies to mach includes Tony Lindgren
2012-09-11  5:57   ` Felipe Balbi
2012-09-11  5:57     ` Felipe Balbi
2012-09-11  6:16     ` Tony Lindgren
2012-09-11  6:16       ` Tony Lindgren
2012-09-11 17:56       ` Tony Lindgren
2012-09-11 17:56         ` Tony Lindgren
2012-09-11 18:27         ` Felipe Balbi
2012-09-11 18:27           ` Felipe Balbi
2012-09-12  4:39           ` Poddar, Sourav
2012-09-12  4:39             ` Poddar, Sourav
2012-09-12  6:39         ` Poddar, Sourav
2012-09-12  6:39           ` Poddar, Sourav
2012-09-11  5:31 ` [PATCH 08/17] W1: OMAP HDQ1W: Remove dependencies to mach/hardware.h Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 09/17] serial/8250: Limit the omap workarounds to omap1 Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11 16:42   ` Alan Cox
2012-09-11 16:42     ` Alan Cox
2012-09-11 16:40     ` Tony Lindgren
2012-09-11 16:40       ` Tony Lindgren
2012-09-11 19:19       ` Alan Cox
2012-09-11 19:19         ` Alan Cox
2012-10-03 22:26         ` Tony Lindgren
2012-10-03 22:26           ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 10/17] staging: tidspbridge: Prepare for irqs.h removal Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 11/17] ARM: OMAP2+: " Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 12/17] ARM: OMAP2+: Remove hardcoded IRQs and enable SPARSE_IRQ Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:59   ` Felipe Balbi
2012-09-11  5:59     ` Felipe Balbi
2012-09-11  5:31 ` [PATCH 13/17] ARM: OMAP1: Move plat/irqs.h to mach/irqs.h Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 14/17] ARM: OMAP: Remove unused old gpio-switch.h Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 15/17] ARM: OMAP: Split plat/hardware.h, use local soc.h for omap2+ Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11 10:48   ` Wim Van Sebroeck
2012-09-11  5:31 ` [PATCH 16/17] ARM: OMAP2+ Move SoC specific headers to be local to mach-omap2 Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren
2012-09-11  5:31 ` [PATCH 17/17] ARM: OMAP1: Move SoC specific headers from plat to mach for omap1 Tony Lindgren
2012-09-11  5:31   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120911053059.29637.22108.stgit@muffinssi.local \
    --to=tony@atomide.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.