1*327156c5SLaxman Dewangan /* 2*327156c5SLaxman Dewangan * Defining registers address and its bit definitions of MAX77620 and MAX20024 3*327156c5SLaxman Dewangan * 4*327156c5SLaxman Dewangan * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved. 5*327156c5SLaxman Dewangan * 6*327156c5SLaxman Dewangan * This program is free software; you can redistribute it and/or modify it 7*327156c5SLaxman Dewangan * under the terms and conditions of the GNU General Public License, 8*327156c5SLaxman Dewangan * version 2, as published by the Free Software Foundation. 9*327156c5SLaxman Dewangan */ 10*327156c5SLaxman Dewangan 11*327156c5SLaxman Dewangan #ifndef _MFD_MAX77620_H_ 12*327156c5SLaxman Dewangan #define _MFD_MAX77620_H_ 13*327156c5SLaxman Dewangan 14*327156c5SLaxman Dewangan #include <linux/types.h> 15*327156c5SLaxman Dewangan 16*327156c5SLaxman Dewangan /* GLOBAL, PMIC, GPIO, FPS, ONOFFC, CID Registers */ 17*327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL1 0x00 18*327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL2 0x01 19*327156c5SLaxman Dewangan #define MAX77620_REG_CNFGGLBL3 0x02 20*327156c5SLaxman Dewangan #define MAX77620_REG_CNFG1_32K 0x03 21*327156c5SLaxman Dewangan #define MAX77620_REG_CNFGBBC 0x04 22*327156c5SLaxman Dewangan #define MAX77620_REG_IRQTOP 0x05 23*327156c5SLaxman Dewangan #define MAX77620_REG_INTLBT 0x06 24*327156c5SLaxman Dewangan #define MAX77620_REG_IRQSD 0x07 25*327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_L0_7 0x08 26*327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_L8 0x09 27*327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_LVL2_GPIO 0x0A 28*327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFIRQ 0x0B 29*327156c5SLaxman Dewangan #define MAX77620_REG_NVERC 0x0C 30*327156c5SLaxman Dewangan #define MAX77620_REG_IRQTOPM 0x0D 31*327156c5SLaxman Dewangan #define MAX77620_REG_INTENLBT 0x0E 32*327156c5SLaxman Dewangan #define MAX77620_REG_IRQMASKSD 0x0F 33*327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_MSK_L0_7 0x10 34*327156c5SLaxman Dewangan #define MAX77620_REG_IRQ_MSK_L8 0x11 35*327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFIRQM 0x12 36*327156c5SLaxman Dewangan #define MAX77620_REG_STATLBT 0x13 37*327156c5SLaxman Dewangan #define MAX77620_REG_STATSD 0x14 38*327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFSTAT 0x15 39*327156c5SLaxman Dewangan 40*327156c5SLaxman Dewangan /* SD and LDO Registers */ 41*327156c5SLaxman Dewangan #define MAX77620_REG_SD0 0x16 42*327156c5SLaxman Dewangan #define MAX77620_REG_SD1 0x17 43*327156c5SLaxman Dewangan #define MAX77620_REG_SD2 0x18 44*327156c5SLaxman Dewangan #define MAX77620_REG_SD3 0x19 45*327156c5SLaxman Dewangan #define MAX77620_REG_SD4 0x1A 46*327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD0 0x1B 47*327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD1 0x1C 48*327156c5SLaxman Dewangan #define MAX77620_REG_SD0_CFG 0x1D 49*327156c5SLaxman Dewangan #define MAX77620_REG_SD1_CFG 0x1E 50*327156c5SLaxman Dewangan #define MAX77620_REG_SD2_CFG 0x1F 51*327156c5SLaxman Dewangan #define MAX77620_REG_SD3_CFG 0x20 52*327156c5SLaxman Dewangan #define MAX77620_REG_SD4_CFG 0x21 53*327156c5SLaxman Dewangan #define MAX77620_REG_SD_CFG2 0x22 54*327156c5SLaxman Dewangan #define MAX77620_REG_LDO0_CFG 0x23 55*327156c5SLaxman Dewangan #define MAX77620_REG_LDO0_CFG2 0x24 56*327156c5SLaxman Dewangan #define MAX77620_REG_LDO1_CFG 0x25 57*327156c5SLaxman Dewangan #define MAX77620_REG_LDO1_CFG2 0x26 58*327156c5SLaxman Dewangan #define MAX77620_REG_LDO2_CFG 0x27 59*327156c5SLaxman Dewangan #define MAX77620_REG_LDO2_CFG2 0x28 60*327156c5SLaxman Dewangan #define MAX77620_REG_LDO3_CFG 0x29 61*327156c5SLaxman Dewangan #define MAX77620_REG_LDO3_CFG2 0x2A 62*327156c5SLaxman Dewangan #define MAX77620_REG_LDO4_CFG 0x2B 63*327156c5SLaxman Dewangan #define MAX77620_REG_LDO4_CFG2 0x2C 64*327156c5SLaxman Dewangan #define MAX77620_REG_LDO5_CFG 0x2D 65*327156c5SLaxman Dewangan #define MAX77620_REG_LDO5_CFG2 0x2E 66*327156c5SLaxman Dewangan #define MAX77620_REG_LDO6_CFG 0x2F 67*327156c5SLaxman Dewangan #define MAX77620_REG_LDO6_CFG2 0x30 68*327156c5SLaxman Dewangan #define MAX77620_REG_LDO7_CFG 0x31 69*327156c5SLaxman Dewangan #define MAX77620_REG_LDO7_CFG2 0x32 70*327156c5SLaxman Dewangan #define MAX77620_REG_LDO8_CFG 0x33 71*327156c5SLaxman Dewangan #define MAX77620_REG_LDO8_CFG2 0x34 72*327156c5SLaxman Dewangan #define MAX77620_REG_LDO_CFG3 0x35 73*327156c5SLaxman Dewangan 74*327156c5SLaxman Dewangan #define MAX77620_LDO_SLEW_RATE_MASK 0x1 75*327156c5SLaxman Dewangan 76*327156c5SLaxman Dewangan /* LDO Configuration 3 */ 77*327156c5SLaxman Dewangan #define MAX77620_TRACK4_MASK BIT(5) 78*327156c5SLaxman Dewangan #define MAX77620_TRACK4_SHIFT 5 79*327156c5SLaxman Dewangan 80*327156c5SLaxman Dewangan /* Voltage */ 81*327156c5SLaxman Dewangan #define MAX77620_SDX_VOLT_MASK 0xFF 82*327156c5SLaxman Dewangan #define MAX77620_SD0_VOLT_MASK 0x3F 83*327156c5SLaxman Dewangan #define MAX77620_SD1_VOLT_MASK 0x7F 84*327156c5SLaxman Dewangan #define MAX77620_LDO_VOLT_MASK 0x3F 85*327156c5SLaxman Dewangan 86*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO0 0x36 87*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO1 0x37 88*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO2 0x38 89*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO3 0x39 90*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO4 0x3A 91*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO5 0x3B 92*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO6 0x3C 93*327156c5SLaxman Dewangan #define MAX77620_REG_GPIO7 0x3D 94*327156c5SLaxman Dewangan #define MAX77620_REG_PUE_GPIO 0x3E 95*327156c5SLaxman Dewangan #define MAX77620_REG_PDE_GPIO 0x3F 96*327156c5SLaxman Dewangan #define MAX77620_REG_AME_GPIO 0x40 97*327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFCNFG1 0x41 98*327156c5SLaxman Dewangan #define MAX77620_REG_ONOFFCNFG2 0x42 99*327156c5SLaxman Dewangan 100*327156c5SLaxman Dewangan /* FPS Registers */ 101*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG0 0x43 102*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG1 0x44 103*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_CFG2 0x45 104*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO0 0x46 105*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO1 0x47 106*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO2 0x48 107*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO3 0x49 108*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO4 0x4A 109*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO5 0x4B 110*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO6 0x4C 111*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO7 0x4D 112*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_LDO8 0x4E 113*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD0 0x4F 114*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD1 0x50 115*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD2 0x51 116*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD3 0x52 117*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_SD4 0x53 118*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_NONE 0 119*327156c5SLaxman Dewangan 120*327156c5SLaxman Dewangan #define MAX77620_FPS_SRC_MASK 0xC0 121*327156c5SLaxman Dewangan #define MAX77620_FPS_SRC_SHIFT 6 122*327156c5SLaxman Dewangan #define MAX77620_FPS_PU_PERIOD_MASK 0x38 123*327156c5SLaxman Dewangan #define MAX77620_FPS_PU_PERIOD_SHIFT 3 124*327156c5SLaxman Dewangan #define MAX77620_FPS_PD_PERIOD_MASK 0x07 125*327156c5SLaxman Dewangan #define MAX77620_FPS_PD_PERIOD_SHIFT 0 126*327156c5SLaxman Dewangan #define MAX77620_FPS_TIME_PERIOD_MASK 0x38 127*327156c5SLaxman Dewangan #define MAX77620_FPS_TIME_PERIOD_SHIFT 3 128*327156c5SLaxman Dewangan #define MAX77620_FPS_EN_SRC_MASK 0x06 129*327156c5SLaxman Dewangan #define MAX77620_FPS_EN_SRC_SHIFT 1 130*327156c5SLaxman Dewangan #define MAX77620_FPS_ENFPS_SW_MASK 0x01 131*327156c5SLaxman Dewangan #define MAX77620_FPS_ENFPS_SW 0x01 132*327156c5SLaxman Dewangan 133*327156c5SLaxman Dewangan /* Minimum and maximum FPS period time (in microseconds) are 134*327156c5SLaxman Dewangan * different for MAX77620 and Max20024. 135*327156c5SLaxman Dewangan */ 136*327156c5SLaxman Dewangan #define MAX77620_FPS_PERIOD_MIN_US 40 137*327156c5SLaxman Dewangan #define MAX20024_FPS_PERIOD_MIN_US 20 138*327156c5SLaxman Dewangan 139*327156c5SLaxman Dewangan #define MAX77620_FPS_PERIOD_MAX_US 2560 140*327156c5SLaxman Dewangan #define MAX20024_FPS_PERIOD_MAX_US 5120 141*327156c5SLaxman Dewangan 142*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO1 0x54 143*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO2 0x55 144*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_GPIO3 0x56 145*327156c5SLaxman Dewangan #define MAX77620_REG_FPS_RSO 0x57 146*327156c5SLaxman Dewangan #define MAX77620_REG_CID0 0x58 147*327156c5SLaxman Dewangan #define MAX77620_REG_CID1 0x59 148*327156c5SLaxman Dewangan #define MAX77620_REG_CID2 0x5A 149*327156c5SLaxman Dewangan #define MAX77620_REG_CID3 0x5B 150*327156c5SLaxman Dewangan #define MAX77620_REG_CID4 0x5C 151*327156c5SLaxman Dewangan #define MAX77620_REG_CID5 0x5D 152*327156c5SLaxman Dewangan 153*327156c5SLaxman Dewangan #define MAX77620_REG_DVSSD4 0x5E 154*327156c5SLaxman Dewangan #define MAX20024_REG_MAX_ADD 0x70 155*327156c5SLaxman Dewangan 156*327156c5SLaxman Dewangan #define MAX77620_CID_DIDM_MASK 0xF0 157*327156c5SLaxman Dewangan #define MAX77620_CID_DIDM_SHIFT 4 158*327156c5SLaxman Dewangan 159*327156c5SLaxman Dewangan /* CNCG2SD */ 160*327156c5SLaxman Dewangan #define MAX77620_SD_CNF2_ROVS_EN_SD1 BIT(1) 161*327156c5SLaxman Dewangan #define MAX77620_SD_CNF2_ROVS_EN_SD0 BIT(2) 162*327156c5SLaxman Dewangan 163*327156c5SLaxman Dewangan /* Device Identification Metal */ 164*327156c5SLaxman Dewangan #define MAX77620_CID5_DIDM(n) (((n) >> 4) & 0xF) 165*327156c5SLaxman Dewangan /* Device Indentification OTP */ 166*327156c5SLaxman Dewangan #define MAX77620_CID5_DIDO(n) ((n) & 0xF) 167*327156c5SLaxman Dewangan 168*327156c5SLaxman Dewangan /* SD CNFG1 */ 169*327156c5SLaxman Dewangan #define MAX77620_SD_SR_MASK 0xC0 170*327156c5SLaxman Dewangan #define MAX77620_SD_SR_SHIFT 6 171*327156c5SLaxman Dewangan #define MAX77620_SD_POWER_MODE_MASK 0x30 172*327156c5SLaxman Dewangan #define MAX77620_SD_POWER_MODE_SHIFT 4 173*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_MASK BIT(3) 174*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_DISABLE 0 175*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_ADE_ENABLE BIT(3) 176*327156c5SLaxman Dewangan #define MAX77620_SD_FPWM_MASK 0x04 177*327156c5SLaxman Dewangan #define MAX77620_SD_FPWM_SHIFT 2 178*327156c5SLaxman Dewangan #define MAX77620_SD_FSRADE_MASK 0x01 179*327156c5SLaxman Dewangan #define MAX77620_SD_FSRADE_SHIFT 0 180*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_MASK BIT(2) 181*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_SKIP 0 182*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FPWM_SD_FPWM BIT(2) 183*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_MASK BIT(0) 184*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_DISABLE 0 185*327156c5SLaxman Dewangan #define MAX77620_SD_CFG1_FSRADE_SD_ENABLE BIT(0) 186*327156c5SLaxman Dewangan 187*327156c5SLaxman Dewangan /* LDO_CNFG2 */ 188*327156c5SLaxman Dewangan #define MAX77620_LDO_POWER_MODE_MASK 0xC0 189*327156c5SLaxman Dewangan #define MAX77620_LDO_POWER_MODE_SHIFT 6 190*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_MASK BIT(1) 191*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_DISABLE 0 192*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_ADE_ENABLE BIT(1) 193*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_MASK BIT(0) 194*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_FAST BIT(0) 195*327156c5SLaxman Dewangan #define MAX77620_LDO_CFG2_SS_SLOW 0 196*327156c5SLaxman Dewangan 197*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_GLBL_MASK BIT(7) 198*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_SD_MASK BIT(6) 199*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_LDO_MASK BIT(5) 200*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_GPIO_MASK BIT(4) 201*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_RTC_MASK BIT(3) 202*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_32K_MASK BIT(2) 203*327156c5SLaxman Dewangan #define MAX77620_IRQ_TOP_ONOFF_MASK BIT(1) 204*327156c5SLaxman Dewangan 205*327156c5SLaxman Dewangan #define MAX77620_IRQ_LBM_MASK BIT(3) 206*327156c5SLaxman Dewangan #define MAX77620_IRQ_TJALRM1_MASK BIT(2) 207*327156c5SLaxman Dewangan #define MAX77620_IRQ_TJALRM2_MASK BIT(1) 208*327156c5SLaxman Dewangan 209*327156c5SLaxman Dewangan #define MAX77620_PWR_I2C_ADDR 0x3c 210*327156c5SLaxman Dewangan #define MAX77620_RTC_I2C_ADDR 0x68 211*327156c5SLaxman Dewangan 212*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_MASK BIT(0) 213*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_PUSHPULL BIT(0) 214*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DRV_OPENDRAIN 0 215*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_MASK BIT(1) 216*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_INPUT BIT(1) 217*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DIR_OUTPUT 0 218*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INPUT_VAL_MASK BIT(2) 219*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK BIT(3) 220*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_HIGH BIT(3) 221*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_OUTPUT_VAL_LOW 0 222*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_MASK (0x3 << 4) 223*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_FALLING BIT(4) 224*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_INT_RISING BIT(5) 225*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_MASK (0x3 << 6) 226*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_None (0x0 << 6) 227*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_8ms (0x1 << 6) 228*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_16ms (0x2 << 6) 229*327156c5SLaxman Dewangan #define MAX77620_CNFG_GPIO_DBNC_32ms (0x3 << 6) 230*327156c5SLaxman Dewangan 231*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE0 BIT(0) 232*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE1 BIT(1) 233*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE2 BIT(2) 234*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE3 BIT(3) 235*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE4 BIT(4) 236*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE5 BIT(5) 237*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE6 BIT(6) 238*327156c5SLaxman Dewangan #define MAX77620_IRQ_LVL2_GPIO_EDGE7 BIT(7) 239*327156c5SLaxman Dewangan 240*327156c5SLaxman Dewangan #define MAX77620_CNFG1_32K_OUT0_EN BIT(2) 241*327156c5SLaxman Dewangan 242*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_SFT_RST BIT(7) 243*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_MRT_MASK 0x38 244*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_MRT_SHIFT 0x3 245*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_SLPEN BIT(2) 246*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG1_PWR_OFF BIT(1) 247*327156c5SLaxman Dewangan #define MAX20024_ONOFFCNFG1_CLRSE 0x18 248*327156c5SLaxman Dewangan 249*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_SFT_RST_WK BIT(7) 250*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WD_RST_WK BIT(6) 251*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_SLP_LPM_MSK BIT(5) 252*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WK_ALARM1 BIT(2) 253*327156c5SLaxman Dewangan #define MAX77620_ONOFFCNFG2_WK_EN0 BIT(0) 254*327156c5SLaxman Dewangan 255*327156c5SLaxman Dewangan #define MAX77620_GLBLM_MASK BIT(0) 256*327156c5SLaxman Dewangan 257*327156c5SLaxman Dewangan #define MAX77620_WDTC_MASK 0x3 258*327156c5SLaxman Dewangan #define MAX77620_WDTOFFC BIT(4) 259*327156c5SLaxman Dewangan #define MAX77620_WDTSLPC BIT(3) 260*327156c5SLaxman Dewangan #define MAX77620_WDTEN BIT(2) 261*327156c5SLaxman Dewangan 262*327156c5SLaxman Dewangan #define MAX77620_TWD_MASK 0x3 263*327156c5SLaxman Dewangan #define MAX77620_TWD_2s 0x0 264*327156c5SLaxman Dewangan #define MAX77620_TWD_16s 0x1 265*327156c5SLaxman Dewangan #define MAX77620_TWD_64s 0x2 266*327156c5SLaxman Dewangan #define MAX77620_TWD_128s 0x3 267*327156c5SLaxman Dewangan 268*327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBDAC_EN BIT(7) 269*327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_MPPLD BIT(6) 270*327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBHYST (BIT(5) | BIT(4)) 271*327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBDAC 0x0E 272*327156c5SLaxman Dewangan #define MAX77620_CNFGGLBL1_LBRSTEN BIT(0) 273*327156c5SLaxman Dewangan 274*327156c5SLaxman Dewangan /* CNFG BBC registers */ 275*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_ENABLE BIT(0) 276*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_CURRENT_MASK 0x06 277*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_CURRENT_SHIFT 1 278*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_VOLTAGE_MASK 0x18 279*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_VOLTAGE_SHIFT 3 280*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_LOW_CURRENT_DISABLE BIT(5) 281*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_RESISTOR_MASK 0xC0 282*327156c5SLaxman Dewangan #define MAX77620_CNFGBBC_RESISTOR_SHIFT 6 283*327156c5SLaxman Dewangan 284*327156c5SLaxman Dewangan #define MAX77620_FPS_COUNT 3 285*327156c5SLaxman Dewangan 286*327156c5SLaxman Dewangan /* Interrupts */ 287*327156c5SLaxman Dewangan enum { 288*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_GLBL, /* Low-Battery */ 289*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_SD, /* SD power fail */ 290*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_LDO, /* LDO power fail */ 291*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_GPIO, /* TOP GPIO internal int to MAX77620 */ 292*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_RTC, /* RTC */ 293*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_32K, /* 32kHz oscillator */ 294*327156c5SLaxman Dewangan MAX77620_IRQ_TOP_ONOFF, /* ON/OFF oscillator */ 295*327156c5SLaxman Dewangan MAX77620_IRQ_LBT_MBATLOW, /* Thermal alarm status, > 120C */ 296*327156c5SLaxman Dewangan MAX77620_IRQ_LBT_TJALRM1, /* Thermal alarm status, > 120C */ 297*327156c5SLaxman Dewangan MAX77620_IRQ_LBT_TJALRM2, /* Thermal alarm status, > 140C */ 298*327156c5SLaxman Dewangan }; 299*327156c5SLaxman Dewangan 300*327156c5SLaxman Dewangan /* GPIOs */ 301*327156c5SLaxman Dewangan enum { 302*327156c5SLaxman Dewangan MAX77620_GPIO0, 303*327156c5SLaxman Dewangan MAX77620_GPIO1, 304*327156c5SLaxman Dewangan MAX77620_GPIO2, 305*327156c5SLaxman Dewangan MAX77620_GPIO3, 306*327156c5SLaxman Dewangan MAX77620_GPIO4, 307*327156c5SLaxman Dewangan MAX77620_GPIO5, 308*327156c5SLaxman Dewangan MAX77620_GPIO6, 309*327156c5SLaxman Dewangan MAX77620_GPIO7, 310*327156c5SLaxman Dewangan MAX77620_GPIO_NR, 311*327156c5SLaxman Dewangan }; 312*327156c5SLaxman Dewangan 313*327156c5SLaxman Dewangan /* FPS Source */ 314*327156c5SLaxman Dewangan enum max77620_fps_src { 315*327156c5SLaxman Dewangan MAX77620_FPS_SRC_0, 316*327156c5SLaxman Dewangan MAX77620_FPS_SRC_1, 317*327156c5SLaxman Dewangan MAX77620_FPS_SRC_2, 318*327156c5SLaxman Dewangan MAX77620_FPS_SRC_NONE, 319*327156c5SLaxman Dewangan MAX77620_FPS_SRC_DEF, 320*327156c5SLaxman Dewangan }; 321*327156c5SLaxman Dewangan 322*327156c5SLaxman Dewangan enum max77620_chip_id { 323*327156c5SLaxman Dewangan MAX77620, 324*327156c5SLaxman Dewangan MAX20024, 325*327156c5SLaxman Dewangan }; 326*327156c5SLaxman Dewangan 327*327156c5SLaxman Dewangan struct max77620_chip { 328*327156c5SLaxman Dewangan struct device *dev; 329*327156c5SLaxman Dewangan struct regmap *rmap; 330*327156c5SLaxman Dewangan 331*327156c5SLaxman Dewangan int chip_irq; 332*327156c5SLaxman Dewangan int irq_base; 333*327156c5SLaxman Dewangan 334*327156c5SLaxman Dewangan /* chip id */ 335*327156c5SLaxman Dewangan enum max77620_chip_id chip_id; 336*327156c5SLaxman Dewangan 337*327156c5SLaxman Dewangan bool sleep_enable; 338*327156c5SLaxman Dewangan bool enable_global_lpm; 339*327156c5SLaxman Dewangan int shutdown_fps_period[MAX77620_FPS_COUNT]; 340*327156c5SLaxman Dewangan int suspend_fps_period[MAX77620_FPS_COUNT]; 341*327156c5SLaxman Dewangan 342*327156c5SLaxman Dewangan struct regmap_irq_chip_data *top_irq_data; 343*327156c5SLaxman Dewangan struct regmap_irq_chip_data *gpio_irq_data; 344*327156c5SLaxman Dewangan }; 345*327156c5SLaxman Dewangan 346*327156c5SLaxman Dewangan #endif /* _MFD_MAX77620_H_ */ 347