linux/include/linux/mfd/max14577-private.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * max14577-private.h - Common API for the Maxim 14577/77836 internal sub chip
 *
 * Copyright (C) 2014 Samsung Electrnoics
 * Chanwoo Choi <[email protected]>
 * Krzysztof Kozlowski <[email protected]>
 */

#ifndef __MAX14577_PRIVATE_H__
#define __MAX14577_PRIVATE_H__

#include <linux/i2c.h>
#include <linux/regmap.h>

#define I2C_ADDR_PMIC
#define I2C_ADDR_MUIC
#define I2C_ADDR_FG

enum maxim_device_type {};

/* Slave addr = 0x4A: MUIC and Charger */
enum max14577_reg {};

/* Slave addr = 0x4A: MUIC */
enum max14577_muic_reg {};

/*
 * Combined charger types for max14577 and max77836.
 *
 * On max14577 three lower bits map to STATUS2/CHGTYP field.
 * However the max77836 has different two last values of STATUS2/CHGTYP.
 * To indicate the difference enum has two additional values for max77836.
 * These values are just a register value bitwise OR with 0x8.
 */
enum max14577_muic_charger_type {};

/* MAX14577 interrupts */
#define MAX14577_INT1_ADC_MASK
#define MAX14577_INT1_ADCLOW_MASK
#define MAX14577_INT1_ADCERR_MASK
#define MAX77836_INT1_ADC1K_MASK

#define MAX14577_INT2_CHGTYP_MASK
#define MAX14577_INT2_CHGDETRUN_MASK
#define MAX14577_INT2_DCDTMR_MASK
#define MAX14577_INT2_DBCHG_MASK
#define MAX14577_INT2_VBVOLT_MASK
#define MAX77836_INT2_VIDRM_MASK

#define MAX14577_INT3_EOC_MASK
#define MAX14577_INT3_CGMBC_MASK
#define MAX14577_INT3_OVP_MASK
#define MAX14577_INT3_MBCCHGERR_MASK

/* MAX14577 DEVICE ID register */
#define DEVID_VENDORID_SHIFT
#define DEVID_DEVICEID_SHIFT
#define DEVID_VENDORID_MASK
#define DEVID_DEVICEID_MASK

/* MAX14577 STATUS1 register */
#define STATUS1_ADC_SHIFT
#define STATUS1_ADCLOW_SHIFT
#define STATUS1_ADCERR_SHIFT
#define MAX77836_STATUS1_ADC1K_SHIFT
#define STATUS1_ADC_MASK
#define STATUS1_ADCLOW_MASK
#define STATUS1_ADCERR_MASK
#define MAX77836_STATUS1_ADC1K_MASK

/* MAX14577 STATUS2 register */
#define STATUS2_CHGTYP_SHIFT
#define STATUS2_CHGDETRUN_SHIFT
#define STATUS2_DCDTMR_SHIFT
#define MAX14577_STATUS2_DBCHG_SHIFT
#define MAX77836_STATUS2_DXOVP_SHIFT
#define STATUS2_VBVOLT_SHIFT
#define MAX77836_STATUS2_VIDRM_SHIFT
#define STATUS2_CHGTYP_MASK
#define STATUS2_CHGDETRUN_MASK
#define STATUS2_DCDTMR_MASK
#define MAX14577_STATUS2_DBCHG_MASK
#define MAX77836_STATUS2_DXOVP_MASK
#define STATUS2_VBVOLT_MASK
#define MAX77836_STATUS2_VIDRM_MASK

/* MAX14577 CONTROL1 register */
#define COMN1SW_SHIFT
#define COMP2SW_SHIFT
#define MICEN_SHIFT
#define IDBEN_SHIFT
#define COMN1SW_MASK
#define COMP2SW_MASK
#define MICEN_MASK
#define IDBEN_MASK
#define CLEAR_IDBEN_MICEN_MASK
#define CTRL1_SW_USB
#define CTRL1_SW_AUDIO
#define CTRL1_SW_UART
#define CTRL1_SW_OPEN

/* MAX14577 CONTROL2 register */
#define CTRL2_LOWPWR_SHIFT
#define CTRL2_ADCEN_SHIFT
#define CTRL2_CPEN_SHIFT
#define CTRL2_SFOUTASRT_SHIFT
#define CTRL2_SFOUTORD_SHIFT
#define CTRL2_ACCDET_SHIFT
#define CTRL2_USBCPINT_SHIFT
#define CTRL2_RCPS_SHIFT
#define CTRL2_LOWPWR_MASK
#define CTRL2_ADCEN_MASK
#define CTRL2_CPEN_MASK
#define CTRL2_SFOUTASRT_MASK
#define CTRL2_SFOUTORD_MASK
#define CTRL2_ACCDET_MASK
#define CTRL2_USBCPINT_MASK
#define CTRL2_RCPS_MASK

#define CTRL2_CPEN1_LOWPWR0
#define CTRL2_CPEN0_LOWPWR1

/* MAX14577 CONTROL3 register */
#define CTRL3_JIGSET_SHIFT
#define CTRL3_BOOTSET_SHIFT
#define CTRL3_ADCDBSET_SHIFT
#define CTRL3_WBTH_SHIFT
#define CTRL3_JIGSET_MASK
#define CTRL3_BOOTSET_MASK
#define CTRL3_ADCDBSET_MASK
#define CTRL3_WBTH_MASK

/* Slave addr = 0x4A: Charger */
enum max14577_charger_reg {};

/* MAX14577 STATUS3 register */
#define STATUS3_EOC_SHIFT
#define STATUS3_CGMBC_SHIFT
#define STATUS3_OVP_SHIFT
#define STATUS3_MBCCHGERR_SHIFT
#define STATUS3_EOC_MASK
#define STATUS3_CGMBC_MASK
#define STATUS3_OVP_MASK
#define STATUS3_MBCCHGERR_MASK

/* MAX14577 CDETCTRL1 register */
#define CDETCTRL1_CHGDETEN_SHIFT
#define CDETCTRL1_CHGTYPMAN_SHIFT
#define CDETCTRL1_DCDEN_SHIFT
#define CDETCTRL1_DCD2SCT_SHIFT
#define MAX14577_CDETCTRL1_DCHKTM_SHIFT
#define MAX77836_CDETCTRL1_CDLY_SHIFT
#define MAX14577_CDETCTRL1_DBEXIT_SHIFT
#define MAX77836_CDETCTRL1_DCDCPL_SHIFT
#define CDETCTRL1_DBIDLE_SHIFT
#define CDETCTRL1_CDPDET_SHIFT
#define CDETCTRL1_CHGDETEN_MASK
#define CDETCTRL1_CHGTYPMAN_MASK
#define CDETCTRL1_DCDEN_MASK
#define CDETCTRL1_DCD2SCT_MASK
#define MAX14577_CDETCTRL1_DCHKTM_MASK
#define MAX77836_CDETCTRL1_CDDLY_MASK
#define MAX14577_CDETCTRL1_DBEXIT_MASK
#define MAX77836_CDETCTRL1_DCDCPL_MASK
#define CDETCTRL1_DBIDLE_MASK
#define CDETCTRL1_CDPDET_MASK

/* MAX14577 CHGCTRL1 register */
#define CHGCTRL1_TCHW_SHIFT
#define CHGCTRL1_TCHW_MASK

/* MAX14577 CHGCTRL2 register */
#define CHGCTRL2_MBCHOSTEN_SHIFT
#define CHGCTRL2_MBCHOSTEN_MASK
#define CHGCTRL2_VCHGR_RC_SHIFT
#define CHGCTRL2_VCHGR_RC_MASK

/* MAX14577 CHGCTRL3 register */
#define CHGCTRL3_MBCCVWRC_SHIFT
#define CHGCTRL3_MBCCVWRC_MASK

/* MAX14577 CHGCTRL4 register */
#define CHGCTRL4_MBCICHWRCH_SHIFT
#define CHGCTRL4_MBCICHWRCH_MASK
#define CHGCTRL4_MBCICHWRCL_SHIFT
#define CHGCTRL4_MBCICHWRCL_MASK

/* MAX14577 CHGCTRL5 register */
#define CHGCTRL5_EOCS_SHIFT
#define CHGCTRL5_EOCS_MASK

/* MAX14577 CHGCTRL6 register */
#define CHGCTRL6_AUTOSTOP_SHIFT
#define CHGCTRL6_AUTOSTOP_MASK

/* MAX14577 CHGCTRL7 register */
#define CHGCTRL7_OTPCGHCVS_SHIFT
#define CHGCTRL7_OTPCGHCVS_MASK

/* MAX14577 charger current limits (as in CHGCTRL4 register), uA */
#define MAX14577_CHARGER_CURRENT_LIMIT_MIN
#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_START
#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_STEP
#define MAX14577_CHARGER_CURRENT_LIMIT_MAX

/* MAX77836 charger current limits (as in CHGCTRL4 register), uA */
#define MAX77836_CHARGER_CURRENT_LIMIT_MIN
#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_START
#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP
#define MAX77836_CHARGER_CURRENT_LIMIT_MAX

/*
 * MAX14577 charger End-Of-Charge current limits
 * (as in CHGCTRL5 register), uA
 */
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX

/*
 * MAX14577/MAX77836 Battery Constant Voltage
 * (as in CHGCTRL3 register), uV
 */
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MIN
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_STEP
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MAX

/* Default value for fast charge timer, in hours */
#define MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT

/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE

/* MAX77836 regulator LDOx voltage, uV */
#define MAX77836_REGULATOR_LDO_VOLTAGE_MIN
#define MAX77836_REGULATOR_LDO_VOLTAGE_MAX
#define MAX77836_REGULATOR_LDO_VOLTAGE_STEP
#define MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM

/* Slave addr = 0x46: PMIC */
enum max77836_pmic_reg {};

#define MAX77836_INTSRC_MASK_TOP_INT_SHIFT
#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT
#define MAX77836_INTSRC_MASK_TOP_INT_MASK
#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_MASK

/* MAX77836 PMIC interrupts */
#define MAX77836_TOPSYS_INT_T120C_SHIFT
#define MAX77836_TOPSYS_INT_T140C_SHIFT
#define MAX77836_TOPSYS_INT_T120C_MASK
#define MAX77836_TOPSYS_INT_T140C_MASK

/* LDO1/LDO2 CONFIG1 register */
#define MAX77836_CNFG1_LDO_PWRMD_SHIFT
#define MAX77836_CNFG1_LDO_TV_SHIFT
#define MAX77836_CNFG1_LDO_PWRMD_MASK
#define MAX77836_CNFG1_LDO_TV_MASK

/* LDO1/LDO2 CONFIG2 register */
#define MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT
#define MAX77836_CNFG2_LDO_ALPMEN_SHIFT
#define MAX77836_CNFG2_LDO_COMP_SHIFT
#define MAX77836_CNFG2_LDO_POK_SHIFT
#define MAX77836_CNFG2_LDO_ADE_SHIFT
#define MAX77836_CNFG2_LDO_SS_SHIFT
#define MAX77836_CNFG2_LDO_OVCLMPEN_MASK
#define MAX77836_CNFG2_LDO_ALPMEN_MASK
#define MAX77836_CNFG2_LDO_COMP_MASK
#define MAX77836_CNFG2_LDO_POK_MASK
#define MAX77836_CNFG2_LDO_ADE_MASK
#define MAX77836_CNFG2_LDO_SS_MASK

/* Slave addr = 0x6C: Fuel-Gauge/Battery */
enum max77836_fg_reg {};

enum max14577_irq {};

struct max14577 {};

/* MAX14577 shared regmap API function */
static inline int max14577_read_reg(struct regmap *map, u8 reg, u8 *dest)
{}

static inline int max14577_bulk_read(struct regmap *map, u8 reg, u8 *buf,
		int count)
{}

static inline int max14577_write_reg(struct regmap *map, u8 reg, u8 value)
{}

static inline int max14577_bulk_write(struct regmap *map, u8 reg, u8 *buf,
		int count)
{}

static inline int max14577_update_reg(struct regmap *map, u8 reg, u8 mask,
		u8 val)
{}

#endif /* __MAX14577_PRIVATE_H__ */