Commit 7a176332 authored by Naveen Kumar Gaddipati's avatar Naveen Kumar Gaddipati Committed by Greg Kroah-Hartman

staging: synaptics: Implement error handling for rmi4 touch regulator

Implement the error handling for regulator in synaptics
rmi4 touch screen
Signed-off-by: default avatarNaveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 09861bc3
...@@ -926,17 +926,19 @@ static int __devinit synaptics_rmi4_probe ...@@ -926,17 +926,19 @@ static int __devinit synaptics_rmi4_probe
goto err_input; goto err_input;
} }
if (platformdata->regulator_en) {
rmi4_data->regulator = regulator_get(&client->dev, "vdd"); rmi4_data->regulator = regulator_get(&client->dev, "vdd");
if (IS_ERR(rmi4_data->regulator)) { if (IS_ERR(rmi4_data->regulator)) {
dev_err(&client->dev, "%s:get regulator failed\n", dev_err(&client->dev, "%s:get regulator failed\n",
__func__); __func__);
retval = PTR_ERR(rmi4_data->regulator); retval = PTR_ERR(rmi4_data->regulator);
goto err_regulator; goto err_get_regulator;
} }
regulator_enable(rmi4_data->regulator); retval = regulator_enable(rmi4_data->regulator);
if (retval < 0) {
dev_err(&client->dev, "%s:regulator enable failed\n",
__func__);
goto err_regulator_enable;
} }
init_waitqueue_head(&rmi4_data->wait); init_waitqueue_head(&rmi4_data->wait);
/* /*
* Copy i2c_client pointer into RTID's i2c_client pointer for * Copy i2c_client pointer into RTID's i2c_client pointer for
...@@ -1011,11 +1013,10 @@ static int __devinit synaptics_rmi4_probe ...@@ -1011,11 +1013,10 @@ static int __devinit synaptics_rmi4_probe
err_free_irq: err_free_irq:
free_irq(platformdata->irq_number, rmi4_data); free_irq(platformdata->irq_number, rmi4_data);
err_query_dev: err_query_dev:
if (platformdata->regulator_en) {
regulator_disable(rmi4_data->regulator); regulator_disable(rmi4_data->regulator);
err_regulator_enable:
regulator_put(rmi4_data->regulator); regulator_put(rmi4_data->regulator);
} err_get_regulator:
err_regulator:
input_free_device(rmi4_data->input_dev); input_free_device(rmi4_data->input_dev);
rmi4_data->input_dev = NULL; rmi4_data->input_dev = NULL;
err_input: err_input:
...@@ -1039,10 +1040,8 @@ static int __devexit synaptics_rmi4_remove(struct i2c_client *client) ...@@ -1039,10 +1040,8 @@ static int __devexit synaptics_rmi4_remove(struct i2c_client *client)
wake_up(&rmi4_data->wait); wake_up(&rmi4_data->wait);
free_irq(pdata->irq_number, rmi4_data); free_irq(pdata->irq_number, rmi4_data);
input_unregister_device(rmi4_data->input_dev); input_unregister_device(rmi4_data->input_dev);
if (pdata->regulator_en) {
regulator_disable(rmi4_data->regulator); regulator_disable(rmi4_data->regulator);
regulator_put(rmi4_data->regulator); regulator_put(rmi4_data->regulator);
}
kfree(rmi4_data); kfree(rmi4_data);
return 0; return 0;
...@@ -1080,7 +1079,6 @@ static int synaptics_rmi4_suspend(struct device *dev) ...@@ -1080,7 +1079,6 @@ static int synaptics_rmi4_suspend(struct device *dev)
if (retval < 0) if (retval < 0)
return retval; return retval;
if (pdata->regulator_en)
regulator_disable(rmi4_data->regulator); regulator_disable(rmi4_data->regulator);
return 0; return 0;
...@@ -1099,7 +1097,6 @@ static int synaptics_rmi4_resume(struct device *dev) ...@@ -1099,7 +1097,6 @@ static int synaptics_rmi4_resume(struct device *dev)
struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board; const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board;
if (pdata->regulator_en)
regulator_enable(rmi4_data->regulator); regulator_enable(rmi4_data->regulator);
enable_irq(pdata->irq_number); enable_irq(pdata->irq_number);
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
* @irq_type: irq type * @irq_type: irq type
* @x flip: x flip flag * @x flip: x flip flag
* @y flip: y flip flag * @y flip: y flip flag
* @regulator_en: regulator enable flag
* *
* This structure gives platform data for rmi4. * This structure gives platform data for rmi4.
*/ */
...@@ -43,7 +42,6 @@ struct synaptics_rmi4_platform_data { ...@@ -43,7 +42,6 @@ struct synaptics_rmi4_platform_data {
int irq_type; int irq_type;
bool x_flip; bool x_flip;
bool y_flip; bool y_flip;
bool regulator_en;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment