From: Rebecca Schultz Zavin Date: Tue, 14 Dec 2010 22:29:57 +0000 (-0800) Subject: input: touchscreen: Add regulator to qtouch driver X-Git-Tag: firefly_0821_release~9834^2~247 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=86f2fcf324f2391771c53092981d4bfcba7219a2;p=firefly-linux-kernel-4.4.55.git input: touchscreen: Add regulator to qtouch driver Change-Id: Ic2461309a9c7b6a6162c4e5fb9b67b6828369938 Signed-off-by: Rebecca Schultz Zavin --- diff --git a/drivers/input/touchscreen/qtouch_obp_ts.c b/drivers/input/touchscreen/qtouch_obp_ts.c index d45a6e083c17..915471b53c4f 100644 --- a/drivers/input/touchscreen/qtouch_obp_ts.c +++ b/drivers/input/touchscreen/qtouch_obp_ts.c @@ -29,6 +29,7 @@ #include #include #include +#include #define IGNORE_CHECKSUM_MISMATCH @@ -101,6 +102,8 @@ struct qtouch_ts_data { * MUST enforce that there is no concurrent access to msg_buf. */ uint8_t *msg_buf; int msg_size; + + struct regulator *regulator; }; #ifdef CONFIG_HAS_EARLYSUSPEND @@ -1819,6 +1822,10 @@ finish_touch_setup: goto err_create_fw_version_file_failed; } + ts->regulator = regulator_get(&ts->client->dev, "vio"); + if (!IS_ERR_OR_NULL(ts->regulator)) + regulator_enable(ts->regulator); + #ifdef CONFIG_HAS_EARLYSUSPEND ts->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 1; ts->early_suspend.suspend = qtouch_ts_early_suspend; @@ -1851,6 +1858,9 @@ static int qtouch_ts_remove(struct i2c_client *client) { struct qtouch_ts_data *ts = i2c_get_clientdata(client); + if (!IS_ERR_OR_NULL(ts->regulator)) + regulator_put(ts->regulator); + device_remove_file(&ts->client->dev, &dev_attr_irq_enable); device_remove_file(&ts->client->dev, &dev_attr_update_status); device_remove_file(&ts->client->dev, &dev_attr_fw_version); @@ -1891,6 +1901,9 @@ static int qtouch_ts_suspend(struct i2c_client *client, pm_message_t mesg) if (ts->pdata->hw_suspend) ts->pdata->hw_suspend(1); + if (!IS_ERR_OR_NULL(ts->regulator)) + regulator_disable(ts->regulator); + return 0; } @@ -1910,6 +1923,9 @@ static int qtouch_ts_resume(struct i2c_client *client) if (ts->mode == 1) return -EBUSY; + if (!IS_ERR_OR_NULL(ts->regulator)) + regulator_enable(ts->regulator); + if (ts->pdata->hw_suspend) ts->pdata->hw_suspend(0);