|
19 | 19 | #define TSD_TEMP_160 0x01
|
20 | 20 | #define VB_LO_ACT_SD 0x00
|
21 | 21 | #define VB_LO_ACT_INT 0x01
|
| 22 | +#define VB_LO_3400MV 3400 |
22 | 23 |
|
23 | 24 | static const struct reg_field rk806_reg_fields[] = {
|
24 | 25 | [POWER_EN0] = REG_FIELD(0x00, 0, 7),
|
@@ -571,47 +572,13 @@ static int rk806_pinctrl_init(struct rk806 *rk806)
|
571 | 572 | return 0;
|
572 | 573 | }
|
573 | 574 |
|
574 |
| -static irqreturn_t rk806_vb_low_irq(int irq, void *rk806) |
| 575 | +static void rk806_vb_force_shutdown_init(struct rk806 *rk806) |
575 | 576 | {
|
576 |
| - return IRQ_HANDLED; |
577 |
| -} |
578 |
| - |
579 |
| -static int rk806_low_power_irqs(struct rk806 *rk806) |
580 |
| -{ |
581 |
| - struct rk806_platform_data *pdata; |
582 |
| - int ret, vb_lo_irq; |
583 |
| - |
584 |
| - pdata = rk806->pdata; |
585 |
| - |
586 |
| - if (!pdata->low_voltage_threshold) |
587 |
| - return 0; |
588 |
| - |
589 |
| - rk806_field_write(rk806, VB_LO_ACT, VB_LO_ACT_INT); |
| 577 | + struct rk806_platform_data *pdata = rk806->pdata; |
590 | 578 |
|
| 579 | + rk806_field_write(rk806, VB_LO_ACT, VB_LO_ACT_SD); |
591 | 580 | rk806_field_write(rk806, VB_LO_SEL,
|
592 | 581 | (pdata->low_voltage_threshold - 2800) / 100);
|
593 |
| - |
594 |
| - vb_lo_irq = regmap_irq_get_virq(rk806->irq_data, RK806_IRQ_VB_LO); |
595 |
| - if (vb_lo_irq < 0) { |
596 |
| - dev_err(rk806->dev, "vb_lo_irq request failed!\n"); |
597 |
| - return vb_lo_irq; |
598 |
| - } |
599 |
| - |
600 |
| - ret = devm_request_threaded_irq(rk806->dev, vb_lo_irq, |
601 |
| - NULL, |
602 |
| - rk806_vb_low_irq, |
603 |
| - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, |
604 |
| - "rk806_vb_low", rk806); |
605 |
| - if (ret) { |
606 |
| - dev_err(rk806->dev, "vb_lo_irq request failed!\n"); |
607 |
| - return ret; |
608 |
| - } |
609 |
| - |
610 |
| - rk806->vb_lo_irq = vb_lo_irq; |
611 |
| - disable_irq(rk806->vb_lo_irq); |
612 |
| - enable_irq_wake(vb_lo_irq); |
613 |
| - |
614 |
| - return 0; |
615 | 582 | }
|
616 | 583 |
|
617 | 584 | static irqreturn_t rk806_vdc_irq(int irq, void *data)
|
@@ -685,13 +652,13 @@ static int rk806_parse_dt(struct rk806 *rk806)
|
685 | 652 | "low_voltage_threshold",
|
686 | 653 | &pdata->low_voltage_threshold);
|
687 | 654 | if (ret < 0) {
|
688 |
| - pdata->low_voltage_threshold = 0; |
| 655 | + pdata->low_voltage_threshold = VB_LO_3400MV; |
689 | 656 | dev_info(dev, "low_voltage_threshold missing!\n");
|
690 | 657 | } else {
|
691 | 658 | if ((pdata->low_voltage_threshold > 3500) ||
|
692 | 659 | (pdata->low_voltage_threshold < 2800)) {
|
693 | 660 | dev_err(dev, "low_voltage_threshold out [2800 3500]!\n");
|
694 |
| - pdata->low_voltage_threshold = 2800; |
| 661 | + pdata->low_voltage_threshold = VB_LO_3400MV; |
695 | 662 | }
|
696 | 663 | }
|
697 | 664 | ret = device_property_read_u32(dev,
|
@@ -761,7 +728,7 @@ static int rk806_init(struct rk806 *rk806)
|
761 | 728 | /* Digital output 2MHz clock force enable */
|
762 | 729 | rk806_field_write(rk806, ENB2_2M, 0x01);
|
763 | 730 |
|
764 |
| - rk806_low_power_irqs(rk806); |
| 731 | + rk806_vb_force_shutdown_init(rk806); |
765 | 732 | rk806_vdc_irqs_init(rk806);
|
766 | 733 |
|
767 | 734 | return 0;
|
@@ -822,6 +789,7 @@ int rk806_device_init(struct rk806 *rk806)
|
822 | 789 | dev_err(rk806->dev, "Failed to add IRQ chip: err = %d\n", ret);
|
823 | 790 | return ret;
|
824 | 791 | }
|
| 792 | + enable_irq_wake(rk806->irq); |
825 | 793 |
|
826 | 794 | ret = devm_mfd_add_devices(rk806->dev,
|
827 | 795 | PLATFORM_DEVID_AUTO,
|
|
0 commit comments