.. | .. |
---|
40 | 40 | #include <linux/compat.h> |
---|
41 | 41 | #endif |
---|
42 | 42 | #include <linux/soc/rockchip/rk_vendor_storage.h> |
---|
43 | | -#include <linux/regulator/consumer.h> |
---|
44 | 43 | |
---|
45 | 44 | #define SENSOR_CALIBRATION_LEN 64 |
---|
46 | 45 | struct sensor_calibration_data { |
---|
.. | .. |
---|
546 | 545 | struct i2c_client *client = sensor->client; |
---|
547 | 546 | |
---|
548 | 547 | mutex_lock(&sensor->sensor_mutex); |
---|
549 | | - pm_stay_awake(&client->dev); |
---|
550 | 548 | if (sensor->ops->report(client) < 0) |
---|
551 | 549 | dev_err(&client->dev, "%s: Get data failed\n", __func__); |
---|
552 | | - pm_relax(&client->dev); |
---|
553 | 550 | mutex_unlock(&sensor->sensor_mutex); |
---|
554 | 551 | |
---|
555 | 552 | return IRQ_HANDLED; |
---|
.. | .. |
---|
562 | 559 | int result = 0; |
---|
563 | 560 | int irq; |
---|
564 | 561 | |
---|
565 | | - if ((sensor->pdata->irq_enable || sensor->pdata->wake_enable) && (sensor->pdata->irq_flags != SENSOR_UNKNOW_DATA)) { |
---|
| 562 | + if ((sensor->pdata->irq_enable) && (sensor->pdata->irq_flags != SENSOR_UNKNOW_DATA)) { |
---|
566 | 563 | if (sensor->pdata->poll_delay_ms <= 0) |
---|
567 | 564 | sensor->pdata->poll_delay_ms = 30; |
---|
568 | 565 | result = gpio_request(client->irq, sensor->i2c_id->name); |
---|
.. | .. |
---|
578 | 575 | |
---|
579 | 576 | client->irq = irq; |
---|
580 | 577 | disable_irq_nosync(client->irq); |
---|
581 | | - dev_info(&client->dev, "%s:use irq=%d\n", __func__, irq); |
---|
582 | | - } |
---|
583 | 578 | |
---|
584 | | - if (!sensor->pdata->irq_enable) { |
---|
| 579 | + dev_info(&client->dev, "%s:use irq=%d\n", __func__, irq); |
---|
| 580 | + } else if (!sensor->pdata->irq_enable) { |
---|
585 | 581 | INIT_DELAYED_WORK(&sensor->delaywork, sensor_delaywork_func); |
---|
586 | 582 | sensor->stop_work = 1; |
---|
587 | 583 | if (sensor->pdata->poll_delay_ms <= 0) |
---|
.. | .. |
---|
634 | 630 | if (sensor->ops->suspend) |
---|
635 | 631 | sensor->ops->suspend(sensor->client); |
---|
636 | 632 | |
---|
637 | | - if (mem_sleep_current == PM_SUSPEND_MEM_LITE) { |
---|
638 | | - if (sensor->pdata->wake_enable) { |
---|
639 | | - enable_irq(sensor->client->irq); |
---|
640 | | - enable_irq_wake(sensor->client->irq); |
---|
641 | | - } |
---|
642 | | - } |
---|
643 | | - |
---|
644 | 633 | return 0; |
---|
645 | 634 | } |
---|
646 | 635 | |
---|
.. | .. |
---|
650 | 639 | |
---|
651 | 640 | if (sensor->ops->resume) |
---|
652 | 641 | sensor->ops->resume(sensor->client); |
---|
653 | | - |
---|
654 | | - if (mem_sleep_current == PM_SUSPEND_MEM_LITE) { |
---|
655 | | - if (sensor->pdata->wake_enable) { |
---|
656 | | - disable_irq_wake(sensor->client->irq); |
---|
657 | | - disable_irq(sensor->client->irq); |
---|
658 | | - } |
---|
659 | | - return 0; |
---|
660 | | - } |
---|
661 | | - |
---|
662 | 642 | if (sensor->pdata->power_off_in_suspend) |
---|
663 | 643 | sensor_initial(sensor->client); |
---|
664 | 644 | |
---|
.. | .. |
---|
1629 | 1609 | pdata->irq_pin = of_get_named_gpio_flags(np, "irq-gpio", 0, (enum of_gpio_flags *)&irq_flags); |
---|
1630 | 1610 | pdata->reset_pin = of_get_named_gpio_flags(np, "reset-gpio", 0, &rst_flags); |
---|
1631 | 1611 | pdata->power_pin = of_get_named_gpio_flags(np, "power-gpio", 0, &pwr_flags); |
---|
1632 | | - pdata->wake_enable = of_property_read_bool(np, "wakeup-source"); |
---|
| 1612 | + |
---|
1633 | 1613 | of_property_read_u32(np, "irq_enable", &(pdata->irq_enable)); |
---|
1634 | 1614 | of_property_read_u32(np, "poll_delay_ms", &(pdata->poll_delay_ms)); |
---|
1635 | 1615 | |
---|
.. | .. |
---|
1759 | 1739 | pdata->orientation[8] = -1; |
---|
1760 | 1740 | break; |
---|
1761 | 1741 | |
---|
| 1742 | + case 9: |
---|
| 1743 | + pdata->orientation[0] = -1; |
---|
| 1744 | + pdata->orientation[1] = 0; |
---|
| 1745 | + pdata->orientation[2] = 0; |
---|
| 1746 | + |
---|
| 1747 | + pdata->orientation[3] = 0; |
---|
| 1748 | + pdata->orientation[4] = -1; |
---|
| 1749 | + pdata->orientation[5] = 0; |
---|
| 1750 | + |
---|
| 1751 | + pdata->orientation[6] = 0; |
---|
| 1752 | + pdata->orientation[7] = 0; |
---|
| 1753 | + pdata->orientation[8] = -1; |
---|
| 1754 | + break; |
---|
| 1755 | + |
---|
1762 | 1756 | default: |
---|
1763 | 1757 | pdata->orientation[0] = 1; |
---|
1764 | 1758 | pdata->orientation[1] = 0; |
---|