Skip to contentSkip to conversation

twl4030: keypad: Hooks for board specific suspend-resume

PATCH In review Sanjeev Premi 2 participants 3 messages Feb 4, 2010 – Feb 5, 2010 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 twl4030: keypad: Hooks for board specific suspend-resume

This patch adds hooks to support board specific implementation during the suspend and resume operations.

The TWL4030 can be connected to multiple boards. Without these hooks, board specific macros will be required in a generic driver.

---
 drivers/input/keyboard/twl4030_keypad.c |   10 ++++++++++
 include/linux/i2c/twl.h                 |   12 ++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
drivers/input/keyboard/twl4030_keypad.c +10 -0
index af0651d..9950d7e 100644
@@ -442,11 +442,21 @@ static int __devexit twl4030_kp_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
 {
+	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
+
+	if (pdata->on_suspend)
+		pdata->on_suspend(pdata->pm_state);
+
 	return 0;
 }
 
 static int twl4030_kp_resume(struct platform_device *pdev)
 {
+	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
+
+	if (pdata->on_resume)
+		pdata->on_resume(pdata->pm_state);
+
 	return 0;
 }
 #else
include/linux/i2c/twl.h +12 -0
index bf1c5be..eefabf2 100644
@@ -487,6 +487,18 @@ struct twl4030_keypad_data {
 	unsigned rows;
 	unsigned cols;
 	bool rep;
+#ifdef CONFIG_PM
+	/*
+	 * Board specific information required during suspend, resume.
+	 * E.g. configuration as wake-up source.
+	 */
+	void *pm_state;
+	/*
+	 * Hooks for board specific execution during suspend, resume.
+	 */
+	void (*on_suspend)(void *pstate);
+	void (*on_resume)(void *pstate);
+#endif
 };
 
 enum twl4030_usb_mode {
Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 8 lines · Sanjeev Premi

This patch adds hooks to support board specific implementation during the suspend and resume operations.

The TWL4030 can be connected to multiple boards. Without these hooks, board specific macros will be required in a generic driver.

Looks ok, but I think you should drop the 'on_' prefix in function pointer names.

Kevin

Quoted 61 lines
---
 drivers/input/keyboard/twl4030_keypad.c |   10 ++++++++++
 include/linux/i2c/twl.h                 |   12 ++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
drivers/input/keyboard/twl4030_keypad.c +10 -0
index af0651d..9950d7e 100644
@@ -442,11 +442,21 @@ static int __devexit twl4030_kp_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
 {
+	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
+
+	if (pdata->on_suspend)
+		pdata->on_suspend(pdata->pm_state);
+
 	return 0;
 }
 
 static int twl4030_kp_resume(struct platform_device *pdev)
 {
+	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
+
+	if (pdata->on_resume)
+		pdata->on_resume(pdata->pm_state);
+
 	return 0;
 }
 #else
include/linux/i2c/twl.h +12 -0
index bf1c5be..eefabf2 100644
@@ -487,6 +487,18 @@ struct twl4030_keypad_data {
 	unsigned rows;
 	unsigned cols;
 	bool rep;
+#ifdef CONFIG_PM
+	/*
+	 * Board specific information required during suspend, resume.
+	 * E.g. configuration as wake-up source.
+	 */
+	void *pm_state;
+	/*
+	 * Hooks for board specific execution during suspend, resume.
+	 */
+	void (*on_suspend)(void *pstate);
+	void (*on_resume)(void *pstate);
+#endif
 };
 
 enum twl4030_usb_mode {
Signature · 6 lines
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 17 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Friday, February 05, 2010 3:19 AM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume

Quoted 7 lines · Sanjeev Premi

This patch adds hooks to support board specific implementation during the suspend and resume operations.

The TWL4030 can be connected to multiple boards. Without these hooks, board specific macros will be required in a generic driver.

Quoted 7 lines
Quoted 1 line

Looks ok, but I think you should drop the 'on_' prefix in function pointer names.

Kevin

Will re-submit this patch after change.

~sanjeev

[snip]--[snip]