summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajagopala V <rajagopala.v@stericsson.com>2011-08-25 16:57:56 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:03:33 +0200
commita0d47f3a38d5bf1edc679f401084b15e5498bc09 (patch)
tree0bdde03ab2b07be5446c2900c6fcbf1c3388dc2a
parent2b236e95ab8c997ed2bce09dac25cf5f7751a1ab (diff)
u5500: ponkey: shutdown time configuration
support for compile time configuration of poweron key shutdown time. Default is 10sec and can be set to 5sec or disabled ST-Ericsson Linux next: NA ST-Ericsson ID: WP257125 ST-Ericsson FOSS-OUT ID: NA Change-Id: I7fbf57d21ff218370dba24182716222c354f4dc5 Signed-off-by: Rajagopala V <rajagopala.v@stericsson.com Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/28430 Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com> Tested-by: Rajagopala VENKATARAVANAPPA X <rajagopala.v@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> Signed-off-by: Robert Marklund <robert.marklund@stericsson.com>
-rw-r--r--drivers/input/misc/ab8500-ponkey.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
index a6ade3aaf14..60471ba3086 100644
--- a/drivers/input/misc/ab8500-ponkey.c
+++ b/drivers/input/misc/ab8500-ponkey.c
@@ -13,15 +13,28 @@
#include <linux/interrupt.h>
#include <linux/mfd/abx500/ab8500.h>
#include <linux/slab.h>
+#include <linux/mfd/abx500.h>
+
+/* Ponkey time control bits */
+#define AB5500_MCB 0x2F
+#define AB5500_PONKEY_10SEC 0x0
+#define AB5500_PONKEY_5SEC 0x1
+#define AB5500_PONKEY_DISABLE 0x2
+#define AB5500_PONKEY_TMR_MASK 0x1
+#define AB5500_PONKEY_TR_MASK 0x2
+
+static int ab5500_ponkey_hw_init(struct platform_device *);
struct ab8500_ponkey_variant {
const char *irq_falling;
const char *irq_rising;
+ int (*hw_init)(struct platform_device *);
};
static const struct ab8500_ponkey_variant ab5500_onswa = {
.irq_falling = "ONSWAn_falling",
.irq_rising = "ONSWAn_rising",
+ .hw_init = ab5500_ponkey_hw_init,
};
static const struct ab8500_ponkey_variant ab8500_ponkey = {
@@ -41,6 +54,37 @@ struct ab8500_ponkey_info {
int irq_dbr;
};
+static int ab5500_ponkey_hw_init(struct platform_device *pdev)
+{
+ u8 val;
+ struct ab5500_ponkey_platform_data *pdata;
+
+ pdata = pdev->dev.platform_data;
+ if (pdata) {
+ switch (pdata->shutdown_secs) {
+ case 0:
+ val = AB5500_PONKEY_DISABLE;
+ break;
+ case 5:
+ val = AB5500_PONKEY_5SEC;
+ break;
+ case 10:
+ val = AB5500_PONKEY_10SEC;
+ break;
+ default:
+ val = AB5500_PONKEY_10SEC;
+ }
+ } else {
+ val = AB5500_PONKEY_10SEC;
+ }
+ return abx500_mask_and_set(
+ &pdev->dev,
+ AB5500_BANK_STARTUP,
+ AB5500_MCB,
+ AB5500_PONKEY_TMR_MASK | AB5500_PONKEY_TR_MASK,
+ val);
+}
+
/* AB8500 gives us an interrupt when ONKEY is held */
static irqreturn_t ab8500_ponkey_handler(int irq, void *data)
{
@@ -65,6 +109,14 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev)
variant = (const struct ab8500_ponkey_variant *)
pdev->id_entry->driver_data;
+ if (variant->hw_init) {
+ ret = variant->hw_init(pdev);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Failed to init hw");
+ return ret;
+ }
+ }
+
irq_dbf = platform_get_irq_byname(pdev, variant->irq_falling);
if (irq_dbf < 0) {
dev_err(&pdev->dev, "No IRQ for %s: %d\n",