aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorVishnudev Ramakrishnan <vramakri@sta.samsung.com>2011-06-30 09:23:51 -0700
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:54:40 -0800
commitb0e6fc0f12ce4c2fc27f4aa7c07c0bd4c31ab7e4 (patch)
treec3bc466d5ee4245d3857cee36c7388b4205c830b /drivers/input
parent286369ffaa9c0753db07fbc23e5f5bd62ac35abc (diff)
downloadkernel_samsung_crespo-b0e6fc0f12ce4c2fc27f4aa7c07c0bd4c31ab7e4.zip
kernel_samsung_crespo-b0e6fc0f12ce4c2fc27f4aa7c07c0bd4c31ab7e4.tar.gz
kernel_samsung_crespo-b0e6fc0f12ce4c2fc27f4aa7c07c0bd4c31ab7e4.tar.bz2
tuna: sensors: proximity sensor driver bug fix
This change fixes a bug in the proximity sensor. The bug is that proximity sensor did not always report a value when it turns on. Change-Id: Ibe68d2b04242318629686fd740c652b7d20b6a33 Signed-off-by: Vishnudev Ramakrishnan <vramakri@sta.samsung.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/gp2a.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/input/misc/gp2a.c b/drivers/input/misc/gp2a.c
index 04a1de7..1cd501e 100644
--- a/drivers/input/misc/gp2a.c
+++ b/drivers/input/misc/gp2a.c
@@ -426,6 +426,9 @@ static int gp2a_setup_irq(struct gp2a_data *gp2a)
disable_irq(irq);
gp2a->irq = irq;
+ /* sync input device with proximity gpio pin default value */
+ gp2a_irq_handler(gp2a->irq, gp2a);
+
gp2a_dbgmsg("success\n");
goto done;
@@ -474,12 +477,6 @@ static int gp2a_i2c_probe(struct i2c_client *client,
"prx_wake_lock");
mutex_init(&gp2a->power_lock);
- ret = gp2a_setup_irq(gp2a);
- if (ret) {
- pr_err("%s: could not setup irq\n", __func__);
- goto err_setup_irq;
- }
-
/* allocate proximity input_device */
input_dev = input_allocate_device();
if (!input_dev) {
@@ -492,6 +489,13 @@ static int gp2a_i2c_probe(struct i2c_client *client,
input_set_capability(input_dev, EV_ABS, ABS_DISTANCE);
input_set_abs_params(input_dev, ABS_DISTANCE, 0, 1, 0, 0);
+ ret = gp2a_setup_irq(gp2a);
+ if (ret) {
+ pr_err("%s: could not setup irq\n", __func__);
+ input_free_device(input_dev);
+ goto err_setup_irq;
+ }
+
gp2a_dbgmsg("registering proximity input device\n");
ret = input_register_device(input_dev);
if (ret < 0) {
@@ -563,10 +567,10 @@ err_create_workqueue:
err_sysfs_create_group_proximity:
input_unregister_device(gp2a->proximity_input_dev);
err_input_register_device_proximity:
-err_input_allocate_device_proximity:
free_irq(gp2a->irq, gp2a);
gpio_free(gp2a->pdata->p_out);
err_setup_irq:
+err_input_allocate_device_proximity:
mutex_destroy(&gp2a->power_lock);
wake_lock_destroy(&gp2a->prx_wake_lock);
kfree(gp2a);