summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhou Jingyu <b02241@freescale.com>2011-05-12 13:21:36 +0800
committerZhou Jingyu <b02241@freescale.com>2011-05-12 18:42:52 +0800
commit4e2a89449dfc80b78533e35f670b98f09f3c95ab (patch)
tree38eedbbc788ae99ebb92766b094e91fb16323144
parent99a218e876a3a4831ec121fdff0e2b4e39408eda (diff)
ENGR00143239-1 MX53: add power off and reset function
add power off interface for da9053 Signed-off-by: Zhou Jingyu <Jingyu.Zhou@freescale.com>
-rw-r--r--drivers/mfd/da9052-core.c18
-rw-r--r--include/linux/mfd/da9052/da9052.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 68e8393a455f..a9b620320902 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)
{
@@ -499,6 +500,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;
}
@@ -515,6 +517,22 @@ void da9052_ssc_exit(struct da9052 *da9052)
return;
}
+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);
+}
+
MODULE_AUTHOR("Dialog Semiconductor Ltd <dchen@diasemi.com>");
MODULE_DESCRIPTION("DA9052 MFD Core");
MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 6070696b658d..0ff9693ee387 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -225,4 +225,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 */