Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * as3722 definitions
0004  *
0005  * Copyright (C) 2013 ams
0006  * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
0007  *
0008  * Author: Florian Lobmaier <florian.lobmaier@ams.com>
0009  * Author: Laxman Dewangan <ldewangan@nvidia.com>
0010  */
0011 
0012 #ifndef __LINUX_MFD_AS3722_H__
0013 #define __LINUX_MFD_AS3722_H__
0014 
0015 #include <linux/regmap.h>
0016 
0017 /* AS3722 registers */
0018 #define AS3722_SD0_VOLTAGE_REG              0x00
0019 #define AS3722_SD1_VOLTAGE_REG              0x01
0020 #define AS3722_SD2_VOLTAGE_REG              0x02
0021 #define AS3722_SD3_VOLTAGE_REG              0x03
0022 #define AS3722_SD4_VOLTAGE_REG              0x04
0023 #define AS3722_SD5_VOLTAGE_REG              0x05
0024 #define AS3722_SD6_VOLTAGE_REG              0x06
0025 #define AS3722_GPIO0_CONTROL_REG            0x08
0026 #define AS3722_GPIO1_CONTROL_REG            0x09
0027 #define AS3722_GPIO2_CONTROL_REG            0x0A
0028 #define AS3722_GPIO3_CONTROL_REG            0x0B
0029 #define AS3722_GPIO4_CONTROL_REG            0x0C
0030 #define AS3722_GPIO5_CONTROL_REG            0x0D
0031 #define AS3722_GPIO6_CONTROL_REG            0x0E
0032 #define AS3722_GPIO7_CONTROL_REG            0x0F
0033 #define AS3722_LDO0_VOLTAGE_REG             0x10
0034 #define AS3722_LDO1_VOLTAGE_REG             0x11
0035 #define AS3722_LDO2_VOLTAGE_REG             0x12
0036 #define AS3722_LDO3_VOLTAGE_REG             0x13
0037 #define AS3722_LDO4_VOLTAGE_REG             0x14
0038 #define AS3722_LDO5_VOLTAGE_REG             0x15
0039 #define AS3722_LDO6_VOLTAGE_REG             0x16
0040 #define AS3722_LDO7_VOLTAGE_REG             0x17
0041 #define AS3722_LDO9_VOLTAGE_REG             0x19
0042 #define AS3722_LDO10_VOLTAGE_REG            0x1A
0043 #define AS3722_LDO11_VOLTAGE_REG            0x1B
0044 #define AS3722_GPIO_DEB1_REG                0x1E
0045 #define AS3722_GPIO_DEB2_REG                0x1F
0046 #define AS3722_GPIO_SIGNAL_OUT_REG          0x20
0047 #define AS3722_GPIO_SIGNAL_IN_REG           0x21
0048 #define AS3722_REG_SEQU_MOD1_REG            0x22
0049 #define AS3722_REG_SEQU_MOD2_REG            0x23
0050 #define AS3722_REG_SEQU_MOD3_REG            0x24
0051 #define AS3722_SD_PHSW_CTRL_REG             0x27
0052 #define AS3722_SD_PHSW_STATUS               0x28
0053 #define AS3722_SD0_CONTROL_REG              0x29
0054 #define AS3722_SD1_CONTROL_REG              0x2A
0055 #define AS3722_SDmph_CONTROL_REG            0x2B
0056 #define AS3722_SD23_CONTROL_REG             0x2C
0057 #define AS3722_SD4_CONTROL_REG              0x2D
0058 #define AS3722_SD5_CONTROL_REG              0x2E
0059 #define AS3722_SD6_CONTROL_REG              0x2F
0060 #define AS3722_SD_DVM_REG               0x30
0061 #define AS3722_RESET_REASON_REG             0x31
0062 #define AS3722_BATTERY_VOLTAGE_MONITOR_REG      0x32
0063 #define AS3722_STARTUP_CONTROL_REG          0x33
0064 #define AS3722_RESET_TIMER_REG              0x34
0065 #define AS3722_REFERENCE_CONTROL_REG            0x35
0066 #define AS3722_RESET_CONTROL_REG            0x36
0067 #define AS3722_OVER_TEMP_CONTROL_REG            0x37
0068 #define AS3722_WATCHDOG_CONTROL_REG         0x38
0069 #define AS3722_REG_STANDBY_MOD1_REG         0x39
0070 #define AS3722_REG_STANDBY_MOD2_REG         0x3A
0071 #define AS3722_REG_STANDBY_MOD3_REG         0x3B
0072 #define AS3722_ENABLE_CTRL1_REG             0x3C
0073 #define AS3722_ENABLE_CTRL2_REG             0x3D
0074 #define AS3722_ENABLE_CTRL3_REG             0x3E
0075 #define AS3722_ENABLE_CTRL4_REG             0x3F
0076 #define AS3722_ENABLE_CTRL5_REG             0x40
0077 #define AS3722_PWM_CONTROL_L_REG            0x41
0078 #define AS3722_PWM_CONTROL_H_REG            0x42
0079 #define AS3722_WATCHDOG_TIMER_REG           0x46
0080 #define AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG     0x48
0081 #define AS3722_IOVOLTAGE_REG                0x49
0082 #define AS3722_BATTERY_VOLTAGE_MONITOR2_REG     0x4A
0083 #define AS3722_SD_CONTROL_REG               0x4D
0084 #define AS3722_LDOCONTROL0_REG              0x4E
0085 #define AS3722_LDOCONTROL1_REG              0x4F
0086 #define AS3722_SD0_PROTECT_REG              0x50
0087 #define AS3722_SD6_PROTECT_REG              0x51
0088 #define AS3722_PWM_VCONTROL1_REG            0x52
0089 #define AS3722_PWM_VCONTROL2_REG            0x53
0090 #define AS3722_PWM_VCONTROL3_REG            0x54
0091 #define AS3722_PWM_VCONTROL4_REG            0x55
0092 #define AS3722_BB_CHARGER_REG               0x57
0093 #define AS3722_CTRL_SEQU1_REG               0x58
0094 #define AS3722_CTRL_SEQU2_REG               0x59
0095 #define AS3722_OVCURRENT_REG                0x5A
0096 #define AS3722_OVCURRENT_DEB_REG            0x5B
0097 #define AS3722_SDLV_DEB_REG             0x5C
0098 #define AS3722_OC_PG_CTRL_REG               0x5D
0099 #define AS3722_OC_PG_CTRL2_REG              0x5E
0100 #define AS3722_CTRL_STATUS              0x5F
0101 #define AS3722_RTC_CONTROL_REG              0x60
0102 #define AS3722_RTC_SECOND_REG               0x61
0103 #define AS3722_RTC_MINUTE_REG               0x62
0104 #define AS3722_RTC_HOUR_REG             0x63
0105 #define AS3722_RTC_DAY_REG              0x64
0106 #define AS3722_RTC_MONTH_REG                0x65
0107 #define AS3722_RTC_YEAR_REG             0x66
0108 #define AS3722_RTC_ALARM_SECOND_REG         0x67
0109 #define AS3722_RTC_ALARM_MINUTE_REG         0x68
0110 #define AS3722_RTC_ALARM_HOUR_REG           0x69
0111 #define AS3722_RTC_ALARM_DAY_REG            0x6A
0112 #define AS3722_RTC_ALARM_MONTH_REG          0x6B
0113 #define AS3722_RTC_ALARM_YEAR_REG           0x6C
0114 #define AS3722_SRAM_REG                 0x6D
0115 #define AS3722_RTC_ACCESS_REG               0x6F
0116 #define AS3722_RTC_STATUS_REG               0x73
0117 #define AS3722_INTERRUPT_MASK1_REG          0x74
0118 #define AS3722_INTERRUPT_MASK2_REG          0x75
0119 #define AS3722_INTERRUPT_MASK3_REG          0x76
0120 #define AS3722_INTERRUPT_MASK4_REG          0x77
0121 #define AS3722_INTERRUPT_STATUS1_REG            0x78
0122 #define AS3722_INTERRUPT_STATUS2_REG            0x79
0123 #define AS3722_INTERRUPT_STATUS3_REG            0x7A
0124 #define AS3722_INTERRUPT_STATUS4_REG            0x7B
0125 #define AS3722_TEMP_STATUS_REG              0x7D
0126 #define AS3722_ADC0_CONTROL_REG             0x80
0127 #define AS3722_ADC1_CONTROL_REG             0x81
0128 #define AS3722_ADC0_MSB_RESULT_REG          0x82
0129 #define AS3722_ADC0_LSB_RESULT_REG          0x83
0130 #define AS3722_ADC1_MSB_RESULT_REG          0x84
0131 #define AS3722_ADC1_LSB_RESULT_REG          0x85
0132 #define AS3722_ADC1_THRESHOLD_HI_MSB_REG        0x86
0133 #define AS3722_ADC1_THRESHOLD_HI_LSB_REG        0x87
0134 #define AS3722_ADC1_THRESHOLD_LO_MSB_REG        0x88
0135 #define AS3722_ADC1_THRESHOLD_LO_LSB_REG        0x89
0136 #define AS3722_ADC_CONFIGURATION_REG            0x8A
0137 #define AS3722_ASIC_ID1_REG             0x90
0138 #define AS3722_ASIC_ID2_REG             0x91
0139 #define AS3722_LOCK_REG                 0x9E
0140 #define AS3722_FUSE7_REG                0xA7
0141 #define AS3722_MAX_REGISTER             0xF4
0142 
0143 #define AS3722_SD0_EXT_ENABLE_MASK          0x03
0144 #define AS3722_SD1_EXT_ENABLE_MASK          0x0C
0145 #define AS3722_SD2_EXT_ENABLE_MASK          0x30
0146 #define AS3722_SD3_EXT_ENABLE_MASK          0xC0
0147 #define AS3722_SD4_EXT_ENABLE_MASK          0x03
0148 #define AS3722_SD5_EXT_ENABLE_MASK          0x0C
0149 #define AS3722_SD6_EXT_ENABLE_MASK          0x30
0150 #define AS3722_LDO0_EXT_ENABLE_MASK         0x03
0151 #define AS3722_LDO1_EXT_ENABLE_MASK         0x0C
0152 #define AS3722_LDO2_EXT_ENABLE_MASK         0x30
0153 #define AS3722_LDO3_EXT_ENABLE_MASK         0xC0
0154 #define AS3722_LDO4_EXT_ENABLE_MASK         0x03
0155 #define AS3722_LDO5_EXT_ENABLE_MASK         0x0C
0156 #define AS3722_LDO6_EXT_ENABLE_MASK         0x30
0157 #define AS3722_LDO7_EXT_ENABLE_MASK         0xC0
0158 #define AS3722_LDO9_EXT_ENABLE_MASK         0x0C
0159 #define AS3722_LDO10_EXT_ENABLE_MASK            0x30
0160 #define AS3722_LDO11_EXT_ENABLE_MASK            0xC0
0161 
0162 #define AS3722_OVCURRENT_SD0_ALARM_MASK         0x07
0163 #define AS3722_OVCURRENT_SD0_ALARM_SHIFT        0x01
0164 #define AS3722_OVCURRENT_SD0_TRIP_MASK          0x18
0165 #define AS3722_OVCURRENT_SD0_TRIP_SHIFT         0x03
0166 #define AS3722_OVCURRENT_SD1_TRIP_MASK          0x60
0167 #define AS3722_OVCURRENT_SD1_TRIP_SHIFT         0x05
0168 
0169 #define AS3722_OVCURRENT_SD6_ALARM_MASK         0x07
0170 #define AS3722_OVCURRENT_SD6_ALARM_SHIFT        0x01
0171 #define AS3722_OVCURRENT_SD6_TRIP_MASK          0x18
0172 #define AS3722_OVCURRENT_SD6_TRIP_SHIFT         0x03
0173 
0174 /* AS3722 register bits and bit masks */
0175 #define AS3722_LDO_ILIMIT_MASK              BIT(7)
0176 #define AS3722_LDO_ILIMIT_BIT               BIT(7)
0177 #define AS3722_LDO0_VSEL_MASK               0x1F
0178 #define AS3722_LDO0_VSEL_MIN                0x01
0179 #define AS3722_LDO0_VSEL_MAX                0x12
0180 #define AS3722_LDO0_NUM_VOLT                0x12
0181 #define AS3722_LDO3_VSEL_MASK               0x3F
0182 #define AS3722_LDO3_VSEL_MIN                0x01
0183 #define AS3722_LDO3_VSEL_MAX                0x2D
0184 #define AS3722_LDO3_NUM_VOLT                0x2D
0185 #define AS3722_LDO6_VSEL_BYPASS             0x3F
0186 #define AS3722_LDO_VSEL_MASK                0x7F
0187 #define AS3722_LDO_VSEL_MIN             0x01
0188 #define AS3722_LDO_VSEL_MAX             0x7F
0189 #define AS3722_LDO_VSEL_DNU_MIN             0x25
0190 #define AS3722_LDO_VSEL_DNU_MAX             0x3F
0191 #define AS3722_LDO_NUM_VOLT             0x80
0192 
0193 #define AS3722_LDO0_CTRL                BIT(0)
0194 #define AS3722_LDO1_CTRL                BIT(1)
0195 #define AS3722_LDO2_CTRL                BIT(2)
0196 #define AS3722_LDO3_CTRL                BIT(3)
0197 #define AS3722_LDO4_CTRL                BIT(4)
0198 #define AS3722_LDO5_CTRL                BIT(5)
0199 #define AS3722_LDO6_CTRL                BIT(6)
0200 #define AS3722_LDO7_CTRL                BIT(7)
0201 #define AS3722_LDO9_CTRL                BIT(1)
0202 #define AS3722_LDO10_CTRL               BIT(2)
0203 #define AS3722_LDO11_CTRL               BIT(3)
0204 
0205 #define AS3722_LDO3_MODE_MASK               (3 << 6)
0206 #define AS3722_LDO3_MODE_VAL(n)             (((n) & 0x3) << 6)
0207 #define AS3722_LDO3_MODE_PMOS               AS3722_LDO3_MODE_VAL(0)
0208 #define AS3722_LDO3_MODE_PMOS_TRACKING          AS3722_LDO3_MODE_VAL(1)
0209 #define AS3722_LDO3_MODE_NMOS               AS3722_LDO3_MODE_VAL(2)
0210 #define AS3722_LDO3_MODE_SWITCH             AS3722_LDO3_MODE_VAL(3)
0211 
0212 #define AS3722_SD_VSEL_MASK             0x7F
0213 #define AS3722_SD0_VSEL_MIN             0x01
0214 #define AS3722_SD0_VSEL_MAX             0x5A
0215 #define AS3722_SD0_VSEL_LOW_VOL_MAX         0x6E
0216 #define AS3722_SD2_VSEL_MIN             0x01
0217 #define AS3722_SD2_VSEL_MAX             0x7F
0218 
0219 #define AS3722_SDn_CTRL(n)              BIT(n)
0220 
0221 #define AS3722_SD0_MODE_FAST                BIT(4)
0222 #define AS3722_SD1_MODE_FAST                BIT(4)
0223 #define AS3722_SD2_MODE_FAST                BIT(2)
0224 #define AS3722_SD3_MODE_FAST                BIT(6)
0225 #define AS3722_SD4_MODE_FAST                BIT(2)
0226 #define AS3722_SD5_MODE_FAST                BIT(2)
0227 #define AS3722_SD6_MODE_FAST                BIT(4)
0228 
0229 #define AS3722_POWER_OFF                BIT(1)
0230 
0231 #define AS3722_INTERRUPT_MASK1_LID          BIT(0)
0232 #define AS3722_INTERRUPT_MASK1_ACOK         BIT(1)
0233 #define AS3722_INTERRUPT_MASK1_ENABLE1          BIT(2)
0234 #define AS3722_INTERRUPT_MASK1_OCURR_ALARM_SD0      BIT(3)
0235 #define AS3722_INTERRUPT_MASK1_ONKEY_LONG       BIT(4)
0236 #define AS3722_INTERRUPT_MASK1_ONKEY            BIT(5)
0237 #define AS3722_INTERRUPT_MASK1_OVTMP            BIT(6)
0238 #define AS3722_INTERRUPT_MASK1_LOWBAT           BIT(7)
0239 
0240 #define AS3722_INTERRUPT_MASK2_SD0_LV           BIT(0)
0241 #define AS3722_INTERRUPT_MASK2_SD1_LV           BIT(1)
0242 #define AS3722_INTERRUPT_MASK2_SD2345_LV        BIT(2)
0243 #define AS3722_INTERRUPT_MASK2_PWM1_OV_PROT     BIT(3)
0244 #define AS3722_INTERRUPT_MASK2_PWM2_OV_PROT     BIT(4)
0245 #define AS3722_INTERRUPT_MASK2_ENABLE2          BIT(5)
0246 #define AS3722_INTERRUPT_MASK2_SD6_LV           BIT(6)
0247 #define AS3722_INTERRUPT_MASK2_RTC_REP          BIT(7)
0248 
0249 #define AS3722_INTERRUPT_MASK3_RTC_ALARM        BIT(0)
0250 #define AS3722_INTERRUPT_MASK3_GPIO1            BIT(1)
0251 #define AS3722_INTERRUPT_MASK3_GPIO2            BIT(2)
0252 #define AS3722_INTERRUPT_MASK3_GPIO3            BIT(3)
0253 #define AS3722_INTERRUPT_MASK3_GPIO4            BIT(4)
0254 #define AS3722_INTERRUPT_MASK3_GPIO5            BIT(5)
0255 #define AS3722_INTERRUPT_MASK3_WATCHDOG         BIT(6)
0256 #define AS3722_INTERRUPT_MASK3_ENABLE3          BIT(7)
0257 
0258 #define AS3722_INTERRUPT_MASK4_TEMP_SD0_SHUTDOWN    BIT(0)
0259 #define AS3722_INTERRUPT_MASK4_TEMP_SD1_SHUTDOWN    BIT(1)
0260 #define AS3722_INTERRUPT_MASK4_TEMP_SD6_SHUTDOWN    BIT(2)
0261 #define AS3722_INTERRUPT_MASK4_TEMP_SD0_ALARM       BIT(3)
0262 #define AS3722_INTERRUPT_MASK4_TEMP_SD1_ALARM       BIT(4)
0263 #define AS3722_INTERRUPT_MASK4_TEMP_SD6_ALARM       BIT(5)
0264 #define AS3722_INTERRUPT_MASK4_OCCUR_ALARM_SD6      BIT(6)
0265 #define AS3722_INTERRUPT_MASK4_ADC          BIT(7)
0266 
0267 #define AS3722_ADC1_INTERVAL_TIME           BIT(0)
0268 #define AS3722_ADC1_INT_MODE_ON             BIT(1)
0269 #define AS3722_ADC_BUF_ON               BIT(2)
0270 #define AS3722_ADC1_LOW_VOLTAGE_RANGE           BIT(5)
0271 #define AS3722_ADC1_INTEVAL_SCAN            BIT(6)
0272 #define AS3722_ADC1_INT_MASK                BIT(7)
0273 
0274 #define AS3722_ADC_MSB_VAL_MASK             0x7F
0275 #define AS3722_ADC_LSB_VAL_MASK             0x07
0276 
0277 #define AS3722_ADC0_CONV_START              BIT(7)
0278 #define AS3722_ADC0_CONV_NOTREADY           BIT(7)
0279 #define AS3722_ADC0_SOURCE_SELECT_MASK          0x1F
0280 
0281 #define AS3722_ADC1_CONV_START              BIT(7)
0282 #define AS3722_ADC1_CONV_NOTREADY           BIT(7)
0283 #define AS3722_ADC1_SOURCE_SELECT_MASK          0x1F
0284 
0285 #define AS3722_CTRL_SEQU1_AC_OK_PWR_ON          BIT(0)
0286 
0287 /* GPIO modes */
0288 #define AS3722_GPIO_MODE_MASK               0x07
0289 #define AS3722_GPIO_MODE_INPUT              0x00
0290 #define AS3722_GPIO_MODE_OUTPUT_VDDH            0x01
0291 #define AS3722_GPIO_MODE_IO_OPEN_DRAIN          0x02
0292 #define AS3722_GPIO_MODE_ADC_IN             0x03
0293 #define AS3722_GPIO_MODE_INPUT_PULL_UP          0x04
0294 #define AS3722_GPIO_MODE_INPUT_PULL_DOWN        0x05
0295 #define AS3722_GPIO_MODE_IO_OPEN_DRAIN_PULL_UP      0x06
0296 #define AS3722_GPIO_MODE_OUTPUT_VDDL            0x07
0297 #define AS3722_GPIO_MODE_VAL(n)         ((n) & AS3722_GPIO_MODE_MASK)
0298 
0299 #define AS3722_GPIO_INV                 BIT(7)
0300 #define AS3722_GPIO_IOSF_MASK               0x78
0301 #define AS3722_GPIO_IOSF_VAL(n)             (((n) & 0xF) << 3)
0302 #define AS3722_GPIO_IOSF_NORMAL             AS3722_GPIO_IOSF_VAL(0)
0303 #define AS3722_GPIO_IOSF_INTERRUPT_OUT          AS3722_GPIO_IOSF_VAL(1)
0304 #define AS3722_GPIO_IOSF_VSUP_LOW_OUT           AS3722_GPIO_IOSF_VAL(2)
0305 #define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN      AS3722_GPIO_IOSF_VAL(3)
0306 #define AS3722_GPIO_IOSF_ISINK_PWM_IN           AS3722_GPIO_IOSF_VAL(4)
0307 #define AS3722_GPIO_IOSF_VOLTAGE_STBY           AS3722_GPIO_IOSF_VAL(5)
0308 #define AS3722_GPIO_IOSF_SD0_OUT            AS3722_GPIO_IOSF_VAL(6)
0309 #define AS3722_GPIO_IOSF_PWR_GOOD_OUT           AS3722_GPIO_IOSF_VAL(7)
0310 #define AS3722_GPIO_IOSF_Q32K_OUT           AS3722_GPIO_IOSF_VAL(8)
0311 #define AS3722_GPIO_IOSF_WATCHDOG_IN            AS3722_GPIO_IOSF_VAL(9)
0312 #define AS3722_GPIO_IOSF_SOFT_RESET_IN          AS3722_GPIO_IOSF_VAL(11)
0313 #define AS3722_GPIO_IOSF_PWM_OUT            AS3722_GPIO_IOSF_VAL(12)
0314 #define AS3722_GPIO_IOSF_VSUP_LOW_DEB_OUT       AS3722_GPIO_IOSF_VAL(13)
0315 #define AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW       AS3722_GPIO_IOSF_VAL(14)
0316 
0317 #define AS3722_GPIOn_SIGNAL(n)              BIT(n)
0318 #define AS3722_GPIOn_CONTROL_REG(n)     (AS3722_GPIO0_CONTROL_REG + n)
0319 #define AS3722_I2C_PULL_UP              BIT(4)
0320 #define AS3722_INT_PULL_UP              BIT(5)
0321 
0322 #define AS3722_RTC_REP_WAKEUP_EN            BIT(0)
0323 #define AS3722_RTC_ALARM_WAKEUP_EN          BIT(1)
0324 #define AS3722_RTC_ON                   BIT(2)
0325 #define AS3722_RTC_IRQMODE              BIT(3)
0326 #define AS3722_RTC_CLK32K_OUT_EN            BIT(5)
0327 
0328 #define AS3722_WATCHDOG_TIMER_MAX           0x7F
0329 #define AS3722_WATCHDOG_ON              BIT(0)
0330 #define AS3722_WATCHDOG_SW_SIG              BIT(0)
0331 
0332 #define AS3722_EXT_CONTROL_ENABLE1          0x1
0333 #define AS3722_EXT_CONTROL_ENABLE2          0x2
0334 #define AS3722_EXT_CONTROL_ENABLE3          0x3
0335 
0336 #define AS3722_FUSE7_SD0_LOW_VOLTAGE            BIT(4)
0337 
0338 /* Interrupt IDs */
0339 enum as3722_irq {
0340     AS3722_IRQ_LID,
0341     AS3722_IRQ_ACOK,
0342     AS3722_IRQ_ENABLE1,
0343     AS3722_IRQ_OCCUR_ALARM_SD0,
0344     AS3722_IRQ_ONKEY_LONG_PRESS,
0345     AS3722_IRQ_ONKEY,
0346     AS3722_IRQ_OVTMP,
0347     AS3722_IRQ_LOWBAT,
0348     AS3722_IRQ_SD0_LV,
0349     AS3722_IRQ_SD1_LV,
0350     AS3722_IRQ_SD2_LV,
0351     AS3722_IRQ_PWM1_OV_PROT,
0352     AS3722_IRQ_PWM2_OV_PROT,
0353     AS3722_IRQ_ENABLE2,
0354     AS3722_IRQ_SD6_LV,
0355     AS3722_IRQ_RTC_REP,
0356     AS3722_IRQ_RTC_ALARM,
0357     AS3722_IRQ_GPIO1,
0358     AS3722_IRQ_GPIO2,
0359     AS3722_IRQ_GPIO3,
0360     AS3722_IRQ_GPIO4,
0361     AS3722_IRQ_GPIO5,
0362     AS3722_IRQ_WATCHDOG,
0363     AS3722_IRQ_ENABLE3,
0364     AS3722_IRQ_TEMP_SD0_SHUTDOWN,
0365     AS3722_IRQ_TEMP_SD1_SHUTDOWN,
0366     AS3722_IRQ_TEMP_SD2_SHUTDOWN,
0367     AS3722_IRQ_TEMP_SD0_ALARM,
0368     AS3722_IRQ_TEMP_SD1_ALARM,
0369     AS3722_IRQ_TEMP_SD6_ALARM,
0370     AS3722_IRQ_OCCUR_ALARM_SD6,
0371     AS3722_IRQ_ADC,
0372     AS3722_IRQ_MAX,
0373 };
0374 
0375 struct as3722 {
0376     struct device *dev;
0377     struct regmap *regmap;
0378     int chip_irq;
0379     unsigned long irq_flags;
0380     bool en_intern_int_pullup;
0381     bool en_intern_i2c_pullup;
0382     bool en_ac_ok_pwr_on;
0383     struct regmap_irq_chip_data *irq_data;
0384 };
0385 
0386 static inline int as3722_read(struct as3722 *as3722, u32 reg, u32 *dest)
0387 {
0388     return regmap_read(as3722->regmap, reg, dest);
0389 }
0390 
0391 static inline int as3722_write(struct as3722 *as3722, u32 reg, u32 value)
0392 {
0393     return regmap_write(as3722->regmap, reg, value);
0394 }
0395 
0396 static inline int as3722_block_read(struct as3722 *as3722, u32 reg,
0397         int count, u8 *buf)
0398 {
0399     return regmap_bulk_read(as3722->regmap, reg, buf, count);
0400 }
0401 
0402 static inline int as3722_block_write(struct as3722 *as3722, u32 reg,
0403         int count, u8 *data)
0404 {
0405     return regmap_bulk_write(as3722->regmap, reg, data, count);
0406 }
0407 
0408 static inline int as3722_update_bits(struct as3722 *as3722, u32 reg,
0409         u32 mask, u8 val)
0410 {
0411     return regmap_update_bits(as3722->regmap, reg, mask, val);
0412 }
0413 
0414 static inline int as3722_irq_get_virq(struct as3722 *as3722, int irq)
0415 {
0416     return regmap_irq_get_virq(as3722->irq_data, irq);
0417 }
0418 #endif /* __LINUX_MFD_AS3722_H__ */