0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __LINUX_MFD_WM8350_CORE_H_
0009 #define __LINUX_MFD_WM8350_CORE_H_
0010
0011 #include <linux/kernel.h>
0012 #include <linux/mutex.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/completion.h>
0015 #include <linux/regmap.h>
0016
0017 #include <linux/mfd/wm8350/audio.h>
0018 #include <linux/mfd/wm8350/gpio.h>
0019 #include <linux/mfd/wm8350/pmic.h>
0020 #include <linux/mfd/wm8350/rtc.h>
0021 #include <linux/mfd/wm8350/supply.h>
0022 #include <linux/mfd/wm8350/wdt.h>
0023
0024
0025
0026
0027 #define WM8350_RESET_ID 0x00
0028 #define WM8350_ID 0x01
0029 #define WM8350_REVISION 0x02
0030 #define WM8350_SYSTEM_CONTROL_1 0x03
0031 #define WM8350_SYSTEM_CONTROL_2 0x04
0032 #define WM8350_SYSTEM_HIBERNATE 0x05
0033 #define WM8350_INTERFACE_CONTROL 0x06
0034 #define WM8350_POWER_MGMT_1 0x08
0035 #define WM8350_POWER_MGMT_2 0x09
0036 #define WM8350_POWER_MGMT_3 0x0A
0037 #define WM8350_POWER_MGMT_4 0x0B
0038 #define WM8350_POWER_MGMT_5 0x0C
0039 #define WM8350_POWER_MGMT_6 0x0D
0040 #define WM8350_POWER_MGMT_7 0x0E
0041
0042 #define WM8350_SYSTEM_INTERRUPTS 0x18
0043 #define WM8350_INT_STATUS_1 0x19
0044 #define WM8350_INT_STATUS_2 0x1A
0045 #define WM8350_POWER_UP_INT_STATUS 0x1B
0046 #define WM8350_UNDER_VOLTAGE_INT_STATUS 0x1C
0047 #define WM8350_OVER_CURRENT_INT_STATUS 0x1D
0048 #define WM8350_GPIO_INT_STATUS 0x1E
0049 #define WM8350_COMPARATOR_INT_STATUS 0x1F
0050 #define WM8350_SYSTEM_INTERRUPTS_MASK 0x20
0051 #define WM8350_INT_STATUS_1_MASK 0x21
0052 #define WM8350_INT_STATUS_2_MASK 0x22
0053 #define WM8350_POWER_UP_INT_STATUS_MASK 0x23
0054 #define WM8350_UNDER_VOLTAGE_INT_STATUS_MASK 0x24
0055 #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
0056 #define WM8350_GPIO_INT_STATUS_MASK 0x26
0057 #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
0058 #define WM8350_CHARGER_OVERRIDES 0xE2
0059 #define WM8350_MISC_OVERRIDES 0xE3
0060 #define WM8350_COMPARATOR_OVERRIDES 0xE7
0061 #define WM8350_STATE_MACHINE_STATUS 0xE9
0062
0063 #define WM8350_MAX_REGISTER 0xFF
0064
0065 #define WM8350_UNLOCK_KEY 0x0013
0066 #define WM8350_LOCK_KEY 0x0000
0067
0068
0069
0070
0071
0072
0073
0074
0075 #define WM8350_SW_RESET_CHIP_ID_MASK 0xFFFF
0076
0077
0078
0079
0080 #define WM8350_CHIP_REV_MASK 0x7000
0081 #define WM8350_CONF_STS_MASK 0x0C00
0082 #define WM8350_CUST_ID_MASK 0x00FF
0083
0084
0085
0086
0087 #define WM8350_MASK_REV_MASK 0x00FF
0088
0089
0090
0091
0092 #define WM8350_CHIP_ON 0x8000
0093 #define WM8350_POWERCYCLE 0x2000
0094 #define WM8350_VCC_FAULT_OV 0x1000
0095 #define WM8350_REG_RSTB_TIME_MASK 0x0C00
0096 #define WM8350_BG_SLEEP 0x0200
0097 #define WM8350_MEM_VALID 0x0020
0098 #define WM8350_CHIP_SET_UP 0x0010
0099 #define WM8350_ON_DEB_T 0x0008
0100 #define WM8350_ON_POL 0x0002
0101 #define WM8350_IRQ_POL 0x0001
0102
0103
0104
0105
0106 #define WM8350_USB_SUSPEND_8MA 0x8000
0107 #define WM8350_USB_SUSPEND 0x4000
0108 #define WM8350_USB_MSTR 0x2000
0109 #define WM8350_USB_MSTR_SRC 0x1000
0110 #define WM8350_USB_500MA 0x0800
0111 #define WM8350_USB_NOLIM 0x0400
0112
0113
0114
0115
0116 #define WM8350_HIBERNATE 0x8000
0117 #define WM8350_WDOG_HIB_MODE 0x0080
0118 #define WM8350_REG_HIB_STARTUP_SEQ 0x0040
0119 #define WM8350_REG_RESET_HIB_MODE 0x0020
0120 #define WM8350_RST_HIB_MODE 0x0010
0121 #define WM8350_IRQ_HIB_MODE 0x0008
0122 #define WM8350_MEMRST_HIB_MODE 0x0004
0123 #define WM8350_PCCOMP_HIB_MODE 0x0002
0124 #define WM8350_TEMPMON_HIB_MODE 0x0001
0125
0126
0127
0128
0129 #define WM8350_USE_DEV_PINS 0x8000
0130 #define WM8350_USE_DEV_PINS_MASK 0x8000
0131 #define WM8350_USE_DEV_PINS_SHIFT 15
0132 #define WM8350_DEV_ADDR_MASK 0x6000
0133 #define WM8350_DEV_ADDR_SHIFT 13
0134 #define WM8350_CONFIG_DONE 0x1000
0135 #define WM8350_CONFIG_DONE_MASK 0x1000
0136 #define WM8350_CONFIG_DONE_SHIFT 12
0137 #define WM8350_RECONFIG_AT_ON 0x0800
0138 #define WM8350_RECONFIG_AT_ON_MASK 0x0800
0139 #define WM8350_RECONFIG_AT_ON_SHIFT 11
0140 #define WM8350_AUTOINC 0x0200
0141 #define WM8350_AUTOINC_MASK 0x0200
0142 #define WM8350_AUTOINC_SHIFT 9
0143 #define WM8350_ARA 0x0100
0144 #define WM8350_ARA_MASK 0x0100
0145 #define WM8350_ARA_SHIFT 8
0146 #define WM8350_SPI_CFG 0x0008
0147 #define WM8350_SPI_CFG_MASK 0x0008
0148 #define WM8350_SPI_CFG_SHIFT 3
0149 #define WM8350_SPI_4WIRE 0x0004
0150 #define WM8350_SPI_4WIRE_MASK 0x0004
0151 #define WM8350_SPI_4WIRE_SHIFT 2
0152 #define WM8350_SPI_3WIRE 0x0002
0153 #define WM8350_SPI_3WIRE_MASK 0x0002
0154 #define WM8350_SPI_3WIRE_SHIFT 1
0155
0156
0157 #define WM8350_USE_DEV_PINS_PRIMARY 0
0158 #define WM8350_USE_DEV_PINS_DEV 1
0159
0160 #define WM8350_DEV_ADDR_34 0
0161 #define WM8350_DEV_ADDR_36 1
0162 #define WM8350_DEV_ADDR_3C 2
0163 #define WM8350_DEV_ADDR_3E 3
0164
0165 #define WM8350_CONFIG_DONE_OFF 0
0166 #define WM8350_CONFIG_DONE_DONE 1
0167
0168 #define WM8350_RECONFIG_AT_ON_OFF 0
0169 #define WM8350_RECONFIG_AT_ON_ON 1
0170
0171 #define WM8350_AUTOINC_OFF 0
0172 #define WM8350_AUTOINC_ON 1
0173
0174 #define WM8350_ARA_OFF 0
0175 #define WM8350_ARA_ON 1
0176
0177 #define WM8350_SPI_CFG_CMOS 0
0178 #define WM8350_SPI_CFG_OD 1
0179
0180 #define WM8350_SPI_4WIRE_3WIRE 0
0181 #define WM8350_SPI_4WIRE_4WIRE 1
0182
0183 #define WM8350_SPI_3WIRE_I2C 0
0184 #define WM8350_SPI_3WIRE_SPI 1
0185
0186
0187
0188
0189 #define WM8350_CODEC_ISEL_MASK 0xC000
0190 #define WM8350_VBUFEN 0x2000
0191 #define WM8350_OUTPUT_DRAIN_EN 0x0400
0192 #define WM8350_MIC_DET_ENA 0x0100
0193 #define WM8350_BIASEN 0x0020
0194 #define WM8350_MICBEN 0x0010
0195 #define WM8350_VMIDEN 0x0004
0196 #define WM8350_VMID_MASK 0x0003
0197 #define WM8350_VMID_SHIFT 0
0198
0199
0200
0201
0202 #define WM8350_IN3R_ENA 0x0800
0203 #define WM8350_IN3L_ENA 0x0400
0204 #define WM8350_INR_ENA 0x0200
0205 #define WM8350_INL_ENA 0x0100
0206 #define WM8350_MIXINR_ENA 0x0080
0207 #define WM8350_MIXINL_ENA 0x0040
0208 #define WM8350_OUT4_ENA 0x0020
0209 #define WM8350_OUT3_ENA 0x0010
0210 #define WM8350_MIXOUTR_ENA 0x0002
0211 #define WM8350_MIXOUTL_ENA 0x0001
0212
0213
0214
0215
0216 #define WM8350_IN3R_TO_OUT2R 0x0080
0217 #define WM8350_OUT2R_ENA 0x0008
0218 #define WM8350_OUT2L_ENA 0x0004
0219 #define WM8350_OUT1R_ENA 0x0002
0220 #define WM8350_OUT1L_ENA 0x0001
0221
0222
0223
0224
0225 #define WM8350_SYSCLK_ENA 0x4000
0226 #define WM8350_ADC_HPF_ENA 0x2000
0227 #define WM8350_FLL_ENA 0x0800
0228 #define WM8350_FLL_OSC_ENA 0x0400
0229 #define WM8350_TOCLK_ENA 0x0100
0230 #define WM8350_DACR_ENA 0x0020
0231 #define WM8350_DACL_ENA 0x0010
0232 #define WM8350_ADCR_ENA 0x0008
0233 #define WM8350_ADCL_ENA 0x0004
0234
0235
0236
0237
0238 #define WM8350_CODEC_ENA 0x1000
0239 #define WM8350_RTC_TICK_ENA 0x0800
0240 #define WM8350_OSC32K_ENA 0x0400
0241 #define WM8350_CHG_ENA 0x0200
0242 #define WM8350_ACC_DET_ENA 0x0100
0243 #define WM8350_AUXADC_ENA 0x0080
0244 #define WM8350_DCMP4_ENA 0x0008
0245 #define WM8350_DCMP3_ENA 0x0004
0246 #define WM8350_DCMP2_ENA 0x0002
0247 #define WM8350_DCMP1_ENA 0x0001
0248
0249
0250
0251
0252 #define WM8350_LS_ENA 0x8000
0253 #define WM8350_LDO4_ENA 0x0800
0254 #define WM8350_LDO3_ENA 0x0400
0255 #define WM8350_LDO2_ENA 0x0200
0256 #define WM8350_LDO1_ENA 0x0100
0257 #define WM8350_DC6_ENA 0x0020
0258 #define WM8350_DC5_ENA 0x0010
0259 #define WM8350_DC4_ENA 0x0008
0260 #define WM8350_DC3_ENA 0x0004
0261 #define WM8350_DC2_ENA 0x0002
0262 #define WM8350_DC1_ENA 0x0001
0263
0264
0265
0266
0267 #define WM8350_CS2_ENA 0x0002
0268 #define WM8350_CS1_ENA 0x0001
0269
0270
0271
0272
0273 #define WM8350_OC_INT 0x2000
0274 #define WM8350_UV_INT 0x1000
0275 #define WM8350_PUTO_INT 0x0800
0276 #define WM8350_CS_INT 0x0200
0277 #define WM8350_EXT_INT 0x0100
0278 #define WM8350_CODEC_INT 0x0080
0279 #define WM8350_GP_INT 0x0040
0280 #define WM8350_AUXADC_INT 0x0020
0281 #define WM8350_RTC_INT 0x0010
0282 #define WM8350_SYS_INT 0x0008
0283 #define WM8350_CHG_INT 0x0004
0284 #define WM8350_USB_INT 0x0002
0285 #define WM8350_WKUP_INT 0x0001
0286
0287
0288
0289
0290 #define WM8350_CHG_BAT_HOT_EINT 0x8000
0291 #define WM8350_CHG_BAT_COLD_EINT 0x4000
0292 #define WM8350_CHG_BAT_FAIL_EINT 0x2000
0293 #define WM8350_CHG_TO_EINT 0x1000
0294 #define WM8350_CHG_END_EINT 0x0800
0295 #define WM8350_CHG_START_EINT 0x0400
0296 #define WM8350_CHG_FAST_RDY_EINT 0x0200
0297 #define WM8350_RTC_PER_EINT 0x0080
0298 #define WM8350_RTC_SEC_EINT 0x0040
0299 #define WM8350_RTC_ALM_EINT 0x0020
0300 #define WM8350_CHG_VBATT_LT_3P9_EINT 0x0004
0301 #define WM8350_CHG_VBATT_LT_3P1_EINT 0x0002
0302 #define WM8350_CHG_VBATT_LT_2P85_EINT 0x0001
0303
0304
0305
0306
0307 #define WM8350_CS1_EINT 0x2000
0308 #define WM8350_CS2_EINT 0x1000
0309 #define WM8350_USB_LIMIT_EINT 0x0400
0310 #define WM8350_AUXADC_DATARDY_EINT 0x0100
0311 #define WM8350_AUXADC_DCOMP4_EINT 0x0080
0312 #define WM8350_AUXADC_DCOMP3_EINT 0x0040
0313 #define WM8350_AUXADC_DCOMP2_EINT 0x0020
0314 #define WM8350_AUXADC_DCOMP1_EINT 0x0010
0315 #define WM8350_SYS_HYST_COMP_FAIL_EINT 0x0008
0316 #define WM8350_SYS_CHIP_GT115_EINT 0x0004
0317 #define WM8350_SYS_CHIP_GT140_EINT 0x0002
0318 #define WM8350_SYS_WDOG_TO_EINT 0x0001
0319
0320
0321
0322
0323 #define WM8350_PUTO_LDO4_EINT 0x0800
0324 #define WM8350_PUTO_LDO3_EINT 0x0400
0325 #define WM8350_PUTO_LDO2_EINT 0x0200
0326 #define WM8350_PUTO_LDO1_EINT 0x0100
0327 #define WM8350_PUTO_DC6_EINT 0x0020
0328 #define WM8350_PUTO_DC5_EINT 0x0010
0329 #define WM8350_PUTO_DC4_EINT 0x0008
0330 #define WM8350_PUTO_DC3_EINT 0x0004
0331 #define WM8350_PUTO_DC2_EINT 0x0002
0332 #define WM8350_PUTO_DC1_EINT 0x0001
0333
0334
0335
0336
0337 #define WM8350_UV_LDO4_EINT 0x0800
0338 #define WM8350_UV_LDO3_EINT 0x0400
0339 #define WM8350_UV_LDO2_EINT 0x0200
0340 #define WM8350_UV_LDO1_EINT 0x0100
0341 #define WM8350_UV_DC6_EINT 0x0020
0342 #define WM8350_UV_DC5_EINT 0x0010
0343 #define WM8350_UV_DC4_EINT 0x0008
0344 #define WM8350_UV_DC3_EINT 0x0004
0345 #define WM8350_UV_DC2_EINT 0x0002
0346 #define WM8350_UV_DC1_EINT 0x0001
0347
0348
0349
0350
0351 #define WM8350_OC_LS_EINT 0x8000
0352
0353
0354
0355
0356 #define WM8350_GP12_EINT 0x1000
0357 #define WM8350_GP11_EINT 0x0800
0358 #define WM8350_GP10_EINT 0x0400
0359 #define WM8350_GP9_EINT 0x0200
0360 #define WM8350_GP8_EINT 0x0100
0361 #define WM8350_GP7_EINT 0x0080
0362 #define WM8350_GP6_EINT 0x0040
0363 #define WM8350_GP5_EINT 0x0020
0364 #define WM8350_GP4_EINT 0x0010
0365 #define WM8350_GP3_EINT 0x0008
0366 #define WM8350_GP2_EINT 0x0004
0367 #define WM8350_GP1_EINT 0x0002
0368 #define WM8350_GP0_EINT 0x0001
0369
0370
0371
0372
0373 #define WM8350_EXT_USB_FB_EINT 0x8000
0374 #define WM8350_EXT_WALL_FB_EINT 0x4000
0375 #define WM8350_EXT_BAT_FB_EINT 0x2000
0376 #define WM8350_CODEC_JCK_DET_L_EINT 0x0800
0377 #define WM8350_CODEC_JCK_DET_R_EINT 0x0400
0378 #define WM8350_CODEC_MICSCD_EINT 0x0200
0379 #define WM8350_CODEC_MICD_EINT 0x0100
0380 #define WM8350_WKUP_OFF_STATE_EINT 0x0040
0381 #define WM8350_WKUP_HIB_STATE_EINT 0x0020
0382 #define WM8350_WKUP_CONV_FAULT_EINT 0x0010
0383 #define WM8350_WKUP_WDOG_RST_EINT 0x0008
0384 #define WM8350_WKUP_GP_PWR_ON_EINT 0x0004
0385 #define WM8350_WKUP_ONKEY_EINT 0x0002
0386 #define WM8350_WKUP_GP_WAKEUP_EINT 0x0001
0387
0388
0389
0390
0391 #define WM8350_IM_OC_INT 0x2000
0392 #define WM8350_IM_UV_INT 0x1000
0393 #define WM8350_IM_PUTO_INT 0x0800
0394 #define WM8350_IM_SPARE_INT 0x0400
0395 #define WM8350_IM_CS_INT 0x0200
0396 #define WM8350_IM_EXT_INT 0x0100
0397 #define WM8350_IM_CODEC_INT 0x0080
0398 #define WM8350_IM_GP_INT 0x0040
0399 #define WM8350_IM_AUXADC_INT 0x0020
0400 #define WM8350_IM_RTC_INT 0x0010
0401 #define WM8350_IM_SYS_INT 0x0008
0402 #define WM8350_IM_CHG_INT 0x0004
0403 #define WM8350_IM_USB_INT 0x0002
0404 #define WM8350_IM_WKUP_INT 0x0001
0405
0406
0407
0408
0409 #define WM8350_IM_CHG_BAT_HOT_EINT 0x8000
0410 #define WM8350_IM_CHG_BAT_COLD_EINT 0x4000
0411 #define WM8350_IM_CHG_BAT_FAIL_EINT 0x2000
0412 #define WM8350_IM_CHG_TO_EINT 0x1000
0413 #define WM8350_IM_CHG_END_EINT 0x0800
0414 #define WM8350_IM_CHG_START_EINT 0x0400
0415 #define WM8350_IM_CHG_FAST_RDY_EINT 0x0200
0416 #define WM8350_IM_RTC_PER_EINT 0x0080
0417 #define WM8350_IM_RTC_SEC_EINT 0x0040
0418 #define WM8350_IM_RTC_ALM_EINT 0x0020
0419 #define WM8350_IM_CHG_VBATT_LT_3P9_EINT 0x0004
0420 #define WM8350_IM_CHG_VBATT_LT_3P1_EINT 0x0002
0421 #define WM8350_IM_CHG_VBATT_LT_2P85_EINT 0x0001
0422
0423
0424
0425
0426 #define WM8350_IM_SPARE2_EINT 0x8000
0427 #define WM8350_IM_SPARE1_EINT 0x4000
0428 #define WM8350_IM_CS1_EINT 0x2000
0429 #define WM8350_IM_CS2_EINT 0x1000
0430 #define WM8350_IM_USB_LIMIT_EINT 0x0400
0431 #define WM8350_IM_AUXADC_DATARDY_EINT 0x0100
0432 #define WM8350_IM_AUXADC_DCOMP4_EINT 0x0080
0433 #define WM8350_IM_AUXADC_DCOMP3_EINT 0x0040
0434 #define WM8350_IM_AUXADC_DCOMP2_EINT 0x0020
0435 #define WM8350_IM_AUXADC_DCOMP1_EINT 0x0010
0436 #define WM8350_IM_SYS_HYST_COMP_FAIL_EINT 0x0008
0437 #define WM8350_IM_SYS_CHIP_GT115_EINT 0x0004
0438 #define WM8350_IM_SYS_CHIP_GT140_EINT 0x0002
0439 #define WM8350_IM_SYS_WDOG_TO_EINT 0x0001
0440
0441
0442
0443
0444 #define WM8350_IM_PUTO_LDO4_EINT 0x0800
0445 #define WM8350_IM_PUTO_LDO3_EINT 0x0400
0446 #define WM8350_IM_PUTO_LDO2_EINT 0x0200
0447 #define WM8350_IM_PUTO_LDO1_EINT 0x0100
0448 #define WM8350_IM_PUTO_DC6_EINT 0x0020
0449 #define WM8350_IM_PUTO_DC5_EINT 0x0010
0450 #define WM8350_IM_PUTO_DC4_EINT 0x0008
0451 #define WM8350_IM_PUTO_DC3_EINT 0x0004
0452 #define WM8350_IM_PUTO_DC2_EINT 0x0002
0453 #define WM8350_IM_PUTO_DC1_EINT 0x0001
0454
0455
0456
0457
0458 #define WM8350_IM_UV_LDO4_EINT 0x0800
0459 #define WM8350_IM_UV_LDO3_EINT 0x0400
0460 #define WM8350_IM_UV_LDO2_EINT 0x0200
0461 #define WM8350_IM_UV_LDO1_EINT 0x0100
0462 #define WM8350_IM_UV_DC6_EINT 0x0020
0463 #define WM8350_IM_UV_DC5_EINT 0x0010
0464 #define WM8350_IM_UV_DC4_EINT 0x0008
0465 #define WM8350_IM_UV_DC3_EINT 0x0004
0466 #define WM8350_IM_UV_DC2_EINT 0x0002
0467 #define WM8350_IM_UV_DC1_EINT 0x0001
0468
0469
0470
0471
0472 #define WM8350_IM_OC_LS_EINT 0x8000
0473
0474
0475
0476
0477 #define WM8350_IM_GP12_EINT 0x1000
0478 #define WM8350_IM_GP11_EINT 0x0800
0479 #define WM8350_IM_GP10_EINT 0x0400
0480 #define WM8350_IM_GP9_EINT 0x0200
0481 #define WM8350_IM_GP8_EINT 0x0100
0482 #define WM8350_IM_GP7_EINT 0x0080
0483 #define WM8350_IM_GP6_EINT 0x0040
0484 #define WM8350_IM_GP5_EINT 0x0020
0485 #define WM8350_IM_GP4_EINT 0x0010
0486 #define WM8350_IM_GP3_EINT 0x0008
0487 #define WM8350_IM_GP2_EINT 0x0004
0488 #define WM8350_IM_GP1_EINT 0x0002
0489 #define WM8350_IM_GP0_EINT 0x0001
0490
0491
0492
0493
0494 #define WM8350_IM_EXT_USB_FB_EINT 0x8000
0495 #define WM8350_IM_EXT_WALL_FB_EINT 0x4000
0496 #define WM8350_IM_EXT_BAT_FB_EINT 0x2000
0497 #define WM8350_IM_CODEC_JCK_DET_L_EINT 0x0800
0498 #define WM8350_IM_CODEC_JCK_DET_R_EINT 0x0400
0499 #define WM8350_IM_CODEC_MICSCD_EINT 0x0200
0500 #define WM8350_IM_CODEC_MICD_EINT 0x0100
0501 #define WM8350_IM_WKUP_OFF_STATE_EINT 0x0040
0502 #define WM8350_IM_WKUP_HIB_STATE_EINT 0x0020
0503 #define WM8350_IM_WKUP_CONV_FAULT_EINT 0x0010
0504 #define WM8350_IM_WKUP_WDOG_RST_EINT 0x0008
0505 #define WM8350_IM_WKUP_GP_PWR_ON_EINT 0x0004
0506 #define WM8350_IM_WKUP_ONKEY_EINT 0x0002
0507 #define WM8350_IM_WKUP_GP_WAKEUP_EINT 0x0001
0508
0509
0510
0511
0512 #define WM8350_READ_STATUS 0x0800
0513 #define WM8350_TSTRAM_CLK 0x0100
0514 #define WM8350_TSTRAM_CLK_ENA 0x0080
0515 #define WM8350_STARTSEQ 0x0040
0516 #define WM8350_READ_SRC 0x0020
0517 #define WM8350_COUNT_DIR 0x0010
0518 #define WM8350_TSTRAM_MODE_MASK 0x000E
0519 #define WM8350_TSTRAM_ENA 0x0001
0520
0521
0522
0523
0524 #define WM8350_LS_STS 0x8000
0525 #define WM8350_LDO4_STS 0x0800
0526 #define WM8350_LDO3_STS 0x0400
0527 #define WM8350_LDO2_STS 0x0200
0528 #define WM8350_LDO1_STS 0x0100
0529 #define WM8350_DC6_STS 0x0020
0530 #define WM8350_DC5_STS 0x0010
0531 #define WM8350_DC4_STS 0x0008
0532 #define WM8350_DC3_STS 0x0004
0533 #define WM8350_DC2_STS 0x0002
0534 #define WM8350_DC1_STS 0x0001
0535
0536
0537
0538
0539 #define WM8350_CHG_BATT_HOT_OVRDE 0x8000
0540 #define WM8350_CHG_BATT_COLD_OVRDE 0x4000
0541
0542
0543
0544
0545 #define WM8350_USB_LIMIT_OVRDE 0x0400
0546
0547
0548
0549
0550 #define WM8350_USB_FB_OVRDE 0x8000
0551 #define WM8350_WALL_FB_OVRDE 0x4000
0552 #define WM8350_BATT_FB_OVRDE 0x2000
0553
0554
0555
0556
0557
0558 #define WM8350_USB_SM_MASK 0x0700
0559 #define WM8350_USB_SM_SHIFT 8
0560
0561 #define WM8350_USB_SM_100_SLV 1
0562 #define WM8350_USB_SM_500_SLV 5
0563 #define WM8350_USB_SM_STDBY_SLV 7
0564
0565
0566 #define WM8350_IRQ_WKUP_OFF_STATE 43
0567 #define WM8350_IRQ_WKUP_HIB_STATE 44
0568 #define WM8350_IRQ_WKUP_CONV_FAULT 45
0569 #define WM8350_IRQ_WKUP_WDOG_RST 46
0570 #define WM8350_IRQ_WKUP_GP_PWR_ON 47
0571 #define WM8350_IRQ_WKUP_ONKEY 48
0572 #define WM8350_IRQ_WKUP_GP_WAKEUP 49
0573
0574
0575 #define WM8350_REV_E 0x4
0576 #define WM8350_REV_F 0x5
0577 #define WM8350_REV_G 0x6
0578 #define WM8350_REV_H 0x7
0579
0580 #define WM8350_NUM_IRQ 63
0581
0582 #define WM8350_NUM_IRQ_REGS 7
0583
0584 extern const struct regmap_config wm8350_regmap;
0585
0586 struct wm8350;
0587
0588 struct wm8350_hwmon {
0589 struct platform_device *pdev;
0590 struct device *classdev;
0591 };
0592
0593 struct wm8350 {
0594 struct device *dev;
0595
0596
0597 struct regmap *regmap;
0598 bool unlocked;
0599
0600 struct mutex auxadc_mutex;
0601 struct completion auxadc_done;
0602
0603
0604 struct mutex irq_lock;
0605 int chip_irq;
0606 int irq_base;
0607 u16 irq_masks[WM8350_NUM_IRQ_REGS];
0608
0609
0610 struct wm8350_codec codec;
0611 struct wm8350_gpio gpio;
0612 struct wm8350_hwmon hwmon;
0613 struct wm8350_pmic pmic;
0614 struct wm8350_power power;
0615 struct wm8350_rtc rtc;
0616 struct wm8350_wdt wdt;
0617 };
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628 struct wm8350_platform_data {
0629 int (*init)(struct wm8350 *wm8350);
0630 int irq_high;
0631 int irq_base;
0632 int gpio_base;
0633 };
0634
0635
0636
0637
0638
0639 int wm8350_device_init(struct wm8350 *wm8350, int irq,
0640 struct wm8350_platform_data *pdata);
0641
0642
0643
0644
0645 int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
0646 int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
0647 u16 wm8350_reg_read(struct wm8350 *wm8350, int reg);
0648 int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val);
0649 int wm8350_reg_lock(struct wm8350 *wm8350);
0650 int wm8350_reg_unlock(struct wm8350 *wm8350);
0651 int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest);
0652 int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
0653
0654
0655
0656
0657 static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq,
0658 irq_handler_t handler,
0659 unsigned long flags,
0660 const char *name, void *data)
0661 {
0662 if (!wm8350->irq_base)
0663 return -ENODEV;
0664
0665 return request_threaded_irq(irq + wm8350->irq_base, NULL,
0666 handler, flags, name, data);
0667 }
0668
0669 static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data)
0670 {
0671 free_irq(irq + wm8350->irq_base, data);
0672 }
0673
0674 static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq)
0675 {
0676 disable_irq(irq + wm8350->irq_base);
0677 }
0678
0679 static inline void wm8350_unmask_irq(struct wm8350 *wm8350, int irq)
0680 {
0681 enable_irq(irq + wm8350->irq_base);
0682 }
0683
0684 int wm8350_irq_init(struct wm8350 *wm8350, int irq,
0685 struct wm8350_platform_data *pdata);
0686 int wm8350_irq_exit(struct wm8350 *wm8350);
0687
0688 #endif