From: Sanjeev Premi <premi@ti.com>
To: linux-omap@vger.kernel.org
Cc: Sanjeev Premi <premi@ti.com>
Subject: [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume
Date: Thu, 4 Feb 2010 21:36:49 +0530 [thread overview]
Message-ID: <1265299609-30087-1-git-send-email-premi@ti.com> (raw)
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
next reply other threads:[~2010-02-04 16:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 16:06 Sanjeev Premi [this message]
2010-02-04 21:48 ` [PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume Kevin Hilman
2010-02-05 7:58 ` Premi, Sanjeev
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=1265299609-30087-1-git-send-email-premi@ti.com \
--to=premi@ti.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox