diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-2.6.39/sakoman/0018-Add-power-off-support-for-the-TWL4030-companion.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-2.6.39/sakoman/0018-Add-power-off-support-for-the-TWL4030-companion.patch | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-2.6.39/sakoman/0018-Add-power-off-support-for-the-TWL4030-companion.patch b/extras/recipes-kernel/linux/linux-omap-2.6.39/sakoman/0018-Add-power-off-support-for-the-TWL4030-companion.patch new file mode 100644 index 00000000..30860275 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-2.6.39/sakoman/0018-Add-power-off-support-for-the-TWL4030-companion.patch | |||
@@ -0,0 +1,103 @@ | |||
1 | From 8c257a6e7460ceb8c899980f7dad701ceb619adc Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Bernhard=20W=C3=B6rndl-Aichriedler?= <bwa@xdevelop.at> | ||
3 | Date: Sat, 15 May 2010 16:34:05 +0200 | ||
4 | Subject: [PATCH 18/32] Add power-off support for the TWL4030 companion | ||
5 | |||
6 | This patch adds support for the power-off on shutdown feature of the TWL4030 | ||
7 | --- | ||
8 | drivers/mfd/Kconfig | 6 ++++++ | ||
9 | drivers/mfd/twl-core.c | 40 ++++++++++++++++++++++++++++++++++++++++ | ||
10 | 2 files changed, 46 insertions(+), 0 deletions(-) | ||
11 | |||
12 | diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig | ||
13 | index 3ed3ff0..fe2370a 100644 | ||
14 | --- a/drivers/mfd/Kconfig | ||
15 | +++ b/drivers/mfd/Kconfig | ||
16 | @@ -210,6 +210,12 @@ config TWL4030_CODEC | ||
17 | select MFD_CORE | ||
18 | default n | ||
19 | |||
20 | +config TWL4030_POWEROFF | ||
21 | + bool "TWL4030 Allow power-off on shutdown" | ||
22 | + depends on TWL4030_CORE | ||
23 | + help | ||
24 | + Enables the CPU to power-off the system on shutdown | ||
25 | + | ||
26 | config TWL6030_PWM | ||
27 | tristate "TWL6030 PWM (Pulse Width Modulator) Support" | ||
28 | depends on TWL4030_CORE | ||
29 | diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c | ||
30 | index 960b5be..8804550 100644 | ||
31 | --- a/drivers/mfd/twl-core.c | ||
32 | +++ b/drivers/mfd/twl-core.c | ||
33 | @@ -122,6 +122,12 @@ | ||
34 | #define twl_has_bci() false | ||
35 | #endif | ||
36 | |||
37 | +#if defined (CONFIG_TWL4030_POWEROFF) | ||
38 | +#define twl_has_poweroff() true | ||
39 | +#else | ||
40 | +#define twl_has_poweroff() false | ||
41 | +#endif | ||
42 | + | ||
43 | /* Triton Core internal information (BEGIN) */ | ||
44 | |||
45 | /* Last - for index max*/ | ||
46 | @@ -224,6 +230,10 @@ | ||
47 | #define TWL5031 BIT(2) /* twl5031 has different registers */ | ||
48 | #define TWL6030_CLASS BIT(3) /* TWL6030 class */ | ||
49 | |||
50 | +/* for pm_power_off */ | ||
51 | +#define PWR_P1_SW_EVENTS 0x10 | ||
52 | +#define PWR_DEVOFF (1 << 0) | ||
53 | + | ||
54 | /*----------------------------------------------------------------------*/ | ||
55 | |||
56 | /* is driver active, bound to a chip? */ | ||
57 | @@ -1006,6 +1016,30 @@ static int twl_remove(struct i2c_client *client) | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | +static void twl_poweroff(void) | ||
62 | +{ | ||
63 | + int err; | ||
64 | + u8 val; | ||
65 | + | ||
66 | + err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &val, | ||
67 | + PWR_P1_SW_EVENTS); | ||
68 | + if (err) { | ||
69 | + pr_err("%s: i2c error %d while reading TWL4030" | ||
70 | + "PM_MASTER P1_SW_EVENTS\n", | ||
71 | + DRIVER_NAME, err); | ||
72 | + return; | ||
73 | + } | ||
74 | + | ||
75 | + val |= PWR_DEVOFF; | ||
76 | + | ||
77 | + err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, val, | ||
78 | + PWR_P1_SW_EVENTS); | ||
79 | + if (err) | ||
80 | + pr_err("%s: i2c error %d while writing TWL4030" | ||
81 | + "PM_MASTER P1_SW_EVENTS\n", | ||
82 | + DRIVER_NAME, err); | ||
83 | +} | ||
84 | + | ||
85 | /* NOTE: this driver only handles a single twl4030/tps659x0 chip */ | ||
86 | static int __devinit | ||
87 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
88 | @@ -1093,6 +1127,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
89 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); | ||
90 | } | ||
91 | |||
92 | + if(twl_has_poweroff()) | ||
93 | + { | ||
94 | + /* initialize pm_power_off routine */ | ||
95 | + pm_power_off = twl_poweroff; | ||
96 | + } | ||
97 | + | ||
98 | status = add_children(pdata, id->driver_data); | ||
99 | fail: | ||
100 | if (status < 0) | ||
101 | -- | ||
102 | 1.6.6.1 | ||
103 | |||