diff options
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/abx500-accdet.c | 11 | ||||
-rw-r--r-- | drivers/input/misc/lps001wp_prs.c | 36 |
2 files changed, 32 insertions, 15 deletions
diff --git a/drivers/input/misc/abx500-accdet.c b/drivers/input/misc/abx500-accdet.c index b0879b6c96a..6ce49c7f682 100644 --- a/drivers/input/misc/abx500-accdet.c +++ b/drivers/input/misc/abx500-accdet.c @@ -53,9 +53,9 @@ #define ACCESSORY_CVIDEO_DET_VOL_MAX 105 #define ACCESSORY_CARKIT_DET_VOL_MIN 1100 #define ACCESSORY_CARKIT_DET_VOL_MAX 1300 -#define ACCESSORY_HEADSET_DET_VOL_MIN 0 -#define ACCESSORY_HEADSET_DET_VOL_MAX 200 -#define ACCESSORY_OPENCABLE_DET_VOL_MIN 1730 +#define ACCESSORY_HEADSET_DET_VOL_MIN 1301 +#define ACCESSORY_HEADSET_DET_VOL_MAX 2000 +#define ACCESSORY_OPENCABLE_DET_VOL_MIN 2001 #define ACCESSORY_OPENCABLE_DET_VOL_MAX 2150 @@ -522,8 +522,6 @@ static int detect_hw(struct abx500_ad *dd, status = dd->detect_plugged_in(dd); break; case JACK_TYPE_CARKIT: - dd->config_hw_test_basic_carkit(dd, 1); - /* flow through.. */ case JACK_TYPE_HEADPHONE: case JACK_TYPE_CVIDEO: case JACK_TYPE_HEADSET: @@ -550,6 +548,8 @@ static enum accessory_jack_type detect(struct abx500_ad *dd, int i; accessory_regulator_enable(dd, REGULATOR_VAUDIO | REGULATOR_AVSWITCH); + /* enable the VAMIC1 regulator */ + dd->config_hw_test_basic_carkit(dd, 0); for (i = 0; i < ARRAY_SIZE(detect_ops); ++i) { if (detect_hw(dd, &detect_ops[i])) { @@ -559,7 +559,6 @@ static enum accessory_jack_type detect(struct abx500_ad *dd, } } - dd->config_hw_test_basic_carkit(dd, 0); dd->config_hw_test_plug_connected(dd, 0); if (jack_supports_buttons(type)) diff --git a/drivers/input/misc/lps001wp_prs.c b/drivers/input/misc/lps001wp_prs.c index 9ec96ba3863..cb60762ac61 100644 --- a/drivers/input/misc/lps001wp_prs.c +++ b/drivers/input/misc/lps001wp_prs.c @@ -46,6 +46,7 @@ #include <linux/input.h> #include <linux/workqueue.h> #include <linux/device.h> +#include <linux/regulator/consumer.h> #include <linux/input/lps001wp.h> @@ -164,6 +165,8 @@ struct lps001wp_prs_data { u8 resume_state[RESUME_ENTRIES]; + struct regulator *regulator; + #ifdef DEBUG u8 reg_addr; #endif @@ -380,10 +383,13 @@ static void lps001wp_prs_device_power_off(struct lps001wp_prs_data *prs) if (err < 0) dev_err(&prs->client->dev, "soft power off failed: %d\n", err); - if (prs->pdata->power_off) { - prs->pdata->power_off(); - prs->hw_initialized = 0; + /* disable regulator */ + if (prs->regulator) { + err = regulator_disable(prs->regulator); + if (err < 0) + dev_err(&prs->client->dev, "failed to disable regulator\n"); } + if (prs->hw_initialized) { prs->hw_initialized = 0; } @@ -394,15 +400,23 @@ static int lps001wp_prs_device_power_on(struct lps001wp_prs_data *prs) { int err = -1; - if (prs->pdata->power_on) { - err = prs->pdata->power_on(); - if (err < 0) { - dev_err(&prs->client->dev, - "power_on failed: %d\n", err); - return err; + /* get the regulator the first time */ + if (!prs->regulator) { + prs->regulator = regulator_get(&prs->client->dev, "vdd"); + if (IS_ERR(prs->regulator)) { + dev_err(&prs->client->dev, "failed to get regulator\n"); + prs->regulator = NULL; + return PTR_ERR(prs->regulator); } } + /* enable it also */ + err = regulator_enable(prs->regulator); + if (err < 0) { + dev_err(&prs->client->dev, "failed to enable regulator\n"); + return err; + } + if (!prs->hw_initialized) { err = lps001wp_prs_hw_init(prs); if (prs->hw_working == 1 && err < 0) { @@ -1210,6 +1224,10 @@ static int __devexit lps001wp_prs_remove(struct i2c_client *client) if (prs->pdata->exit) prs->pdata->exit(); + + if (prs->regulator) + regulator_put(prs->regulator); + kfree(prs->pdata); kfree(prs); |