Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 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 | |
Alexander Shiyan | 10f9eda | 2014-06-18 21:05:40 +0400 | [diff] [blame] | 16 | #define MC13XXX_NUMREGS 0x3f |
| 17 | #define MC13XXX_IRQ_REG_CNT 2 |
| 18 | #define MC13XXX_IRQ_PER_REG 24 |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 19 | |
| 20 | struct mc13xxx; |
| 21 | |
| 22 | struct mc13xxx_variant { |
| 23 | const char *name; |
| 24 | void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision); |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 25 | }; |
| 26 | |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 27 | extern struct mc13xxx_variant |
| 28 | mc13xxx_variant_mc13783, |
Uwe Kleine-König | 0312e02 | 2012-07-12 09:57:53 +0000 | [diff] [blame] | 29 | mc13xxx_variant_mc13892, |
| 30 | mc13xxx_variant_mc34708; |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 31 | |
| 32 | struct mc13xxx { |
| 33 | struct regmap *regmap; |
| 34 | |
| 35 | struct device *dev; |
Uwe Kleine-König | cd0f34b | 2012-07-12 09:57:52 +0000 | [diff] [blame] | 36 | const struct mc13xxx_variant *variant; |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 37 | |
Alexander Shiyan | 10f9eda | 2014-06-18 21:05:40 +0400 | [diff] [blame] | 38 | struct regmap_irq irqs[MC13XXX_IRQ_PER_REG * MC13XXX_IRQ_REG_CNT]; |
| 39 | struct regmap_irq_chip irq_chip; |
| 40 | struct regmap_irq_chip_data *irq_data; |
| 41 | |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 42 | struct mutex lock; |
| 43 | int irq; |
| 44 | int flags; |
| 45 | |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 46 | int adcflags; |
| 47 | }; |
| 48 | |
Alexander Shiyan | db9ef44 | 2013-12-14 17:03:12 +0400 | [diff] [blame] | 49 | int mc13xxx_common_init(struct device *dev); |
| 50 | int mc13xxx_common_exit(struct device *dev); |
Marc Reilly | a0c7c1d | 2012-04-01 16:41:38 +1000 | [diff] [blame] | 51 | |
| 52 | #endif /* __DRIVERS_MFD_MC13XXX_H */ |