aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/88pm860x-ts.c')
-rw-r--r--drivers/input/touchscreen/88pm860x-ts.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index 251ff2aa0633..7a0dbce4dae9 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -126,7 +126,7 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
126 int data, n, ret; 126 int data, n, ret;
127 if (!np) 127 if (!np)
128 return -ENODEV; 128 return -ENODEV;
129 np = of_find_node_by_name(np, "touch"); 129 np = of_get_child_by_name(np, "touch");
130 if (!np) { 130 if (!np) {
131 dev_err(&pdev->dev, "Can't find touch node\n"); 131 dev_err(&pdev->dev, "Can't find touch node\n");
132 return -EINVAL; 132 return -EINVAL;
@@ -144,13 +144,13 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
144 if (data) { 144 if (data) {
145 ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data); 145 ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data);
146 if (ret < 0) 146 if (ret < 0)
147 return -EINVAL; 147 goto err_put_node;
148 } 148 }
149 /* set tsi prebias time */ 149 /* set tsi prebias time */
150 if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) { 150 if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) {
151 ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data); 151 ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data);
152 if (ret < 0) 152 if (ret < 0)
153 return -EINVAL; 153 goto err_put_node;
154 } 154 }
155 /* set prebias & prechg time of pen detect */ 155 /* set prebias & prechg time of pen detect */
156 data = 0; 156 data = 0;
@@ -161,10 +161,18 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
161 if (data) { 161 if (data) {
162 ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data); 162 ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data);
163 if (ret < 0) 163 if (ret < 0)
164 return -EINVAL; 164 goto err_put_node;
165 } 165 }
166 of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x); 166 of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x);
167
168 of_node_put(np);
169
167 return 0; 170 return 0;
171
172err_put_node:
173 of_node_put(np);
174
175 return -EINVAL;
168} 176}
169#else 177#else
170#define pm860x_touch_dt_init(x, y, z) (-1) 178#define pm860x_touch_dt_init(x, y, z) (-1)