blob: ce6eec52e8eb11d2467f7eace881f2910c0d62ca [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Marc Reillya0c7c1d2012-04-01 16:41:38 +10002/*
3 * Copyright 2012 Creative Product Design
4 * Marc Reilly <marc@cpdesign.com.au>
Marc Reillya0c7c1d2012-04-01 16:41:38 +10005 */
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
Alexander Shiyan10f9eda2014-06-18 21:05:40 +040013#define MC13XXX_NUMREGS 0x3f
14#define MC13XXX_IRQ_REG_CNT 2
15#define MC13XXX_IRQ_PER_REG 24
Uwe Kleine-Königcd0f34b2012-07-12 09:57:52 +000016
17struct mc13xxx;
18
19struct mc13xxx_variant {
20 const char *name;
21 void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
Marc Reillya0c7c1d2012-04-01 16:41:38 +100022};
23
Uwe Kleine-Königcd0f34b2012-07-12 09:57:52 +000024extern struct mc13xxx_variant
25 mc13xxx_variant_mc13783,
Uwe Kleine-König0312e022012-07-12 09:57:53 +000026 mc13xxx_variant_mc13892,
27 mc13xxx_variant_mc34708;
Marc Reillya0c7c1d2012-04-01 16:41:38 +100028
29struct mc13xxx {
30 struct regmap *regmap;
31
32 struct device *dev;
Uwe Kleine-Königcd0f34b2012-07-12 09:57:52 +000033 const struct mc13xxx_variant *variant;
Marc Reillya0c7c1d2012-04-01 16:41:38 +100034
Alexander Shiyan10f9eda2014-06-18 21:05:40 +040035 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
Marc Reillya0c7c1d2012-04-01 16:41:38 +100039 struct mutex lock;
40 int irq;
41 int flags;
42
Marc Reillya0c7c1d2012-04-01 16:41:38 +100043 int adcflags;
44};
45
Alexander Shiyandb9ef442013-12-14 17:03:12 +040046int mc13xxx_common_init(struct device *dev);
47int mc13xxx_common_exit(struct device *dev);
Marc Reillya0c7c1d2012-04-01 16:41:38 +100048
49#endif /* __DRIVERS_MFD_MC13XXX_H */