linux/include/linux/mfd/rohm-bd71828.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Copyright (C) 2019 ROHM Semiconductors */

#ifndef __LINUX_MFD_BD71828_H__
#define __LINUX_MFD_BD71828_H__

#include <linux/bits.h>
#include <linux/mfd/rohm-generic.h>
#include <linux/mfd/rohm-shared.h>

/* Regulator IDs */
enum {};

#define BD71828_BUCK1267_VOLTS
#define BD71828_BUCK3_VOLTS
#define BD71828_BUCK4_VOLTS
#define BD71828_BUCK5_VOLTS
#define BD71828_LDO_VOLTS
/* LDO6 is fixed 1.8V voltage */
#define BD71828_LDO_6_VOLTAGE

/* Registers and masks*/

/* MODE control */
#define BD71828_REG_PS_CTRL_1
#define BD71828_REG_PS_CTRL_2
#define BD71828_REG_PS_CTRL_3

#define BD71828_MASK_STATE_HBNT

#define BD71828_MASK_RUN_LVL_CTRL

/* Regulator control masks */

#define BD71828_MASK_RAMP_DELAY

#define BD71828_MASK_RUN_EN
#define BD71828_MASK_SUSP_EN
#define BD71828_MASK_IDLE_EN
#define BD71828_MASK_LPSR_EN

#define BD71828_MASK_RUN0_EN
#define BD71828_MASK_RUN1_EN
#define BD71828_MASK_RUN2_EN
#define BD71828_MASK_RUN3_EN

#define BD71828_MASK_DVS_BUCK1_CTRL
#define BD71828_DVS_BUCK1_CTRL_I2C
#define BD71828_DVS_BUCK1_USE_RUNLVL

#define BD71828_MASK_DVS_BUCK2_CTRL
#define BD71828_DVS_BUCK2_CTRL_I2C
#define BD71828_DVS_BUCK2_USE_RUNLVL

#define BD71828_MASK_DVS_BUCK6_CTRL
#define BD71828_DVS_BUCK6_CTRL_I2C
#define BD71828_DVS_BUCK6_USE_RUNLVL

#define BD71828_MASK_DVS_BUCK7_CTRL
#define BD71828_DVS_BUCK7_CTRL_I2C
#define BD71828_DVS_BUCK7_USE_RUNLVL

#define BD71828_MASK_BUCK1267_VOLT
#define BD71828_MASK_BUCK3_VOLT
#define BD71828_MASK_BUCK4_VOLT
#define BD71828_MASK_BUCK5_VOLT
#define BD71828_MASK_LDO_VOLT

/* Regulator control regs */
#define BD71828_REG_BUCK1_EN
#define BD71828_REG_BUCK1_CTRL
#define BD71828_REG_BUCK1_MODE
#define BD71828_REG_BUCK1_IDLE_VOLT
#define BD71828_REG_BUCK1_SUSP_VOLT
#define BD71828_REG_BUCK1_VOLT

#define BD71828_REG_BUCK2_EN
#define BD71828_REG_BUCK2_CTRL
#define BD71828_REG_BUCK2_MODE
#define BD71828_REG_BUCK2_IDLE_VOLT
#define BD71828_REG_BUCK2_SUSP_VOLT
#define BD71828_REG_BUCK2_VOLT

#define BD71828_REG_BUCK3_EN
#define BD71828_REG_BUCK3_MODE
#define BD71828_REG_BUCK3_VOLT

#define BD71828_REG_BUCK4_EN
#define BD71828_REG_BUCK4_MODE
#define BD71828_REG_BUCK4_VOLT

#define BD71828_REG_BUCK5_EN
#define BD71828_REG_BUCK5_MODE
#define BD71828_REG_BUCK5_VOLT

#define BD71828_REG_BUCK6_EN
#define BD71828_REG_BUCK6_CTRL
#define BD71828_REG_BUCK6_MODE
#define BD71828_REG_BUCK6_IDLE_VOLT
#define BD71828_REG_BUCK6_SUSP_VOLT
#define BD71828_REG_BUCK6_VOLT

#define BD71828_REG_BUCK7_EN
#define BD71828_REG_BUCK7_CTRL
#define BD71828_REG_BUCK7_MODE
#define BD71828_REG_BUCK7_IDLE_VOLT
#define BD71828_REG_BUCK7_SUSP_VOLT
#define BD71828_REG_BUCK7_VOLT

#define BD71828_REG_LDO1_EN
#define BD71828_REG_LDO1_VOLT
#define BD71828_REG_LDO2_EN
#define BD71828_REG_LDO2_VOLT
#define BD71828_REG_LDO3_EN
#define BD71828_REG_LDO3_VOLT
#define BD71828_REG_LDO4_EN
#define BD71828_REG_LDO4_VOLT
#define BD71828_REG_LDO5_EN
#define BD71828_REG_LDO5_VOLT
#define BD71828_REG_LDO5_VOLT_OPT
#define BD71828_REG_LDO6_EN
#define BD71828_REG_LDO7_EN
#define BD71828_REG_LDO7_VOLT

/* GPIO */

#define BD71828_GPIO_DRIVE_MASK
#define BD71828_GPIO_OPEN_DRAIN
#define BD71828_GPIO_PUSH_PULL
#define BD71828_GPIO_OUT_HI
#define BD71828_GPIO_OUT_LO
#define BD71828_GPIO_OUT_MASK

#define BD71828_REG_GPIO_CTRL1
#define BD71828_REG_GPIO_CTRL2
#define BD71828_REG_GPIO_CTRL3
#define BD71828_REG_IO_STAT

/* clk */
#define BD71828_REG_OUT32K

/* RTC */
#define BD71828_REG_RTC_SEC
#define BD71828_REG_RTC_MINUTE
#define BD71828_REG_RTC_HOUR
#define BD71828_REG_RTC_WEEK
#define BD71828_REG_RTC_DAY
#define BD71828_REG_RTC_MONTH
#define BD71828_REG_RTC_YEAR

#define BD71828_REG_RTC_ALM0_SEC
#define BD71828_REG_RTC_ALM_START
#define BD71828_REG_RTC_ALM0_MINUTE
#define BD71828_REG_RTC_ALM0_HOUR
#define BD71828_REG_RTC_ALM0_WEEK
#define BD71828_REG_RTC_ALM0_DAY
#define BD71828_REG_RTC_ALM0_MONTH
#define BD71828_REG_RTC_ALM0_YEAR
#define BD71828_REG_RTC_ALM0_MASK

#define BD71828_REG_RTC_ALM1_SEC
#define BD71828_REG_RTC_ALM1_MINUTE
#define BD71828_REG_RTC_ALM1_HOUR
#define BD71828_REG_RTC_ALM1_WEEK
#define BD71828_REG_RTC_ALM1_DAY
#define BD71828_REG_RTC_ALM1_MONTH
#define BD71828_REG_RTC_ALM1_YEAR
#define BD71828_REG_RTC_ALM1_MASK

#define BD71828_REG_RTC_ALM2
#define BD71828_REG_RTC_START

/* Charger/Battey */
#define BD71828_REG_CHG_STATE
#define BD71828_REG_CHG_FULL

/* LEDs */
#define BD71828_REG_LED_CTRL
#define BD71828_MASK_LED_AMBER
#define BD71828_MASK_LED_GREEN
#define BD71828_LED_ON
#define BD71828_LED_OFF

/* IRQ registers */
#define BD71828_REG_INT_MASK_BUCK
#define BD71828_REG_INT_MASK_DCIN1
#define BD71828_REG_INT_MASK_DCIN2
#define BD71828_REG_INT_MASK_VSYS
#define BD71828_REG_INT_MASK_CHG
#define BD71828_REG_INT_MASK_BAT
#define BD71828_REG_INT_MASK_BAT_MON1
#define BD71828_REG_INT_MASK_BAT_MON2
#define BD71828_REG_INT_MASK_BAT_MON3
#define BD71828_REG_INT_MASK_BAT_MON4
#define BD71828_REG_INT_MASK_TEMP
#define BD71828_REG_INT_MASK_RTC

#define BD71828_REG_INT_MAIN
#define BD71828_REG_INT_BUCK
#define BD71828_REG_INT_DCIN1
#define BD71828_REG_INT_DCIN2
#define BD71828_REG_INT_VSYS
#define BD71828_REG_INT_CHG
#define BD71828_REG_INT_BAT
#define BD71828_REG_INT_BAT_MON1
#define BD71828_REG_INT_BAT_MON2
#define BD71828_REG_INT_BAT_MON3
#define BD71828_REG_INT_BAT_MON4
#define BD71828_REG_INT_TEMP
#define BD71828_REG_INT_RTC
#define BD71828_REG_INT_UPDATE

#define BD71828_MAX_REGISTER

/* Masks for main IRQ register bits */
enum {};

/* Interrupts */
enum {};

#define BD71828_INT_BUCK1_OCP_MASK
#define BD71828_INT_BUCK2_OCP_MASK
#define BD71828_INT_BUCK3_OCP_MASK
#define BD71828_INT_BUCK4_OCP_MASK
#define BD71828_INT_BUCK5_OCP_MASK
#define BD71828_INT_BUCK6_OCP_MASK
#define BD71828_INT_BUCK7_OCP_MASK
#define BD71828_INT_PGFAULT_MASK

#define BD71828_INT_DCIN_DET_MASK
#define BD71828_INT_DCIN_RMV_MASK
#define BD71828_INT_CLPS_OUT_MASK
#define BD71828_INT_CLPS_IN_MASK
	/* DCIN2 interrupts */
#define BD71828_INT_DCIN_MON_RES_MASK
#define BD71828_INT_DCIN_MON_DET_MASK
#define BD71828_INT_LONGPUSH_MASK
#define BD71828_INT_MIDPUSH_MASK
#define BD71828_INT_SHORTPUSH_MASK
#define BD71828_INT_PUSH_MASK
#define BD71828_INT_WDOG_MASK
#define BD71828_INT_SWRESET_MASK
	/* Vsys */
#define BD71828_INT_VSYS_UV_RES_MASK
#define BD71828_INT_VSYS_UV_DET_MASK
#define BD71828_INT_VSYS_LOW_RES_MASK
#define BD71828_INT_VSYS_LOW_DET_MASK
#define BD71828_INT_VSYS_HALL_IN_MASK
#define BD71828_INT_VSYS_HALL_TOGGLE_MASK
#define BD71828_INT_VSYS_MON_RES_MASK
#define BD71828_INT_VSYS_MON_DET_MASK
	/* Charger */
#define BD71828_INT_CHG_DCIN_ILIM_MASK
#define BD71828_INT_CHG_TOPOFF_TO_DONE_MASK
#define BD71828_INT_CHG_WDG_TEMP_MASK
#define BD71828_INT_CHG_WDG_TIME_MASK
#define BD71828_INT_CHG_RECHARGE_RES_MASK
#define BD71828_INT_CHG_RECHARGE_DET_MASK
#define BD71828_INT_CHG_RANGED_TEMP_TRANSITION_MASK
#define BD71828_INT_CHG_STATE_TRANSITION_MASK
	/* Battery */
#define BD71828_INT_BAT_TEMP_NORMAL_MASK
#define BD71828_INT_BAT_TEMP_ERANGE_MASK
#define BD71828_INT_BAT_TEMP_WARN_MASK
#define BD71828_INT_BAT_REMOVED_MASK
#define BD71828_INT_BAT_DETECTED_MASK
#define BD71828_INT_THERM_REMOVED_MASK
#define BD71828_INT_THERM_DETECTED_MASK
	/* Battery Mon 1 */
#define BD71828_INT_BAT_DEAD_MASK
#define BD71828_INT_BAT_SHORTC_RES_MASK
#define BD71828_INT_BAT_SHORTC_DET_MASK
#define BD71828_INT_BAT_LOW_VOLT_RES_MASK
#define BD71828_INT_BAT_LOW_VOLT_DET_MASK
#define BD71828_INT_BAT_OVER_VOLT_RES_MASK
#define BD71828_INT_BAT_OVER_VOLT_DET_MASK
	/* Battery Mon 2 */
#define BD71828_INT_BAT_MON_RES_MASK
#define BD71828_INT_BAT_MON_DET_MASK
	/* Battery Mon 3 (Coulomb counter) */
#define BD71828_INT_BAT_CC_MON1_MASK
#define BD71828_INT_BAT_CC_MON2_MASK
#define BD71828_INT_BAT_CC_MON3_MASK
	/* Battery Mon 4 */
#define BD71828_INT_BAT_OVER_CURR_1_RES_MASK
#define BD71828_INT_BAT_OVER_CURR_1_DET_MASK
#define BD71828_INT_BAT_OVER_CURR_2_RES_MASK
#define BD71828_INT_BAT_OVER_CURR_2_DET_MASK
#define BD71828_INT_BAT_OVER_CURR_3_RES_MASK
#define BD71828_INT_BAT_OVER_CURR_3_DET_MASK
	/* Temperature */
#define BD71828_INT_TEMP_BAT_LOW_RES_MASK
#define BD71828_INT_TEMP_BAT_LOW_DET_MASK
#define BD71828_INT_TEMP_BAT_HI_RES_MASK
#define BD71828_INT_TEMP_BAT_HI_DET_MASK
#define BD71828_INT_TEMP_CHIP_OVER_125_RES_MASK
#define BD71828_INT_TEMP_CHIP_OVER_125_DET_MASK
#define BD71828_INT_TEMP_CHIP_OVER_VF_RES_MASK
#define BD71828_INT_TEMP_CHIP_OVER_VF_DET_MASK
	/* RTC Alarm */
#define BD71828_INT_RTC0_MASK
#define BD71828_INT_RTC1_MASK
#define BD71828_INT_RTC2_MASK

#define BD71828_OUT_TYPE_MASK
#define BD71828_OUT_TYPE_OPEN_DRAIN
#define BD71828_OUT_TYPE_CMOS

#endif /* __LINUX_MFD_BD71828_H__ */