Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: cyapa - fix for losing events during device power transitions

When changing the scan rate as part of runtime-resume process we may lose
some of the events, because:

1) for gen3 trackpads, the driver must msleep() some time to ensure that
the device is ready to accept next command;

2) for gen5 and later trackpads, the queue dumping function will simply
ignore the events when waiting for the set power mode command response.

The solution is to keep polling and report those valid events when the set
power mode command is in progress.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Dudley Du and committed by
Dmitry Torokhov
3cd47869 5186b8c4

+188 -59
+12 -10
drivers/input/mouse/cyapa.c
··· 383 383 * when in operational mode. 384 384 */ 385 385 error = cyapa->ops->set_power_mode(cyapa, 386 - PWR_MODE_FULL_ACTIVE, 0, false); 386 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 387 387 if (error) { 388 388 dev_warn(dev, "set active power failed: %d\n", error); 389 389 goto out; ··· 424 424 pm_runtime_set_suspended(dev); 425 425 426 426 if (cyapa->operational) 427 - cyapa->ops->set_power_mode(cyapa, PWR_MODE_OFF, 0, false); 427 + cyapa->ops->set_power_mode(cyapa, 428 + PWR_MODE_OFF, 0, CYAPA_PM_DEACTIVE); 428 429 429 430 mutex_unlock(&cyapa->state_sync_lock); 430 431 } ··· 535 534 */ 536 535 if (!input || cyapa->operational) 537 536 cyapa->ops->set_power_mode(cyapa, 538 - PWR_MODE_FULL_ACTIVE, 0, false); 537 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 539 538 /* Gen3 always using polling mode for command. */ 540 539 if (cyapa->gen >= CYAPA_GEN5) 541 540 enable_irq(cyapa->client->irq); ··· 551 550 disable_irq(cyapa->client->irq); 552 551 if (!input || cyapa->operational) 553 552 cyapa->ops->set_power_mode(cyapa, 554 - PWR_MODE_OFF, 0, false); 553 + PWR_MODE_OFF, 0, CYAPA_PM_ACTIVE); 555 554 } 556 555 } 557 556 ··· 618 617 619 618 /* Power down the device until we need it. */ 620 619 if (cyapa->operational) 621 - cyapa->ops->set_power_mode(cyapa, PWR_MODE_OFF, 0, false); 620 + cyapa->ops->set_power_mode(cyapa, 621 + PWR_MODE_OFF, 0, CYAPA_PM_ACTIVE); 622 622 623 623 return 0; 624 624 } ··· 636 634 /* Avoid command failures when TP was in OFF state. */ 637 635 if (cyapa->operational) 638 636 cyapa->ops->set_power_mode(cyapa, 639 - PWR_MODE_FULL_ACTIVE, 0, false); 637 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 640 638 641 639 error = cyapa_detect(cyapa); 642 640 if (error) ··· 656 654 /* Reset to power OFF state to save power when no user open. */ 657 655 if (cyapa->operational) 658 656 cyapa->ops->set_power_mode(cyapa, 659 - PWR_MODE_OFF, 0, false); 657 + PWR_MODE_OFF, 0, CYAPA_PM_DEACTIVE); 660 658 } else if (!error && cyapa->operational) { 661 659 /* 662 660 * Make sure only enable runtime PM when device is ··· 1394 1392 power_mode = device_may_wakeup(dev) ? cyapa->suspend_power_mode 1395 1393 : PWR_MODE_OFF; 1396 1394 error = cyapa->ops->set_power_mode(cyapa, power_mode, 1397 - cyapa->suspend_sleep_time, true); 1395 + cyapa->suspend_sleep_time, CYAPA_PM_SUSPEND); 1398 1396 if (error) 1399 1397 dev_err(dev, "suspend set power mode failed: %d\n", 1400 1398 error); ··· 1449 1447 error = cyapa->ops->set_power_mode(cyapa, 1450 1448 cyapa->runtime_suspend_power_mode, 1451 1449 cyapa->runtime_suspend_sleep_time, 1452 - false); 1450 + CYAPA_PM_RUNTIME_SUSPEND); 1453 1451 if (error) 1454 1452 dev_warn(dev, "runtime suspend failed: %d\n", error); 1455 1453 ··· 1462 1460 int error; 1463 1461 1464 1462 error = cyapa->ops->set_power_mode(cyapa, 1465 - PWR_MODE_FULL_ACTIVE, 0, false); 1463 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_RUNTIME_RESUME); 1466 1464 if (error) 1467 1465 dev_warn(dev, "runtime resume failed: %d\n", error); 1468 1466
+13 -1
drivers/input/mouse/cyapa.h
··· 250 250 251 251 typedef bool (*cb_sort)(struct cyapa *, u8 *, int); 252 252 253 + enum cyapa_pm_stage { 254 + CYAPA_PM_DEACTIVE, 255 + CYAPA_PM_ACTIVE, 256 + CYAPA_PM_SUSPEND, 257 + CYAPA_PM_RESUME, 258 + CYAPA_PM_RUNTIME_SUSPEND, 259 + CYAPA_PM_RUNTIME_RESUME, 260 + }; 261 + 253 262 struct cyapa_dev_ops { 254 263 int (*check_fw)(struct cyapa *, const struct firmware *); 255 264 int (*bl_enter)(struct cyapa *); ··· 282 273 int (*sort_empty_output_data)(struct cyapa *, 283 274 u8 *, int *, cb_sort); 284 275 285 - int (*set_power_mode)(struct cyapa *, u8, u16, bool); 276 + int (*set_power_mode)(struct cyapa *, u8, u16, enum cyapa_pm_stage); 286 277 287 278 int (*set_proximity)(struct cyapa *, bool); 288 279 }; ··· 297 288 cb_sort resp_sort_func; 298 289 u8 *resp_data; 299 290 int *resp_len; 291 + 292 + enum cyapa_pm_stage pm_stage; 293 + struct mutex pm_stage_lock; 300 294 301 295 u8 irq_cmd_buf[CYAPA_REG_MAP_SIZE]; 302 296 u8 empty_buf[CYAPA_REG_MAP_SIZE];
+79 -29
drivers/input/mouse/cyapa_gen3.c
··· 269 269 { CYAPA_SMBUS_MIN_BASELINE, 1 }, /* CYAPA_CMD_MIN_BASELINE */ 270 270 }; 271 271 272 + static int cyapa_gen3_try_poll_handler(struct cyapa *cyapa); 272 273 273 274 /* 274 275 * cyapa_smbus_read_block - perform smbus block read command ··· 951 950 * Device power mode can only be set when device is in operational mode. 952 951 */ 953 952 static int cyapa_gen3_set_power_mode(struct cyapa *cyapa, u8 power_mode, 954 - u16 always_unused, bool is_suspend_unused) 953 + u16 always_unused, enum cyapa_pm_stage pm_stage) 955 954 { 956 - int ret; 955 + struct input_dev *input = cyapa->input; 957 956 u8 power; 958 957 int tries; 959 - u16 sleep_time; 958 + int sleep_time; 959 + int interval; 960 + int ret; 960 961 961 962 if (cyapa->state != CYAPA_STATE_OP) 962 963 return 0; ··· 980 977 if ((ret & PWR_MODE_MASK) == power_mode) 981 978 return 0; 982 979 983 - sleep_time = cyapa_get_wait_time_for_pwr_cmd(ret & PWR_MODE_MASK); 980 + sleep_time = (int)cyapa_get_wait_time_for_pwr_cmd(ret & PWR_MODE_MASK); 984 981 power = ret; 985 982 power &= ~PWR_MODE_MASK; 986 983 power |= power_mode & PWR_MODE_MASK; ··· 998 995 * doing so before issuing the next command may result in errors 999 996 * depending on the command's content. 1000 997 */ 1001 - msleep(sleep_time); 998 + if (cyapa->operational && input && input->users && 999 + (pm_stage == CYAPA_PM_RUNTIME_SUSPEND || 1000 + pm_stage == CYAPA_PM_RUNTIME_RESUME)) { 1001 + /* Try to polling in 120Hz, read may fail, just ignore it. */ 1002 + interval = 1000 / 120; 1003 + while (sleep_time > 0) { 1004 + if (sleep_time > interval) 1005 + msleep(interval); 1006 + else 1007 + msleep(sleep_time); 1008 + sleep_time -= interval; 1009 + cyapa_gen3_try_poll_handler(cyapa); 1010 + } 1011 + } else { 1012 + msleep(sleep_time); 1013 + } 1014 + 1002 1015 return ret; 1003 1016 } 1004 1017 ··· 1131 1112 * may cause problems, so we set the power mode first here. 1132 1113 */ 1133 1114 error = cyapa_gen3_set_power_mode(cyapa, 1134 - PWR_MODE_FULL_ACTIVE, 0, false); 1115 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 1135 1116 if (error) 1136 1117 dev_err(dev, "%s: set full power mode failed: %d\n", 1137 1118 __func__, error); ··· 1187 1168 return false; 1188 1169 } 1189 1170 1190 - static int cyapa_gen3_irq_handler(struct cyapa *cyapa) 1171 + static int cyapa_gen3_event_process(struct cyapa *cyapa, 1172 + struct cyapa_reg_data *data) 1191 1173 { 1192 1174 struct input_dev *input = cyapa->input; 1193 - struct device *dev = &cyapa->client->dev; 1194 - struct cyapa_reg_data data; 1195 1175 int num_fingers; 1196 - int ret; 1197 1176 int i; 1198 1177 1199 - ret = cyapa_read_block(cyapa, CYAPA_CMD_GROUP_DATA, (u8 *)&data); 1200 - if (ret != sizeof(data)) { 1201 - dev_err(dev, "failed to read report data, (%d)\n", ret); 1202 - return -EINVAL; 1203 - } 1204 - 1205 - if ((data.device_status & OP_STATUS_SRC) != OP_STATUS_SRC || 1206 - (data.device_status & OP_STATUS_DEV) != CYAPA_DEV_NORMAL || 1207 - (data.finger_btn & OP_DATA_VALID) != OP_DATA_VALID) { 1208 - dev_err(dev, "invalid device state bytes, %02x %02x\n", 1209 - data.device_status, data.finger_btn); 1210 - return -EINVAL; 1211 - } 1212 - 1213 - num_fingers = (data.finger_btn >> 4) & 0x0f; 1178 + num_fingers = (data->finger_btn >> 4) & 0x0f; 1214 1179 for (i = 0; i < num_fingers; i++) { 1215 - const struct cyapa_touch *touch = &data.touches[i]; 1180 + const struct cyapa_touch *touch = &data->touches[i]; 1216 1181 /* Note: touch->id range is 1 to 15; slots are 0 to 14. */ 1217 1182 int slot = touch->id - 1; 1218 1183 ··· 1213 1210 1214 1211 if (cyapa->btn_capability & CAPABILITY_LEFT_BTN_MASK) 1215 1212 input_report_key(input, BTN_LEFT, 1216 - !!(data.finger_btn & OP_DATA_LEFT_BTN)); 1213 + !!(data->finger_btn & OP_DATA_LEFT_BTN)); 1217 1214 if (cyapa->btn_capability & CAPABILITY_MIDDLE_BTN_MASK) 1218 1215 input_report_key(input, BTN_MIDDLE, 1219 - !!(data.finger_btn & OP_DATA_MIDDLE_BTN)); 1216 + !!(data->finger_btn & OP_DATA_MIDDLE_BTN)); 1220 1217 if (cyapa->btn_capability & CAPABILITY_RIGHT_BTN_MASK) 1221 1218 input_report_key(input, BTN_RIGHT, 1222 - !!(data.finger_btn & OP_DATA_RIGHT_BTN)); 1219 + !!(data->finger_btn & OP_DATA_RIGHT_BTN)); 1223 1220 input_sync(input); 1224 1221 1225 1222 return 0; 1223 + } 1224 + 1225 + static int cyapa_gen3_irq_handler(struct cyapa *cyapa) 1226 + { 1227 + struct device *dev = &cyapa->client->dev; 1228 + struct cyapa_reg_data data; 1229 + int ret; 1230 + 1231 + ret = cyapa_read_block(cyapa, CYAPA_CMD_GROUP_DATA, (u8 *)&data); 1232 + if (ret != sizeof(data)) { 1233 + dev_err(dev, "failed to read report data, (%d)\n", ret); 1234 + return -EINVAL; 1235 + } 1236 + 1237 + if ((data.device_status & OP_STATUS_SRC) != OP_STATUS_SRC || 1238 + (data.device_status & OP_STATUS_DEV) != CYAPA_DEV_NORMAL || 1239 + (data.finger_btn & OP_DATA_VALID) != OP_DATA_VALID) { 1240 + dev_err(dev, "invalid device state bytes: %02x %02x\n", 1241 + data.device_status, data.finger_btn); 1242 + return -EINVAL; 1243 + } 1244 + 1245 + return cyapa_gen3_event_process(cyapa, &data); 1246 + } 1247 + 1248 + /* 1249 + * This function will be called in the cyapa_gen3_set_power_mode function, 1250 + * and it's known that it may failed in some situation after the set power 1251 + * mode command was sent. So this function is aimed to avoid the knwon 1252 + * and unwanted output I2C and data parse error messages. 1253 + */ 1254 + static int cyapa_gen3_try_poll_handler(struct cyapa *cyapa) 1255 + { 1256 + struct cyapa_reg_data data; 1257 + int ret; 1258 + 1259 + ret = cyapa_read_block(cyapa, CYAPA_CMD_GROUP_DATA, (u8 *)&data); 1260 + if (ret != sizeof(data)) 1261 + return -EINVAL; 1262 + 1263 + if ((data.device_status & OP_STATUS_SRC) != OP_STATUS_SRC || 1264 + (data.device_status & OP_STATUS_DEV) != CYAPA_DEV_NORMAL || 1265 + (data.finger_btn & OP_DATA_VALID) != OP_DATA_VALID) 1266 + return -EINVAL; 1267 + 1268 + return cyapa_gen3_event_process(cyapa, &data); 1269 + 1226 1270 } 1227 1271 1228 1272 static int cyapa_gen3_initialize(struct cyapa *cyapa) { return 0; }
+82 -17
drivers/input/mouse/cyapa_gen5.c
··· 342 342 static u8 cyapa_pip_bl_cmd_key[] = { 0xa5, 0x01, 0x02, 0x03, 343 343 0xff, 0xfe, 0xfd, 0x5a }; 344 344 345 + static int cyapa_pip_event_process(struct cyapa *cyapa, 346 + struct cyapa_pip_report_data *report_data); 347 + 345 348 int cyapa_pip_cmd_state_initialize(struct cyapa *cyapa) 346 349 { 347 350 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; ··· 352 349 init_completion(&pip->cmd_ready); 353 350 atomic_set(&pip->cmd_issued, 0); 354 351 mutex_init(&pip->cmd_lock); 352 + 353 + mutex_init(&pip->pm_stage_lock); 354 + pip->pm_stage = CYAPA_PM_DEACTIVE; 355 355 356 356 pip->resp_sort_func = NULL; 357 357 pip->in_progress_cmd = PIP_INVALID_CMD; ··· 403 397 return 0; 404 398 } 405 399 400 + static void cyapa_set_pip_pm_state(struct cyapa *cyapa, 401 + enum cyapa_pm_stage pm_stage) 402 + { 403 + struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; 404 + 405 + mutex_lock(&pip->pm_stage_lock); 406 + pip->pm_stage = pm_stage; 407 + mutex_unlock(&pip->pm_stage_lock); 408 + } 409 + 410 + static void cyapa_reset_pip_pm_state(struct cyapa *cyapa) 411 + { 412 + struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; 413 + 414 + /* Indicates the pip->pm_stage is not valid. */ 415 + mutex_lock(&pip->pm_stage_lock); 416 + pip->pm_stage = CYAPA_PM_DEACTIVE; 417 + mutex_unlock(&pip->pm_stage_lock); 418 + } 419 + 420 + static enum cyapa_pm_stage cyapa_get_pip_pm_state(struct cyapa *cyapa) 421 + { 422 + struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; 423 + enum cyapa_pm_stage pm_stage; 424 + 425 + mutex_lock(&pip->pm_stage_lock); 426 + pm_stage = pip->pm_stage; 427 + mutex_unlock(&pip->pm_stage_lock); 428 + 429 + return pm_stage; 430 + } 431 + 406 432 /** 407 433 * This function is aimed to dump all not read data in Gen5 trackpad 408 434 * before send any command, otherwise, the interrupt line will be blocked. ··· 442 404 int cyapa_empty_pip_output_data(struct cyapa *cyapa, 443 405 u8 *buf, int *len, cb_sort func) 444 406 { 407 + struct input_dev *input = cyapa->input; 445 408 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; 409 + enum cyapa_pm_stage pm_stage = cyapa_get_pip_pm_state(cyapa); 446 410 int length; 447 411 int report_count; 448 412 int empty_count; ··· 518 478 *len = length; 519 479 /* Response found, success. */ 520 480 return 0; 481 + } else if (cyapa->operational && input && input->users && 482 + (pm_stage == CYAPA_PM_RUNTIME_RESUME || 483 + pm_stage == CYAPA_PM_RUNTIME_SUSPEND)) { 484 + /* Parse the data and report it if it's valid. */ 485 + cyapa_pip_event_process(cyapa, 486 + (struct cyapa_pip_report_data *)pip->empty_buf); 521 487 } 522 488 523 489 error = -EINVAL; ··· 1612 1566 } 1613 1567 1614 1568 static int cyapa_gen5_set_power_mode(struct cyapa *cyapa, 1615 - u8 power_mode, u16 sleep_time, bool is_suspend) 1569 + u8 power_mode, u16 sleep_time, enum cyapa_pm_stage pm_stage) 1616 1570 { 1617 1571 struct device *dev = &cyapa->client->dev; 1618 1572 u8 power_state; 1619 - int error; 1573 + int error = 0; 1620 1574 1621 1575 if (cyapa->state != CYAPA_STATE_GEN5_APP) 1622 1576 return 0; 1577 + 1578 + cyapa_set_pip_pm_state(cyapa, pm_stage); 1623 1579 1624 1580 if (PIP_DEV_GET_PWR_STATE(cyapa) == UNINIT_PWR_MODE) { 1625 1581 /* ··· 1645 1597 power_mode == PWR_MODE_BTN_ONLY || 1646 1598 PIP_DEV_GET_SLEEP_TIME(cyapa) == sleep_time) { 1647 1599 /* Has in correct power mode state, early return. */ 1648 - return 0; 1600 + goto out; 1649 1601 } 1650 1602 } 1651 1603 ··· 1653 1605 error = cyapa_pip_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_OFF); 1654 1606 if (error) { 1655 1607 dev_err(dev, "enter deep sleep fail: %d\n", error); 1656 - return error; 1608 + goto out; 1657 1609 } 1658 1610 1659 1611 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_OFF); 1660 - return 0; 1612 + goto out; 1661 1613 } 1662 1614 1663 1615 /* ··· 1669 1621 error = cyapa_pip_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_ON); 1670 1622 if (error) { 1671 1623 dev_err(dev, "deep sleep wake fail: %d\n", error); 1672 - return error; 1624 + goto out; 1673 1625 } 1674 1626 } 1675 1627 ··· 1678 1630 GEN5_POWER_STATE_ACTIVE); 1679 1631 if (error) { 1680 1632 dev_err(dev, "change to active fail: %d\n", error); 1681 - return error; 1633 + goto out; 1682 1634 } 1683 1635 1684 1636 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_FULL_ACTIVE); ··· 1687 1639 GEN5_POWER_STATE_BTN_ONLY); 1688 1640 if (error) { 1689 1641 dev_err(dev, "fail to button only mode: %d\n", error); 1690 - return error; 1642 + goto out; 1691 1643 } 1692 1644 1693 1645 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_BTN_ONLY); ··· 1712 1664 if (error) { 1713 1665 dev_err(dev, "set power state to 0x%02x failed: %d\n", 1714 1666 power_state, error); 1715 - return error; 1667 + goto out; 1716 1668 } 1717 1669 1718 1670 /* ··· 1725 1677 * is suspending which may cause interrupt line unable to be 1726 1678 * asserted again. 1727 1679 */ 1728 - if (is_suspend) 1680 + if (pm_stage == CYAPA_PM_SUSPEND) 1729 1681 cyapa_gen5_disable_pip_report(cyapa); 1730 1682 1731 1683 PIP_DEV_SET_PWR_STATE(cyapa, 1732 1684 cyapa_sleep_time_to_pwr_cmd(sleep_time)); 1733 1685 } 1734 1686 1735 - return 0; 1687 + out: 1688 + cyapa_reset_pip_pm_state(cyapa); 1689 + return error; 1736 1690 } 1737 1691 1738 1692 int cyapa_pip_resume_scanning(struct cyapa *cyapa) ··· 2563 2513 * the device state is required. 2564 2514 */ 2565 2515 error = cyapa_gen5_set_power_mode(cyapa, 2566 - PWR_MODE_FULL_ACTIVE, 0, false); 2516 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 2567 2517 if (error) 2568 2518 dev_warn(dev, "%s: failed to set power active mode.\n", 2569 2519 __func__); ··· 2765 2715 struct device *dev = &cyapa->client->dev; 2766 2716 struct cyapa_pip_report_data report_data; 2767 2717 unsigned int report_len; 2768 - u8 report_id; 2769 2718 int ret; 2770 2719 2771 2720 if (!cyapa_is_pip_app_mode(cyapa)) { ··· 2801 2752 return -EINVAL; 2802 2753 } 2803 2754 2804 - report_id = report_data.report_head[PIP_RESP_REPORT_ID_OFFSET]; 2755 + return cyapa_pip_event_process(cyapa, &report_data); 2756 + } 2757 + 2758 + static int cyapa_pip_event_process(struct cyapa *cyapa, 2759 + struct cyapa_pip_report_data *report_data) 2760 + { 2761 + struct device *dev = &cyapa->client->dev; 2762 + unsigned int report_len; 2763 + u8 report_id; 2764 + 2765 + report_len = get_unaligned_le16( 2766 + &report_data->report_head[PIP_RESP_LENGTH_OFFSET]); 2767 + /* Idle, no data for report. */ 2768 + if (report_len == PIP_RESP_LENGTH_SIZE) 2769 + return 0; 2770 + 2771 + report_id = report_data->report_head[PIP_RESP_REPORT_ID_OFFSET]; 2805 2772 if (report_id == PIP_WAKEUP_EVENT_REPORT_ID && 2806 2773 report_len == PIP_WAKEUP_EVENT_SIZE) { 2807 2774 /* ··· 2870 2805 } 2871 2806 2872 2807 if (report_id == PIP_TOUCH_REPORT_ID) 2873 - cyapa_pip_report_touches(cyapa, &report_data); 2808 + cyapa_pip_report_touches(cyapa, report_data); 2874 2809 else if (report_id == PIP_PROXIMITY_REPORT_ID) 2875 - cyapa_pip_report_proximity(cyapa, &report_data); 2810 + cyapa_pip_report_proximity(cyapa, report_data); 2876 2811 else 2877 - cyapa_pip_report_buttons(cyapa, &report_data); 2812 + cyapa_pip_report_buttons(cyapa, report_data); 2878 2813 2879 2814 return 0; 2880 2815 }
+2 -2
drivers/input/mouse/cyapa_gen6.c
··· 425 425 } 426 426 427 427 static int cyapa_gen6_set_power_mode(struct cyapa *cyapa, 428 - u8 power_mode, u16 sleep_time, bool is_suspend) 428 + u8 power_mode, u16 sleep_time, enum cyapa_pm_stage pm_stage) 429 429 { 430 430 struct device *dev = &cyapa->client->dev; 431 431 struct gen6_interval_setting *interval_setting = ··· 689 689 * the device state is required. 690 690 */ 691 691 error = cyapa_gen6_set_power_mode(cyapa, 692 - PWR_MODE_FULL_ACTIVE, 0, false); 692 + PWR_MODE_FULL_ACTIVE, 0, CYAPA_PM_ACTIVE); 693 693 if (error) 694 694 dev_warn(dev, "%s: failed to set power active mode.\n", 695 695 __func__);