linux/include/linux/mfd/as3722.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * as3722 definitions
 *
 * Copyright (C) 2013 ams
 * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
 *
 * Author: Florian Lobmaier <[email protected]>
 * Author: Laxman Dewangan <[email protected]>
 */

#ifndef __LINUX_MFD_AS3722_H__
#define __LINUX_MFD_AS3722_H__

#include <linux/regmap.h>

/* AS3722 registers */
#define AS3722_SD0_VOLTAGE_REG
#define AS3722_SD1_VOLTAGE_REG
#define AS3722_SD2_VOLTAGE_REG
#define AS3722_SD3_VOLTAGE_REG
#define AS3722_SD4_VOLTAGE_REG
#define AS3722_SD5_VOLTAGE_REG
#define AS3722_SD6_VOLTAGE_REG
#define AS3722_GPIO0_CONTROL_REG
#define AS3722_GPIO1_CONTROL_REG
#define AS3722_GPIO2_CONTROL_REG
#define AS3722_GPIO3_CONTROL_REG
#define AS3722_GPIO4_CONTROL_REG
#define AS3722_GPIO5_CONTROL_REG
#define AS3722_GPIO6_CONTROL_REG
#define AS3722_GPIO7_CONTROL_REG
#define AS3722_LDO0_VOLTAGE_REG
#define AS3722_LDO1_VOLTAGE_REG
#define AS3722_LDO2_VOLTAGE_REG
#define AS3722_LDO3_VOLTAGE_REG
#define AS3722_LDO4_VOLTAGE_REG
#define AS3722_LDO5_VOLTAGE_REG
#define AS3722_LDO6_VOLTAGE_REG
#define AS3722_LDO7_VOLTAGE_REG
#define AS3722_LDO9_VOLTAGE_REG
#define AS3722_LDO10_VOLTAGE_REG
#define AS3722_LDO11_VOLTAGE_REG
#define AS3722_GPIO_DEB1_REG
#define AS3722_GPIO_DEB2_REG
#define AS3722_GPIO_SIGNAL_OUT_REG
#define AS3722_GPIO_SIGNAL_IN_REG
#define AS3722_REG_SEQU_MOD1_REG
#define AS3722_REG_SEQU_MOD2_REG
#define AS3722_REG_SEQU_MOD3_REG
#define AS3722_SD_PHSW_CTRL_REG
#define AS3722_SD_PHSW_STATUS
#define AS3722_SD0_CONTROL_REG
#define AS3722_SD1_CONTROL_REG
#define AS3722_SDmph_CONTROL_REG
#define AS3722_SD23_CONTROL_REG
#define AS3722_SD4_CONTROL_REG
#define AS3722_SD5_CONTROL_REG
#define AS3722_SD6_CONTROL_REG
#define AS3722_SD_DVM_REG
#define AS3722_RESET_REASON_REG
#define AS3722_BATTERY_VOLTAGE_MONITOR_REG
#define AS3722_STARTUP_CONTROL_REG
#define AS3722_RESET_TIMER_REG
#define AS3722_REFERENCE_CONTROL_REG
#define AS3722_RESET_CONTROL_REG
#define AS3722_OVER_TEMP_CONTROL_REG
#define AS3722_WATCHDOG_CONTROL_REG
#define AS3722_REG_STANDBY_MOD1_REG
#define AS3722_REG_STANDBY_MOD2_REG
#define AS3722_REG_STANDBY_MOD3_REG
#define AS3722_ENABLE_CTRL1_REG
#define AS3722_ENABLE_CTRL2_REG
#define AS3722_ENABLE_CTRL3_REG
#define AS3722_ENABLE_CTRL4_REG
#define AS3722_ENABLE_CTRL5_REG
#define AS3722_PWM_CONTROL_L_REG
#define AS3722_PWM_CONTROL_H_REG
#define AS3722_WATCHDOG_TIMER_REG
#define AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG
#define AS3722_IOVOLTAGE_REG
#define AS3722_BATTERY_VOLTAGE_MONITOR2_REG
#define AS3722_SD_CONTROL_REG
#define AS3722_LDOCONTROL0_REG
#define AS3722_LDOCONTROL1_REG
#define AS3722_SD0_PROTECT_REG
#define AS3722_SD6_PROTECT_REG
#define AS3722_PWM_VCONTROL1_REG
#define AS3722_PWM_VCONTROL2_REG
#define AS3722_PWM_VCONTROL3_REG
#define AS3722_PWM_VCONTROL4_REG
#define AS3722_BB_CHARGER_REG
#define AS3722_CTRL_SEQU1_REG
#define AS3722_CTRL_SEQU2_REG
#define AS3722_OVCURRENT_REG
#define AS3722_OVCURRENT_DEB_REG
#define AS3722_SDLV_DEB_REG
#define AS3722_OC_PG_CTRL_REG
#define AS3722_OC_PG_CTRL2_REG
#define AS3722_CTRL_STATUS
#define AS3722_RTC_CONTROL_REG
#define AS3722_RTC_SECOND_REG
#define AS3722_RTC_MINUTE_REG
#define AS3722_RTC_HOUR_REG
#define AS3722_RTC_DAY_REG
#define AS3722_RTC_MONTH_REG
#define AS3722_RTC_YEAR_REG
#define AS3722_RTC_ALARM_SECOND_REG
#define AS3722_RTC_ALARM_MINUTE_REG
#define AS3722_RTC_ALARM_HOUR_REG
#define AS3722_RTC_ALARM_DAY_REG
#define AS3722_RTC_ALARM_MONTH_REG
#define AS3722_RTC_ALARM_YEAR_REG
#define AS3722_SRAM_REG
#define AS3722_RTC_ACCESS_REG
#define AS3722_RTC_STATUS_REG
#define AS3722_INTERRUPT_MASK1_REG
#define AS3722_INTERRUPT_MASK2_REG
#define AS3722_INTERRUPT_MASK3_REG
#define AS3722_INTERRUPT_MASK4_REG
#define AS3722_INTERRUPT_STATUS1_REG
#define AS3722_INTERRUPT_STATUS2_REG
#define AS3722_INTERRUPT_STATUS3_REG
#define AS3722_INTERRUPT_STATUS4_REG
#define AS3722_TEMP_STATUS_REG
#define AS3722_ADC0_CONTROL_REG
#define AS3722_ADC1_CONTROL_REG
#define AS3722_ADC0_MSB_RESULT_REG
#define AS3722_ADC0_LSB_RESULT_REG
#define AS3722_ADC1_MSB_RESULT_REG
#define AS3722_ADC1_LSB_RESULT_REG
#define AS3722_ADC1_THRESHOLD_HI_MSB_REG
#define AS3722_ADC1_THRESHOLD_HI_LSB_REG
#define AS3722_ADC1_THRESHOLD_LO_MSB_REG
#define AS3722_ADC1_THRESHOLD_LO_LSB_REG
#define AS3722_ADC_CONFIGURATION_REG
#define AS3722_ASIC_ID1_REG
#define AS3722_ASIC_ID2_REG
#define AS3722_LOCK_REG
#define AS3722_FUSE7_REG
#define AS3722_MAX_REGISTER

#define AS3722_SD0_EXT_ENABLE_MASK
#define AS3722_SD1_EXT_ENABLE_MASK
#define AS3722_SD2_EXT_ENABLE_MASK
#define AS3722_SD3_EXT_ENABLE_MASK
#define AS3722_SD4_EXT_ENABLE_MASK
#define AS3722_SD5_EXT_ENABLE_MASK
#define AS3722_SD6_EXT_ENABLE_MASK
#define AS3722_LDO0_EXT_ENABLE_MASK
#define AS3722_LDO1_EXT_ENABLE_MASK
#define AS3722_LDO2_EXT_ENABLE_MASK
#define AS3722_LDO3_EXT_ENABLE_MASK
#define AS3722_LDO4_EXT_ENABLE_MASK
#define AS3722_LDO5_EXT_ENABLE_MASK
#define AS3722_LDO6_EXT_ENABLE_MASK
#define AS3722_LDO7_EXT_ENABLE_MASK
#define AS3722_LDO9_EXT_ENABLE_MASK
#define AS3722_LDO10_EXT_ENABLE_MASK
#define AS3722_LDO11_EXT_ENABLE_MASK

#define AS3722_OVCURRENT_SD0_ALARM_MASK
#define AS3722_OVCURRENT_SD0_ALARM_SHIFT
#define AS3722_OVCURRENT_SD0_TRIP_MASK
#define AS3722_OVCURRENT_SD0_TRIP_SHIFT
#define AS3722_OVCURRENT_SD1_TRIP_MASK
#define AS3722_OVCURRENT_SD1_TRIP_SHIFT

#define AS3722_OVCURRENT_SD6_ALARM_MASK
#define AS3722_OVCURRENT_SD6_ALARM_SHIFT
#define AS3722_OVCURRENT_SD6_TRIP_MASK
#define AS3722_OVCURRENT_SD6_TRIP_SHIFT

/* AS3722 register bits and bit masks */
#define AS3722_LDO_ILIMIT_MASK
#define AS3722_LDO_ILIMIT_BIT
#define AS3722_LDO0_VSEL_MASK
#define AS3722_LDO0_VSEL_MIN
#define AS3722_LDO0_VSEL_MAX
#define AS3722_LDO0_NUM_VOLT
#define AS3722_LDO3_VSEL_MASK
#define AS3722_LDO3_VSEL_MIN
#define AS3722_LDO3_VSEL_MAX
#define AS3722_LDO3_NUM_VOLT
#define AS3722_LDO6_VSEL_BYPASS
#define AS3722_LDO_VSEL_MASK
#define AS3722_LDO_VSEL_MIN
#define AS3722_LDO_VSEL_MAX
#define AS3722_LDO_VSEL_DNU_MIN
#define AS3722_LDO_VSEL_DNU_MAX
#define AS3722_LDO_NUM_VOLT

#define AS3722_LDO0_CTRL
#define AS3722_LDO1_CTRL
#define AS3722_LDO2_CTRL
#define AS3722_LDO3_CTRL
#define AS3722_LDO4_CTRL
#define AS3722_LDO5_CTRL
#define AS3722_LDO6_CTRL
#define AS3722_LDO7_CTRL
#define AS3722_LDO9_CTRL
#define AS3722_LDO10_CTRL
#define AS3722_LDO11_CTRL

#define AS3722_LDO3_MODE_MASK
#define AS3722_LDO3_MODE_VAL(n)
#define AS3722_LDO3_MODE_PMOS
#define AS3722_LDO3_MODE_PMOS_TRACKING
#define AS3722_LDO3_MODE_NMOS
#define AS3722_LDO3_MODE_SWITCH

#define AS3722_SD_VSEL_MASK
#define AS3722_SD0_VSEL_MIN
#define AS3722_SD0_VSEL_MAX
#define AS3722_SD0_VSEL_LOW_VOL_MAX
#define AS3722_SD2_VSEL_MIN
#define AS3722_SD2_VSEL_MAX

#define AS3722_SDn_CTRL(n)

#define AS3722_SD0_MODE_FAST
#define AS3722_SD1_MODE_FAST
#define AS3722_SD2_MODE_FAST
#define AS3722_SD3_MODE_FAST
#define AS3722_SD4_MODE_FAST
#define AS3722_SD5_MODE_FAST
#define AS3722_SD6_MODE_FAST

#define AS3722_POWER_OFF

#define AS3722_INTERRUPT_MASK1_LID
#define AS3722_INTERRUPT_MASK1_ACOK
#define AS3722_INTERRUPT_MASK1_ENABLE1
#define AS3722_INTERRUPT_MASK1_OCURR_ALARM_SD0
#define AS3722_INTERRUPT_MASK1_ONKEY_LONG
#define AS3722_INTERRUPT_MASK1_ONKEY
#define AS3722_INTERRUPT_MASK1_OVTMP
#define AS3722_INTERRUPT_MASK1_LOWBAT

#define AS3722_INTERRUPT_MASK2_SD0_LV
#define AS3722_INTERRUPT_MASK2_SD1_LV
#define AS3722_INTERRUPT_MASK2_SD2345_LV
#define AS3722_INTERRUPT_MASK2_PWM1_OV_PROT
#define AS3722_INTERRUPT_MASK2_PWM2_OV_PROT
#define AS3722_INTERRUPT_MASK2_ENABLE2
#define AS3722_INTERRUPT_MASK2_SD6_LV
#define AS3722_INTERRUPT_MASK2_RTC_REP

#define AS3722_INTERRUPT_MASK3_RTC_ALARM
#define AS3722_INTERRUPT_MASK3_GPIO1
#define AS3722_INTERRUPT_MASK3_GPIO2
#define AS3722_INTERRUPT_MASK3_GPIO3
#define AS3722_INTERRUPT_MASK3_GPIO4
#define AS3722_INTERRUPT_MASK3_GPIO5
#define AS3722_INTERRUPT_MASK3_WATCHDOG
#define AS3722_INTERRUPT_MASK3_ENABLE3

#define AS3722_INTERRUPT_MASK4_TEMP_SD0_SHUTDOWN
#define AS3722_INTERRUPT_MASK4_TEMP_SD1_SHUTDOWN
#define AS3722_INTERRUPT_MASK4_TEMP_SD6_SHUTDOWN
#define AS3722_INTERRUPT_MASK4_TEMP_SD0_ALARM
#define AS3722_INTERRUPT_MASK4_TEMP_SD1_ALARM
#define AS3722_INTERRUPT_MASK4_TEMP_SD6_ALARM
#define AS3722_INTERRUPT_MASK4_OCCUR_ALARM_SD6
#define AS3722_INTERRUPT_MASK4_ADC

#define AS3722_ADC1_INTERVAL_TIME
#define AS3722_ADC1_INT_MODE_ON
#define AS3722_ADC_BUF_ON
#define AS3722_ADC1_LOW_VOLTAGE_RANGE
#define AS3722_ADC1_INTEVAL_SCAN
#define AS3722_ADC1_INT_MASK

#define AS3722_ADC_MSB_VAL_MASK
#define AS3722_ADC_LSB_VAL_MASK

#define AS3722_ADC0_CONV_START
#define AS3722_ADC0_CONV_NOTREADY
#define AS3722_ADC0_SOURCE_SELECT_MASK

#define AS3722_ADC1_CONV_START
#define AS3722_ADC1_CONV_NOTREADY
#define AS3722_ADC1_SOURCE_SELECT_MASK

#define AS3722_CTRL_SEQU1_AC_OK_PWR_ON

/* GPIO modes */
#define AS3722_GPIO_MODE_MASK
#define AS3722_GPIO_MODE_INPUT
#define AS3722_GPIO_MODE_OUTPUT_VDDH
#define AS3722_GPIO_MODE_IO_OPEN_DRAIN
#define AS3722_GPIO_MODE_ADC_IN
#define AS3722_GPIO_MODE_INPUT_PULL_UP
#define AS3722_GPIO_MODE_INPUT_PULL_DOWN
#define AS3722_GPIO_MODE_IO_OPEN_DRAIN_PULL_UP
#define AS3722_GPIO_MODE_OUTPUT_VDDL
#define AS3722_GPIO_MODE_VAL(n)

#define AS3722_GPIO_INV
#define AS3722_GPIO_IOSF_MASK
#define AS3722_GPIO_IOSF_VAL(n)
#define AS3722_GPIO_IOSF_NORMAL
#define AS3722_GPIO_IOSF_INTERRUPT_OUT
#define AS3722_GPIO_IOSF_VSUP_LOW_OUT
#define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN
#define AS3722_GPIO_IOSF_ISINK_PWM_IN
#define AS3722_GPIO_IOSF_VOLTAGE_STBY
#define AS3722_GPIO_IOSF_SD0_OUT
#define AS3722_GPIO_IOSF_PWR_GOOD_OUT
#define AS3722_GPIO_IOSF_Q32K_OUT
#define AS3722_GPIO_IOSF_WATCHDOG_IN
#define AS3722_GPIO_IOSF_SOFT_RESET_IN
#define AS3722_GPIO_IOSF_PWM_OUT
#define AS3722_GPIO_IOSF_VSUP_LOW_DEB_OUT
#define AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW

#define AS3722_GPIOn_SIGNAL(n)
#define AS3722_GPIOn_CONTROL_REG(n)
#define AS3722_I2C_PULL_UP
#define AS3722_INT_PULL_UP

#define AS3722_RTC_REP_WAKEUP_EN
#define AS3722_RTC_ALARM_WAKEUP_EN
#define AS3722_RTC_ON
#define AS3722_RTC_IRQMODE
#define AS3722_RTC_CLK32K_OUT_EN

#define AS3722_WATCHDOG_TIMER_MAX
#define AS3722_WATCHDOG_ON
#define AS3722_WATCHDOG_SW_SIG

#define AS3722_EXT_CONTROL_ENABLE1
#define AS3722_EXT_CONTROL_ENABLE2
#define AS3722_EXT_CONTROL_ENABLE3

#define AS3722_FUSE7_SD0_LOW_VOLTAGE

/* Interrupt IDs */
enum as3722_irq {};

struct as3722 {};

static inline int as3722_read(struct as3722 *as3722, u32 reg, u32 *dest)
{}

static inline int as3722_write(struct as3722 *as3722, u32 reg, u32 value)
{}

static inline int as3722_block_read(struct as3722 *as3722, u32 reg,
		int count, u8 *buf)
{}

static inline int as3722_block_write(struct as3722 *as3722, u32 reg,
		int count, u8 *data)
{}

static inline int as3722_update_bits(struct as3722 *as3722, u32 reg,
		u32 mask, u8 val)
{}

static inline int as3722_irq_get_virq(struct as3722 *as3722, int irq)
{}
#endif /* __LINUX_MFD_AS3722_H__ */