xref: /openbmc/linux/drivers/regulator/max8649.c (revision c172708d38a401b2f3f841dfcd862b469fa0b670)
1a71b797fSHaojian Zhuang /*
2a71b797fSHaojian Zhuang  * Regulators driver for Maxim max8649
3a71b797fSHaojian Zhuang  *
4a71b797fSHaojian Zhuang  * Copyright (C) 2009-2010 Marvell International Ltd.
5a71b797fSHaojian Zhuang  *      Haojian Zhuang <haojian.zhuang@marvell.com>
6a71b797fSHaojian Zhuang  *
7a71b797fSHaojian Zhuang  * This program is free software; you can redistribute it and/or modify
8a71b797fSHaojian Zhuang  * it under the terms of the GNU General Public License version 2 as
9a71b797fSHaojian Zhuang  * published by the Free Software Foundation.
10a71b797fSHaojian Zhuang  */
11a71b797fSHaojian Zhuang #include <linux/kernel.h>
12a71b797fSHaojian Zhuang #include <linux/module.h>
13a71b797fSHaojian Zhuang #include <linux/err.h>
14a71b797fSHaojian Zhuang #include <linux/i2c.h>
15a71b797fSHaojian Zhuang #include <linux/platform_device.h>
16a71b797fSHaojian Zhuang #include <linux/regulator/driver.h>
175a0e3ad6STejun Heo #include <linux/slab.h>
18a71b797fSHaojian Zhuang #include <linux/regulator/max8649.h>
19c5b68d47SJonghwan Choi #include <linux/regmap.h>
20a71b797fSHaojian Zhuang 
21a71b797fSHaojian Zhuang #define MAX8649_DCDC_VMIN	750000		/* uV */
22a71b797fSHaojian Zhuang #define MAX8649_DCDC_VMAX	1380000		/* uV */
23a71b797fSHaojian Zhuang #define MAX8649_DCDC_STEP	10000		/* uV */
24a71b797fSHaojian Zhuang #define MAX8649_VOL_MASK	0x3f
25a71b797fSHaojian Zhuang 
26a71b797fSHaojian Zhuang /* Registers */
27a71b797fSHaojian Zhuang #define MAX8649_MODE0		0x00
28a71b797fSHaojian Zhuang #define MAX8649_MODE1		0x01
29a71b797fSHaojian Zhuang #define MAX8649_MODE2		0x02
30a71b797fSHaojian Zhuang #define MAX8649_MODE3		0x03
31a71b797fSHaojian Zhuang #define MAX8649_CONTROL		0x04
32a71b797fSHaojian Zhuang #define MAX8649_SYNC		0x05
33a71b797fSHaojian Zhuang #define MAX8649_RAMP		0x06
34a71b797fSHaojian Zhuang #define MAX8649_CHIP_ID1	0x08
35a71b797fSHaojian Zhuang #define MAX8649_CHIP_ID2	0x09
36a71b797fSHaojian Zhuang 
37a71b797fSHaojian Zhuang /* Bits */
38a71b797fSHaojian Zhuang #define MAX8649_EN_PD		(1 << 7)
39a71b797fSHaojian Zhuang #define MAX8649_VID0_PD		(1 << 6)
40a71b797fSHaojian Zhuang #define MAX8649_VID1_PD		(1 << 5)
41a71b797fSHaojian Zhuang #define MAX8649_VID_MASK	(3 << 5)
42a71b797fSHaojian Zhuang 
43a71b797fSHaojian Zhuang #define MAX8649_FORCE_PWM	(1 << 7)
44a71b797fSHaojian Zhuang #define MAX8649_SYNC_EXTCLK	(1 << 6)
45a71b797fSHaojian Zhuang 
46a71b797fSHaojian Zhuang #define MAX8649_EXT_MASK	(3 << 6)
47a71b797fSHaojian Zhuang 
48a71b797fSHaojian Zhuang #define MAX8649_RAMP_MASK	(7 << 5)
49a71b797fSHaojian Zhuang #define MAX8649_RAMP_DOWN	(1 << 1)
50a71b797fSHaojian Zhuang 
51a71b797fSHaojian Zhuang struct max8649_regulator_info {
52a71b797fSHaojian Zhuang 	struct regulator_dev	*regulator;
53a71b797fSHaojian Zhuang 	struct device		*dev;
54c5b68d47SJonghwan Choi 	struct regmap		*regmap;
55a71b797fSHaojian Zhuang 
56a71b797fSHaojian Zhuang 	int		vol_reg;
57a71b797fSHaojian Zhuang 	unsigned	mode:2;	/* bit[1:0] = VID1, VID0 */
58a71b797fSHaojian Zhuang 	unsigned	extclk_freq:2;
59a71b797fSHaojian Zhuang 	unsigned	extclk:1;
60a71b797fSHaojian Zhuang 	unsigned	ramp_timing:3;
61a71b797fSHaojian Zhuang 	unsigned	ramp_down:1;
62a71b797fSHaojian Zhuang };
63a71b797fSHaojian Zhuang 
64a71b797fSHaojian Zhuang /* I2C operations */
65a71b797fSHaojian Zhuang 
66a71b797fSHaojian Zhuang static inline int check_range(int min_uV, int max_uV)
67a71b797fSHaojian Zhuang {
68a71b797fSHaojian Zhuang 	if ((min_uV < MAX8649_DCDC_VMIN) || (max_uV > MAX8649_DCDC_VMAX)
69a71b797fSHaojian Zhuang 		|| (min_uV > max_uV))
70a71b797fSHaojian Zhuang 		return -EINVAL;
71a71b797fSHaojian Zhuang 	return 0;
72a71b797fSHaojian Zhuang }
73a71b797fSHaojian Zhuang 
74a71b797fSHaojian Zhuang static int max8649_list_voltage(struct regulator_dev *rdev, unsigned index)
75a71b797fSHaojian Zhuang {
76a71b797fSHaojian Zhuang 	return (MAX8649_DCDC_VMIN + index * MAX8649_DCDC_STEP);
77a71b797fSHaojian Zhuang }
78a71b797fSHaojian Zhuang 
79a71b797fSHaojian Zhuang static int max8649_get_voltage(struct regulator_dev *rdev)
80a71b797fSHaojian Zhuang {
81a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
82c5b68d47SJonghwan Choi 	unsigned int val;
83a71b797fSHaojian Zhuang 	unsigned char data;
84a71b797fSHaojian Zhuang 	int ret;
85a71b797fSHaojian Zhuang 
86c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, info->vol_reg, &val);
87c5b68d47SJonghwan Choi 	if (ret != 0)
88a71b797fSHaojian Zhuang 		return ret;
89c5b68d47SJonghwan Choi 	data = (unsigned char)val & MAX8649_VOL_MASK;
90a71b797fSHaojian Zhuang 	return max8649_list_voltage(rdev, data);
91a71b797fSHaojian Zhuang }
92a71b797fSHaojian Zhuang 
93a71b797fSHaojian Zhuang static int max8649_set_voltage(struct regulator_dev *rdev,
943a93f2a9SMark Brown 			       int min_uV, int max_uV, unsigned *selector)
95a71b797fSHaojian Zhuang {
96a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
97a71b797fSHaojian Zhuang 	unsigned char data, mask;
98a71b797fSHaojian Zhuang 
99a71b797fSHaojian Zhuang 	if (check_range(min_uV, max_uV)) {
100a71b797fSHaojian Zhuang 		dev_err(info->dev, "invalid voltage range (%d, %d) uV\n",
101a71b797fSHaojian Zhuang 			min_uV, max_uV);
102a71b797fSHaojian Zhuang 		return -EINVAL;
103a71b797fSHaojian Zhuang 	}
10421c9e5f1SAxel Lin 	data = DIV_ROUND_UP(min_uV - MAX8649_DCDC_VMIN, MAX8649_DCDC_STEP);
105a71b797fSHaojian Zhuang 	mask = MAX8649_VOL_MASK;
1063a93f2a9SMark Brown 	*selector = data & mask;
107a71b797fSHaojian Zhuang 
108c5b68d47SJonghwan Choi 	return regmap_update_bits(info->regmap, info->vol_reg, mask, data);
109a71b797fSHaojian Zhuang }
110a71b797fSHaojian Zhuang 
111a71b797fSHaojian Zhuang /* EN_PD means pulldown on EN input */
112a71b797fSHaojian Zhuang static int max8649_enable(struct regulator_dev *rdev)
113a71b797fSHaojian Zhuang {
114a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
115c5b68d47SJonghwan Choi 	return regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_EN_PD, 0);
116a71b797fSHaojian Zhuang }
117a71b797fSHaojian Zhuang 
118a71b797fSHaojian Zhuang /*
119a71b797fSHaojian Zhuang  * Applied internal pulldown resistor on EN input pin.
120a71b797fSHaojian Zhuang  * If pulldown EN pin outside, it would be better.
121a71b797fSHaojian Zhuang  */
122a71b797fSHaojian Zhuang static int max8649_disable(struct regulator_dev *rdev)
123a71b797fSHaojian Zhuang {
124a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
125c5b68d47SJonghwan Choi 	return regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_EN_PD,
126a71b797fSHaojian Zhuang 				MAX8649_EN_PD);
127a71b797fSHaojian Zhuang }
128a71b797fSHaojian Zhuang 
129a71b797fSHaojian Zhuang static int max8649_is_enabled(struct regulator_dev *rdev)
130a71b797fSHaojian Zhuang {
131a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
132c5b68d47SJonghwan Choi 	unsigned int val;
133a71b797fSHaojian Zhuang 	int ret;
134a71b797fSHaojian Zhuang 
135c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, MAX8649_CONTROL, &val);
136c5b68d47SJonghwan Choi 	if (ret != 0)
137a71b797fSHaojian Zhuang 		return ret;
138c5b68d47SJonghwan Choi 	return !((unsigned char)val & MAX8649_EN_PD);
139a71b797fSHaojian Zhuang }
140a71b797fSHaojian Zhuang 
141a71b797fSHaojian Zhuang static int max8649_enable_time(struct regulator_dev *rdev)
142a71b797fSHaojian Zhuang {
143a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
144a71b797fSHaojian Zhuang 	int voltage, rate, ret;
145c5b68d47SJonghwan Choi 	unsigned int val;
146a71b797fSHaojian Zhuang 
147a71b797fSHaojian Zhuang 	/* get voltage */
148c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, info->vol_reg, &val);
149c5b68d47SJonghwan Choi 	if (ret != 0)
150a71b797fSHaojian Zhuang 		return ret;
151c5b68d47SJonghwan Choi 	val &= MAX8649_VOL_MASK;
1529fc886a1SAxel Lin 	voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */
153a71b797fSHaojian Zhuang 
154a71b797fSHaojian Zhuang 	/* get rate */
155c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, MAX8649_RAMP, &val);
156c5b68d47SJonghwan Choi 	if (ret != 0)
157a71b797fSHaojian Zhuang 		return ret;
158c5b68d47SJonghwan Choi 	ret = (val & MAX8649_RAMP_MASK) >> 5;
159a71b797fSHaojian Zhuang 	rate = (32 * 1000) >> ret;	/* uV/uS */
160a71b797fSHaojian Zhuang 
161e69c4997SAxel Lin 	return DIV_ROUND_UP(voltage, rate);
162a71b797fSHaojian Zhuang }
163a71b797fSHaojian Zhuang 
164a71b797fSHaojian Zhuang static int max8649_set_mode(struct regulator_dev *rdev, unsigned int mode)
165a71b797fSHaojian Zhuang {
166a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
167a71b797fSHaojian Zhuang 
168a71b797fSHaojian Zhuang 	switch (mode) {
169a71b797fSHaojian Zhuang 	case REGULATOR_MODE_FAST:
170c5b68d47SJonghwan Choi 		regmap_update_bits(info->regmap, info->vol_reg, MAX8649_FORCE_PWM,
171a71b797fSHaojian Zhuang 				   MAX8649_FORCE_PWM);
172a71b797fSHaojian Zhuang 		break;
173a71b797fSHaojian Zhuang 	case REGULATOR_MODE_NORMAL:
174c5b68d47SJonghwan Choi 		regmap_update_bits(info->regmap, info->vol_reg,
175a71b797fSHaojian Zhuang 				   MAX8649_FORCE_PWM, 0);
176a71b797fSHaojian Zhuang 		break;
177a71b797fSHaojian Zhuang 	default:
178a71b797fSHaojian Zhuang 		return -EINVAL;
179a71b797fSHaojian Zhuang 	}
180a71b797fSHaojian Zhuang 	return 0;
181a71b797fSHaojian Zhuang }
182a71b797fSHaojian Zhuang 
183a71b797fSHaojian Zhuang static unsigned int max8649_get_mode(struct regulator_dev *rdev)
184a71b797fSHaojian Zhuang {
185a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
186c5b68d47SJonghwan Choi 	unsigned int val;
187a71b797fSHaojian Zhuang 	int ret;
188a71b797fSHaojian Zhuang 
189c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, info->vol_reg, &val);
190c5b68d47SJonghwan Choi 	if (ret != 0)
191c5b68d47SJonghwan Choi 		return ret;
192c5b68d47SJonghwan Choi 	if (val & MAX8649_FORCE_PWM)
193a71b797fSHaojian Zhuang 		return REGULATOR_MODE_FAST;
194a71b797fSHaojian Zhuang 	return REGULATOR_MODE_NORMAL;
195a71b797fSHaojian Zhuang }
196a71b797fSHaojian Zhuang 
197a71b797fSHaojian Zhuang static struct regulator_ops max8649_dcdc_ops = {
198a71b797fSHaojian Zhuang 	.set_voltage	= max8649_set_voltage,
199a71b797fSHaojian Zhuang 	.get_voltage	= max8649_get_voltage,
200a71b797fSHaojian Zhuang 	.list_voltage	= max8649_list_voltage,
201a71b797fSHaojian Zhuang 	.enable		= max8649_enable,
202a71b797fSHaojian Zhuang 	.disable	= max8649_disable,
203a71b797fSHaojian Zhuang 	.is_enabled	= max8649_is_enabled,
204a71b797fSHaojian Zhuang 	.enable_time	= max8649_enable_time,
205a71b797fSHaojian Zhuang 	.set_mode	= max8649_set_mode,
206a71b797fSHaojian Zhuang 	.get_mode	= max8649_get_mode,
207a71b797fSHaojian Zhuang 
208a71b797fSHaojian Zhuang };
209a71b797fSHaojian Zhuang 
21009de3473SAxel Lin static const struct regulator_desc dcdc_desc = {
211a71b797fSHaojian Zhuang 	.name		= "max8649",
212a71b797fSHaojian Zhuang 	.ops		= &max8649_dcdc_ops,
213a71b797fSHaojian Zhuang 	.type		= REGULATOR_VOLTAGE,
214a71b797fSHaojian Zhuang 	.n_voltages	= 1 << 6,
215a71b797fSHaojian Zhuang 	.owner		= THIS_MODULE,
216a71b797fSHaojian Zhuang };
217a71b797fSHaojian Zhuang 
218c5b68d47SJonghwan Choi static struct regmap_config max8649_regmap_config = {
219c5b68d47SJonghwan Choi 	.reg_bits = 8,
220c5b68d47SJonghwan Choi 	.val_bits = 8,
221c5b68d47SJonghwan Choi };
222c5b68d47SJonghwan Choi 
223a71b797fSHaojian Zhuang static int __devinit max8649_regulator_probe(struct i2c_client *client,
224a71b797fSHaojian Zhuang 					     const struct i2c_device_id *id)
225a71b797fSHaojian Zhuang {
226a71b797fSHaojian Zhuang 	struct max8649_platform_data *pdata = client->dev.platform_data;
227a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = NULL;
228*c172708dSMark Brown 	struct regulator_config config = { };
229c5b68d47SJonghwan Choi 	unsigned int val;
230a71b797fSHaojian Zhuang 	unsigned char data;
231a71b797fSHaojian Zhuang 	int ret;
232a71b797fSHaojian Zhuang 
233a71b797fSHaojian Zhuang 	info = kzalloc(sizeof(struct max8649_regulator_info), GFP_KERNEL);
234a71b797fSHaojian Zhuang 	if (!info) {
235a71b797fSHaojian Zhuang 		dev_err(&client->dev, "No enough memory\n");
236a71b797fSHaojian Zhuang 		return -ENOMEM;
237a71b797fSHaojian Zhuang 	}
238a71b797fSHaojian Zhuang 
239c5b68d47SJonghwan Choi 	info->regmap = regmap_init_i2c(client, &max8649_regmap_config);
240c5b68d47SJonghwan Choi 	if (IS_ERR(info->regmap)) {
241c5b68d47SJonghwan Choi 		ret = PTR_ERR(info->regmap);
242c5b68d47SJonghwan Choi 		dev_err(&client->dev, "Failed to allocate register map: %d\n", ret);
243c5b68d47SJonghwan Choi 		goto fail;
244c5b68d47SJonghwan Choi 	}
245c5b68d47SJonghwan Choi 
246a71b797fSHaojian Zhuang 	info->dev = &client->dev;
247a71b797fSHaojian Zhuang 	i2c_set_clientdata(client, info);
248a71b797fSHaojian Zhuang 
249a71b797fSHaojian Zhuang 	info->mode = pdata->mode;
250a71b797fSHaojian Zhuang 	switch (info->mode) {
251a71b797fSHaojian Zhuang 	case 0:
252a71b797fSHaojian Zhuang 		info->vol_reg = MAX8649_MODE0;
253a71b797fSHaojian Zhuang 		break;
254a71b797fSHaojian Zhuang 	case 1:
255a71b797fSHaojian Zhuang 		info->vol_reg = MAX8649_MODE1;
256a71b797fSHaojian Zhuang 		break;
257a71b797fSHaojian Zhuang 	case 2:
258a71b797fSHaojian Zhuang 		info->vol_reg = MAX8649_MODE2;
259a71b797fSHaojian Zhuang 		break;
260a71b797fSHaojian Zhuang 	case 3:
261a71b797fSHaojian Zhuang 		info->vol_reg = MAX8649_MODE3;
262a71b797fSHaojian Zhuang 		break;
263a71b797fSHaojian Zhuang 	default:
264a71b797fSHaojian Zhuang 		break;
265a71b797fSHaojian Zhuang 	}
266a71b797fSHaojian Zhuang 
267c5b68d47SJonghwan Choi 	ret = regmap_read(info->regmap, MAX8649_CHIP_ID1, &val);
268c5b68d47SJonghwan Choi 	if (ret != 0) {
269a71b797fSHaojian Zhuang 		dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
270a71b797fSHaojian Zhuang 			ret);
271a71b797fSHaojian Zhuang 		goto out;
272a71b797fSHaojian Zhuang 	}
273da7de6a1SAxel Lin 	dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", val);
274a71b797fSHaojian Zhuang 
275a71b797fSHaojian Zhuang 	/* enable VID0 & VID1 */
276c5b68d47SJonghwan Choi 	regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_VID_MASK, 0);
277a71b797fSHaojian Zhuang 
278a71b797fSHaojian Zhuang 	/* enable/disable external clock synchronization */
279a71b797fSHaojian Zhuang 	info->extclk = pdata->extclk;
280a71b797fSHaojian Zhuang 	data = (info->extclk) ? MAX8649_SYNC_EXTCLK : 0;
281c5b68d47SJonghwan Choi 	regmap_update_bits(info->regmap, info->vol_reg, MAX8649_SYNC_EXTCLK, data);
282a71b797fSHaojian Zhuang 	if (info->extclk) {
283a71b797fSHaojian Zhuang 		/* set external clock frequency */
284a71b797fSHaojian Zhuang 		info->extclk_freq = pdata->extclk_freq;
285c5b68d47SJonghwan Choi 		regmap_update_bits(info->regmap, MAX8649_SYNC, MAX8649_EXT_MASK,
2860f69c897SAxel Lin 				   info->extclk_freq << 6);
287a71b797fSHaojian Zhuang 	}
288a71b797fSHaojian Zhuang 
289a71b797fSHaojian Zhuang 	if (pdata->ramp_timing) {
290a71b797fSHaojian Zhuang 		info->ramp_timing = pdata->ramp_timing;
291c5b68d47SJonghwan Choi 		regmap_update_bits(info->regmap, MAX8649_RAMP, MAX8649_RAMP_MASK,
292a71b797fSHaojian Zhuang 				   info->ramp_timing << 5);
293a71b797fSHaojian Zhuang 	}
294a71b797fSHaojian Zhuang 
295a71b797fSHaojian Zhuang 	info->ramp_down = pdata->ramp_down;
296a71b797fSHaojian Zhuang 	if (info->ramp_down) {
297c5b68d47SJonghwan Choi 		regmap_update_bits(info->regmap, MAX8649_RAMP, MAX8649_RAMP_DOWN,
298a71b797fSHaojian Zhuang 				   MAX8649_RAMP_DOWN);
299a71b797fSHaojian Zhuang 	}
300a71b797fSHaojian Zhuang 
301*c172708dSMark Brown 	config.dev = &client->dev;
302*c172708dSMark Brown 	config.init_data = pdata->regulator;
303*c172708dSMark Brown 	config.driver_data = info;
304*c172708dSMark Brown 
305*c172708dSMark Brown 	info->regulator = regulator_register(&dcdc_desc, &config);
306a71b797fSHaojian Zhuang 	if (IS_ERR(info->regulator)) {
307a71b797fSHaojian Zhuang 		dev_err(info->dev, "failed to register regulator %s\n",
308a71b797fSHaojian Zhuang 			dcdc_desc.name);
309a71b797fSHaojian Zhuang 		ret = PTR_ERR(info->regulator);
310a71b797fSHaojian Zhuang 		goto out;
311a71b797fSHaojian Zhuang 	}
312a71b797fSHaojian Zhuang 
313a71b797fSHaojian Zhuang 	return 0;
314a71b797fSHaojian Zhuang out:
315c5b68d47SJonghwan Choi 	regmap_exit(info->regmap);
316c5b68d47SJonghwan Choi fail:
317a71b797fSHaojian Zhuang 	kfree(info);
318a71b797fSHaojian Zhuang 	return ret;
319a71b797fSHaojian Zhuang }
320a71b797fSHaojian Zhuang 
321a71b797fSHaojian Zhuang static int __devexit max8649_regulator_remove(struct i2c_client *client)
322a71b797fSHaojian Zhuang {
323a71b797fSHaojian Zhuang 	struct max8649_regulator_info *info = i2c_get_clientdata(client);
324a71b797fSHaojian Zhuang 
325a71b797fSHaojian Zhuang 	if (info) {
326a71b797fSHaojian Zhuang 		if (info->regulator)
327a71b797fSHaojian Zhuang 			regulator_unregister(info->regulator);
328c5b68d47SJonghwan Choi 		regmap_exit(info->regmap);
329a71b797fSHaojian Zhuang 		kfree(info);
330a71b797fSHaojian Zhuang 	}
331a71b797fSHaojian Zhuang 
332a71b797fSHaojian Zhuang 	return 0;
333a71b797fSHaojian Zhuang }
334a71b797fSHaojian Zhuang 
335a71b797fSHaojian Zhuang static const struct i2c_device_id max8649_id[] = {
336a71b797fSHaojian Zhuang 	{ "max8649", 0 },
337a71b797fSHaojian Zhuang 	{ }
338a71b797fSHaojian Zhuang };
339a71b797fSHaojian Zhuang MODULE_DEVICE_TABLE(i2c, max8649_id);
340a71b797fSHaojian Zhuang 
341a71b797fSHaojian Zhuang static struct i2c_driver max8649_driver = {
342a71b797fSHaojian Zhuang 	.probe		= max8649_regulator_probe,
343a71b797fSHaojian Zhuang 	.remove		= __devexit_p(max8649_regulator_remove),
344a71b797fSHaojian Zhuang 	.driver		= {
345a71b797fSHaojian Zhuang 		.name	= "max8649",
346a71b797fSHaojian Zhuang 	},
347a71b797fSHaojian Zhuang 	.id_table	= max8649_id,
348a71b797fSHaojian Zhuang };
349a71b797fSHaojian Zhuang 
350a71b797fSHaojian Zhuang static int __init max8649_init(void)
351a71b797fSHaojian Zhuang {
352a71b797fSHaojian Zhuang 	return i2c_add_driver(&max8649_driver);
353a71b797fSHaojian Zhuang }
354a71b797fSHaojian Zhuang subsys_initcall(max8649_init);
355a71b797fSHaojian Zhuang 
356a71b797fSHaojian Zhuang static void __exit max8649_exit(void)
357a71b797fSHaojian Zhuang {
358a71b797fSHaojian Zhuang 	i2c_del_driver(&max8649_driver);
359a71b797fSHaojian Zhuang }
360a71b797fSHaojian Zhuang module_exit(max8649_exit);
361a71b797fSHaojian Zhuang 
362a71b797fSHaojian Zhuang /* Module information */
363a71b797fSHaojian Zhuang MODULE_DESCRIPTION("MAXIM 8649 voltage regulator driver");
364a71b797fSHaojian Zhuang MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
365a71b797fSHaojian Zhuang MODULE_LICENSE("GPL");
366a71b797fSHaojian Zhuang 
367