1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0+
2*4882a593Smuzhiyun //
3*4882a593Smuzhiyun // max8998.c - mfd core driver for the Maxim 8998
4*4882a593Smuzhiyun //
5*4882a593Smuzhiyun // Copyright (C) 2009-2010 Samsung Electronics
6*4882a593Smuzhiyun // Kyungmin Park <kyungmin.park@samsung.com>
7*4882a593Smuzhiyun // Marek Szyprowski <m.szyprowski@samsung.com>
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun #include <linux/err.h>
10*4882a593Smuzhiyun #include <linux/init.h>
11*4882a593Smuzhiyun #include <linux/slab.h>
12*4882a593Smuzhiyun #include <linux/i2c.h>
13*4882a593Smuzhiyun #include <linux/interrupt.h>
14*4882a593Smuzhiyun #include <linux/of.h>
15*4882a593Smuzhiyun #include <linux/of_irq.h>
16*4882a593Smuzhiyun #include <linux/pm_runtime.h>
17*4882a593Smuzhiyun #include <linux/mutex.h>
18*4882a593Smuzhiyun #include <linux/mfd/core.h>
19*4882a593Smuzhiyun #include <linux/mfd/max8998.h>
20*4882a593Smuzhiyun #include <linux/mfd/max8998-private.h>
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun #define RTC_I2C_ADDR (0x0c >> 1)
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun static const struct mfd_cell max8998_devs[] = {
25*4882a593Smuzhiyun {
26*4882a593Smuzhiyun .name = "max8998-pmic",
27*4882a593Smuzhiyun }, {
28*4882a593Smuzhiyun .name = "max8998-rtc",
29*4882a593Smuzhiyun }, {
30*4882a593Smuzhiyun .name = "max8998-battery",
31*4882a593Smuzhiyun },
32*4882a593Smuzhiyun };
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun static const struct mfd_cell lp3974_devs[] = {
35*4882a593Smuzhiyun {
36*4882a593Smuzhiyun .name = "lp3974-pmic",
37*4882a593Smuzhiyun }, {
38*4882a593Smuzhiyun .name = "lp3974-rtc",
39*4882a593Smuzhiyun },
40*4882a593Smuzhiyun };
41*4882a593Smuzhiyun
max8998_read_reg(struct i2c_client * i2c,u8 reg,u8 * dest)42*4882a593Smuzhiyun int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
43*4882a593Smuzhiyun {
44*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
45*4882a593Smuzhiyun int ret;
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun mutex_lock(&max8998->iolock);
48*4882a593Smuzhiyun ret = i2c_smbus_read_byte_data(i2c, reg);
49*4882a593Smuzhiyun mutex_unlock(&max8998->iolock);
50*4882a593Smuzhiyun if (ret < 0)
51*4882a593Smuzhiyun return ret;
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun ret &= 0xff;
54*4882a593Smuzhiyun *dest = ret;
55*4882a593Smuzhiyun return 0;
56*4882a593Smuzhiyun }
57*4882a593Smuzhiyun EXPORT_SYMBOL(max8998_read_reg);
58*4882a593Smuzhiyun
max8998_bulk_read(struct i2c_client * i2c,u8 reg,int count,u8 * buf)59*4882a593Smuzhiyun int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf)
60*4882a593Smuzhiyun {
61*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
62*4882a593Smuzhiyun int ret;
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun mutex_lock(&max8998->iolock);
65*4882a593Smuzhiyun ret = i2c_smbus_read_i2c_block_data(i2c, reg, count, buf);
66*4882a593Smuzhiyun mutex_unlock(&max8998->iolock);
67*4882a593Smuzhiyun if (ret < 0)
68*4882a593Smuzhiyun return ret;
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun return 0;
71*4882a593Smuzhiyun }
72*4882a593Smuzhiyun EXPORT_SYMBOL(max8998_bulk_read);
73*4882a593Smuzhiyun
max8998_write_reg(struct i2c_client * i2c,u8 reg,u8 value)74*4882a593Smuzhiyun int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value)
75*4882a593Smuzhiyun {
76*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
77*4882a593Smuzhiyun int ret;
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun mutex_lock(&max8998->iolock);
80*4882a593Smuzhiyun ret = i2c_smbus_write_byte_data(i2c, reg, value);
81*4882a593Smuzhiyun mutex_unlock(&max8998->iolock);
82*4882a593Smuzhiyun return ret;
83*4882a593Smuzhiyun }
84*4882a593Smuzhiyun EXPORT_SYMBOL(max8998_write_reg);
85*4882a593Smuzhiyun
max8998_bulk_write(struct i2c_client * i2c,u8 reg,int count,u8 * buf)86*4882a593Smuzhiyun int max8998_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf)
87*4882a593Smuzhiyun {
88*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
89*4882a593Smuzhiyun int ret;
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun mutex_lock(&max8998->iolock);
92*4882a593Smuzhiyun ret = i2c_smbus_write_i2c_block_data(i2c, reg, count, buf);
93*4882a593Smuzhiyun mutex_unlock(&max8998->iolock);
94*4882a593Smuzhiyun if (ret < 0)
95*4882a593Smuzhiyun return ret;
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun return 0;
98*4882a593Smuzhiyun }
99*4882a593Smuzhiyun EXPORT_SYMBOL(max8998_bulk_write);
100*4882a593Smuzhiyun
max8998_update_reg(struct i2c_client * i2c,u8 reg,u8 val,u8 mask)101*4882a593Smuzhiyun int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
102*4882a593Smuzhiyun {
103*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
104*4882a593Smuzhiyun int ret;
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun mutex_lock(&max8998->iolock);
107*4882a593Smuzhiyun ret = i2c_smbus_read_byte_data(i2c, reg);
108*4882a593Smuzhiyun if (ret >= 0) {
109*4882a593Smuzhiyun u8 old_val = ret & 0xff;
110*4882a593Smuzhiyun u8 new_val = (val & mask) | (old_val & (~mask));
111*4882a593Smuzhiyun ret = i2c_smbus_write_byte_data(i2c, reg, new_val);
112*4882a593Smuzhiyun }
113*4882a593Smuzhiyun mutex_unlock(&max8998->iolock);
114*4882a593Smuzhiyun return ret;
115*4882a593Smuzhiyun }
116*4882a593Smuzhiyun EXPORT_SYMBOL(max8998_update_reg);
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun #ifdef CONFIG_OF
119*4882a593Smuzhiyun static const struct of_device_id max8998_dt_match[] = {
120*4882a593Smuzhiyun { .compatible = "maxim,max8998", .data = (void *)TYPE_MAX8998 },
121*4882a593Smuzhiyun { .compatible = "national,lp3974", .data = (void *)TYPE_LP3974 },
122*4882a593Smuzhiyun { .compatible = "ti,lp3974", .data = (void *)TYPE_LP3974 },
123*4882a593Smuzhiyun {},
124*4882a593Smuzhiyun };
125*4882a593Smuzhiyun #endif
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun /*
128*4882a593Smuzhiyun * Only the common platform data elements for max8998 are parsed here from the
129*4882a593Smuzhiyun * device tree. Other sub-modules of max8998 such as pmic, rtc and others have
130*4882a593Smuzhiyun * to parse their own platform data elements from device tree.
131*4882a593Smuzhiyun *
132*4882a593Smuzhiyun * The max8998 platform data structure is instantiated here and the drivers for
133*4882a593Smuzhiyun * the sub-modules need not instantiate another instance while parsing their
134*4882a593Smuzhiyun * platform data.
135*4882a593Smuzhiyun */
max8998_i2c_parse_dt_pdata(struct device * dev)136*4882a593Smuzhiyun static struct max8998_platform_data *max8998_i2c_parse_dt_pdata(
137*4882a593Smuzhiyun struct device *dev)
138*4882a593Smuzhiyun {
139*4882a593Smuzhiyun struct max8998_platform_data *pd;
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
142*4882a593Smuzhiyun if (!pd)
143*4882a593Smuzhiyun return ERR_PTR(-ENOMEM);
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun pd->ono = irq_of_parse_and_map(dev->of_node, 1);
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun /*
148*4882a593Smuzhiyun * ToDo: the 'wakeup' member in the platform data is more of a linux
149*4882a593Smuzhiyun * specfic information. Hence, there is no binding for that yet and
150*4882a593Smuzhiyun * not parsed here.
151*4882a593Smuzhiyun */
152*4882a593Smuzhiyun return pd;
153*4882a593Smuzhiyun }
154*4882a593Smuzhiyun
max8998_i2c_get_driver_data(struct i2c_client * i2c,const struct i2c_device_id * id)155*4882a593Smuzhiyun static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c,
156*4882a593Smuzhiyun const struct i2c_device_id *id)
157*4882a593Smuzhiyun {
158*4882a593Smuzhiyun if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) {
159*4882a593Smuzhiyun const struct of_device_id *match;
160*4882a593Smuzhiyun match = of_match_node(max8998_dt_match, i2c->dev.of_node);
161*4882a593Smuzhiyun return (unsigned long)match->data;
162*4882a593Smuzhiyun }
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun return id->driver_data;
165*4882a593Smuzhiyun }
166*4882a593Smuzhiyun
max8998_i2c_probe(struct i2c_client * i2c,const struct i2c_device_id * id)167*4882a593Smuzhiyun static int max8998_i2c_probe(struct i2c_client *i2c,
168*4882a593Smuzhiyun const struct i2c_device_id *id)
169*4882a593Smuzhiyun {
170*4882a593Smuzhiyun struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev);
171*4882a593Smuzhiyun struct max8998_dev *max8998;
172*4882a593Smuzhiyun int ret = 0;
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun max8998 = devm_kzalloc(&i2c->dev, sizeof(struct max8998_dev),
175*4882a593Smuzhiyun GFP_KERNEL);
176*4882a593Smuzhiyun if (max8998 == NULL)
177*4882a593Smuzhiyun return -ENOMEM;
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) {
180*4882a593Smuzhiyun pdata = max8998_i2c_parse_dt_pdata(&i2c->dev);
181*4882a593Smuzhiyun if (IS_ERR(pdata))
182*4882a593Smuzhiyun return PTR_ERR(pdata);
183*4882a593Smuzhiyun }
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun i2c_set_clientdata(i2c, max8998);
186*4882a593Smuzhiyun max8998->dev = &i2c->dev;
187*4882a593Smuzhiyun max8998->i2c = i2c;
188*4882a593Smuzhiyun max8998->irq = i2c->irq;
189*4882a593Smuzhiyun max8998->type = max8998_i2c_get_driver_data(i2c, id);
190*4882a593Smuzhiyun max8998->pdata = pdata;
191*4882a593Smuzhiyun if (pdata) {
192*4882a593Smuzhiyun max8998->ono = pdata->ono;
193*4882a593Smuzhiyun max8998->irq_base = pdata->irq_base;
194*4882a593Smuzhiyun max8998->wakeup = pdata->wakeup;
195*4882a593Smuzhiyun }
196*4882a593Smuzhiyun mutex_init(&max8998->iolock);
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun max8998->rtc = i2c_new_dummy_device(i2c->adapter, RTC_I2C_ADDR);
199*4882a593Smuzhiyun if (IS_ERR(max8998->rtc)) {
200*4882a593Smuzhiyun dev_err(&i2c->dev, "Failed to allocate I2C device for RTC\n");
201*4882a593Smuzhiyun return PTR_ERR(max8998->rtc);
202*4882a593Smuzhiyun }
203*4882a593Smuzhiyun i2c_set_clientdata(max8998->rtc, max8998);
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun max8998_irq_init(max8998);
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun pm_runtime_set_active(max8998->dev);
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun switch (max8998->type) {
210*4882a593Smuzhiyun case TYPE_LP3974:
211*4882a593Smuzhiyun ret = mfd_add_devices(max8998->dev, -1,
212*4882a593Smuzhiyun lp3974_devs, ARRAY_SIZE(lp3974_devs),
213*4882a593Smuzhiyun NULL, 0, NULL);
214*4882a593Smuzhiyun break;
215*4882a593Smuzhiyun case TYPE_MAX8998:
216*4882a593Smuzhiyun ret = mfd_add_devices(max8998->dev, -1,
217*4882a593Smuzhiyun max8998_devs, ARRAY_SIZE(max8998_devs),
218*4882a593Smuzhiyun NULL, 0, NULL);
219*4882a593Smuzhiyun break;
220*4882a593Smuzhiyun default:
221*4882a593Smuzhiyun ret = -EINVAL;
222*4882a593Smuzhiyun }
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun if (ret < 0)
225*4882a593Smuzhiyun goto err;
226*4882a593Smuzhiyun
227*4882a593Smuzhiyun device_init_wakeup(max8998->dev, max8998->wakeup);
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun return ret;
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun err:
232*4882a593Smuzhiyun mfd_remove_devices(max8998->dev);
233*4882a593Smuzhiyun max8998_irq_exit(max8998);
234*4882a593Smuzhiyun i2c_unregister_device(max8998->rtc);
235*4882a593Smuzhiyun return ret;
236*4882a593Smuzhiyun }
237*4882a593Smuzhiyun
238*4882a593Smuzhiyun static const struct i2c_device_id max8998_i2c_id[] = {
239*4882a593Smuzhiyun { "max8998", TYPE_MAX8998 },
240*4882a593Smuzhiyun { "lp3974", TYPE_LP3974},
241*4882a593Smuzhiyun { }
242*4882a593Smuzhiyun };
243*4882a593Smuzhiyun
max8998_suspend(struct device * dev)244*4882a593Smuzhiyun static int max8998_suspend(struct device *dev)
245*4882a593Smuzhiyun {
246*4882a593Smuzhiyun struct i2c_client *i2c = to_i2c_client(dev);
247*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun if (device_may_wakeup(dev))
250*4882a593Smuzhiyun irq_set_irq_wake(max8998->irq, 1);
251*4882a593Smuzhiyun return 0;
252*4882a593Smuzhiyun }
253*4882a593Smuzhiyun
max8998_resume(struct device * dev)254*4882a593Smuzhiyun static int max8998_resume(struct device *dev)
255*4882a593Smuzhiyun {
256*4882a593Smuzhiyun struct i2c_client *i2c = to_i2c_client(dev);
257*4882a593Smuzhiyun struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun if (device_may_wakeup(dev))
260*4882a593Smuzhiyun irq_set_irq_wake(max8998->irq, 0);
261*4882a593Smuzhiyun /*
262*4882a593Smuzhiyun * In LP3974, if IRQ registers are not "read & clear"
263*4882a593Smuzhiyun * when it's set during sleep, the interrupt becomes
264*4882a593Smuzhiyun * disabled.
265*4882a593Smuzhiyun */
266*4882a593Smuzhiyun return max8998_irq_resume(i2c_get_clientdata(i2c));
267*4882a593Smuzhiyun }
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun struct max8998_reg_dump {
270*4882a593Smuzhiyun u8 addr;
271*4882a593Smuzhiyun u8 val;
272*4882a593Smuzhiyun };
273*4882a593Smuzhiyun #define SAVE_ITEM(x) { .addr = (x), .val = 0x0, }
274*4882a593Smuzhiyun static struct max8998_reg_dump max8998_dump[] = {
275*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_IRQM1),
276*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_IRQM2),
277*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_IRQM3),
278*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_IRQM4),
279*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_STATUSM1),
280*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_STATUSM2),
281*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_CHGR1),
282*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_CHGR2),
283*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO_ACTIVE_DISCHARGE1),
284*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO_ACTIVE_DISCHARGE1),
285*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK_ACTIVE_DISCHARGE3),
286*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_ONOFF1),
287*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_ONOFF2),
288*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_ONOFF3),
289*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_ONOFF4),
290*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE1),
291*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE2),
292*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE3),
293*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE4),
294*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK2_VOLTAGE1),
295*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BUCK2_VOLTAGE2),
296*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO2_LDO3),
297*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO4),
298*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO5),
299*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO6),
300*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO7),
301*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO8_LDO9),
302*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO10_LDO11),
303*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO12),
304*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO13),
305*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO14),
306*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO15),
307*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO16),
308*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LDO17),
309*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_BKCHR),
310*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LBCNFG1),
311*4882a593Smuzhiyun SAVE_ITEM(MAX8998_REG_LBCNFG2),
312*4882a593Smuzhiyun };
313*4882a593Smuzhiyun /* Save registers before hibernation */
max8998_freeze(struct device * dev)314*4882a593Smuzhiyun static int max8998_freeze(struct device *dev)
315*4882a593Smuzhiyun {
316*4882a593Smuzhiyun struct i2c_client *i2c = to_i2c_client(dev);
317*4882a593Smuzhiyun int i;
318*4882a593Smuzhiyun
319*4882a593Smuzhiyun for (i = 0; i < ARRAY_SIZE(max8998_dump); i++)
320*4882a593Smuzhiyun max8998_read_reg(i2c, max8998_dump[i].addr,
321*4882a593Smuzhiyun &max8998_dump[i].val);
322*4882a593Smuzhiyun
323*4882a593Smuzhiyun return 0;
324*4882a593Smuzhiyun }
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun /* Restore registers after hibernation */
max8998_restore(struct device * dev)327*4882a593Smuzhiyun static int max8998_restore(struct device *dev)
328*4882a593Smuzhiyun {
329*4882a593Smuzhiyun struct i2c_client *i2c = to_i2c_client(dev);
330*4882a593Smuzhiyun int i;
331*4882a593Smuzhiyun
332*4882a593Smuzhiyun for (i = 0; i < ARRAY_SIZE(max8998_dump); i++)
333*4882a593Smuzhiyun max8998_write_reg(i2c, max8998_dump[i].addr,
334*4882a593Smuzhiyun max8998_dump[i].val);
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun return 0;
337*4882a593Smuzhiyun }
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun static const struct dev_pm_ops max8998_pm = {
340*4882a593Smuzhiyun .suspend = max8998_suspend,
341*4882a593Smuzhiyun .resume = max8998_resume,
342*4882a593Smuzhiyun .freeze = max8998_freeze,
343*4882a593Smuzhiyun .restore = max8998_restore,
344*4882a593Smuzhiyun };
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun static struct i2c_driver max8998_i2c_driver = {
347*4882a593Smuzhiyun .driver = {
348*4882a593Smuzhiyun .name = "max8998",
349*4882a593Smuzhiyun .pm = &max8998_pm,
350*4882a593Smuzhiyun .suppress_bind_attrs = true,
351*4882a593Smuzhiyun .of_match_table = of_match_ptr(max8998_dt_match),
352*4882a593Smuzhiyun },
353*4882a593Smuzhiyun .probe = max8998_i2c_probe,
354*4882a593Smuzhiyun .id_table = max8998_i2c_id,
355*4882a593Smuzhiyun };
356*4882a593Smuzhiyun
max8998_i2c_init(void)357*4882a593Smuzhiyun static int __init max8998_i2c_init(void)
358*4882a593Smuzhiyun {
359*4882a593Smuzhiyun return i2c_add_driver(&max8998_i2c_driver);
360*4882a593Smuzhiyun }
361*4882a593Smuzhiyun /* init early so consumer devices can complete system boot */
362*4882a593Smuzhiyun subsys_initcall(max8998_i2c_init);
363