Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright 2012 Creative Product Design
4 * Marc Reilly <marc@cpdesign.com.au>
5 */
6#ifndef __DRIVERS_MFD_MC13XXX_H
7#define __DRIVERS_MFD_MC13XXX_H
8
9#include <linux/mutex.h>
10#include <linux/regmap.h>
11#include <linux/mfd/mc13xxx.h>
12
13#define MC13XXX_NUMREGS 0x3f
14#define MC13XXX_IRQ_REG_CNT 2
15#define MC13XXX_IRQ_PER_REG 24
16
17struct mc13xxx;
18
19struct mc13xxx_variant {
20 const char *name;
21 void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
22};
23
24extern struct mc13xxx_variant
25 mc13xxx_variant_mc13783,
26 mc13xxx_variant_mc13892,
27 mc13xxx_variant_mc34708;
28
29struct mc13xxx {
30 struct regmap *regmap;
31
32 struct device *dev;
33 const struct mc13xxx_variant *variant;
34
35 struct regmap_irq irqs[MC13XXX_IRQ_PER_REG * MC13XXX_IRQ_REG_CNT];
36 struct regmap_irq_chip irq_chip;
37 struct regmap_irq_chip_data *irq_data;
38
39 struct mutex lock;
40 int irq;
41 int flags;
42
43 int adcflags;
44};
45
46int mc13xxx_common_init(struct device *dev);
47void mc13xxx_common_exit(struct device *dev);
48
49#endif /* __DRIVERS_MFD_MC13XXX_H */
1/*
2 * Copyright 2012 Creative Product Design
3 * Marc Reilly <marc@cpdesign.com.au>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#ifndef __DRIVERS_MFD_MC13XXX_H
10#define __DRIVERS_MFD_MC13XXX_H
11
12#include <linux/mutex.h>
13#include <linux/regmap.h>
14#include <linux/mfd/mc13xxx.h>
15
16enum mc13xxx_id {
17 MC13XXX_ID_MC13783,
18 MC13XXX_ID_MC13892,
19 MC13XXX_ID_INVALID,
20};
21
22#define MC13XXX_NUMREGS 0x3f
23
24struct mc13xxx {
25 struct regmap *regmap;
26
27 struct device *dev;
28 enum mc13xxx_id ictype;
29
30 struct mutex lock;
31 int irq;
32 int flags;
33
34 irq_handler_t irqhandler[MC13XXX_NUM_IRQ];
35 void *irqdata[MC13XXX_NUM_IRQ];
36
37 int adcflags;
38};
39
40int mc13xxx_common_init(struct mc13xxx *mc13xxx,
41 struct mc13xxx_platform_data *pdata, int irq);
42
43void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx);
44
45#endif /* __DRIVERS_MFD_MC13XXX_H */