• Home
  • Raw
  • Download

Lines Matching +full:nosleep +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2011-2016 Synaptics Incorporated
64 /* The device is in bootloader mode */
70 * Sleep mode controls power management on the device and affects all
81 * This bit disables whatever sleep mode may be selected by the sleep_mode
87 * When this bit is set, the touch controller employs a noise-filtering
106 * @ctrl0 - see the bit definitions above.
107 * @doze_interval - controls the interval between checks for finger presence
108 * when the touch sensor is in doze mode, in units of 10ms.
109 * @wakeup_threshold - controls the capacitance threshold at which the touch
111 * @doze_holdoff - controls how long the touch sensor waits after the last
153 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
162 props->manufacturer_id = queries[0]; in rmi_f01_read_properties()
164 props->has_lts = queries[1] & RMI_F01_QRY1_HAS_LTS; in rmi_f01_read_properties()
165 props->has_adjustable_doze = in rmi_f01_read_properties()
167 props->has_adjustable_doze_holdoff = in rmi_f01_read_properties()
172 snprintf(props->dom, sizeof(props->dom), "20%02d/%02d/%02d", in rmi_f01_read_properties()
177 memcpy(props->product_id, &queries[11], in rmi_f01_read_properties()
179 props->product_id[RMI_PRODUCT_ID_LENGTH] = '\0'; in rmi_f01_read_properties()
181 props->productinfo = in rmi_f01_read_properties()
191 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
203 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
212 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
226 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
232 props->package_id = get_unaligned_le64(queries); in rmi_f01_read_properties()
240 dev_err(&rmi_dev->dev, in rmi_f01_read_properties()
246 props->firmware_id = queries[1] << 8 | queries[0]; in rmi_f01_read_properties()
247 props->firmware_id += queries[2] * 65536; in rmi_f01_read_properties()
256 struct f01_data *f01 = dev_get_drvdata(&fn->dev); in rmi_f01_get_product_ID()
258 return f01->properties.product_id; in rmi_f01_get_product_ID()
266 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); in rmi_driver_manufacturer_id_show()
269 f01->properties.manufacturer_id); in rmi_driver_manufacturer_id_show()
279 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); in rmi_driver_dom_show()
281 return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.dom); in rmi_driver_dom_show()
291 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); in rmi_driver_product_id_show()
293 return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.product_id); in rmi_driver_product_id_show()
303 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); in rmi_driver_firmware_id_show()
305 return scnprintf(buf, PAGE_SIZE, "%d\n", f01->properties.firmware_id); in rmi_driver_firmware_id_show()
315 struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); in rmi_driver_package_id_show()
317 u32 package_id = f01->properties.package_id; in rmi_driver_package_id_show()
346 (u32 *)&pdata->power_management.nosleep, in rmi_f01_of_probe()
347 "syna,nosleep-mode", 1); in rmi_f01_of_probe()
352 "syna,wakeup-threshold", 1); in rmi_f01_of_probe()
356 pdata->power_management.wakeup_threshold = val; in rmi_f01_of_probe()
359 "syna,doze-holdoff-ms", 1); in rmi_f01_of_probe()
363 pdata->power_management.doze_holdoff = val * 100; in rmi_f01_of_probe()
366 "syna,doze-interval-ms", 1); in rmi_f01_of_probe()
370 pdata->power_management.doze_interval = val / 10; in rmi_f01_of_probe()
378 return -ENODEV; in rmi_f01_of_probe()
384 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_f01_probe()
385 struct rmi_driver_data *driver_data = dev_get_drvdata(&rmi_dev->dev); in rmi_f01_probe()
389 u16 ctrl_base_addr = fn->fd.control_base_addr; in rmi_f01_probe()
393 if (fn->dev.of_node) { in rmi_f01_probe()
394 error = rmi_f01_of_probe(&fn->dev, pdata); in rmi_f01_probe()
399 f01 = devm_kzalloc(&fn->dev, sizeof(struct f01_data), GFP_KERNEL); in rmi_f01_probe()
401 return -ENOMEM; in rmi_f01_probe()
403 f01->num_of_irq_regs = driver_data->num_of_irq_regs; in rmi_f01_probe()
410 error = rmi_read(rmi_dev, fn->fd.control_base_addr, in rmi_f01_probe()
411 &f01->device_control.ctrl0); in rmi_f01_probe()
413 dev_err(&fn->dev, "Failed to read F01 control: %d\n", error); in rmi_f01_probe()
417 switch (pdata->power_management.nosleep) { in rmi_f01_probe()
421 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_probe()
424 f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_probe()
429 * Sleep mode might be set as a hangover from a system crash or in rmi_f01_probe()
433 if ((f01->device_control.ctrl0 & RMI_F01_CTRL0_SLEEP_MODE_MASK) != in rmi_f01_probe()
435 dev_warn(&fn->dev, in rmi_f01_probe()
436 "WARNING: Non-zero sleep mode found. Clearing...\n"); in rmi_f01_probe()
437 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; in rmi_f01_probe()
440 f01->device_control.ctrl0 |= RMI_F01_CTRL0_CONFIGURED_BIT; in rmi_f01_probe()
442 error = rmi_write(rmi_dev, fn->fd.control_base_addr, in rmi_f01_probe()
443 f01->device_control.ctrl0); in rmi_f01_probe()
445 dev_err(&fn->dev, "Failed to write F01 control: %d\n", error); in rmi_f01_probe()
450 error = rmi_read(rmi_dev, fn->fd.data_base_addr + 1, &temp); in rmi_f01_probe()
452 dev_err(&fn->dev, "Failed to read Interrupt Status.\n"); in rmi_f01_probe()
456 error = rmi_f01_read_properties(rmi_dev, fn->fd.query_base_addr, in rmi_f01_probe()
457 &f01->properties); in rmi_f01_probe()
459 dev_err(&fn->dev, "Failed to read F01 properties.\n"); in rmi_f01_probe()
463 dev_info(&fn->dev, "found RMI device, manufacturer: %s, product: %s, fw id: %d\n", in rmi_f01_probe()
464 f01->properties.manufacturer_id == 1 ? "Synaptics" : "unknown", in rmi_f01_probe()
465 f01->properties.product_id, f01->properties.firmware_id); in rmi_f01_probe()
469 ctrl_base_addr += f01->num_of_irq_regs; in rmi_f01_probe()
472 if (f01->properties.has_adjustable_doze) { in rmi_f01_probe()
473 f01->doze_interval_addr = ctrl_base_addr; in rmi_f01_probe()
476 if (pdata->power_management.doze_interval) { in rmi_f01_probe()
477 f01->device_control.doze_interval = in rmi_f01_probe()
478 pdata->power_management.doze_interval; in rmi_f01_probe()
479 error = rmi_write(rmi_dev, f01->doze_interval_addr, in rmi_f01_probe()
480 f01->device_control.doze_interval); in rmi_f01_probe()
482 dev_err(&fn->dev, in rmi_f01_probe()
488 error = rmi_read(rmi_dev, f01->doze_interval_addr, in rmi_f01_probe()
489 &f01->device_control.doze_interval); in rmi_f01_probe()
491 dev_err(&fn->dev, in rmi_f01_probe()
498 f01->wakeup_threshold_addr = ctrl_base_addr; in rmi_f01_probe()
501 if (pdata->power_management.wakeup_threshold) { in rmi_f01_probe()
502 f01->device_control.wakeup_threshold = in rmi_f01_probe()
503 pdata->power_management.wakeup_threshold; in rmi_f01_probe()
504 error = rmi_write(rmi_dev, f01->wakeup_threshold_addr, in rmi_f01_probe()
505 f01->device_control.wakeup_threshold); in rmi_f01_probe()
507 dev_err(&fn->dev, in rmi_f01_probe()
513 error = rmi_read(rmi_dev, f01->wakeup_threshold_addr, in rmi_f01_probe()
514 &f01->device_control.wakeup_threshold); in rmi_f01_probe()
516 dev_err(&fn->dev, in rmi_f01_probe()
524 if (f01->properties.has_lts) in rmi_f01_probe()
527 if (f01->properties.has_adjustable_doze_holdoff) { in rmi_f01_probe()
528 f01->doze_holdoff_addr = ctrl_base_addr; in rmi_f01_probe()
531 if (pdata->power_management.doze_holdoff) { in rmi_f01_probe()
532 f01->device_control.doze_holdoff = in rmi_f01_probe()
533 pdata->power_management.doze_holdoff; in rmi_f01_probe()
534 error = rmi_write(rmi_dev, f01->doze_holdoff_addr, in rmi_f01_probe()
535 f01->device_control.doze_holdoff); in rmi_f01_probe()
537 dev_err(&fn->dev, in rmi_f01_probe()
543 error = rmi_read(rmi_dev, f01->doze_holdoff_addr, in rmi_f01_probe()
544 &f01->device_control.doze_holdoff); in rmi_f01_probe()
546 dev_err(&fn->dev, in rmi_f01_probe()
554 error = rmi_read(rmi_dev, fn->fd.data_base_addr, &device_status); in rmi_f01_probe()
556 dev_err(&fn->dev, in rmi_f01_probe()
562 dev_err(&fn->dev, in rmi_f01_probe()
565 return -EINVAL; in rmi_f01_probe()
568 dev_set_drvdata(&fn->dev, f01); in rmi_f01_probe()
570 error = sysfs_create_group(&fn->rmi_dev->dev.kobj, &rmi_f01_attr_group); in rmi_f01_probe()
572 dev_warn(&fn->dev, "Failed to create sysfs group: %d\n", error); in rmi_f01_probe()
580 sysfs_remove_group(&fn->rmi_dev->dev.kobj, &rmi_f01_attr_group); in rmi_f01_remove()
585 struct f01_data *f01 = dev_get_drvdata(&fn->dev); in rmi_f01_config()
588 error = rmi_write(fn->rmi_dev, fn->fd.control_base_addr, in rmi_f01_config()
589 f01->device_control.ctrl0); in rmi_f01_config()
591 dev_err(&fn->dev, in rmi_f01_config()
596 if (f01->properties.has_adjustable_doze) { in rmi_f01_config()
597 error = rmi_write(fn->rmi_dev, f01->doze_interval_addr, in rmi_f01_config()
598 f01->device_control.doze_interval); in rmi_f01_config()
600 dev_err(&fn->dev, in rmi_f01_config()
605 error = rmi_write_block(fn->rmi_dev, in rmi_f01_config()
606 f01->wakeup_threshold_addr, in rmi_f01_config()
607 &f01->device_control.wakeup_threshold, in rmi_f01_config()
610 dev_err(&fn->dev, in rmi_f01_config()
617 if (f01->properties.has_adjustable_doze_holdoff) { in rmi_f01_config()
618 error = rmi_write(fn->rmi_dev, f01->doze_holdoff_addr, in rmi_f01_config()
619 f01->device_control.doze_holdoff); in rmi_f01_config()
621 dev_err(&fn->dev, in rmi_f01_config()
632 struct f01_data *f01 = dev_get_drvdata(&fn->dev); in rmi_f01_suspend()
635 f01->old_nosleep = in rmi_f01_suspend()
636 f01->device_control.ctrl0 & RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_suspend()
637 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_suspend()
639 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; in rmi_f01_suspend()
640 if (device_may_wakeup(fn->rmi_dev->xport->dev)) in rmi_f01_suspend()
641 f01->device_control.ctrl0 |= RMI_SLEEP_MODE_RESERVED1; in rmi_f01_suspend()
643 f01->device_control.ctrl0 |= RMI_SLEEP_MODE_SENSOR_SLEEP; in rmi_f01_suspend()
645 error = rmi_write(fn->rmi_dev, fn->fd.control_base_addr, in rmi_f01_suspend()
646 f01->device_control.ctrl0); in rmi_f01_suspend()
648 dev_err(&fn->dev, "Failed to write sleep mode: %d.\n", error); in rmi_f01_suspend()
649 if (f01->old_nosleep) in rmi_f01_suspend()
650 f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_suspend()
651 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; in rmi_f01_suspend()
652 f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; in rmi_f01_suspend()
661 struct f01_data *f01 = dev_get_drvdata(&fn->dev); in rmi_f01_resume()
664 if (f01->old_nosleep) in rmi_f01_resume()
665 f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; in rmi_f01_resume()
667 f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK; in rmi_f01_resume()
668 f01->device_control.ctrl0 |= RMI_SLEEP_MODE_NORMAL; in rmi_f01_resume()
670 error = rmi_write(fn->rmi_dev, fn->fd.control_base_addr, in rmi_f01_resume()
671 f01->device_control.ctrl0); in rmi_f01_resume()
673 dev_err(&fn->dev, in rmi_f01_resume()
684 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_f01_attention()
688 error = rmi_read(rmi_dev, fn->fd.data_base_addr, &device_status); in rmi_f01_attention()
690 dev_err(&fn->dev, in rmi_f01_attention()
696 dev_warn(&fn->dev, in rmi_f01_attention()
697 "Device in bootloader mode, please update firmware\n"); in rmi_f01_attention()
700 dev_warn(&fn->dev, "Device reset detected.\n"); in rmi_f01_attention()
701 error = rmi_dev->driver->reset_handler(rmi_dev); in rmi_f01_attention()
703 dev_err(&fn->dev, "Device reset failed: %d\n", error); in rmi_f01_attention()