diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-07-26 15:07:15 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-07-26 15:07:15 -0400 |
| commit | 0808882863774ab69066d83f49f511606be024e0 (patch) | |
| tree | dc5eaab5db6c18e06025356235b0c9ba02bd7a1d /drivers/input/rmi4 | |
| parent | e9003c9cfaa17d26991688268b04244adb67ee2b (diff) | |
| parent | 0097ff3d5dad1f76c5e1099d849d52509500708c (diff) | |
Merge branch 'next' into for-linus
Prepare first round of input updates for 4.8 merge window.
Diffstat (limited to 'drivers/input/rmi4')
| -rw-r--r-- | drivers/input/rmi4/rmi_f01.c | 22 | ||||
| -rw-r--r-- | drivers/input/rmi4/rmi_f11.c | 9 | ||||
| -rw-r--r-- | drivers/input/rmi4/rmi_f12.c | 1 | ||||
| -rw-r--r-- | drivers/input/rmi4/rmi_i2c.c | 46 |
4 files changed, 60 insertions, 18 deletions
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index eb362bc71a4c..fac81fc9bcf6 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c | |||
| @@ -81,26 +81,26 @@ struct f01_basic_properties { | |||
| 81 | * This bit disables whatever sleep mode may be selected by the sleep_mode | 81 | * This bit disables whatever sleep mode may be selected by the sleep_mode |
| 82 | * field and forces the device to run at full power without sleeping. | 82 | * field and forces the device to run at full power without sleeping. |
| 83 | */ | 83 | */ |
| 84 | #define RMI_F01_CRTL0_NOSLEEP_BIT BIT(2) | 84 | #define RMI_F01_CTRL0_NOSLEEP_BIT BIT(2) |
| 85 | 85 | ||
| 86 | /* | 86 | /* |
| 87 | * When this bit is set, the touch controller employs a noise-filtering | 87 | * When this bit is set, the touch controller employs a noise-filtering |
| 88 | * algorithm designed for use with a connected battery charger. | 88 | * algorithm designed for use with a connected battery charger. |
| 89 | */ | 89 | */ |
| 90 | #define RMI_F01_CRTL0_CHARGER_BIT BIT(5) | 90 | #define RMI_F01_CTRL0_CHARGER_BIT BIT(5) |
| 91 | 91 | ||
| 92 | /* | 92 | /* |
| 93 | * Sets the report rate for the device. The effect of this setting is | 93 | * Sets the report rate for the device. The effect of this setting is |
| 94 | * highly product dependent. Check the spec sheet for your particular | 94 | * highly product dependent. Check the spec sheet for your particular |
| 95 | * touch sensor. | 95 | * touch sensor. |
| 96 | */ | 96 | */ |
| 97 | #define RMI_F01_CRTL0_REPORTRATE_BIT BIT(6) | 97 | #define RMI_F01_CTRL0_REPORTRATE_BIT BIT(6) |
| 98 | 98 | ||
| 99 | /* | 99 | /* |
| 100 | * Written by the host as an indicator that the device has been | 100 | * Written by the host as an indicator that the device has been |
| 101 | * successfully configured. | 101 | * successfully configured. |
| 102 | */ | 102 | */ |
| 103 | #define RMI_F01_CRTL0_CONFIGURED_BIT BIT(7) | 103 | #define RMI_F01_CTRL0_CONFIGURED_BIT BIT(7) |
| 104 | 104 | ||
| 105 | /** | 105 | /** |
| 106 | * @ctrl0 - see the bit definitions above. | 106 | * @ctrl0 - see the bit definitions above. |
| @@ -330,10 +330,10 @@ static int rmi_f01_probe(struct rmi_function *fn) | |||
| 330 | case RMI_F01_NOSLEEP_DEFAULT: | 330 | case RMI_F01_NOSLEEP_DEFAULT: |
| 331 | break; | 331 | break; |
| 332 | case RMI_F01_NOSLEEP_OFF: | 332 | case RMI_F01_NOSLEEP_OFF: |
| 333 | f01->device_control.ctrl0 &= ~RMI_F01_CRTL0_NOSLEEP_BIT; | 333 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; |
| 334 | break; | 334 | break; |
| 335 | case RMI_F01_NOSLEEP_ON: | 335 | case RMI_F01_NOSLEEP_ON: |
| 336 | f01->device_control.ctrl0 |= RMI_F01_CRTL0_NOSLEEP_BIT; | 336 | f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; |
| 337 | break; | 337 | break; |
| 338 | } | 338 | } |
| 339 | 339 | ||
| @@ -349,7 +349,7 @@ static int rmi_f01_probe(struct rmi_function *fn) | |||
| 349 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; | 349 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | f01->device_control.ctrl0 |= RMI_F01_CRTL0_CONFIGURED_BIT; | 352 | f01->device_control.ctrl0 |= RMI_F01_CTRL0_CONFIGURED_BIT; |
| 353 | 353 | ||
| 354 | error = rmi_write(rmi_dev, fn->fd.control_base_addr, | 354 | error = rmi_write(rmi_dev, fn->fd.control_base_addr, |
| 355 | f01->device_control.ctrl0); | 355 | f01->device_control.ctrl0); |
| @@ -535,8 +535,8 @@ static int rmi_f01_suspend(struct rmi_function *fn) | |||
| 535 | int error; | 535 | int error; |
| 536 | 536 | ||
| 537 | f01->old_nosleep = | 537 | f01->old_nosleep = |
| 538 | f01->device_control.ctrl0 & RMI_F01_CRTL0_NOSLEEP_BIT; | 538 | f01->device_control.ctrl0 & RMI_F01_CTRL0_NOSLEEP_BIT; |
| 539 | f01->device_control.ctrl0 &= ~RMI_F01_CRTL0_NOSLEEP_BIT; | 539 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; |
| 540 | 540 | ||
| 541 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; | 541 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; |
| 542 | if (device_may_wakeup(fn->rmi_dev->xport->dev)) | 542 | if (device_may_wakeup(fn->rmi_dev->xport->dev)) |
| @@ -549,7 +549,7 @@ static int rmi_f01_suspend(struct rmi_function *fn) | |||
| 549 | if (error) { | 549 | if (error) { |
| 550 | dev_err(&fn->dev, "Failed to write sleep mode: %d.\n", error); | 550 | dev_err(&fn->dev, "Failed to write sleep mode: %d.\n", error); |
| 551 | if (f01->old_nosleep) | 551 | if (f01->old_nosleep) |
| 552 | f01->device_control.ctrl0 |= RMI_F01_CRTL0_NOSLEEP_BIT; | 552 | f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; |
| 553 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; | 553 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; |
| 554 | f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; | 554 | f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; |
| 555 | return error; | 555 | return error; |
| @@ -564,7 +564,7 @@ static int rmi_f01_resume(struct rmi_function *fn) | |||
| 564 | int error; | 564 | int error; |
| 565 | 565 | ||
| 566 | if (f01->old_nosleep) | 566 | if (f01->old_nosleep) |
| 567 | f01->device_control.ctrl0 |= RMI_F01_CRTL0_NOSLEEP_BIT; | 567 | f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; |
| 568 | 568 | ||
| 569 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; | 569 | f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; |
| 570 | f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; | 570 | f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; |
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index ec8a10d53288..20c7134b3d3b 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c | |||
| @@ -530,8 +530,8 @@ static void rmi_f11_rel_pos_report(struct f11_data *f11, u8 n_finger) | |||
| 530 | struct f11_2d_data *data = &f11->data; | 530 | struct f11_2d_data *data = &f11->data; |
| 531 | s8 x, y; | 531 | s8 x, y; |
| 532 | 532 | ||
| 533 | x = data->rel_pos[n_finger * 2]; | 533 | x = data->rel_pos[n_finger * RMI_F11_REL_BYTES]; |
| 534 | y = data->rel_pos[n_finger * 2 + 1]; | 534 | y = data->rel_pos[n_finger * RMI_F11_REL_BYTES + 1]; |
| 535 | 535 | ||
| 536 | rmi_2d_sensor_rel_report(sensor, x, y); | 536 | rmi_2d_sensor_rel_report(sensor, x, y); |
| 537 | } | 537 | } |
| @@ -1241,7 +1241,6 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) | |||
| 1241 | struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); | 1241 | struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); |
| 1242 | struct f11_data *f11 = dev_get_drvdata(&fn->dev); | 1242 | struct f11_data *f11 = dev_get_drvdata(&fn->dev); |
| 1243 | u16 data_base_addr = fn->fd.data_base_addr; | 1243 | u16 data_base_addr = fn->fd.data_base_addr; |
| 1244 | u16 data_base_addr_offset = 0; | ||
| 1245 | int error; | 1244 | int error; |
| 1246 | 1245 | ||
| 1247 | if (rmi_dev->xport->attn_data) { | 1246 | if (rmi_dev->xport->attn_data) { |
| @@ -1251,8 +1250,7 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) | |||
| 1251 | rmi_dev->xport->attn_size -= f11->sensor.attn_size; | 1250 | rmi_dev->xport->attn_size -= f11->sensor.attn_size; |
| 1252 | } else { | 1251 | } else { |
| 1253 | error = rmi_read_block(rmi_dev, | 1252 | error = rmi_read_block(rmi_dev, |
| 1254 | data_base_addr + data_base_addr_offset, | 1253 | data_base_addr, f11->sensor.data_pkt, |
| 1255 | f11->sensor.data_pkt, | ||
| 1256 | f11->sensor.pkt_size); | 1254 | f11->sensor.pkt_size); |
| 1257 | if (error < 0) | 1255 | if (error < 0) |
| 1258 | return error; | 1256 | return error; |
| @@ -1260,7 +1258,6 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) | |||
| 1260 | 1258 | ||
| 1261 | rmi_f11_finger_handler(f11, &f11->sensor, irq_bits, | 1259 | rmi_f11_finger_handler(f11, &f11->sensor, irq_bits, |
| 1262 | drvdata->num_of_irq_regs); | 1260 | drvdata->num_of_irq_regs); |
| 1263 | data_base_addr_offset += f11->sensor.pkt_size; | ||
| 1264 | 1261 | ||
| 1265 | return 0; | 1262 | return 0; |
| 1266 | } | 1263 | } |
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 88e91559c84e..332c02f0b107 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c | |||
| @@ -27,7 +27,6 @@ enum rmi_f12_object_type { | |||
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | struct f12_data { | 29 | struct f12_data { |
| 30 | struct rmi_function *fn; | ||
| 31 | struct rmi_2d_sensor sensor; | 30 | struct rmi_2d_sensor sensor; |
| 32 | struct rmi_2d_sensor_platform_data sensor_pdata; | 31 | struct rmi_2d_sensor_platform_data sensor_pdata; |
| 33 | 32 | ||
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index a96a326b53bd..6f2e0e4f0296 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #include <linux/rmi.h> | 11 | #include <linux/rmi.h> |
| 12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
| 13 | #include <linux/of.h> | 13 | #include <linux/of.h> |
| 14 | #include <linux/delay.h> | ||
| 15 | #include <linux/regulator/consumer.h> | ||
| 14 | #include "rmi_driver.h" | 16 | #include "rmi_driver.h" |
| 15 | 17 | ||
| 16 | #define BUFFER_SIZE_INCREMENT 32 | 18 | #define BUFFER_SIZE_INCREMENT 32 |
| @@ -37,6 +39,9 @@ struct rmi_i2c_xport { | |||
| 37 | 39 | ||
| 38 | u8 *tx_buf; | 40 | u8 *tx_buf; |
| 39 | size_t tx_buf_size; | 41 | size_t tx_buf_size; |
| 42 | |||
| 43 | struct regulator_bulk_data supplies[2]; | ||
| 44 | u32 startup_delay; | ||
| 40 | }; | 45 | }; |
| 41 | 46 | ||
| 42 | #define RMI_PAGE_SELECT_REGISTER 0xff | 47 | #define RMI_PAGE_SELECT_REGISTER 0xff |
| @@ -246,6 +251,24 @@ static int rmi_i2c_probe(struct i2c_client *client, | |||
| 246 | return -ENODEV; | 251 | return -ENODEV; |
| 247 | } | 252 | } |
| 248 | 253 | ||
| 254 | rmi_i2c->supplies[0].supply = "vdd"; | ||
| 255 | rmi_i2c->supplies[1].supply = "vio"; | ||
| 256 | retval = devm_regulator_bulk_get(&client->dev, | ||
| 257 | ARRAY_SIZE(rmi_i2c->supplies), | ||
| 258 | rmi_i2c->supplies); | ||
| 259 | if (retval < 0) | ||
| 260 | return retval; | ||
| 261 | |||
| 262 | retval = regulator_bulk_enable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 263 | rmi_i2c->supplies); | ||
| 264 | if (retval < 0) | ||
| 265 | return retval; | ||
| 266 | |||
| 267 | of_property_read_u32(client->dev.of_node, "syna,startup-delay-ms", | ||
| 268 | &rmi_i2c->startup_delay); | ||
| 269 | |||
| 270 | msleep(rmi_i2c->startup_delay); | ||
| 271 | |||
| 249 | rmi_i2c->client = client; | 272 | rmi_i2c->client = client; |
| 250 | mutex_init(&rmi_i2c->page_mutex); | 273 | mutex_init(&rmi_i2c->page_mutex); |
| 251 | 274 | ||
| @@ -286,6 +309,8 @@ static int rmi_i2c_remove(struct i2c_client *client) | |||
| 286 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); | 309 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); |
| 287 | 310 | ||
| 288 | rmi_unregister_transport_device(&rmi_i2c->xport); | 311 | rmi_unregister_transport_device(&rmi_i2c->xport); |
| 312 | regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 313 | rmi_i2c->supplies); | ||
| 289 | 314 | ||
| 290 | return 0; | 315 | return 0; |
| 291 | } | 316 | } |
| @@ -308,6 +333,10 @@ static int rmi_i2c_suspend(struct device *dev) | |||
| 308 | dev_warn(dev, "Failed to enable irq for wake: %d\n", | 333 | dev_warn(dev, "Failed to enable irq for wake: %d\n", |
| 309 | ret); | 334 | ret); |
| 310 | } | 335 | } |
| 336 | |||
| 337 | regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 338 | rmi_i2c->supplies); | ||
| 339 | |||
| 311 | return ret; | 340 | return ret; |
| 312 | } | 341 | } |
| 313 | 342 | ||
| @@ -317,6 +346,13 @@ static int rmi_i2c_resume(struct device *dev) | |||
| 317 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); | 346 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); |
| 318 | int ret; | 347 | int ret; |
| 319 | 348 | ||
| 349 | ret = regulator_bulk_enable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 350 | rmi_i2c->supplies); | ||
| 351 | if (ret) | ||
| 352 | return ret; | ||
| 353 | |||
| 354 | msleep(rmi_i2c->startup_delay); | ||
| 355 | |||
| 320 | enable_irq(rmi_i2c->irq); | 356 | enable_irq(rmi_i2c->irq); |
| 321 | if (device_may_wakeup(&client->dev)) { | 357 | if (device_may_wakeup(&client->dev)) { |
| 322 | ret = disable_irq_wake(rmi_i2c->irq); | 358 | ret = disable_irq_wake(rmi_i2c->irq); |
| @@ -346,6 +382,9 @@ static int rmi_i2c_runtime_suspend(struct device *dev) | |||
| 346 | 382 | ||
| 347 | disable_irq(rmi_i2c->irq); | 383 | disable_irq(rmi_i2c->irq); |
| 348 | 384 | ||
| 385 | regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 386 | rmi_i2c->supplies); | ||
| 387 | |||
| 349 | return 0; | 388 | return 0; |
| 350 | } | 389 | } |
| 351 | 390 | ||
| @@ -355,6 +394,13 @@ static int rmi_i2c_runtime_resume(struct device *dev) | |||
| 355 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); | 394 | struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); |
| 356 | int ret; | 395 | int ret; |
| 357 | 396 | ||
| 397 | ret = regulator_bulk_enable(ARRAY_SIZE(rmi_i2c->supplies), | ||
| 398 | rmi_i2c->supplies); | ||
| 399 | if (ret) | ||
| 400 | return ret; | ||
| 401 | |||
| 402 | msleep(rmi_i2c->startup_delay); | ||
| 403 | |||
| 358 | enable_irq(rmi_i2c->irq); | 404 | enable_irq(rmi_i2c->irq); |
| 359 | 405 | ||
| 360 | ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev); | 406 | ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev); |
