diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2012-02-14 07:46:48 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:06:11 +0200 |
commit | 22ba5f9e665f148206927e4626ca84c00409b8ca (patch) | |
tree | de90fce397c1e393961bdf0f5aca731d8a776e0b | |
parent | af4ffb547c27243bb50f2ac8862251c61817c233 (diff) |
lsm303dlh: add support for Android early suspend
Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
-rw-r--r-- | drivers/hwmon/lsm303dlh_a.c | 13 | ||||
-rw-r--r-- | drivers/hwmon/lsm303dlh_m.c | 10 |
2 files changed, 18 insertions, 5 deletions
diff --git a/drivers/hwmon/lsm303dlh_a.c b/drivers/hwmon/lsm303dlh_a.c index 84a4a76b9ab..a6e724facc3 100644 --- a/drivers/hwmon/lsm303dlh_a.c +++ b/drivers/hwmon/lsm303dlh_a.c @@ -38,6 +38,9 @@ #endif #include <linux/lsm303dlh.h> +#ifdef CONFIG_HAS_EARLYSUSPEND +#include <linux/earlysuspend.h> +#endif #include <linux/regulator/consumer.h> /* lsm303dlh accelerometer registers */ @@ -199,6 +202,9 @@ struct lsm303dlh_a_data { unsigned char interrupt_configure[2]; unsigned char interrupt_duration[2]; unsigned char interrupt_threshold[2]; +#ifdef CONFIG_HAS_EARLYSUSPEND + struct early_suspend early_suspend; +#endif int device_status; int id; }; @@ -289,6 +295,7 @@ static int lsm303dlh_a_restore(struct lsm303dlh_a_data *ddata) if (ddata->regulator) regulator_enable(ddata->regulator); + /* BDU should be enabled by default/recommened */ reg = ddata->range; reg |= LSM303DLH_A_CR4_BDU_MASK; @@ -1340,9 +1347,9 @@ static struct i2c_driver lsm303dlh_a_driver = { .id_table = lsm303dlh_a_id, .driver = { .name = "lsm303dlh_a", - #if (!defined(CONFIG_HAS_EARLYSUSPEND) && defined(CONFIG_PM)) - .pm = &lsm303dlh_a_dev_pm_ops, - #endif +#if (!defined(CONFIG_HAS_EARLYSUSPEND) && defined(CONFIG_PM)) + .pm = &lsm303dlh_a_dev_pm_ops, +#endif }, }; diff --git a/drivers/hwmon/lsm303dlh_m.c b/drivers/hwmon/lsm303dlh_m.c index 52f71ae6e96..11815e3470f 100644 --- a/drivers/hwmon/lsm303dlh_m.c +++ b/drivers/hwmon/lsm303dlh_m.c @@ -39,6 +39,9 @@ #include <linux/lsm303dlh.h> #include <linux/regulator/consumer.h> +#ifdef CONFIG_HAS_EARLYSUSPEND +#include <linux/earlysuspend.h> +#endif #include <linux/kernel.h> /* lsm303dlh magnetometer registers */ @@ -164,6 +167,9 @@ struct lsm303dlh_m_data { unsigned char mode; unsigned char rate; unsigned char range; +#ifdef CONFIG_HAS_EARLYSUSPEND + struct early_suspend early_suspend; +#endif int device_status; }; @@ -894,9 +900,9 @@ static struct i2c_driver lsm303dlh_m_driver = { .id_table = lsm303dlh_m_id, .driver = { .name = "lsm303dlh_m", - #if (!defined(CONFIG_HAS_EARLYSUSPEND) && defined(CONFIG_PM)) +#if (!defined(CONFIG_HAS_EARLYSUSPEND) && defined(CONFIG_PM)) .pm = &lsm303dlh_m_dev_pm_ops, - #endif +#endif }, }; |