Input: bu21013_ts - added regulator support
Add regulator support in ROHM BU21013 touch panel driver. Signed-off-by: Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Родитель
d2763b4f44
Коммит
81e78deafb
|
@ -12,6 +12,7 @@
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/input/bu21013.h>
|
#include <linux/input/bu21013.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/regulator/consumer.h>
|
||||||
|
|
||||||
#define PEN_DOWN_INTR 0
|
#define PEN_DOWN_INTR 0
|
||||||
#define MAX_FINGERS 2
|
#define MAX_FINGERS 2
|
||||||
|
@ -139,6 +140,7 @@
|
||||||
* @chip: pointer to the touch panel controller
|
* @chip: pointer to the touch panel controller
|
||||||
* @in_dev: pointer to the input device structure
|
* @in_dev: pointer to the input device structure
|
||||||
* @intr_pin: interrupt pin value
|
* @intr_pin: interrupt pin value
|
||||||
|
* @regulator: pointer to the Regulator used for touch screen
|
||||||
*
|
*
|
||||||
* Touch panel device data structure
|
* Touch panel device data structure
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +151,7 @@ struct bu21013_ts_data {
|
||||||
const struct bu21013_platform_device *chip;
|
const struct bu21013_platform_device *chip;
|
||||||
struct input_dev *in_dev;
|
struct input_dev *in_dev;
|
||||||
unsigned int intr_pin;
|
unsigned int intr_pin;
|
||||||
|
struct regulator *regulator;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -456,6 +459,20 @@ static int __devinit bu21013_probe(struct i2c_client *client,
|
||||||
bu21013_data->in_dev = in_dev;
|
bu21013_data->in_dev = in_dev;
|
||||||
bu21013_data->chip = pdata;
|
bu21013_data->chip = pdata;
|
||||||
bu21013_data->client = client;
|
bu21013_data->client = client;
|
||||||
|
|
||||||
|
bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH");
|
||||||
|
if (IS_ERR(bu21013_data->regulator)) {
|
||||||
|
dev_err(&client->dev, "regulator_get failed\n");
|
||||||
|
error = PTR_ERR(bu21013_data->regulator);
|
||||||
|
goto err_free_mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = regulator_enable(bu21013_data->regulator);
|
||||||
|
if (error < 0) {
|
||||||
|
dev_err(&client->dev, "regulator enable failed\n");
|
||||||
|
goto err_put_regulator;
|
||||||
|
}
|
||||||
|
|
||||||
bu21013_data->touch_stopped = false;
|
bu21013_data->touch_stopped = false;
|
||||||
init_waitqueue_head(&bu21013_data->wait);
|
init_waitqueue_head(&bu21013_data->wait);
|
||||||
|
|
||||||
|
@ -464,7 +481,7 @@ static int __devinit bu21013_probe(struct i2c_client *client,
|
||||||
error = pdata->cs_en(pdata->cs_pin);
|
error = pdata->cs_en(pdata->cs_pin);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
dev_err(&client->dev, "chip init failed\n");
|
dev_err(&client->dev, "chip init failed\n");
|
||||||
goto err_free_mem;
|
goto err_disable_regulator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,6 +530,10 @@ err_free_irq:
|
||||||
bu21013_free_irq(bu21013_data);
|
bu21013_free_irq(bu21013_data);
|
||||||
err_cs_disable:
|
err_cs_disable:
|
||||||
pdata->cs_dis(pdata->cs_pin);
|
pdata->cs_dis(pdata->cs_pin);
|
||||||
|
err_disable_regulator:
|
||||||
|
regulator_disable(bu21013_data->regulator);
|
||||||
|
err_put_regulator:
|
||||||
|
regulator_put(bu21013_data->regulator);
|
||||||
err_free_mem:
|
err_free_mem:
|
||||||
input_free_device(in_dev);
|
input_free_device(in_dev);
|
||||||
kfree(bu21013_data);
|
kfree(bu21013_data);
|
||||||
|
@ -535,6 +556,10 @@ static int __devexit bu21013_remove(struct i2c_client *client)
|
||||||
bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin);
|
bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin);
|
||||||
|
|
||||||
input_unregister_device(bu21013_data->in_dev);
|
input_unregister_device(bu21013_data->in_dev);
|
||||||
|
|
||||||
|
regulator_disable(bu21013_data->regulator);
|
||||||
|
regulator_put(bu21013_data->regulator);
|
||||||
|
|
||||||
kfree(bu21013_data);
|
kfree(bu21013_data);
|
||||||
|
|
||||||
device_init_wakeup(&client->dev, false);
|
device_init_wakeup(&client->dev, false);
|
||||||
|
@ -561,6 +586,8 @@ static int bu21013_suspend(struct device *dev)
|
||||||
else
|
else
|
||||||
disable_irq(bu21013_data->chip->irq);
|
disable_irq(bu21013_data->chip->irq);
|
||||||
|
|
||||||
|
regulator_disable(bu21013_data->regulator);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,6 +604,12 @@ static int bu21013_resume(struct device *dev)
|
||||||
struct i2c_client *client = bu21013_data->client;
|
struct i2c_client *client = bu21013_data->client;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
retval = regulator_enable(bu21013_data->regulator);
|
||||||
|
if (retval < 0) {
|
||||||
|
dev_err(&client->dev, "bu21013 regulator enable failed\n");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
retval = bu21013_init_chip(bu21013_data);
|
retval = bu21013_init_chip(bu21013_data);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
dev_err(&client->dev, "bu21013 controller config failed\n");
|
dev_err(&client->dev, "bu21013 controller config failed\n");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче