public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume
@ 2010-02-04 16:06 Sanjeev Premi
  2010-02-04 21:48 ` Kevin Hilman
  0 siblings, 1 reply; 3+ messages in thread
From: Sanjeev Premi @ 2010-02-04 16:06 UTC (permalink / raw)
  To: linux-omap; +Cc: 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.

Signed-off-by: Sanjeev Premi <premi@ti.com>
---
 drivers/input/keyboard/twl4030_keypad.c |   10 ++++++++++
 include/linux/i2c/twl.h                 |   12 ++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index af0651d..9950d7e 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -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
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index bf1c5be..eefabf2 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -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 {
-- 
1.6.2.2


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

* Re: [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume
  2010-02-04 16:06 [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume Sanjeev Premi
@ 2010-02-04 21:48 ` Kevin Hilman
  2010-02-05  7:58   ` Premi, Sanjeev
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hilman @ 2010-02-04 21:48 UTC (permalink / raw)
  To: Sanjeev Premi; +Cc: linux-omap

Sanjeev Premi <premi@ti.com> writes:

> 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.
>
> Signed-off-by: Sanjeev Premi <premi@ti.com>

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

Kevin

> ---
>  drivers/input/keyboard/twl4030_keypad.c |   10 ++++++++++
>  include/linux/i2c/twl.h                 |   12 ++++++++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
> index af0651d..9950d7e 100644
> --- a/drivers/input/keyboard/twl4030_keypad.c
> +++ b/drivers/input/keyboard/twl4030_keypad.c
> @@ -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
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index bf1c5be..eefabf2 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -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 {
> -- 
> 1.6.2.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume
  2010-02-04 21:48 ` Kevin Hilman
@ 2010-02-05  7:58   ` Premi, Sanjeev
  0 siblings, 0 replies; 3+ messages in thread
From: Premi, Sanjeev @ 2010-02-05  7:58 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@deeprootsystems.com] 
> Sent: Friday, February 05, 2010 3:19 AM
> To: Premi, Sanjeev
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [PATCH 2/3] twl4030: keypad: Hooks for board 
> specific suspend-resume
> 
> Sanjeev Premi <premi@ti.com> writes:
> 
> > 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.
> >
> > Signed-off-by: Sanjeev Premi <premi@ti.com>
> 
> 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]

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

end of thread, other threads:[~2010-02-05  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04 16:06 [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume Sanjeev Premi
2010-02-04 21:48 ` Kevin Hilman
2010-02-05  7:58   ` Premi, Sanjeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox