diff options
Diffstat (limited to 'include/linux/mfd/tps65910.h')
-rw-r--r-- | include/linux/mfd/tps65910.h | 158 |
1 files changed, 112 insertions, 46 deletions
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 9bf8767818b..20e433e551e 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -132,6 +132,16 @@ | |||
132 | * | 132 | * |
133 | */ | 133 | */ |
134 | 134 | ||
135 | /* RTC_CTRL_REG bitfields */ | ||
136 | #define TPS65910_RTC_CTRL_STOP_RTC 0x01 /*0=stop, 1=run */ | ||
137 | #define TPS65910_RTC_CTRL_GET_TIME 0x40 | ||
138 | |||
139 | /* RTC_STATUS_REG bitfields */ | ||
140 | #define TPS65910_RTC_STATUS_ALARM 0x40 | ||
141 | |||
142 | /* RTC_INTERRUPTS_REG bitfields */ | ||
143 | #define TPS65910_RTC_INTERRUPTS_EVERY 0x03 | ||
144 | #define TPS65910_RTC_INTERRUPTS_IT_ALARM 0x08 | ||
135 | 145 | ||
136 | /*Register BCK1 (0x80) register.RegisterDescription */ | 146 | /*Register BCK1 (0x80) register.RegisterDescription */ |
137 | #define BCK1_BCKUP_MASK 0xFF | 147 | #define BCK1_BCKUP_MASK 0xFF |
@@ -366,6 +376,8 @@ | |||
366 | 376 | ||
367 | 377 | ||
368 | /*Register DEVCTRL (0x80) register.RegisterDescription */ | 378 | /*Register DEVCTRL (0x80) register.RegisterDescription */ |
379 | #define DEVCTRL_PWR_OFF_MASK 0x80 | ||
380 | #define DEVCTRL_PWR_OFF_SHIFT 7 | ||
369 | #define DEVCTRL_RTC_PWDN_MASK 0x40 | 381 | #define DEVCTRL_RTC_PWDN_MASK 0x40 |
370 | #define DEVCTRL_RTC_PWDN_SHIFT 6 | 382 | #define DEVCTRL_RTC_PWDN_SHIFT 6 |
371 | #define DEVCTRL_CK32K_CTRL_MASK 0x20 | 383 | #define DEVCTRL_CK32K_CTRL_MASK 0x20 |
@@ -560,6 +572,49 @@ | |||
560 | #define SPARE_SPARE_MASK 0xFF | 572 | #define SPARE_SPARE_MASK 0xFF |
561 | #define SPARE_SPARE_SHIFT 0 | 573 | #define SPARE_SPARE_SHIFT 0 |
562 | 574 | ||
575 | #define TPS65910_INT_STS_RTC_PERIOD_IT_MASK 0x80 | ||
576 | #define TPS65910_INT_STS_RTC_PERIOD_IT_SHIFT 7 | ||
577 | #define TPS65910_INT_STS_RTC_ALARM_IT_MASK 0x40 | ||
578 | #define TPS65910_INT_STS_RTC_ALARM_IT_SHIFT 6 | ||
579 | #define TPS65910_INT_STS_HOTDIE_IT_MASK 0x20 | ||
580 | #define TPS65910_INT_STS_HOTDIE_IT_SHIFT 5 | ||
581 | #define TPS65910_INT_STS_PWRHOLD_F_IT_MASK 0x10 | ||
582 | #define TPS65910_INT_STS_PWRHOLD_F_IT_SHIFT 4 | ||
583 | #define TPS65910_INT_STS_PWRON_LP_IT_MASK 0x08 | ||
584 | #define TPS65910_INT_STS_PWRON_LP_IT_SHIFT 3 | ||
585 | #define TPS65910_INT_STS_PWRON_IT_MASK 0x04 | ||
586 | #define TPS65910_INT_STS_PWRON_IT_SHIFT 2 | ||
587 | #define TPS65910_INT_STS_VMBHI_IT_MASK 0x02 | ||
588 | #define TPS65910_INT_STS_VMBHI_IT_SHIFT 1 | ||
589 | #define TPS65910_INT_STS_VMBDCH_IT_MASK 0x01 | ||
590 | #define TPS65910_INT_STS_VMBDCH_IT_SHIFT 0 | ||
591 | |||
592 | #define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_MASK 0x80 | ||
593 | #define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_SHIFT 7 | ||
594 | #define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_MASK 0x40 | ||
595 | #define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6 | ||
596 | #define TPS65910_INT_MSK_HOTDIE_IT_MSK_MASK 0x20 | ||
597 | #define TPS65910_INT_MSK_HOTDIE_IT_MSK_SHIFT 5 | ||
598 | #define TPS65910_INT_MSK_PWRHOLD_IT_MSK_MASK 0x10 | ||
599 | #define TPS65910_INT_MSK_PWRHOLD_IT_MSK_SHIFT 4 | ||
600 | #define TPS65910_INT_MSK_PWRON_LP_IT_MSK_MASK 0x08 | ||
601 | #define TPS65910_INT_MSK_PWRON_LP_IT_MSK_SHIFT 3 | ||
602 | #define TPS65910_INT_MSK_PWRON_IT_MSK_MASK 0x04 | ||
603 | #define TPS65910_INT_MSK_PWRON_IT_MSK_SHIFT 2 | ||
604 | #define TPS65910_INT_MSK_VMBHI_IT_MSK_MASK 0x02 | ||
605 | #define TPS65910_INT_MSK_VMBHI_IT_MSK_SHIFT 1 | ||
606 | #define TPS65910_INT_MSK_VMBDCH_IT_MSK_MASK 0x01 | ||
607 | #define TPS65910_INT_MSK_VMBDCH_IT_MSK_SHIFT 0 | ||
608 | |||
609 | #define TPS65910_INT_STS2_GPIO0_F_IT_SHIFT 2 | ||
610 | #define TPS65910_INT_STS2_GPIO0_F_IT_MASK 0x02 | ||
611 | #define TPS65910_INT_STS2_GPIO0_R_IT_SHIFT 1 | ||
612 | #define TPS65910_INT_STS2_GPIO0_R_IT_MASK 0x01 | ||
613 | |||
614 | #define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_SHIFT 2 | ||
615 | #define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_MASK 0x02 | ||
616 | #define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_SHIFT 1 | ||
617 | #define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_MASK 0x01 | ||
563 | 618 | ||
564 | /*Register INT_STS (0x80) register.RegisterDescription */ | 619 | /*Register INT_STS (0x80) register.RegisterDescription */ |
565 | #define INT_STS_RTC_PERIOD_IT_MASK 0x80 | 620 | #define INT_STS_RTC_PERIOD_IT_MASK 0x80 |
@@ -568,16 +623,16 @@ | |||
568 | #define INT_STS_RTC_ALARM_IT_SHIFT 6 | 623 | #define INT_STS_RTC_ALARM_IT_SHIFT 6 |
569 | #define INT_STS_HOTDIE_IT_MASK 0x20 | 624 | #define INT_STS_HOTDIE_IT_MASK 0x20 |
570 | #define INT_STS_HOTDIE_IT_SHIFT 5 | 625 | #define INT_STS_HOTDIE_IT_SHIFT 5 |
571 | #define INT_STS_PWRHOLD_IT_MASK 0x10 | 626 | #define INT_STS_PWRHOLD_R_IT_MASK 0x10 |
572 | #define INT_STS_PWRHOLD_IT_SHIFT 4 | 627 | #define INT_STS_PWRHOLD_R_IT_SHIFT 4 |
573 | #define INT_STS_PWRON_LP_IT_MASK 0x08 | 628 | #define INT_STS_PWRON_LP_IT_MASK 0x08 |
574 | #define INT_STS_PWRON_LP_IT_SHIFT 3 | 629 | #define INT_STS_PWRON_LP_IT_SHIFT 3 |
575 | #define INT_STS_PWRON_IT_MASK 0x04 | 630 | #define INT_STS_PWRON_IT_MASK 0x04 |
576 | #define INT_STS_PWRON_IT_SHIFT 2 | 631 | #define INT_STS_PWRON_IT_SHIFT 2 |
577 | #define INT_STS_VMBHI_IT_MASK 0x02 | 632 | #define INT_STS_VMBHI_IT_MASK 0x02 |
578 | #define INT_STS_VMBHI_IT_SHIFT 1 | 633 | #define INT_STS_VMBHI_IT_SHIFT 1 |
579 | #define INT_STS_VMBDCH_IT_MASK 0x01 | 634 | #define INT_STS_PWRHOLD_F_IT_MASK 0x01 |
580 | #define INT_STS_VMBDCH_IT_SHIFT 0 | 635 | #define INT_STS_PWRHOLD_F_IT_SHIFT 0 |
581 | 636 | ||
582 | 637 | ||
583 | /*Register INT_MSK (0x80) register.RegisterDescription */ | 638 | /*Register INT_MSK (0x80) register.RegisterDescription */ |
@@ -587,16 +642,16 @@ | |||
587 | #define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6 | 642 | #define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6 |
588 | #define INT_MSK_HOTDIE_IT_MSK_MASK 0x20 | 643 | #define INT_MSK_HOTDIE_IT_MSK_MASK 0x20 |
589 | #define INT_MSK_HOTDIE_IT_MSK_SHIFT 5 | 644 | #define INT_MSK_HOTDIE_IT_MSK_SHIFT 5 |
590 | #define INT_MSK_PWRHOLD_IT_MSK_MASK 0x10 | 645 | #define INT_MSK_PWRHOLD_R_IT_MSK_MASK 0x10 |
591 | #define INT_MSK_PWRHOLD_IT_MSK_SHIFT 4 | 646 | #define INT_MSK_PWRHOLD_R_IT_MSK_SHIFT 4 |
592 | #define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08 | 647 | #define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08 |
593 | #define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3 | 648 | #define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3 |
594 | #define INT_MSK_PWRON_IT_MSK_MASK 0x04 | 649 | #define INT_MSK_PWRON_IT_MSK_MASK 0x04 |
595 | #define INT_MSK_PWRON_IT_MSK_SHIFT 2 | 650 | #define INT_MSK_PWRON_IT_MSK_SHIFT 2 |
596 | #define INT_MSK_VMBHI_IT_MSK_MASK 0x02 | 651 | #define INT_MSK_VMBHI_IT_MSK_MASK 0x02 |
597 | #define INT_MSK_VMBHI_IT_MSK_SHIFT 1 | 652 | #define INT_MSK_VMBHI_IT_MSK_SHIFT 1 |
598 | #define INT_MSK_VMBDCH_IT_MSK_MASK 0x01 | 653 | #define INT_MSK_PWRHOLD_F_IT_MSK_MASK 0x01 |
599 | #define INT_MSK_VMBDCH_IT_MSK_SHIFT 0 | 654 | #define INT_MSK_PWRHOLD_F_IT_MSK_SHIFT 0 |
600 | 655 | ||
601 | 656 | ||
602 | /*Register INT_STS2 (0x80) register.RegisterDescription */ | 657 | /*Register INT_STS2 (0x80) register.RegisterDescription */ |
@@ -638,6 +693,14 @@ | |||
638 | 693 | ||
639 | 694 | ||
640 | /*Register INT_STS3 (0x80) register.RegisterDescription */ | 695 | /*Register INT_STS3 (0x80) register.RegisterDescription */ |
696 | #define INT_STS3_PWRDN_IT_MASK 0x80 | ||
697 | #define INT_STS3_PWRDN_IT_SHIFT 7 | ||
698 | #define INT_STS3_VMBCH2_L_IT_MASK 0x40 | ||
699 | #define INT_STS3_VMBCH2_L_IT_SHIFT 6 | ||
700 | #define INT_STS3_VMBCH2_H_IT_MASK 0x20 | ||
701 | #define INT_STS3_VMBCH2_H_IT_SHIFT 5 | ||
702 | #define INT_STS3_WTCHDG_IT_MASK 0x10 | ||
703 | #define INT_STS3_WTCHDG_IT_SHIFT 4 | ||
641 | #define INT_STS3_GPIO5_F_IT_MASK 0x08 | 704 | #define INT_STS3_GPIO5_F_IT_MASK 0x08 |
642 | #define INT_STS3_GPIO5_F_IT_SHIFT 3 | 705 | #define INT_STS3_GPIO5_F_IT_SHIFT 3 |
643 | #define INT_STS3_GPIO5_R_IT_MASK 0x04 | 706 | #define INT_STS3_GPIO5_R_IT_MASK 0x04 |
@@ -649,6 +712,14 @@ | |||
649 | 712 | ||
650 | 713 | ||
651 | /*Register INT_MSK3 (0x80) register.RegisterDescription */ | 714 | /*Register INT_MSK3 (0x80) register.RegisterDescription */ |
715 | #define INT_MSK3_PWRDN_IT_MSK_MASK 0x80 | ||
716 | #define INT_MSK3_PWRDN_IT_MSK_SHIFT 7 | ||
717 | #define INT_MSK3_VMBCH2_L_IT_MSK_MASK 0x40 | ||
718 | #define INT_MSK3_VMBCH2_L_IT_MSK_SHIFT 6 | ||
719 | #define INT_MSK3_VMBCH2_H_IT_MSK_MASK 0x20 | ||
720 | #define INT_MSK3_VMBCH2_H_IT_MSK_SHIFT 5 | ||
721 | #define INT_MSK3_WTCHDG_IT_MSK_MASK 0x10 | ||
722 | #define INT_MSK3_WTCHDG_IT_MSK_SHIFT 4 | ||
652 | #define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08 | 723 | #define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08 |
653 | #define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3 | 724 | #define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3 |
654 | #define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04 | 725 | #define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04 |
@@ -709,34 +780,32 @@ | |||
709 | #define TPS65910_IRQ_GPIO_F 9 | 780 | #define TPS65910_IRQ_GPIO_F 9 |
710 | #define TPS65910_NUM_IRQ 10 | 781 | #define TPS65910_NUM_IRQ 10 |
711 | 782 | ||
712 | #define TPS65911_IRQ_VBAT_VMBDCH 0 | 783 | #define TPS65911_IRQ_PWRHOLD_F 0 |
713 | #define TPS65911_IRQ_VBAT_VMBDCH2L 1 | 784 | #define TPS65911_IRQ_VBAT_VMHI 1 |
714 | #define TPS65911_IRQ_VBAT_VMBDCH2H 2 | 785 | #define TPS65911_IRQ_PWRON 2 |
715 | #define TPS65911_IRQ_VBAT_VMHI 3 | 786 | #define TPS65911_IRQ_PWRON_LP 3 |
716 | #define TPS65911_IRQ_PWRON 4 | 787 | #define TPS65911_IRQ_PWRHOLD_R 4 |
717 | #define TPS65911_IRQ_PWRON_LP 5 | 788 | #define TPS65911_IRQ_HOTDIE 5 |
718 | #define TPS65911_IRQ_PWRHOLD_F 6 | 789 | #define TPS65911_IRQ_RTC_ALARM 6 |
719 | #define TPS65911_IRQ_PWRHOLD_R 7 | 790 | #define TPS65911_IRQ_RTC_PERIOD 7 |
720 | #define TPS65911_IRQ_HOTDIE 8 | 791 | #define TPS65911_IRQ_GPIO0_R 8 |
721 | #define TPS65911_IRQ_RTC_ALARM 9 | 792 | #define TPS65911_IRQ_GPIO0_F 9 |
722 | #define TPS65911_IRQ_RTC_PERIOD 10 | 793 | #define TPS65911_IRQ_GPIO1_R 10 |
723 | #define TPS65911_IRQ_GPIO0_R 11 | 794 | #define TPS65911_IRQ_GPIO1_F 11 |
724 | #define TPS65911_IRQ_GPIO0_F 12 | 795 | #define TPS65911_IRQ_GPIO2_R 12 |
725 | #define TPS65911_IRQ_GPIO1_R 13 | 796 | #define TPS65911_IRQ_GPIO2_F 13 |
726 | #define TPS65911_IRQ_GPIO1_F 14 | 797 | #define TPS65911_IRQ_GPIO3_R 14 |
727 | #define TPS65911_IRQ_GPIO2_R 15 | 798 | #define TPS65911_IRQ_GPIO3_F 15 |
728 | #define TPS65911_IRQ_GPIO2_F 16 | 799 | #define TPS65911_IRQ_GPIO4_R 16 |
729 | #define TPS65911_IRQ_GPIO3_R 17 | 800 | #define TPS65911_IRQ_GPIO4_F 17 |
730 | #define TPS65911_IRQ_GPIO3_F 18 | 801 | #define TPS65911_IRQ_GPIO5_R 18 |
731 | #define TPS65911_IRQ_GPIO4_R 19 | 802 | #define TPS65911_IRQ_GPIO5_F 19 |
732 | #define TPS65911_IRQ_GPIO4_F 20 | 803 | #define TPS65911_IRQ_WTCHDG 20 |
733 | #define TPS65911_IRQ_GPIO5_R 21 | 804 | #define TPS65911_IRQ_VMBCH2_H 21 |
734 | #define TPS65911_IRQ_GPIO5_F 22 | 805 | #define TPS65911_IRQ_VMBCH2_L 22 |
735 | #define TPS65911_IRQ_WTCHDG 23 | 806 | #define TPS65911_IRQ_PWRDN 23 |
736 | #define TPS65911_IRQ_PWRDN 24 | 807 | |
737 | 808 | #define TPS65911_NUM_IRQ 24 | |
738 | #define TPS65911_NUM_IRQ 25 | ||
739 | |||
740 | 809 | ||
741 | /* GPIO Register Definitions */ | 810 | /* GPIO Register Definitions */ |
742 | #define TPS65910_GPIO_DEB BIT(2) | 811 | #define TPS65910_GPIO_DEB BIT(2) |
@@ -809,6 +878,7 @@ struct tps65910_board { | |||
809 | int vmbch2_threshold; | 878 | int vmbch2_threshold; |
810 | bool en_ck32k_xtal; | 879 | bool en_ck32k_xtal; |
811 | bool en_dev_slp; | 880 | bool en_dev_slp; |
881 | bool pm_off; | ||
812 | struct tps65910_sleep_keepon_data *slp_keepon; | 882 | struct tps65910_sleep_keepon_data *slp_keepon; |
813 | bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; | 883 | bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; |
814 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; | 884 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; |
@@ -823,7 +893,6 @@ struct tps65910 { | |||
823 | struct device *dev; | 893 | struct device *dev; |
824 | struct i2c_client *i2c_client; | 894 | struct i2c_client *i2c_client; |
825 | struct regmap *regmap; | 895 | struct regmap *regmap; |
826 | struct mutex io_mutex; | ||
827 | unsigned int id; | 896 | unsigned int id; |
828 | 897 | ||
829 | /* Client devices */ | 898 | /* Client devices */ |
@@ -835,12 +904,8 @@ struct tps65910 { | |||
835 | struct tps65910_board *of_plat_data; | 904 | struct tps65910_board *of_plat_data; |
836 | 905 | ||
837 | /* IRQ Handling */ | 906 | /* IRQ Handling */ |
838 | struct mutex irq_lock; | ||
839 | int chip_irq; | 907 | int chip_irq; |
840 | int irq_base; | 908 | struct regmap_irq_chip_data *irq_data; |
841 | int irq_num; | ||
842 | u32 irq_mask; | ||
843 | struct irq_domain *domain; | ||
844 | }; | 909 | }; |
845 | 910 | ||
846 | struct tps65910_platform_data { | 911 | struct tps65910_platform_data { |
@@ -848,10 +913,6 @@ struct tps65910_platform_data { | |||
848 | int irq_base; | 913 | int irq_base; |
849 | }; | 914 | }; |
850 | 915 | ||
851 | int tps65910_irq_init(struct tps65910 *tps65910, int irq, | ||
852 | struct tps65910_platform_data *pdata); | ||
853 | int tps65910_irq_exit(struct tps65910 *tps65910); | ||
854 | |||
855 | static inline int tps65910_chip_id(struct tps65910 *tps65910) | 916 | static inline int tps65910_chip_id(struct tps65910 *tps65910) |
856 | { | 917 | { |
857 | return tps65910->id; | 918 | return tps65910->id; |
@@ -887,4 +948,9 @@ static inline int tps65910_reg_update_bits(struct tps65910 *tps65910, u8 reg, | |||
887 | return regmap_update_bits(tps65910->regmap, reg, mask, val); | 948 | return regmap_update_bits(tps65910->regmap, reg, mask, val); |
888 | } | 949 | } |
889 | 950 | ||
951 | static inline int tps65910_irq_get_virq(struct tps65910 *tps65910, int irq) | ||
952 | { | ||
953 | return regmap_irq_get_virq(tps65910->irq_data, irq); | ||
954 | } | ||
955 | |||
890 | #endif /* __LINUX_MFD_TPS65910_H */ | 956 | #endif /* __LINUX_MFD_TPS65910_H */ |