xref: /openbmc/linux/drivers/mfd/pcf50633-core.c (revision 8220fe4cb25d0177bd0795a516d2023799008ca0)
1f52046b1SBalaji Rao /* NXP PCF50633 Power Management Unit (PMU) driver
2f52046b1SBalaji Rao  *
3f52046b1SBalaji Rao  * (C) 2006-2008 by Openmoko, Inc.
4f52046b1SBalaji Rao  * Author: Harald Welte <laforge@openmoko.org>
5f52046b1SBalaji Rao  * 	   Balaji Rao <balajirrao@openmoko.org>
6f52046b1SBalaji Rao  * All rights reserved.
7f52046b1SBalaji Rao  *
8f52046b1SBalaji Rao  *  This program is free software; you can redistribute  it and/or modify it
9f52046b1SBalaji Rao  *  under  the terms of  the GNU General  Public License as published by the
10f52046b1SBalaji Rao  *  Free Software Foundation;  either version 2 of the  License, or (at your
11f52046b1SBalaji Rao  *  option) any later version.
12f52046b1SBalaji Rao  *
13f52046b1SBalaji Rao  */
14f52046b1SBalaji Rao 
15f52046b1SBalaji Rao #include <linux/kernel.h>
16f52046b1SBalaji Rao #include <linux/device.h>
17f52046b1SBalaji Rao #include <linux/sysfs.h>
18f52046b1SBalaji Rao #include <linux/module.h>
19f52046b1SBalaji Rao #include <linux/types.h>
20f52046b1SBalaji Rao #include <linux/interrupt.h>
21f52046b1SBalaji Rao #include <linux/workqueue.h>
22f52046b1SBalaji Rao #include <linux/platform_device.h>
23f52046b1SBalaji Rao #include <linux/i2c.h>
245a0e3ad6STejun Heo #include <linux/slab.h>
25f52046b1SBalaji Rao 
26f52046b1SBalaji Rao #include <linux/mfd/pcf50633/core.h>
27f52046b1SBalaji Rao 
28f52046b1SBalaji Rao static int __pcf50633_read(struct pcf50633 *pcf, u8 reg, int num, u8 *data)
29f52046b1SBalaji Rao {
30f52046b1SBalaji Rao 	int ret;
31f52046b1SBalaji Rao 
32f52046b1SBalaji Rao 	ret = i2c_smbus_read_i2c_block_data(pcf->i2c_client, reg,
33f52046b1SBalaji Rao 				num, data);
34f52046b1SBalaji Rao 	if (ret < 0)
35f52046b1SBalaji Rao 		dev_err(pcf->dev, "Error reading %d regs at %d\n", num, reg);
36f52046b1SBalaji Rao 
37f52046b1SBalaji Rao 	return ret;
38f52046b1SBalaji Rao }
39f52046b1SBalaji Rao 
40f52046b1SBalaji Rao static int __pcf50633_write(struct pcf50633 *pcf, u8 reg, int num, u8 *data)
41f52046b1SBalaji Rao {
42f52046b1SBalaji Rao 	int ret;
43f52046b1SBalaji Rao 
44f52046b1SBalaji Rao 	ret = i2c_smbus_write_i2c_block_data(pcf->i2c_client, reg,
45f52046b1SBalaji Rao 				num, data);
46f52046b1SBalaji Rao 	if (ret < 0)
47f52046b1SBalaji Rao 		dev_err(pcf->dev, "Error writing %d regs at %d\n", num, reg);
48f52046b1SBalaji Rao 
49f52046b1SBalaji Rao 	return ret;
50f52046b1SBalaji Rao 
51f52046b1SBalaji Rao }
52f52046b1SBalaji Rao 
53f52046b1SBalaji Rao /* Read a block of upto 32 regs  */
54f52046b1SBalaji Rao int pcf50633_read_block(struct pcf50633 *pcf, u8 reg,
55f52046b1SBalaji Rao 					int nr_regs, u8 *data)
56f52046b1SBalaji Rao {
57f52046b1SBalaji Rao 	int ret;
58f52046b1SBalaji Rao 
59f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
60f52046b1SBalaji Rao 	ret = __pcf50633_read(pcf, reg, nr_regs, data);
61f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
62f52046b1SBalaji Rao 
63f52046b1SBalaji Rao 	return ret;
64f52046b1SBalaji Rao }
65f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_read_block);
66f52046b1SBalaji Rao 
67f52046b1SBalaji Rao /* Write a block of upto 32 regs  */
68f52046b1SBalaji Rao int pcf50633_write_block(struct pcf50633 *pcf , u8 reg,
69f52046b1SBalaji Rao 					int nr_regs, u8 *data)
70f52046b1SBalaji Rao {
71f52046b1SBalaji Rao 	int ret;
72f52046b1SBalaji Rao 
73f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
74f52046b1SBalaji Rao 	ret = __pcf50633_write(pcf, reg, nr_regs, data);
75f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
76f52046b1SBalaji Rao 
77f52046b1SBalaji Rao 	return ret;
78f52046b1SBalaji Rao }
79f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_write_block);
80f52046b1SBalaji Rao 
81f52046b1SBalaji Rao u8 pcf50633_reg_read(struct pcf50633 *pcf, u8 reg)
82f52046b1SBalaji Rao {
83f52046b1SBalaji Rao 	u8 val;
84f52046b1SBalaji Rao 
85f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
86f52046b1SBalaji Rao 	__pcf50633_read(pcf, reg, 1, &val);
87f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
88f52046b1SBalaji Rao 
89f52046b1SBalaji Rao 	return val;
90f52046b1SBalaji Rao }
91f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_reg_read);
92f52046b1SBalaji Rao 
93f52046b1SBalaji Rao int pcf50633_reg_write(struct pcf50633 *pcf, u8 reg, u8 val)
94f52046b1SBalaji Rao {
95f52046b1SBalaji Rao 	int ret;
96f52046b1SBalaji Rao 
97f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
98f52046b1SBalaji Rao 	ret = __pcf50633_write(pcf, reg, 1, &val);
99f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
100f52046b1SBalaji Rao 
101f52046b1SBalaji Rao 	return ret;
102f52046b1SBalaji Rao }
103f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_reg_write);
104f52046b1SBalaji Rao 
105f52046b1SBalaji Rao int pcf50633_reg_set_bit_mask(struct pcf50633 *pcf, u8 reg, u8 mask, u8 val)
106f52046b1SBalaji Rao {
107f52046b1SBalaji Rao 	int ret;
108f52046b1SBalaji Rao 	u8 tmp;
109f52046b1SBalaji Rao 
110f52046b1SBalaji Rao 	val &= mask;
111f52046b1SBalaji Rao 
112f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
113f52046b1SBalaji Rao 	ret = __pcf50633_read(pcf, reg, 1, &tmp);
114f52046b1SBalaji Rao 	if (ret < 0)
115f52046b1SBalaji Rao 		goto out;
116f52046b1SBalaji Rao 
117f52046b1SBalaji Rao 	tmp &= ~mask;
118f52046b1SBalaji Rao 	tmp |= val;
119f52046b1SBalaji Rao 	ret = __pcf50633_write(pcf, reg, 1, &tmp);
120f52046b1SBalaji Rao 
121f52046b1SBalaji Rao out:
122f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
123f52046b1SBalaji Rao 
124f52046b1SBalaji Rao 	return ret;
125f52046b1SBalaji Rao }
126f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_reg_set_bit_mask);
127f52046b1SBalaji Rao 
128f52046b1SBalaji Rao int pcf50633_reg_clear_bits(struct pcf50633 *pcf, u8 reg, u8 val)
129f52046b1SBalaji Rao {
130f52046b1SBalaji Rao 	int ret;
131f52046b1SBalaji Rao 	u8 tmp;
132f52046b1SBalaji Rao 
133f52046b1SBalaji Rao 	mutex_lock(&pcf->lock);
134f52046b1SBalaji Rao 	ret = __pcf50633_read(pcf, reg, 1, &tmp);
135f52046b1SBalaji Rao 	if (ret < 0)
136f52046b1SBalaji Rao 		goto out;
137f52046b1SBalaji Rao 
138f52046b1SBalaji Rao 	tmp &= ~val;
139f52046b1SBalaji Rao 	ret = __pcf50633_write(pcf, reg, 1, &tmp);
140f52046b1SBalaji Rao 
141f52046b1SBalaji Rao out:
142f52046b1SBalaji Rao 	mutex_unlock(&pcf->lock);
143f52046b1SBalaji Rao 
144f52046b1SBalaji Rao 	return ret;
145f52046b1SBalaji Rao }
146f52046b1SBalaji Rao EXPORT_SYMBOL_GPL(pcf50633_reg_clear_bits);
147f52046b1SBalaji Rao 
148f52046b1SBalaji Rao /* sysfs attributes */
149f52046b1SBalaji Rao static ssize_t show_dump_regs(struct device *dev, struct device_attribute *attr,
150f52046b1SBalaji Rao 			    char *buf)
151f52046b1SBalaji Rao {
152f52046b1SBalaji Rao 	struct pcf50633 *pcf = dev_get_drvdata(dev);
153f52046b1SBalaji Rao 	u8 dump[16];
154f52046b1SBalaji Rao 	int n, n1, idx = 0;
155f52046b1SBalaji Rao 	char *buf1 = buf;
156f52046b1SBalaji Rao 	static u8 address_no_read[] = { /* must be ascending */
157f52046b1SBalaji Rao 		PCF50633_REG_INT1,
158f52046b1SBalaji Rao 		PCF50633_REG_INT2,
159f52046b1SBalaji Rao 		PCF50633_REG_INT3,
160f52046b1SBalaji Rao 		PCF50633_REG_INT4,
161f52046b1SBalaji Rao 		PCF50633_REG_INT5,
162f52046b1SBalaji Rao 		0 /* terminator */
163f52046b1SBalaji Rao 	};
164f52046b1SBalaji Rao 
165f52046b1SBalaji Rao 	for (n = 0; n < 256; n += sizeof(dump)) {
166f52046b1SBalaji Rao 		for (n1 = 0; n1 < sizeof(dump); n1++)
167f52046b1SBalaji Rao 			if (n == address_no_read[idx]) {
168f52046b1SBalaji Rao 				idx++;
169f52046b1SBalaji Rao 				dump[n1] = 0x00;
170f52046b1SBalaji Rao 			} else
171f52046b1SBalaji Rao 				dump[n1] = pcf50633_reg_read(pcf, n + n1);
172f52046b1SBalaji Rao 
173f52046b1SBalaji Rao 		hex_dump_to_buffer(dump, sizeof(dump), 16, 1, buf1, 128, 0);
174f52046b1SBalaji Rao 		buf1 += strlen(buf1);
175f52046b1SBalaji Rao 		*buf1++ = '\n';
176f52046b1SBalaji Rao 		*buf1 = '\0';
177f52046b1SBalaji Rao 	}
178f52046b1SBalaji Rao 
179f52046b1SBalaji Rao 	return buf1 - buf;
180f52046b1SBalaji Rao }
181f52046b1SBalaji Rao static DEVICE_ATTR(dump_regs, 0400, show_dump_regs, NULL);
182f52046b1SBalaji Rao 
183f52046b1SBalaji Rao static ssize_t show_resume_reason(struct device *dev,
184f52046b1SBalaji Rao 				struct device_attribute *attr, char *buf)
185f52046b1SBalaji Rao {
186f52046b1SBalaji Rao 	struct pcf50633 *pcf = dev_get_drvdata(dev);
187f52046b1SBalaji Rao 	int n;
188f52046b1SBalaji Rao 
189f52046b1SBalaji Rao 	n = sprintf(buf, "%02x%02x%02x%02x%02x\n",
190f52046b1SBalaji Rao 				pcf->resume_reason[0],
191f52046b1SBalaji Rao 				pcf->resume_reason[1],
192f52046b1SBalaji Rao 				pcf->resume_reason[2],
193f52046b1SBalaji Rao 				pcf->resume_reason[3],
194f52046b1SBalaji Rao 				pcf->resume_reason[4]);
195f52046b1SBalaji Rao 
196f52046b1SBalaji Rao 	return n;
197f52046b1SBalaji Rao }
198f52046b1SBalaji Rao static DEVICE_ATTR(resume_reason, 0400, show_resume_reason, NULL);
199f52046b1SBalaji Rao 
200f52046b1SBalaji Rao static struct attribute *pcf_sysfs_entries[] = {
201f52046b1SBalaji Rao 	&dev_attr_dump_regs.attr,
202f52046b1SBalaji Rao 	&dev_attr_resume_reason.attr,
203f52046b1SBalaji Rao 	NULL,
204f52046b1SBalaji Rao };
205f52046b1SBalaji Rao 
206f52046b1SBalaji Rao static struct attribute_group pcf_attr_group = {
207f52046b1SBalaji Rao 	.name	= NULL,			/* put in device directory */
208f52046b1SBalaji Rao 	.attrs	= pcf_sysfs_entries,
209f52046b1SBalaji Rao };
210f52046b1SBalaji Rao 
211f52046b1SBalaji Rao static void
212f52046b1SBalaji Rao pcf50633_client_dev_register(struct pcf50633 *pcf, const char *name,
213f52046b1SBalaji Rao 						struct platform_device **pdev)
214f52046b1SBalaji Rao {
215f52046b1SBalaji Rao 	int ret;
216f52046b1SBalaji Rao 
217f52046b1SBalaji Rao 	*pdev = platform_device_alloc(name, -1);
218f52046b1SBalaji Rao 	if (!*pdev) {
219f52046b1SBalaji Rao 		dev_err(pcf->dev, "Falied to allocate %s\n", name);
220f52046b1SBalaji Rao 		return;
221f52046b1SBalaji Rao 	}
222f52046b1SBalaji Rao 
223f52046b1SBalaji Rao 	(*pdev)->dev.parent = pcf->dev;
224f52046b1SBalaji Rao 
225f52046b1SBalaji Rao 	ret = platform_device_add(*pdev);
226f52046b1SBalaji Rao 	if (ret) {
227f52046b1SBalaji Rao 		dev_err(pcf->dev, "Failed to register %s: %d\n", name, ret);
228f52046b1SBalaji Rao 		platform_device_put(*pdev);
229f52046b1SBalaji Rao 		*pdev = NULL;
230f52046b1SBalaji Rao 	}
231f52046b1SBalaji Rao }
232f52046b1SBalaji Rao 
233f52046b1SBalaji Rao #ifdef CONFIG_PM
23425993e4eSLars-Peter Clausen static int pcf50633_suspend(struct i2c_client *client, pm_message_t state)
235f52046b1SBalaji Rao {
236f52046b1SBalaji Rao 	struct pcf50633 *pcf;
23725993e4eSLars-Peter Clausen 	pcf = i2c_get_clientdata(client);
238f52046b1SBalaji Rao 
239380c09f6SLars-Peter Clausen 	return pcf50633_irq_suspend(pcf);
240f52046b1SBalaji Rao }
241f52046b1SBalaji Rao 
24225993e4eSLars-Peter Clausen static int pcf50633_resume(struct i2c_client *client)
243f52046b1SBalaji Rao {
244f52046b1SBalaji Rao 	struct pcf50633 *pcf;
24525993e4eSLars-Peter Clausen 	pcf = i2c_get_clientdata(client);
246f52046b1SBalaji Rao 
247380c09f6SLars-Peter Clausen 	return pcf50633_irq_resume(pcf);
248f52046b1SBalaji Rao }
249f52046b1SBalaji Rao #else
250f52046b1SBalaji Rao #define pcf50633_suspend NULL
251f52046b1SBalaji Rao #define pcf50633_resume NULL
252f52046b1SBalaji Rao #endif
253f52046b1SBalaji Rao 
254f52046b1SBalaji Rao static int __devinit pcf50633_probe(struct i2c_client *client,
255f52046b1SBalaji Rao 				const struct i2c_device_id *ids)
256f52046b1SBalaji Rao {
257f52046b1SBalaji Rao 	struct pcf50633 *pcf;
258f52046b1SBalaji Rao 	struct pcf50633_platform_data *pdata = client->dev.platform_data;
25924213ae1SLars-Peter Clausen 	int i, ret;
260f52046b1SBalaji Rao 	int version, variant;
261f52046b1SBalaji Rao 
26224213ae1SLars-Peter Clausen 	if (!client->irq) {
26324213ae1SLars-Peter Clausen 		dev_err(&client->dev, "Missing IRQ\n");
26424213ae1SLars-Peter Clausen 		return -ENOENT;
26524213ae1SLars-Peter Clausen 	}
26624213ae1SLars-Peter Clausen 
267f52046b1SBalaji Rao 	pcf = kzalloc(sizeof(*pcf), GFP_KERNEL);
268f52046b1SBalaji Rao 	if (!pcf)
269f52046b1SBalaji Rao 		return -ENOMEM;
270f52046b1SBalaji Rao 
271f52046b1SBalaji Rao 	pcf->pdata = pdata;
272f52046b1SBalaji Rao 
273f52046b1SBalaji Rao 	mutex_init(&pcf->lock);
274f52046b1SBalaji Rao 
275f52046b1SBalaji Rao 	i2c_set_clientdata(client, pcf);
276f52046b1SBalaji Rao 	pcf->dev = &client->dev;
277f52046b1SBalaji Rao 	pcf->i2c_client = client;
278f52046b1SBalaji Rao 
279f52046b1SBalaji Rao 	version = pcf50633_reg_read(pcf, 0);
280f52046b1SBalaji Rao 	variant = pcf50633_reg_read(pcf, 1);
281f52046b1SBalaji Rao 	if (version < 0 || variant < 0) {
282f52046b1SBalaji Rao 		dev_err(pcf->dev, "Unable to probe pcf50633\n");
283f52046b1SBalaji Rao 		ret = -ENODEV;
284f7b2a77fSLars-Peter Clausen 		goto err_free;
285f52046b1SBalaji Rao 	}
286f52046b1SBalaji Rao 
287f52046b1SBalaji Rao 	dev_info(pcf->dev, "Probed device version %d variant %d\n",
288f52046b1SBalaji Rao 							version, variant);
289f52046b1SBalaji Rao 
290380c09f6SLars-Peter Clausen 	pcf50633_irq_init(pcf, client->irq);
29124213ae1SLars-Peter Clausen 
292f52046b1SBalaji Rao 	/* Create sub devices */
293f52046b1SBalaji Rao 	pcf50633_client_dev_register(pcf, "pcf50633-input",
294f52046b1SBalaji Rao 						&pcf->input_pdev);
295f52046b1SBalaji Rao 	pcf50633_client_dev_register(pcf, "pcf50633-rtc",
296f52046b1SBalaji Rao 						&pcf->rtc_pdev);
297f52046b1SBalaji Rao 	pcf50633_client_dev_register(pcf, "pcf50633-mbc",
298f52046b1SBalaji Rao 						&pcf->mbc_pdev);
299f52046b1SBalaji Rao 	pcf50633_client_dev_register(pcf, "pcf50633-adc",
300f52046b1SBalaji Rao 						&pcf->adc_pdev);
301f5bf403aSLars-Peter Clausen 	pcf50633_client_dev_register(pcf, "pcf50633-backlight",
302f5bf403aSLars-Peter Clausen 						&pcf->bl_pdev);
303f5bf403aSLars-Peter Clausen 
304f52046b1SBalaji Rao 
305f52046b1SBalaji Rao 	for (i = 0; i < PCF50633_NUM_REGULATORS; i++) {
306f52046b1SBalaji Rao 		struct platform_device *pdev;
307f52046b1SBalaji Rao 
308f52046b1SBalaji Rao 		pdev = platform_device_alloc("pcf50633-regltr", i);
309f52046b1SBalaji Rao 		if (!pdev) {
31024213ae1SLars-Peter Clausen 			dev_err(pcf->dev, "Cannot create regulator %d\n", i);
311f52046b1SBalaji Rao 			continue;
312f52046b1SBalaji Rao 		}
313f52046b1SBalaji Rao 
314f52046b1SBalaji Rao 		pdev->dev.parent = pcf->dev;
315bbb2e496SLars-Peter Clausen 		platform_device_add_data(pdev, &pdata->reg_init_data[i],
316bbb2e496SLars-Peter Clausen 					sizeof(pdata->reg_init_data[i]));
317f52046b1SBalaji Rao 		pcf->regulator_pdev[i] = pdev;
318f52046b1SBalaji Rao 
319f52046b1SBalaji Rao 		platform_device_add(pdev);
320f52046b1SBalaji Rao 	}
321f52046b1SBalaji Rao 
322f52046b1SBalaji Rao 	ret = sysfs_create_group(&client->dev.kobj, &pcf_attr_group);
323f52046b1SBalaji Rao 	if (ret)
324f52046b1SBalaji Rao 		dev_err(pcf->dev, "error creating sysfs entries\n");
325f52046b1SBalaji Rao 
326f52046b1SBalaji Rao 	if (pdata->probe_done)
327f52046b1SBalaji Rao 		pdata->probe_done(pcf);
328f52046b1SBalaji Rao 
329f52046b1SBalaji Rao 	return 0;
330f52046b1SBalaji Rao 
33124213ae1SLars-Peter Clausen err_free:
332f52046b1SBalaji Rao 	kfree(pcf);
33324213ae1SLars-Peter Clausen 
334f52046b1SBalaji Rao 	return ret;
335f52046b1SBalaji Rao }
336f52046b1SBalaji Rao 
337f52046b1SBalaji Rao static int __devexit pcf50633_remove(struct i2c_client *client)
338f52046b1SBalaji Rao {
339f52046b1SBalaji Rao 	struct pcf50633 *pcf = i2c_get_clientdata(client);
340f52046b1SBalaji Rao 	int i;
341f52046b1SBalaji Rao 
342*8220fe4cSAxel Lin 	sysfs_remove_group(&client->dev.kobj, &pcf_attr_group);
343380c09f6SLars-Peter Clausen 	pcf50633_irq_free(pcf);
344f52046b1SBalaji Rao 
345f52046b1SBalaji Rao 	platform_device_unregister(pcf->input_pdev);
346f52046b1SBalaji Rao 	platform_device_unregister(pcf->rtc_pdev);
347f52046b1SBalaji Rao 	platform_device_unregister(pcf->mbc_pdev);
348f52046b1SBalaji Rao 	platform_device_unregister(pcf->adc_pdev);
349*8220fe4cSAxel Lin 	platform_device_unregister(pcf->bl_pdev);
350f52046b1SBalaji Rao 
351f52046b1SBalaji Rao 	for (i = 0; i < PCF50633_NUM_REGULATORS; i++)
352f52046b1SBalaji Rao 		platform_device_unregister(pcf->regulator_pdev[i]);
353f52046b1SBalaji Rao 
354f52046b1SBalaji Rao 	kfree(pcf);
355f52046b1SBalaji Rao 
356f52046b1SBalaji Rao 	return 0;
357f52046b1SBalaji Rao }
358f52046b1SBalaji Rao 
359f52046b1SBalaji Rao static struct i2c_device_id pcf50633_id_table[] = {
360f52046b1SBalaji Rao 	{"pcf50633", 0x73},
3618915e540SJean Delvare 	{/* end of list */}
362f52046b1SBalaji Rao };
363f52046b1SBalaji Rao 
364f52046b1SBalaji Rao static struct i2c_driver pcf50633_driver = {
365f52046b1SBalaji Rao 	.driver = {
366f52046b1SBalaji Rao 		.name	= "pcf50633",
367f52046b1SBalaji Rao 	},
368f52046b1SBalaji Rao 	.id_table = pcf50633_id_table,
369f52046b1SBalaji Rao 	.probe = pcf50633_probe,
370f52046b1SBalaji Rao 	.remove = __devexit_p(pcf50633_remove),
37125993e4eSLars-Peter Clausen 	.suspend = pcf50633_suspend,
37225993e4eSLars-Peter Clausen 	.resume	= pcf50633_resume,
373f52046b1SBalaji Rao };
374f52046b1SBalaji Rao 
375f52046b1SBalaji Rao static int __init pcf50633_init(void)
376f52046b1SBalaji Rao {
377f52046b1SBalaji Rao 	return i2c_add_driver(&pcf50633_driver);
378f52046b1SBalaji Rao }
379f52046b1SBalaji Rao 
380f52046b1SBalaji Rao static void __exit pcf50633_exit(void)
381f52046b1SBalaji Rao {
382f52046b1SBalaji Rao 	i2c_del_driver(&pcf50633_driver);
383f52046b1SBalaji Rao }
384f52046b1SBalaji Rao 
385f52046b1SBalaji Rao MODULE_DESCRIPTION("I2C chip driver for NXP PCF50633 PMU");
386f52046b1SBalaji Rao MODULE_AUTHOR("Harald Welte <laforge@openmoko.org>");
387f52046b1SBalaji Rao MODULE_LICENSE("GPL");
388f52046b1SBalaji Rao 
3892021de87SSamuel Ortiz subsys_initcall(pcf50633_init);
390f52046b1SBalaji Rao module_exit(pcf50633_exit);
391