diff options
Diffstat (limited to 'drivers/input/touchscreen/stmpe-ts.c')
| -rw-r--r-- | drivers/input/touchscreen/stmpe-ts.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index e4c31256a74d..e414d43e5159 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
| @@ -267,27 +267,10 @@ static void stmpe_ts_close(struct input_dev *dev) | |||
| 267 | static void stmpe_ts_get_platform_info(struct platform_device *pdev, | 267 | static void stmpe_ts_get_platform_info(struct platform_device *pdev, |
| 268 | struct stmpe_touch *ts) | 268 | struct stmpe_touch *ts) |
| 269 | { | 269 | { |
| 270 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | ||
| 271 | struct device_node *np = pdev->dev.of_node; | 270 | struct device_node *np = pdev->dev.of_node; |
| 272 | struct stmpe_ts_platform_data *ts_pdata = NULL; | 271 | u32 val; |
| 273 | |||
| 274 | ts->stmpe = stmpe; | ||
| 275 | |||
| 276 | if (stmpe->pdata && stmpe->pdata->ts) { | ||
| 277 | ts_pdata = stmpe->pdata->ts; | ||
| 278 | |||
| 279 | ts->sample_time = ts_pdata->sample_time; | ||
| 280 | ts->mod_12b = ts_pdata->mod_12b; | ||
| 281 | ts->ref_sel = ts_pdata->ref_sel; | ||
| 282 | ts->adc_freq = ts_pdata->adc_freq; | ||
| 283 | ts->ave_ctrl = ts_pdata->ave_ctrl; | ||
| 284 | ts->touch_det_delay = ts_pdata->touch_det_delay; | ||
| 285 | ts->settling = ts_pdata->settling; | ||
| 286 | ts->fraction_z = ts_pdata->fraction_z; | ||
| 287 | ts->i_drive = ts_pdata->i_drive; | ||
| 288 | } else if (np) { | ||
| 289 | u32 val; | ||
| 290 | 272 | ||
| 273 | if (np) { | ||
| 291 | if (!of_property_read_u32(np, "st,sample-time", &val)) | 274 | if (!of_property_read_u32(np, "st,sample-time", &val)) |
| 292 | ts->sample_time = val; | 275 | ts->sample_time = val; |
| 293 | if (!of_property_read_u32(np, "st,mod-12b", &val)) | 276 | if (!of_property_read_u32(np, "st,mod-12b", &val)) |
| @@ -311,6 +294,7 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, | |||
| 311 | 294 | ||
| 312 | static int stmpe_input_probe(struct platform_device *pdev) | 295 | static int stmpe_input_probe(struct platform_device *pdev) |
| 313 | { | 296 | { |
| 297 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | ||
| 314 | struct stmpe_touch *ts; | 298 | struct stmpe_touch *ts; |
| 315 | struct input_dev *idev; | 299 | struct input_dev *idev; |
| 316 | int error; | 300 | int error; |
| @@ -329,6 +313,7 @@ static int stmpe_input_probe(struct platform_device *pdev) | |||
| 329 | return -ENOMEM; | 313 | return -ENOMEM; |
| 330 | 314 | ||
| 331 | platform_set_drvdata(pdev, ts); | 315 | platform_set_drvdata(pdev, ts); |
| 316 | ts->stmpe = stmpe; | ||
| 332 | ts->idev = idev; | 317 | ts->idev = idev; |
| 333 | ts->dev = &pdev->dev; | 318 | ts->dev = &pdev->dev; |
| 334 | 319 | ||
| @@ -351,14 +336,13 @@ static int stmpe_input_probe(struct platform_device *pdev) | |||
| 351 | idev->name = STMPE_TS_NAME; | 336 | idev->name = STMPE_TS_NAME; |
| 352 | idev->phys = STMPE_TS_NAME"/input0"; | 337 | idev->phys = STMPE_TS_NAME"/input0"; |
| 353 | idev->id.bustype = BUS_I2C; | 338 | idev->id.bustype = BUS_I2C; |
| 354 | idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
| 355 | idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
| 356 | 339 | ||
| 357 | idev->open = stmpe_ts_open; | 340 | idev->open = stmpe_ts_open; |
| 358 | idev->close = stmpe_ts_close; | 341 | idev->close = stmpe_ts_close; |
| 359 | 342 | ||
| 360 | input_set_drvdata(idev, ts); | 343 | input_set_drvdata(idev, ts); |
| 361 | 344 | ||
| 345 | input_set_capability(idev, EV_KEY, BTN_TOUCH); | ||
| 362 | input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0); | 346 | input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0); |
| 363 | input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); | 347 | input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); |
| 364 | input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); | 348 | input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); |
| @@ -383,14 +367,19 @@ static int stmpe_ts_remove(struct platform_device *pdev) | |||
| 383 | 367 | ||
| 384 | static struct platform_driver stmpe_ts_driver = { | 368 | static struct platform_driver stmpe_ts_driver = { |
| 385 | .driver = { | 369 | .driver = { |
| 386 | .name = STMPE_TS_NAME, | 370 | .name = STMPE_TS_NAME, |
| 387 | }, | 371 | }, |
| 388 | .probe = stmpe_input_probe, | 372 | .probe = stmpe_input_probe, |
| 389 | .remove = stmpe_ts_remove, | 373 | .remove = stmpe_ts_remove, |
| 390 | }; | 374 | }; |
| 391 | module_platform_driver(stmpe_ts_driver); | 375 | module_platform_driver(stmpe_ts_driver); |
| 392 | 376 | ||
| 377 | static const struct of_device_id stmpe_ts_ids[] = { | ||
| 378 | { .compatible = "st,stmpe-ts", }, | ||
| 379 | { }, | ||
| 380 | }; | ||
| 381 | MODULE_DEVICE_TABLE(of, stmpe_ts_ids); | ||
| 382 | |||
| 393 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); | 383 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); |
| 394 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); | 384 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); |
| 395 | MODULE_LICENSE("GPL"); | 385 | MODULE_LICENSE("GPL"); |
| 396 | MODULE_ALIAS("platform:" STMPE_TS_NAME); | ||
