aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chen <b02280@freescale.com>2011-05-25 18:36:03 +0800
committerEric Miao <eric.miao@linaro.org>2011-05-27 21:11:30 +0800
commit0adde3c3d8bd67aa17b21cd9386759559885a613 (patch)
treee5e20bd922f39253bfb3bb3646846382b1a728ef
parent8ee59be38f87bd49562248f4366e09479dcdaaf8 (diff)
downloadlinux-linaro-natty-0adde3c3d8bd67aa17b21cd9386759559885a613.tar.gz
LINARO: MX53: add pmic poweroff support
BugLink: http://bugs.launchpad.net/bugs/738217 Signed-off-by: Jason Chen <jason.chen@linaro.org> Signed-off-by: Eric Miao <eric.miao@linaro.org>
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c3
-rw-r--r--drivers/mfd/da9052-core.c18
-rw-r--r--include/linux/mfd/da9052/da9052.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index b12ce22883f9..740fb6b8021c 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -28,6 +28,7 @@
#include <linux/pwm_backlight.h>
#include <linux/ahci_platform.h>
#include <linux/gpio_keys.h>
+#include <linux/mfd/da9052/da9052.h>
#include <mach/common.h>
#include <mach/hardware.h>
@@ -774,6 +775,8 @@ static void __init mx53_loco_board_init(void)
* during boot, even if SCC2 driver is not part of the image
*/
imx53_add_mxc_scc2();
+
+ pm_power_off = da9053_power_off;
}
static void __init mx53_loco_timer_init(void)
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 9290831f26b8..d6e47df58fc7 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -34,6 +34,7 @@ struct da9052_eh_nb eve_nb_array[EVE_CNT];
static struct da9052_ssc_ops ssc_ops;
struct mutex manconv_lock;
static struct semaphore eve_nb_array_lock;
+static struct da9052 *da9052_data;
void da9052_lock(struct da9052 *da9052)
{
@@ -370,6 +371,22 @@ static void da9052_eh_restore_irq(struct da9052 *da9052)
free_irq(da9052->irq, NULL);
}
+void da9053_power_off(void)
+{
+ struct da9052_ssc_msg ssc_msg;
+ if (!da9052_data)
+ return;
+
+ ssc_msg.addr = DA9052_CONTROLB_REG;
+ da9052_data->read(da9052_data, &ssc_msg);
+ ssc_msg.data |= DA9052_CONTROLB_SHUTDOWN;
+ pr_info("da9052 shutdown: DA9052_CONTROLB_REG=%x\n", ssc_msg.data);
+ da9052_data->write(da9052_data, &ssc_msg);
+ ssc_msg.addr = DA9052_GPID9_REG;
+ ssc_msg.data = 0;
+ da9052_data->read(da9052_data, &ssc_msg);
+}
+
static int da9052_add_subdevice_pdata(struct da9052 *da9052,
const char *name, void *pdata, size_t pdata_size)
{
@@ -512,6 +529,7 @@ int da9052_ssc_init(struct da9052 *da9052)
DA9052_EH_DEVICE_NAME, da9052))
return -EIO;
enable_irq_wake(da9052->irq);
+ da9052_data = da9052;
return 0;
}
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index fd83f73bcd82..c477023e2f8c 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -206,4 +206,5 @@ int eh_register_nb(struct da9052 *da9052, struct da9052_eh_nb *nb);
int eh_unregister_nb(struct da9052 *da9052, struct da9052_eh_nb *nb);
int da9052_manual_read(struct da9052 *da9052,
unsigned char channel);
+void da9053_power_off(void);
#endif /* __LINUX_MFD_DA9052_DA9052_H */