1*fd2f02f9SAxel Lin /* SPDX-License-Identifier: GPL-2.0+ */ 216f10918SSteve Twiss /* 316f10918SSteve Twiss * da9210-regulator.h - Regulator definitions for DA9210 416f10918SSteve Twiss * Copyright (C) 2013 Dialog Semiconductor Ltd. 516f10918SSteve Twiss */ 616f10918SSteve Twiss 716f10918SSteve Twiss #ifndef __DA9210_REGISTERS_H__ 816f10918SSteve Twiss #define __DA9210_REGISTERS_H__ 916f10918SSteve Twiss 1016f10918SSteve Twiss struct da9210_pdata { 1116f10918SSteve Twiss struct regulator_init_data da9210_constraints; 1216f10918SSteve Twiss }; 1316f10918SSteve Twiss 1416f10918SSteve Twiss /* Page selection */ 1516f10918SSteve Twiss #define DA9210_REG_PAGE_CON 0x00 1616f10918SSteve Twiss 1716f10918SSteve Twiss /* System Control and Event Registers */ 1816f10918SSteve Twiss #define DA9210_REG_STATUS_A 0x50 1916f10918SSteve Twiss #define DA9210_REG_STATUS_B 0x51 2016f10918SSteve Twiss #define DA9210_REG_EVENT_A 0x52 2116f10918SSteve Twiss #define DA9210_REG_EVENT_B 0x53 2216f10918SSteve Twiss #define DA9210_REG_MASK_A 0x54 2316f10918SSteve Twiss #define DA9210_REG_MASK_B 0x55 2416f10918SSteve Twiss #define DA9210_REG_CONTROL_A 0x56 2516f10918SSteve Twiss 2616f10918SSteve Twiss /* GPIO Control Registers */ 2716f10918SSteve Twiss #define DA9210_REG_GPIO_0_1 0x58 2816f10918SSteve Twiss #define DA9210_REG_GPIO_2_3 0x59 2916f10918SSteve Twiss #define DA9210_REG_GPIO_4_5 0x5A 3016f10918SSteve Twiss #define DA9210_REG_GPIO_6 0x5B 3116f10918SSteve Twiss 3216f10918SSteve Twiss /* Regulator Registers */ 3316f10918SSteve Twiss #define DA9210_REG_BUCK_CONT 0x5D 3416f10918SSteve Twiss #define DA9210_REG_BUCK_ILIM 0xD0 3516f10918SSteve Twiss #define DA9210_REG_BUCK_CONF1 0xD1 3616f10918SSteve Twiss #define DA9210_REG_BUCK_CONF2 0xD2 3716f10918SSteve Twiss #define DA9210_REG_VBACK_AUTO 0xD4 3816f10918SSteve Twiss #define DA9210_REG_VBACK_BASE 0xD5 3916f10918SSteve Twiss #define DA9210_REG_VBACK_MAX_DVC_IF 0xD6 4016f10918SSteve Twiss #define DA9210_REG_VBACK_DVC 0xD7 4116f10918SSteve Twiss #define DA9210_REG_VBUCK_A 0xD8 4216f10918SSteve Twiss #define DA9210_REG_VBUCK_B 0xD9 4316f10918SSteve Twiss 4416f10918SSteve Twiss /* I2C Interface Settings */ 4516f10918SSteve Twiss #define DA9210_REG_INTERFACE 0x105 4616f10918SSteve Twiss 4716f10918SSteve Twiss /* OTP */ 4816f10918SSteve Twiss #define DA9210_REG_OPT_COUNT 0x140 4916f10918SSteve Twiss #define DA9210_REG_OPT_ADDR 0x141 5016f10918SSteve Twiss #define DA9210_REG_OPT_DATA 0x142 5116f10918SSteve Twiss 5216f10918SSteve Twiss /* Customer Trim and Configuration */ 5316f10918SSteve Twiss #define DA9210_REG_CONFIG_A 0x143 5416f10918SSteve Twiss #define DA9210_REG_CONFIG_B 0x144 5516f10918SSteve Twiss #define DA9210_REG_CONFIG_C 0x145 5616f10918SSteve Twiss #define DA9210_REG_CONFIG_D 0x146 5716f10918SSteve Twiss #define DA9210_REG_CONFIG_E 0x147 5816f10918SSteve Twiss 5916f10918SSteve Twiss 6016f10918SSteve Twiss /* 6116f10918SSteve Twiss * Registers bits 6216f10918SSteve Twiss */ 6316f10918SSteve Twiss /* DA9210_REG_PAGE_CON (addr=0x00) */ 6416f10918SSteve Twiss #define DA9210_PEG_PAGE_SHIFT 0 6516f10918SSteve Twiss #define DA9210_REG_PAGE_MASK 0x0F 6616f10918SSteve Twiss /* On I2C registers 0x00 - 0xFF */ 6716f10918SSteve Twiss #define DA9210_REG_PAGE0 0 6816f10918SSteve Twiss /* On I2C registers 0x100 - 0x1FF */ 6916f10918SSteve Twiss #define DA9210_REG_PAGE2 2 7016f10918SSteve Twiss #define DA9210_PAGE_WRITE_MODE 0x00 7116f10918SSteve Twiss #define DA9210_REPEAT_WRITE_MODE 0x40 7216f10918SSteve Twiss #define DA9210_PAGE_REVERT 0x80 7316f10918SSteve Twiss 7416f10918SSteve Twiss /* DA9210_REG_STATUS_A (addr=0x50) */ 7516f10918SSteve Twiss #define DA9210_GPI0 0x01 7616f10918SSteve Twiss #define DA9210_GPI1 0x02 7716f10918SSteve Twiss #define DA9210_GPI2 0x04 7816f10918SSteve Twiss #define DA9210_GPI3 0x08 7916f10918SSteve Twiss #define DA9210_GPI4 0x10 8016f10918SSteve Twiss #define DA9210_GPI5 0x20 8116f10918SSteve Twiss #define DA9210_GPI6 0x40 8216f10918SSteve Twiss 8316f10918SSteve Twiss /* DA9210_REG_EVENT_A (addr=0x52) */ 8416f10918SSteve Twiss #define DA9210_E_GPI0 0x01 8516f10918SSteve Twiss #define DA9210_E_GPI1 0x02 8616f10918SSteve Twiss #define DA9210_E_GPI2 0x04 8716f10918SSteve Twiss #define DA9210_E_GPI3 0x08 8816f10918SSteve Twiss #define DA9210_E_GPI4 0x10 8916f10918SSteve Twiss #define DA9210_E_GPI5 0x20 9016f10918SSteve Twiss #define DA9210_E_GPI6 0x40 9116f10918SSteve Twiss 9216f10918SSteve Twiss /* DA9210_REG_EVENT_B (addr=0x53) */ 9316f10918SSteve Twiss #define DA9210_E_OVCURR 0x01 9416f10918SSteve Twiss #define DA9210_E_NPWRGOOD 0x02 9516f10918SSteve Twiss #define DA9210_E_TEMP_WARN 0x04 9616f10918SSteve Twiss #define DA9210_E_TEMP_CRIT 0x08 9716f10918SSteve Twiss #define DA9210_E_VMAX 0x10 9816f10918SSteve Twiss 9916f10918SSteve Twiss /* DA9210_REG_MASK_A (addr=0x54) */ 10016f10918SSteve Twiss #define DA9210_M_GPI0 0x01 10116f10918SSteve Twiss #define DA9210_M_GPI1 0x02 10216f10918SSteve Twiss #define DA9210_M_GPI2 0x04 10316f10918SSteve Twiss #define DA9210_M_GPI3 0x08 10416f10918SSteve Twiss #define DA9210_M_GPI4 0x10 10516f10918SSteve Twiss #define DA9210_M_GPI5 0x20 10616f10918SSteve Twiss #define DA9210_M_GPI6 0x40 10716f10918SSteve Twiss 10816f10918SSteve Twiss /* DA9210_REG_MASK_B (addr=0x55) */ 10916f10918SSteve Twiss #define DA9210_M_OVCURR 0x01 11016f10918SSteve Twiss #define DA9210_M_NPWRGOOD 0x02 11116f10918SSteve Twiss #define DA9210_M_TEMP_WARN 0x04 11216f10918SSteve Twiss #define DA9210_M_TEMP_CRIT 0x08 11316f10918SSteve Twiss #define DA9210_M_VMAX 0x10 11416f10918SSteve Twiss 11516f10918SSteve Twiss /* DA9210_REG_CONTROL_A (addr=0x56) */ 11616f10918SSteve Twiss #define DA9210_DEBOUNCING_SHIFT 0 11716f10918SSteve Twiss #define DA9210_DEBOUNCING_MASK 0x07 11816f10918SSteve Twiss #define DA9210_SLEW_RATE_SHIFT 3 11916f10918SSteve Twiss #define DA9210_SLEW_RATE_MASK 0x18 12016f10918SSteve Twiss #define DA9210_V_LOCK 0x20 12116f10918SSteve Twiss 12216f10918SSteve Twiss /* DA9210_REG_GPIO_0_1 (addr=0x58) */ 12316f10918SSteve Twiss #define DA9210_GPIO0_PIN_SHIFT 0 12416f10918SSteve Twiss #define DA9210_GPIO0_PIN_MASK 0x03 12516f10918SSteve Twiss #define DA9210_GPIO0_PIN_GPI 0x00 12616f10918SSteve Twiss #define DA9210_GPIO0_PIN_GPO_OD 0x02 12716f10918SSteve Twiss #define DA9210_GPIO0_PIN_GPO 0x03 12816f10918SSteve Twiss #define DA9210_GPIO0_TYPE 0x04 12916f10918SSteve Twiss #define DA9210_GPIO0_TYPE_GPI 0x00 13016f10918SSteve Twiss #define DA9210_GPIO0_TYPE_GPO 0x04 13116f10918SSteve Twiss #define DA9210_GPIO0_MODE 0x08 13216f10918SSteve Twiss #define DA9210_GPIO1_PIN_SHIFT 4 13316f10918SSteve Twiss #define DA9210_GPIO1_PIN_MASK 0x30 13416f10918SSteve Twiss #define DA9210_GPIO1_PIN_GPI 0x00 13516f10918SSteve Twiss #define DA9210_GPIO1_PIN_VERROR 0x10 13616f10918SSteve Twiss #define DA9210_GPIO1_PIN_GPO_OD 0x20 13716f10918SSteve Twiss #define DA9210_GPIO1_PIN_GPO 0x30 13816f10918SSteve Twiss #define DA9210_GPIO1_TYPE_SHIFT 0x40 13916f10918SSteve Twiss #define DA9210_GPIO1_TYPE_GPI 0x00 14016f10918SSteve Twiss #define DA9210_GPIO1_TYPE_GPO 0x40 14116f10918SSteve Twiss #define DA9210_GPIO1_MODE 0x80 14216f10918SSteve Twiss 14316f10918SSteve Twiss /* DA9210_REG_GPIO_2_3 (addr=0x59) */ 14416f10918SSteve Twiss #define DA9210_GPIO2_PIN_SHIFT 0 14516f10918SSteve Twiss #define DA9210_GPIO2_PIN_MASK 0x03 14616f10918SSteve Twiss #define DA9210_GPIO2_PIN_GPI 0x00 14716f10918SSteve Twiss #define DA9210_GPIO5_PIN_BUCK_CLK 0x10 14816f10918SSteve Twiss #define DA9210_GPIO2_PIN_GPO_OD 0x02 14916f10918SSteve Twiss #define DA9210_GPIO2_PIN_GPO 0x03 15016f10918SSteve Twiss #define DA9210_GPIO2_TYPE 0x04 15116f10918SSteve Twiss #define DA9210_GPIO2_TYPE_GPI 0x00 15216f10918SSteve Twiss #define DA9210_GPIO2_TYPE_GPO 0x04 15316f10918SSteve Twiss #define DA9210_GPIO2_MODE 0x08 15416f10918SSteve Twiss #define DA9210_GPIO3_PIN_SHIFT 4 15516f10918SSteve Twiss #define DA9210_GPIO3_PIN_MASK 0x30 15616f10918SSteve Twiss #define DA9210_GPIO3_PIN_GPI 0x00 15716f10918SSteve Twiss #define DA9210_GPIO3_PIN_IERROR 0x10 15816f10918SSteve Twiss #define DA9210_GPIO3_PIN_GPO_OD 0x20 15916f10918SSteve Twiss #define DA9210_GPIO3_PIN_GPO 0x30 16016f10918SSteve Twiss #define DA9210_GPIO3_TYPE_SHIFT 0x40 16116f10918SSteve Twiss #define DA9210_GPIO3_TYPE_GPI 0x00 16216f10918SSteve Twiss #define DA9210_GPIO3_TYPE_GPO 0x40 16316f10918SSteve Twiss #define DA9210_GPIO3_MODE 0x80 16416f10918SSteve Twiss 16516f10918SSteve Twiss /* DA9210_REG_GPIO_4_5 (addr=0x5A) */ 16616f10918SSteve Twiss #define DA9210_GPIO4_PIN_SHIFT 0 16716f10918SSteve Twiss #define DA9210_GPIO4_PIN_MASK 0x03 16816f10918SSteve Twiss #define DA9210_GPIO4_PIN_GPI 0x00 16916f10918SSteve Twiss #define DA9210_GPIO4_PIN_GPO_OD 0x02 17016f10918SSteve Twiss #define DA9210_GPIO4_PIN_GPO 0x03 17116f10918SSteve Twiss #define DA9210_GPIO4_TYPE 0x04 17216f10918SSteve Twiss #define DA9210_GPIO4_TYPE_GPI 0x00 17316f10918SSteve Twiss #define DA9210_GPIO4_TYPE_GPO 0x04 17416f10918SSteve Twiss #define DA9210_GPIO4_MODE 0x08 17516f10918SSteve Twiss #define DA9210_GPIO5_PIN_SHIFT 4 17616f10918SSteve Twiss #define DA9210_GPIO5_PIN_MASK 0x30 17716f10918SSteve Twiss #define DA9210_GPIO5_PIN_GPI 0x00 17816f10918SSteve Twiss #define DA9210_GPIO5_PIN_INTERFACE 0x01 17916f10918SSteve Twiss #define DA9210_GPIO5_PIN_GPO_OD 0x20 18016f10918SSteve Twiss #define DA9210_GPIO5_PIN_GPO 0x30 18116f10918SSteve Twiss #define DA9210_GPIO5_TYPE_SHIFT 0x40 18216f10918SSteve Twiss #define DA9210_GPIO5_TYPE_GPI 0x00 18316f10918SSteve Twiss #define DA9210_GPIO5_TYPE_GPO 0x40 18416f10918SSteve Twiss #define DA9210_GPIO5_MODE 0x80 18516f10918SSteve Twiss 18616f10918SSteve Twiss /* DA9210_REG_GPIO_6 (addr=0x5B) */ 18716f10918SSteve Twiss #define DA9210_GPIO6_PIN_SHIFT 0 18816f10918SSteve Twiss #define DA9210_GPIO6_PIN_MASK 0x03 18916f10918SSteve Twiss #define DA9210_GPIO6_PIN_GPI 0x00 19016f10918SSteve Twiss #define DA9210_GPIO6_PIN_INTERFACE 0x01 19116f10918SSteve Twiss #define DA9210_GPIO6_PIN_GPO_OD 0x02 19216f10918SSteve Twiss #define DA9210_GPIO6_PIN_GPO 0x03 19316f10918SSteve Twiss #define DA9210_GPIO6_TYPE 0x04 19416f10918SSteve Twiss #define DA9210_GPIO6_TYPE_GPI 0x00 19516f10918SSteve Twiss #define DA9210_GPIO6_TYPE_GPO 0x04 19616f10918SSteve Twiss #define DA9210_GPIO6_MODE 0x08 19716f10918SSteve Twiss 19816f10918SSteve Twiss /* DA9210_REG_BUCK_CONT (addr=0x5D) */ 19916f10918SSteve Twiss #define DA9210_BUCK_EN 0x01 20016f10918SSteve Twiss #define DA9210_BUCK_GPI_SHIFT 1 20116f10918SSteve Twiss #define DA9210_BUCK_GPI_MASK 0x06 20216f10918SSteve Twiss #define DA9210_BUCK_GPI_OFF 0x00 20316f10918SSteve Twiss #define DA9210_BUCK_GPI_GPIO0 0x02 20416f10918SSteve Twiss #define DA9210_BUCK_GPI_GPIO3 0x04 20516f10918SSteve Twiss #define DA9210_BUCK_GPI_GPIO4 0x06 20616f10918SSteve Twiss #define DA9210_BUCK_PD_DIS 0x08 20716f10918SSteve Twiss #define DA9210_VBUCK_SEL 0x10 20816f10918SSteve Twiss #define DA9210_VBUCK_SEL_A 0x00 20916f10918SSteve Twiss #define DA9210_VBUCK_SEL_B 0x10 21016f10918SSteve Twiss #define DA9210_VBUCK_GPI_SHIFT 5 21116f10918SSteve Twiss #define DA9210_VBUCK_GPI_MASK 0x60 21216f10918SSteve Twiss #define DA9210_VBUCK_GPI_OFF 0x00 21316f10918SSteve Twiss #define DA9210_VBUCK_GPI_GPIO0 0x20 21416f10918SSteve Twiss #define DA9210_VBUCK_GPI_GPIO3 0x40 21516f10918SSteve Twiss #define DA9210_VBUCK_GPI_GPIO4 0x60 21616f10918SSteve Twiss #define DA9210_DVC_CTRL_EN 0x80 21716f10918SSteve Twiss 21816f10918SSteve Twiss /* DA9210_REG_BUCK_ILIM (addr=0xD0) */ 21916f10918SSteve Twiss #define DA9210_BUCK_ILIM_SHIFT 0 22016f10918SSteve Twiss #define DA9210_BUCK_ILIM_MASK 0x0F 22116f10918SSteve Twiss #define DA9210_BUCK_IALARM 0x10 22216f10918SSteve Twiss 22316f10918SSteve Twiss /* DA9210_REG_BUCK_CONF1 (addr=0xD1) */ 22416f10918SSteve Twiss #define DA9210_BUCK_MODE_SHIFT 0 22516f10918SSteve Twiss #define DA9210_BUCK_MODE_MASK 0x03 22616f10918SSteve Twiss #define DA9210_BUCK_MODE_MANUAL 0x00 22716f10918SSteve Twiss #define DA9210_BUCK_MODE_SLEEP 0x01 22816f10918SSteve Twiss #define DA9210_BUCK_MODE_SYNC 0x02 22916f10918SSteve Twiss #define DA9210_BUCK_MODE_AUTO 0x03 23016f10918SSteve Twiss #define DA9210_STARTUP_CTRL_SHIFT 2 23116f10918SSteve Twiss #define DA9210_STARTUP_CTRL_MASK 0x1C 23216f10918SSteve Twiss #define DA9210_PWR_DOWN_CTRL_SHIFT 5 23316f10918SSteve Twiss #define DA9210_PWR_DOWN_CTRL_MASK 0xE0 23416f10918SSteve Twiss 23516f10918SSteve Twiss /* DA9210_REG_BUCK_CONF2 (addr=0xD2) */ 23616f10918SSteve Twiss #define DA9210_PHASE_SEL_SHIFT 0 23716f10918SSteve Twiss #define DA9210_PHASE_SEL_MASK 0x03 23816f10918SSteve Twiss #define DA9210_FREQ_SEL 0x40 23916f10918SSteve Twiss 24016f10918SSteve Twiss /* DA9210_REG_BUCK_AUTO (addr=0xD4) */ 24116f10918SSteve Twiss #define DA9210_VBUCK_AUTO_SHIFT 0 24216f10918SSteve Twiss #define DA9210_VBUCK_AUTO_MASK 0x7F 24316f10918SSteve Twiss 24416f10918SSteve Twiss /* DA9210_REG_BUCK_BASE (addr=0xD5) */ 24516f10918SSteve Twiss #define DA9210_VBUCK_BASE_SHIFT 0 24616f10918SSteve Twiss #define DA9210_VBUCK_BASE_MASK 0x7F 24716f10918SSteve Twiss 24816f10918SSteve Twiss /* DA9210_REG_VBUCK_MAX_DVC_IF (addr=0xD6) */ 24916f10918SSteve Twiss #define DA9210_VBUCK_MAX_SHIFT 0 25016f10918SSteve Twiss #define DA9210_VBUCK_MAX_MASK 0x7F 25116f10918SSteve Twiss #define DA9210_DVC_STEP_SIZE 0x80 25216f10918SSteve Twiss #define DA9210_DVC_STEP_SIZE_10MV 0x00 25316f10918SSteve Twiss #define DA9210_DVC_STEP_SIZE_20MV 0x80 25416f10918SSteve Twiss 25516f10918SSteve Twiss /* DA9210_REG_VBUCK_DVC (addr=0xD7) */ 25616f10918SSteve Twiss #define DA9210_VBUCK_DVC_SHIFT 0 25716f10918SSteve Twiss #define DA9210_VBUCK_DVC_MASK 0x7F 25816f10918SSteve Twiss 25916f10918SSteve Twiss /* DA9210_REG_VBUCK_A/B (addr=0xD8/0xD9) */ 26016f10918SSteve Twiss #define DA9210_VBUCK_SHIFT 0 26116f10918SSteve Twiss #define DA9210_VBUCK_MASK 0x7F 26216f10918SSteve Twiss #define DA9210_VBUCK_BIAS 0 26316f10918SSteve Twiss #define DA9210_BUCK_SL 0x80 26416f10918SSteve Twiss 26516f10918SSteve Twiss /* DA9210_REG_INTERFACE (addr=0x105) */ 26616f10918SSteve Twiss #define DA9210_IF_BASE_ADDR_SHIFT 4 26716f10918SSteve Twiss #define DA9210_IF_BASE_ADDR_MASK 0xF0 26816f10918SSteve Twiss 26916f10918SSteve Twiss /* DA9210_REG_CONFIG_E (addr=0x147) */ 27016f10918SSteve Twiss #define DA9210_STAND_ALONE 0x01 27116f10918SSteve Twiss 27216f10918SSteve Twiss #endif /* __DA9210_REGISTERS_H__ */ 27316f10918SSteve Twiss 274