Source
1
1
/*
2
2
* Base driver for Analog Devices ADP5520/ADP5501 MFD PMICs
3
3
* LCD Backlight: drivers/video/backlight/adp5520_bl
4
4
* LEDs : drivers/led/leds-adp5520
5
5
* GPIO : drivers/gpio/adp5520-gpio (ADP5520 only)
6
6
* Keys : drivers/input/keyboard/adp5520-keys (ADP5520 only)
7
7
*
8
8
* Copyright 2009 Analog Devices Inc.
9
9
*
10
+
* Author: Michael Hennerich <michael.hennerich@analog.com>
11
+
*
10
12
* Derived from da903x:
11
13
* Copyright (C) 2008 Compulab, Ltd.
12
14
* Mike Rapoport <mike@compulab.co.il>
13
15
*
14
16
* Copyright (C) 2006-2008 Marvell International Ltd.
15
17
* Eric Miao <eric.miao@marvell.com>
16
18
*
17
19
* Licensed under the GPL-2 or later.
18
20
*/
19
21
20
22
#include <linux/kernel.h>
21
-
#include <linux/module.h>
23
+
#include <linux/init.h>
22
24
#include <linux/platform_device.h>
23
25
#include <linux/slab.h>
24
26
#include <linux/interrupt.h>
25
27
#include <linux/irq.h>
26
28
#include <linux/err.h>
27
29
#include <linux/i2c.h>
28
30
29
31
#include <linux/mfd/adp5520.h>
30
32
31
33
struct adp5520_chip {
297
299
out_remove_subdevs:
298
300
adp5520_remove_subdevs(chip);
299
301
300
302
out_free_irq:
301
303
if (chip->irq)
302
304
free_irq(chip->irq, chip);
303
305
304
306
return ret;
305
307
}
306
308
307
-
static int adp5520_remove(struct i2c_client *client)
308
-
{
309
-
struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
310
-
311
-
if (chip->irq)
312
-
free_irq(chip->irq, chip);
313
-
314
-
adp5520_remove_subdevs(chip);
315
-
adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
316
-
return 0;
317
-
}
318
-
319
309
#ifdef CONFIG_PM_SLEEP
320
310
static int adp5520_suspend(struct device *dev)
321
311
{
322
312
struct i2c_client *client = to_i2c_client(dev);
323
313
struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
324
314
325
315
adp5520_read(chip->dev, ADP5520_MODE_STATUS, &chip->mode);
326
316
/* All other bits are W1C */
327
317
chip->mode &= ADP5520_BL_EN | ADP5520_DIM_EN | ADP5520_nSTNBY;
328
318
adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
339
329
}
340
330
#endif
341
331
342
332
static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume);
343
333
344
334
static const struct i2c_device_id adp5520_id[] = {
345
335
{ "pmic-adp5520", ID_ADP5520 },
346
336
{ "pmic-adp5501", ID_ADP5501 },
347
337
{ }
348
338
};
349
-
MODULE_DEVICE_TABLE(i2c, adp5520_id);
350
339
351
340
static struct i2c_driver adp5520_driver = {
352
341
.driver = {
353
-
.name = "adp5520",
354
-
.pm = &adp5520_pm,
342
+
.name = "adp5520",
343
+
.pm = &adp5520_pm,
344
+
.suppress_bind_attrs = true,
355
345
},
356
346
.probe = adp5520_probe,
357
-
.remove = adp5520_remove,
358
347
.id_table = adp5520_id,
359
348
};
360
-
361
-
module_i2c_driver(adp5520_driver);
362
-
363
-
MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
364
-
MODULE_DESCRIPTION("ADP5520(01) PMIC-MFD Driver");
365
-
MODULE_LICENSE("GPL");
349
+
builtin_i2c_driver(adp5520_driver);