linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3]OMAP4: Keypad support
@ 2010-12-27  5:51 shubhrajyoti
  2010-12-27  5:51 ` [PATCH v8 1/3] OMAP4: hwmod data: Add keypad in the hwmod database shubhrajyoti
  2011-02-15  9:41 ` [PATCH 0/3]OMAP4: Keypad support Shubhrajyoti Datta
  0 siblings, 2 replies; 13+ messages in thread
From: shubhrajyoti @ 2010-12-27  5:51 UTC (permalink / raw)
  To: linux-omap, linux-input; +Cc: Shubhrajyoti D

From: Shubhrajyoti D <a0393217@india.ti.com>

Adding the keypad 4430sdp board support and PM runtime change.
Tested on 4430sdp.

Abraham Arce (1):
  OMAP4:keypad: PM runtime

Benoit Cousson (1):
  OMAP4: hwmod data: Add keypad in the hwmod database

Syed Rafiuddin (1):
  OMAP4: keypad: Add the board support.

 arch/arm/mach-omap2/board-4430sdp.c        |   89 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c              |   41 +++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   70 ++++++++++++++++++++++
 drivers/input/keyboard/omap4-keypad.c      |    8 +++
 4 files changed, 208 insertions(+), 0 deletions(-)


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

* [PATCH v8 1/3] OMAP4: hwmod data: Add keypad in the hwmod database
  2010-12-27  5:51 [PATCH 0/3]OMAP4: Keypad support shubhrajyoti
@ 2010-12-27  5:51 ` shubhrajyoti
  2010-12-27  5:51   ` [PATCH v8 2/3] OMAP4: keypad: Add the board support shubhrajyoti
  2011-02-15  9:41 ` [PATCH 0/3]OMAP4: Keypad support Shubhrajyoti Datta
  1 sibling, 1 reply; 13+ messages in thread
From: shubhrajyoti @ 2010-12-27  5:51 UTC (permalink / raw)
  To: linux-omap, linux-input; +Cc: Benoit Cousson, Abraham Arce, Shubhrajyoti D

From: Benoit Cousson <b-cousson@ti.com>

Add hwmod data for OMAP4 keyboard controller
taking Benoit's patch:

 OMAP4: hwmod: Add partial hwmod support for OMAP4430

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   70 ++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index f9778fb..a0c6c39 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -657,6 +657,73 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
 };
 
 /*
+ * 'kbd' class
+ * keyboard controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_kbd_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap44xx_kbd_hwmod_class = {
+	.name = "kbd",
+	.sysc = &omap44xx_kbd_sysc,
+};
+
+/* kbd */
+static struct omap_hwmod omap44xx_kbd_hwmod;
+static struct omap_hwmod_irq_info omap44xx_kbd_irqs[] = {
+	{ .irq = 120 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_addr_space omap44xx_kbd_addrs[] = {
+	{
+		.pa_start	= 0x4a31c000,
+		.pa_end		= 0x4a31c07f,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_wkup -> kbd */
+static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
+	.master		= &omap44xx_l4_wkup_hwmod,
+	.slave		= &omap44xx_kbd_hwmod,
+	.clk		= "l4_wkup_clk_mux_ck",
+	.addr		= omap44xx_kbd_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap44xx_kbd_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* kbd slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_kbd_slaves[] = {
+	&omap44xx_l4_wkup__kbd,
+};
+
+static struct omap_hwmod omap44xx_kbd_hwmod = {
+	.name		= "kbd",
+	.class		= &omap44xx_kbd_hwmod_class,
+	.mpu_irqs	= omap44xx_kbd_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_kbd_irqs),
+	.main_clk	= "kbd_fck",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
+		},
+	},
+	.slaves		= omap44xx_kbd_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap44xx_kbd_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
+};
+
+
+/*
  * 'mpu' class
  * mpu sub-system
  */
@@ -1509,6 +1576,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	&omap44xx_gpio5_hwmod,
 	&omap44xx_gpio6_hwmod,
 
+	/* kbd class */
+	&omap44xx_kbd_hwmod,
+
 	/* mpu class */
 	&omap44xx_mpu_hwmod,
 	/* wd_timer class */
-- 
1.7.0.4


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

* [PATCH v8 2/3] OMAP4: keypad: Add the board support.
  2010-12-27  5:51 ` [PATCH v8 1/3] OMAP4: hwmod data: Add keypad in the hwmod database shubhrajyoti
@ 2010-12-27  5:51   ` shubhrajyoti
  2010-12-27  5:51     ` [PATCH v8 3/3] OMAP4:keypad: PM runtime shubhrajyoti
  0 siblings, 1 reply; 13+ messages in thread
From: shubhrajyoti @ 2010-12-27  5:51 UTC (permalink / raw)
  To: linux-omap, linux-input; +Cc: Syed Rafiuddin, Abraham Arce, Shubhrajyoti D

From: Syed Rafiuddin <rafiuddin.syed@ti.com>

-Add the platform changes for the keypad driver
-Register keyboard device with hwmod framework.

Signed-off-by: Syed Rafiuddin <rafiuddin.syed@ti.com>
Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c |   89 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c       |   41 ++++++++++++++++
 2 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 9525515..0bbceb3 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -35,6 +35,7 @@
 #include <plat/common.h>
 #include <plat/usb.h>
 #include <plat/mmc.h>
+#include <plat/omap4-keypad.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -48,6 +49,90 @@
 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO	184
 #define OMAP4_SFH7741_ENABLE_GPIO		188
 
+static const int sdp4430_keymap[] = {
+	KEY(0, 0, KEY_E),
+	KEY(0, 1, KEY_R),
+	KEY(0, 2, KEY_T),
+	KEY(0, 3, KEY_HOME),
+	KEY(0, 4, KEY_F5),
+	KEY(0, 5, KEY_UNKNOWN),
+	KEY(0, 6, KEY_I),
+	KEY(0, 7, KEY_LEFTSHIFT),
+
+	KEY(1, 0, KEY_D),
+	KEY(1, 1, KEY_F),
+	KEY(1, 2, KEY_G),
+	KEY(1, 3, KEY_SEND),
+	KEY(1, 4, KEY_F6),
+	KEY(1, 5, KEY_UNKNOWN),
+	KEY(1, 6, KEY_K),
+	KEY(1, 7, KEY_ENTER),
+
+	KEY(2, 0, KEY_X),
+	KEY(2, 1, KEY_C),
+	KEY(2, 2, KEY_V),
+	KEY(2, 3, KEY_END),
+	KEY(2, 4, KEY_F7),
+	KEY(2, 5, KEY_UNKNOWN),
+	KEY(2, 6, KEY_DOT),
+	KEY(2, 7, KEY_CAPSLOCK),
+
+	KEY(3, 0, KEY_Z),
+	KEY(3, 1, KEY_KPPLUS),
+	KEY(3, 2, KEY_B),
+	KEY(3, 3, KEY_F1),
+	KEY(3, 4, KEY_F8),
+	KEY(3, 5, KEY_UNKNOWN),
+	KEY(3, 6, KEY_O),
+	KEY(3, 7, KEY_SPACE),
+
+	KEY(4, 0, KEY_W),
+	KEY(4, 1, KEY_Y),
+	KEY(4, 2, KEY_U),
+	KEY(4, 3, KEY_F2),
+	KEY(4, 4, KEY_VOLUMEUP),
+	KEY(4, 5, KEY_UNKNOWN),
+	KEY(4, 6, KEY_L),
+	KEY(4, 7, KEY_LEFT),
+
+	KEY(5, 0, KEY_S),
+	KEY(5, 1, KEY_H),
+	KEY(5, 2, KEY_J),
+	KEY(5, 3, KEY_F3),
+	KEY(5, 4, KEY_F9),
+	KEY(5, 5, KEY_VOLUMEDOWN),
+	KEY(5, 6, KEY_M),
+	KEY(5, 7, KEY_RIGHT),
+
+	KEY(6, 0, KEY_Q),
+	KEY(6, 1, KEY_A),
+	KEY(6, 2, KEY_N),
+	KEY(6, 3, KEY_BACK),
+	KEY(6, 4, KEY_BACKSPACE),
+	KEY(6, 5, KEY_UNKNOWN),
+	KEY(6, 6, KEY_P),
+	KEY(6, 7, KEY_UP),
+
+	KEY(7, 0, KEY_PROG1),
+	KEY(7, 1, KEY_PROG2),
+	KEY(7, 2, KEY_PROG3),
+	KEY(7, 3, KEY_PROG4),
+	KEY(7, 4, KEY_F4),
+	KEY(7, 5, KEY_UNKNOWN),
+	KEY(7, 6, KEY_OK),
+	KEY(7, 7, KEY_DOWN),
+};
+
+static struct matrix_keymap_data sdp4430_keymap_data = {
+	.keymap			= sdp4430_keymap,
+	.keymap_size		= ARRAY_SIZE(sdp4430_keymap),
+};
+
+static struct omap4_keypad_platform_data sdp4430_keypad_data = {
+	.keymap_data		= &sdp4430_keymap_data,
+	.rows			= 8,
+	.cols			= 8,
+};
 static struct gpio_led sdp4430_gpio_leds[] = {
 	{
 		.name	= "omap4:green:debug0",
@@ -591,6 +676,10 @@ static void __init omap_4430sdp_init(void)
 		spi_register_board_info(sdp4430_spi_board_info,
 				ARRAY_SIZE(sdp4430_spi_board_info));
 	}
+
+	status = omap4_keyboard_init(&sdp4430_keypad_data);
+	if (status)
+		pr_err("Keypad initialization failed: %d\n", status);
 }
 
 static void __init omap_4430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1bca147..24831af 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -30,6 +30,7 @@
 #include <plat/dma.h>
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
+#include <plat/omap4-keypad.h>
 
 #include "mux.h"
 #include "control.h"
@@ -141,6 +142,46 @@ static inline void omap_init_camera(void)
 }
 #endif
 
+struct omap_device_pm_latency omap_keyboard_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+int __init omap4_keyboard_init(struct omap4_keypad_platform_data
+						*sdp4430_keypad_data)
+{
+	struct omap_device *od;
+	struct omap_hwmod *oh;
+	struct omap4_keypad_platform_data *keypad_data;
+	unsigned int id = -1;
+	char *oh_name = "kbd";
+	char *name = "omap4-keypad";
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (!oh) {
+		pr_err("Could not look up %s\n", oh_name);
+		return -ENODEV;
+	}
+
+	keypad_data = sdp4430_keypad_data;
+
+	od = omap_device_build(name, id, oh, keypad_data,
+			sizeof(struct omap4_keypad_platform_data),
+			omap_keyboard_latency,
+			ARRAY_SIZE(omap_keyboard_latency), 0);
+
+	if (IS_ERR(od)) {
+		WARN(1, "Cant build omap_device for %s:%s.\n",
+						name, oh->name);
+		return PTR_ERR(od);
+	}
+
+	return 0;
+}
+
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
 #define MBOX_REG_SIZE   0x120
-- 
1.7.0.4


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

* [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2010-12-27  5:51   ` [PATCH v8 2/3] OMAP4: keypad: Add the board support shubhrajyoti
@ 2010-12-27  5:51     ` shubhrajyoti
  2011-02-08  8:30       ` Shubhrajyoti
  0 siblings, 1 reply; 13+ messages in thread
From: shubhrajyoti @ 2010-12-27  5:51 UTC (permalink / raw)
  To: linux-omap, linux-input; +Cc: Abraham Arce, Kevin Hilman, Shubhrajyoti D

From: Abraham Arce <x0066660@ti.com>

Enable Runtime PM functionality in OMAP4 driver based on the following assumptions

A minimal pm runtime get/put approach is implemented in probe/remove calls
respectively.

- Keyboard controller in wakeup domain so it is always on and
  power impact may be minimal
- In OMAP4 the device control is at module/device level and ick/fclk level control is
  difficult so cutting of clocks will prevent interrupts.

Signed-off-by: Abraham Arce <x0066660@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/input/keyboard/omap4-keypad.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 45bd097..fcfbb9b 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -29,6 +29,7 @@
 #include <linux/io.h>
 #include <linux/input.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include <plat/omap4-keypad.h>
 
@@ -239,6 +240,9 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
 			input_dev->keycode, input_dev->keybit);
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+
 	omap4_keypad_config(keypad_data);
 
 	error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
@@ -278,6 +282,10 @@ static int __devexit omap4_keypad_remove(struct platform_device *pdev)
 	struct resource *res;
 
 	free_irq(keypad_data->irq, keypad_data);
+
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
+
 	input_unregister_device(keypad_data->input);
 
 	iounmap(keypad_data->base);
-- 
1.7.0.4


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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2010-12-27  5:51     ` [PATCH v8 3/3] OMAP4:keypad: PM runtime shubhrajyoti
@ 2011-02-08  8:30       ` Shubhrajyoti
  2011-02-11 17:18         ` Shubhrajyoti
  2011-02-19  3:07         ` Shubhrajyoti
  0 siblings, 2 replies; 13+ messages in thread
From: Shubhrajyoti @ 2011-02-08  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: shubhrajyoti, Abraham Arce, Kevin Hilman

Hello,
Any comments/suggestions.

Thanks,

On Monday 27 December 2010 11:21 AM, shubhrajyoti@ti.com wrote:
> From: Abraham Arce<x0066660@ti.com>
>
> Enable Runtime PM functionality in OMAP4 driver based on the following assumptions
>
> A minimal pm runtime get/put approach is implemented in probe/remove calls
> respectively.
>
> - Keyboard controller in wakeup domain so it is always on and
>    power impact may be minimal
> - In OMAP4 the device control is at module/device level and ick/fclk level control is
>    difficult so cutting of clocks will prevent interrupts.
>
> Signed-off-by: Abraham Arce<x0066660@ti.com>
> Cc: Kevin Hilman<khilman@deeprootsystems.com>
> Signed-off-by: Shubhrajyoti D<shubhrajyoti@ti.com>
> ---
>   drivers/input/keyboard/omap4-keypad.c |    8 ++++++++
>   1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index 45bd097..fcfbb9b 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -29,6 +29,7 @@
>   #include<linux/io.h>
>   #include<linux/input.h>
>   #include<linux/slab.h>
> +#include<linux/pm_runtime.h>
>
>   #include<plat/omap4-keypad.h>
>
> @@ -239,6 +240,9 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
>   	matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
>   			input_dev->keycode, input_dev->keybit);
>
> +	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_get_sync(&pdev->dev);
> +
>   	omap4_keypad_config(keypad_data);
>
>   	error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
> @@ -278,6 +282,10 @@ static int __devexit omap4_keypad_remove(struct platform_device *pdev)
>   	struct resource *res;
>
>   	free_irq(keypad_data->irq, keypad_data);
> +
> +	pm_runtime_put_sync(&pdev->dev);
> +	pm_runtime_disable(&pdev->dev);
> +
>   	input_unregister_device(keypad_data->input);
>
>   	iounmap(keypad_data->base);


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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-08  8:30       ` Shubhrajyoti
@ 2011-02-11 17:18         ` Shubhrajyoti
  2011-02-19  3:07         ` Shubhrajyoti
  1 sibling, 0 replies; 13+ messages in thread
From: Shubhrajyoti @ 2011-02-11 17:18 UTC (permalink / raw)
  To: Shubhrajyoti; +Cc: linux-input, linux-omap, Abraham Arce, Kevin Hilman

Missed adding linux omap

On Tuesday 08 February 2011 02:00 PM, Shubhrajyoti wrote:
> Hello,
> Any comments/suggestions.
>
> Thanks,
>
> On Monday 27 December 2010 11:21 AM, shubhrajyoti@ti.com wrote:
>> From: Abraham Arce<x0066660@ti.com>
>>
>> Enable Runtime PM functionality in OMAP4 driver based on the 
>> following assumptions
>>
>> A minimal pm runtime get/put approach is implemented in probe/remove 
>> calls
>> respectively.
>>
>> - Keyboard controller in wakeup domain so it is always on and
>>    power impact may be minimal
>> - In OMAP4 the device control is at module/device level and ick/fclk 
>> level control is
>>    difficult so cutting of clocks will prevent interrupts.
>>
>> Signed-off-by: Abraham Arce<x0066660@ti.com>
>> Cc: Kevin Hilman<khilman@deeprootsystems.com>
>> Signed-off-by: Shubhrajyoti D<shubhrajyoti@ti.com>
>> ---
>>   drivers/input/keyboard/omap4-keypad.c |    8 ++++++++
>>   1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/keyboard/omap4-keypad.c 
>> b/drivers/input/keyboard/omap4-keypad.c
>> index 45bd097..fcfbb9b 100644
>> --- a/drivers/input/keyboard/omap4-keypad.c
>> +++ b/drivers/input/keyboard/omap4-keypad.c
>> @@ -29,6 +29,7 @@
>>   #include<linux/io.h>
>>   #include<linux/input.h>
>>   #include<linux/slab.h>
>> +#include<linux/pm_runtime.h>
>>
>>   #include<plat/omap4-keypad.h>
>>
>> @@ -239,6 +240,9 @@ static int __devinit omap4_keypad_probe(struct 
>> platform_device *pdev)
>>       matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
>>               input_dev->keycode, input_dev->keybit);
>>
>> +    pm_runtime_enable(&pdev->dev);
>> +    pm_runtime_get_sync(&pdev->dev);
>> +
>>       omap4_keypad_config(keypad_data);
>>
>>       error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
>> @@ -278,6 +282,10 @@ static int __devexit omap4_keypad_remove(struct 
>> platform_device *pdev)
>>       struct resource *res;
>>
>>       free_irq(keypad_data->irq, keypad_data);
>> +
>> +    pm_runtime_put_sync(&pdev->dev);
>> +    pm_runtime_disable(&pdev->dev);
>> +
>>       input_unregister_device(keypad_data->input);
>>
>>       iounmap(keypad_data->base);
>


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

* RE: [PATCH 0/3]OMAP4: Keypad support
  2010-12-27  5:51 [PATCH 0/3]OMAP4: Keypad support shubhrajyoti
  2010-12-27  5:51 ` [PATCH v8 1/3] OMAP4: hwmod data: Add keypad in the hwmod database shubhrajyoti
@ 2011-02-15  9:41 ` Shubhrajyoti Datta
  1 sibling, 0 replies; 13+ messages in thread
From: Shubhrajyoti Datta @ 2011-02-15  9:41 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-omap, linux-input
  Cc: Shubhrajyoti D, Kevin Hilman, Cousson, Benoit

Hi,
Any comments on this series.

Thanking you,
With Regards,
Shubhro
> -----Original Message-----
> From: shubhrajyoti@ti.com [mailto:shubhrajyoti@ti.com]
> Sent: Monday, December 27, 2010 11:22 AM
> To: linux-omap@vger.kernel.org; linux-input@vger.kernel.org
> Cc: Shubhrajyoti D
> Subject: [PATCH 0/3]OMAP4: Keypad support
>
> From: Shubhrajyoti D <a0393217@india.ti.com>
>
> Adding the keypad 4430sdp board support and PM runtime change.
> Tested on 4430sdp.
>
> Abraham Arce (1):
>   OMAP4:keypad: PM runtime
>
> Benoit Cousson (1):
>   OMAP4: hwmod data: Add keypad in the hwmod database
>
> Syed Rafiuddin (1):
>   OMAP4: keypad: Add the board support.
>
>  arch/arm/mach-omap2/board-4430sdp.c        |   89
> ++++++++++++++++++++++++++++
>  arch/arm/mach-omap2/devices.c              |   41 +++++++++++++
>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   70
++++++++++++++++++++++
>  drivers/input/keyboard/omap4-keypad.c      |    8 +++
>  4 files changed, 208 insertions(+), 0 deletions(-)

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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-08  8:30       ` Shubhrajyoti
  2011-02-11 17:18         ` Shubhrajyoti
@ 2011-02-19  3:07         ` Shubhrajyoti
  2011-02-19  5:31           ` Dmitry Torokhov
  1 sibling, 1 reply; 13+ messages in thread
From: Shubhrajyoti @ 2011-02-19  3:07 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Abraham Arce, Kevin Hilman, linux-omap

Hello Dmitry,
If there are no further comments.
Can it be queued?

With Regards,
Shubhro

On Tuesday 08 February 2011 02:00 PM, Shubhrajyoti wrote:
> Hello,
> Any comments/suggestions.
>
> Thanks,
>
> On Monday 27 December 2010 11:21 AM, shubhrajyoti@ti.com wrote:
>> From: Abraham Arce<x0066660@ti.com>
>>
>> Enable Runtime PM functionality in OMAP4 driver based on the 
>> following assumptions
>>
>> A minimal pm runtime get/put approach is implemented in probe/remove 
>> calls
>> respectively.
>>
>> - Keyboard controller in wakeup domain so it is always on and
>>    power impact may be minimal
>> - In OMAP4 the device control is at module/device level and ick/fclk 
>> level control is
>>    difficult so cutting of clocks will prevent interrupts.
>>
>> Signed-off-by: Abraham Arce<x0066660@ti.com>
>> Cc: Kevin Hilman<khilman@deeprootsystems.com>
>> Signed-off-by: Shubhrajyoti D<shubhrajyoti@ti.com>
>> ---
>>   drivers/input/keyboard/omap4-keypad.c |    8 ++++++++
>>   1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/keyboard/omap4-keypad.c 
>> b/drivers/input/keyboard/omap4-keypad.c
>> index 45bd097..fcfbb9b 100644
>> --- a/drivers/input/keyboard/omap4-keypad.c
>> +++ b/drivers/input/keyboard/omap4-keypad.c
>> @@ -29,6 +29,7 @@
>>   #include<linux/io.h>
>>   #include<linux/input.h>
>>   #include<linux/slab.h>
>> +#include<linux/pm_runtime.h>
>>
>>   #include<plat/omap4-keypad.h>
>>
>> @@ -239,6 +240,9 @@ static int __devinit omap4_keypad_probe(struct 
>> platform_device *pdev)
>>       matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
>>               input_dev->keycode, input_dev->keybit);
>>
>> +    pm_runtime_enable(&pdev->dev);
>> +    pm_runtime_get_sync(&pdev->dev);
>> +
>>       omap4_keypad_config(keypad_data);
>>
>>       error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
>> @@ -278,6 +282,10 @@ static int __devexit omap4_keypad_remove(struct 
>> platform_device *pdev)
>>       struct resource *res;
>>
>>       free_irq(keypad_data->irq, keypad_data);
>> +
>> +    pm_runtime_put_sync(&pdev->dev);
>> +    pm_runtime_disable(&pdev->dev);
>> +
>>       input_unregister_device(keypad_data->input);
>>
>>       iounmap(keypad_data->base);
>


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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-19  3:07         ` Shubhrajyoti
@ 2011-02-19  5:31           ` Dmitry Torokhov
       [not found]             ` <AANLkTikCmiSrOZb3WvMZHcxRsSRxd1zUsWE59aexHdeF@mail.gmail.com>
  2011-02-23 22:58             ` Tony Lindgren
  0 siblings, 2 replies; 13+ messages in thread
From: Dmitry Torokhov @ 2011-02-19  5:31 UTC (permalink / raw)
  To: Shubhrajyoti; +Cc: linux-input, Abraham Arce, Kevin Hilman, linux-omap

Hi Shubhrajyoti,

On Sat, Feb 19, 2011 at 08:37:15AM +0530, Shubhrajyoti wrote:
> Hello Dmitry,
> If there are no further comments.
> Can it be queued?

I normally try not to merge board code leaving it to arch owner. Can we
at least get arch/board maintainer ACKs on this?

Also, I am wondering, what is the utility of this patch? Without it,
as far as I understand, runtime PM is disabled for the device. With the
patch we enable runtime PM but immediately bump up usage count, thus
ensuring that the device is always powered on. So what changed? Or am I
missing something?

Thanks.

-- 
Dmitry

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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
       [not found]             ` <AANLkTikCmiSrOZb3WvMZHcxRsSRxd1zUsWE59aexHdeF@mail.gmail.com>
@ 2011-02-23  6:29               ` Dmitry Torokhov
  2011-02-23 14:19                 ` Shubhrajyoti
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2011-02-23  6:29 UTC (permalink / raw)
  To: Datta, Shubhrajyoti; +Cc: linux-input, Abraham Arce, Kevin Hilman, linux-omap

On Sat, Feb 19, 2011 at 01:44:32PM +0530, Datta, Shubhrajyoti wrote:
> On Sat, Feb 19, 2011 at 11:01 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com
> > wrote:
> 
> > Hi Shubhrajyoti,
> >
> > On Sat, Feb 19, 2011 at 08:37:15AM +0530, Shubhrajyoti wrote:
> > > Hello Dmitry,
> > > If there are no further comments.
> > > Can it be queued?
> >
> > I normally try not to merge board code leaving it to arch owner. Can we
> > at least get arch/board maintainer ACKs on this?
> >
> > Also, I am wondering, what is the utility of this patch? Without it,
> > as far as I understand, runtime PM is disabled for the device. With the
> > patch we enable runtime PM but immediately bump up usage count, thus
> > ensuring that the device is always powered on. So what changed? Or am I
> > missing something?
> >
> 
> After the hwmod changes the clocks are cut. So if it is not enabled then the
> device is not usable.
> 

OK, that makes sense. So since we are wiring up runtime PM I think we
should go a strep further and do it in open/close methods. Does the
patch below still work for you?

Thanks.

-- 
Dmitry

Input: omap4-keypad - wire up runtime PM handling

From: Abraham Arce <x0066660@ti.com>

Enable Runtime PM functionality in OMAP4 driver based on the following
assumptions:

- keyboard controller in wakeup domain so it is always on and power
  impact is minimal;
- in OMAP4 the device control is at module/device level and ick/fclk
  level control is difficult so cutting of clocks will prevent
  interrupts.

Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/keyboard/omap4-keypad.c |   74 +++++++++++++++++++++++++--------
 1 files changed, 55 insertions(+), 19 deletions(-)


diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 45bd097..c51a3c4 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -29,6 +29,7 @@
 #include <linux/io.h>
 #include <linux/input.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include <plat/omap4-keypad.h>
 
@@ -80,20 +81,6 @@ struct omap4_keypad {
 	unsigned short keymap[];
 };
 
-static void __devinit omap4_keypad_config(struct omap4_keypad *keypad_data)
-{
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
-}
-
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -144,6 +131,49 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static int omap4_keypad_open(struct input_dev *input)
+{
+	struct omap4_keypad *keypad_data = input_get_drvdata(input);
+
+	pm_runtime_get_sync(input->dev.parent);
+
+	disable_irq(keypad_data->irq);
+
+	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
+			keypad_data->base + OMAP4_KBD_CTRL);
+	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
+			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
+	__raw_writel(OMAP4_VAL_IRQDISABLE,
+			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
+			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
+			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+
+	enable_irq(keypad_data->irq);
+
+	return 0;
+}
+
+static void omap4_keypad_close(struct input_dev *input)
+{
+	struct omap4_keypad *keypad_data = input_get_drvdata(input);
+
+	disable_irq(keypad_data->irq);
+
+	/* Disable interrupts */
+	__raw_writel(OMAP4_VAL_IRQDISABLE,
+		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+
+	/* clear pending interrupts */
+	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
+			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+
+	enable_irq(keypad_data->irq);
+
+	pm_runtime_put_sync(input->dev.parent);
+}
+
 static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 {
 	const struct omap4_keypad_platform_data *pdata;
@@ -225,6 +255,9 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	input_dev->id.product = 0x0001;
 	input_dev->id.version = 0x0001;
 
+	input_dev->open = omap4_keypad_open;
+	input_dev->close = omap4_keypad_close;
+
 	input_dev->keycode	= keypad_data->keymap;
 	input_dev->keycodesize	= sizeof(keypad_data->keymap[0]);
 	input_dev->keycodemax	= max_keys;
@@ -239,8 +272,6 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
 			input_dev->keycode, input_dev->keybit);
 
-	omap4_keypad_config(keypad_data);
-
 	error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
 			     IRQF_TRIGGER_RISING,
 			     "omap4-keypad", keypad_data);
@@ -249,17 +280,19 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 		goto err_free_input;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+
 	error = input_register_device(keypad_data->input);
 	if (error < 0) {
 		dev_err(&pdev->dev, "failed to register input device\n");
-		goto err_free_irq;
+		goto err_pm_disable;
 	}
 
-
 	platform_set_drvdata(pdev, keypad_data);
 	return 0;
 
-err_free_irq:
+err_pm_disable:
+	pm_runtime_disable(&pdev->dev);
 	free_irq(keypad_data->irq, keypad_data);
 err_free_input:
 	input_free_device(input_dev);
@@ -278,6 +311,9 @@ static int __devexit omap4_keypad_remove(struct platform_device *pdev)
 	struct resource *res;
 
 	free_irq(keypad_data->irq, keypad_data);
+
+	pm_runtime_disable(&pdev->dev);
+
 	input_unregister_device(keypad_data->input);
 
 	iounmap(keypad_data->base);

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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-23  6:29               ` Dmitry Torokhov
@ 2011-02-23 14:19                 ` Shubhrajyoti
  0 siblings, 0 replies; 13+ messages in thread
From: Shubhrajyoti @ 2011-02-23 14:19 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Abraham Arce, Kevin Hilman, linux-omap

On Wednesday 23 February 2011 11:59 AM, Dmitry Torokhov wrote:
> On Sat, Feb 19, 2011 at 01:44:32PM +0530, Datta, Shubhrajyoti wrote:
>> On Sat, Feb 19, 2011 at 11:01 AM, Dmitry Torokhov<dmitry.torokhov@gmail.com
>>> wrote:
>>> Hi Shubhrajyoti,
>>>
>>> On Sat, Feb 19, 2011 at 08:37:15AM +0530, Shubhrajyoti wrote:
>>>> Hello Dmitry,
>>>> If there are no further comments.
>>>> Can it be queued?
>>> I normally try not to merge board code leaving it to arch owner. Can we
>>> at least get arch/board maintainer ACKs on this?
>>>
>>> Also, I am wondering, what is the utility of this patch? Without it,
>>> as far as I understand, runtime PM is disabled for the device. With the
>>> patch we enable runtime PM but immediately bump up usage count, thus
>>> ensuring that the device is always powered on. So what changed? Or am I
>>> missing something?
>>>
>> After the hwmod changes the clocks are cut. So if it is not enabled then the
>> device is not usable.
>>
> OK, that makes sense. So since we are wiring up runtime PM I think we
> should go a strep further and do it in open/close methods. Does the
> patch below still work for you?
Yes it works I did some basic  testinig it on omap4 sdp. Thanks
> Thanks.
>


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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-19  5:31           ` Dmitry Torokhov
       [not found]             ` <AANLkTikCmiSrOZb3WvMZHcxRsSRxd1zUsWE59aexHdeF@mail.gmail.com>
@ 2011-02-23 22:58             ` Tony Lindgren
  2011-02-23 23:12               ` Dmitry Torokhov
  1 sibling, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2011-02-23 22:58 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Shubhrajyoti, linux-input, Abraham Arce, Kevin Hilman, linux-omap

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [110218 21:29]:
> Hi Shubhrajyoti,
> 
> On Sat, Feb 19, 2011 at 08:37:15AM +0530, Shubhrajyoti wrote:
> > Hello Dmitry,
> > If there are no further comments.
> > Can it be queued?
> 
> I normally try not to merge board code leaving it to arch owner. Can we
> at least get arch/board maintainer ACKs on this?

The omap4 hwmod data should be now queued so that patch needs
to be refreshed to just uncomment omap44xx_kbd_hwmod entry
in what we have queued up in the omap tree.

To avoid conflicts there it's probably best that I take the
arch/arm/*omap*/* patches.

Patch 3/3 should not do anything until the hwmod changes
are merged, so Dmitry can you please take that one?

Regards,

Tony

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

* Re: [PATCH v8 3/3] OMAP4:keypad: PM runtime
  2011-02-23 22:58             ` Tony Lindgren
@ 2011-02-23 23:12               ` Dmitry Torokhov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Torokhov @ 2011-02-23 23:12 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Shubhrajyoti, linux-input, Abraham Arce, Kevin Hilman, linux-omap

On Wed, Feb 23, 2011 at 02:58:18PM -0800, Tony Lindgren wrote:
> * Dmitry Torokhov <dmitry.torokhov@gmail.com> [110218 21:29]:
> > Hi Shubhrajyoti,
> > 
> > On Sat, Feb 19, 2011 at 08:37:15AM +0530, Shubhrajyoti wrote:
> > > Hello Dmitry,
> > > If there are no further comments.
> > > Can it be queued?
> > 
> > I normally try not to merge board code leaving it to arch owner. Can we
> > at least get arch/board maintainer ACKs on this?
> 
> The omap4 hwmod data should be now queued so that patch needs
> to be refreshed to just uncomment omap44xx_kbd_hwmod entry
> in what we have queued up in the omap tree.
> 
> To avoid conflicts there it's probably best that I take the
> arch/arm/*omap*/* patches.
> 
> Patch 3/3 should not do anything until the hwmod changes
> are merged, so Dmitry can you please take that one?
> 

OK, I'll queue it for .39.

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2011-02-23 23:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-27  5:51 [PATCH 0/3]OMAP4: Keypad support shubhrajyoti
2010-12-27  5:51 ` [PATCH v8 1/3] OMAP4: hwmod data: Add keypad in the hwmod database shubhrajyoti
2010-12-27  5:51   ` [PATCH v8 2/3] OMAP4: keypad: Add the board support shubhrajyoti
2010-12-27  5:51     ` [PATCH v8 3/3] OMAP4:keypad: PM runtime shubhrajyoti
2011-02-08  8:30       ` Shubhrajyoti
2011-02-11 17:18         ` Shubhrajyoti
2011-02-19  3:07         ` Shubhrajyoti
2011-02-19  5:31           ` Dmitry Torokhov
     [not found]             ` <AANLkTikCmiSrOZb3WvMZHcxRsSRxd1zUsWE59aexHdeF@mail.gmail.com>
2011-02-23  6:29               ` Dmitry Torokhov
2011-02-23 14:19                 ` Shubhrajyoti
2011-02-23 22:58             ` Tony Lindgren
2011-02-23 23:12               ` Dmitry Torokhov
2011-02-15  9:41 ` [PATCH 0/3]OMAP4: Keypad support Shubhrajyoti Datta

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).