Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2012 Creative Product Design |
| 4 | * Marc Reilly <marc@cpdesign.com.au> |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 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 | |
Alexander Shiyan | 10f9eda | 2014-06-18 21:05:40 +0400 | [diff] [blame] | 13 | #define MC13XXX_NUMREGS 0x3f |
| 14 | #define MC13XXX_IRQ_REG_CNT 2 |
| 15 | #define MC13XXX_IRQ_PER_REG 24 |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 16 | |
| 17 | struct mc13xxx; |
| 18 | |
| 19 | struct mc13xxx_variant { |
| 20 | const char *name; |
| 21 | void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision); |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 22 | }; |
| 23 | |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 24 | extern struct mc13xxx_variant |
| 25 | mc13xxx_variant_mc13783, |
Uwe Kleine-König | 0312e02 | 2012-07-12 09:57:53 +0000 | [diff] [blame] | 26 | mc13xxx_variant_mc13892, |
| 27 | mc13xxx_variant_mc34708; |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 28 | |
| 29 | struct mc13xxx { |
| 30 | struct regmap *regmap; |
| 31 | |
| 32 | struct device *dev; |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 33 | const struct mc13xxx_variant *variant; |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 34 | |
Alexander Shiyan | 10f9eda | 2014-06-18 21:05:40 +0400 | [diff] [blame] | 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 | |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 39 | struct mutex lock; |
| 40 | int irq; |
| 41 | int flags; |
| 42 | |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 43 | int adcflags; |
| 44 | }; |
| 45 | |
Alexander Shiyan | db9ef44 | 2013-12-14 17:03:12 +0400 | [diff] [blame] | 46 | int mc13xxx_common_init(struct device *dev); |
| 47 | int mc13xxx_common_exit(struct device *dev); |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 48 | |
| 49 | #endif /* __DRIVERS_MFD_MC13XXX_H */ |