1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * max8998-private.h - Voltage regulator driver for the Maxim 8998
5 * Copyright (C) 2009-2010 Samsung Electrnoics
6 * Kyungmin Park <kyungmin.park@samsung.com>
7 * Marek Szyprowski <m.szyprowski@samsung.com>
10 #ifndef __LINUX_MFD_MAX8998_PRIV_H
11 #define __LINUX_MFD_MAX8998_PRIV_H
13 #define MAX8998_NUM_IRQ_REGS 4
15 /* MAX 8998 registers */
31 MAX8998_REG_LDO_ACTIVE_DISCHARGE1,
32 MAX8998_REG_LDO_ACTIVE_DISCHARGE2,
33 MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
38 MAX8998_REG_BUCK1_VOLTAGE1,
39 MAX8998_REG_BUCK1_VOLTAGE2,
40 MAX8998_REG_BUCK1_VOLTAGE3,
41 MAX8998_REG_BUCK1_VOLTAGE4,
42 MAX8998_REG_BUCK2_VOLTAGE1,
43 MAX8998_REG_BUCK2_VOLTAGE2,
46 MAX8998_REG_LDO2_LDO3,
51 MAX8998_REG_LDO8_LDO9,
52 MAX8998_REG_LDO10_LDO11,
91 /* MAX8998 various variants */
93 TYPE_MAX8998 = 0, /* Default */
94 TYPE_LP3974, /* National version of MAX8998 */
95 TYPE_LP3979, /* Added AVS */
98 #define MAX8998_IRQ_DCINF_MASK (1 << 2)
99 #define MAX8998_IRQ_DCINR_MASK (1 << 3)
100 #define MAX8998_IRQ_JIGF_MASK (1 << 4)
101 #define MAX8998_IRQ_JIGR_MASK (1 << 5)
102 #define MAX8998_IRQ_PWRONF_MASK (1 << 6)
103 #define MAX8998_IRQ_PWRONR_MASK (1 << 7)
105 #define MAX8998_IRQ_WTSREVNT_MASK (1 << 0)
106 #define MAX8998_IRQ_SMPLEVNT_MASK (1 << 1)
107 #define MAX8998_IRQ_ALARM1_MASK (1 << 2)
108 #define MAX8998_IRQ_ALARM0_MASK (1 << 3)
110 #define MAX8998_IRQ_ONKEY1S_MASK (1 << 0)
111 #define MAX8998_IRQ_TOPOFFR_MASK (1 << 2)
112 #define MAX8998_IRQ_DCINOVPR_MASK (1 << 3)
113 #define MAX8998_IRQ_CHGRSTF_MASK (1 << 4)
114 #define MAX8998_IRQ_DONER_MASK (1 << 5)
115 #define MAX8998_IRQ_CHGFAULT_MASK (1 << 7)
117 #define MAX8998_IRQ_LOBAT1_MASK (1 << 0)
118 #define MAX8998_IRQ_LOBAT2_MASK (1 << 1)
120 #define MAX8998_ENRAMP (1 << 4)
125 * struct max8998_dev - max8998 master device for sub-drivers
126 * @dev: master device of the chip (can be used to access platform data)
127 * @pdata: platform data for the driver and subdrivers
128 * @i2c: i2c client private data for regulator
129 * @rtc: i2c client private data for rtc
130 * @iolock: mutex for serializing io access
131 * @irqlock: mutex for buslock
132 * @irq_base: base IRQ number for max8998, required for IRQs
133 * @irq: generic IRQ number for max8998
134 * @ono: power onoff IRQ number for max8998
135 * @irq_masks_cur: currently active value
136 * @irq_masks_cache: cached hardware value
137 * @type: indicate which max8998 "variant" is used
141 struct max8998_platform_data *pdata;
142 struct i2c_client *i2c;
143 struct i2c_client *rtc;
145 struct mutex irqlock;
147 unsigned int irq_base;
148 struct irq_domain *irq_domain;
151 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
152 u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS];
157 int max8998_irq_init(struct max8998_dev *max8998);
158 void max8998_irq_exit(struct max8998_dev *max8998);
159 int max8998_irq_resume(struct max8998_dev *max8998);
161 extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
162 extern int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count,
164 extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
165 extern int max8998_bulk_write(struct i2c_client *i2c, u8 reg, int count,
167 extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
169 #endif /* __LINUX_MFD_MAX8998_PRIV_H */