1a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly/* 2a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * Copyright 2012 Creative Product Design 3a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * Marc Reilly <marc@cpdesign.com.au> 4a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * 5a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * This program is free software; you can redistribute it and/or modify it under 6a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * the terms of the GNU General Public License version 2 as published by the 7a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly * Free Software Foundation. 8a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly */ 9a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#ifndef __DRIVERS_MFD_MC13XXX_H 10a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#define __DRIVERS_MFD_MC13XXX_H 11a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 12a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#include <linux/mutex.h> 13a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#include <linux/regmap.h> 14a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#include <linux/mfd/mc13xxx.h> 15a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 1610f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan#define MC13XXX_NUMREGS 0x3f 1710f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan#define MC13XXX_IRQ_REG_CNT 2 1810f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan#define MC13XXX_IRQ_PER_REG 24 19cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König 20cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-Königstruct mc13xxx; 21cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König 22cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-Königstruct mc13xxx_variant { 23cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König const char *name; 24cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision); 25a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly}; 26a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 27cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-Königextern struct mc13xxx_variant 28cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König mc13xxx_variant_mc13783, 290312e024d6cde5ef02900c4c6e2f5bb982e24af5Uwe Kleine-König mc13xxx_variant_mc13892, 300312e024d6cde5ef02900c4c6e2f5bb982e24af5Uwe Kleine-König mc13xxx_variant_mc34708; 31a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 32a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reillystruct mc13xxx { 33a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly struct regmap *regmap; 34a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 35a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly struct device *dev; 36cd0f34b08f98af72bb2f74fe4bd251558fc734d3Uwe Kleine-König const struct mc13xxx_variant *variant; 37a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 3810f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan struct regmap_irq irqs[MC13XXX_IRQ_PER_REG * MC13XXX_IRQ_REG_CNT]; 3910f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan struct regmap_irq_chip irq_chip; 4010f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan struct regmap_irq_chip_data *irq_data; 4110f9edaeaa30468194e1dcd0e47e59b012f4cf8bAlexander Shiyan 42a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly struct mutex lock; 43a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly int irq; 44a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly int flags; 45a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 46a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly int adcflags; 47a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly}; 48a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 49db9ef449aaa550389008c2020fba02e4440ce24bAlexander Shiyanint mc13xxx_common_init(struct device *dev); 50db9ef449aaa550389008c2020fba02e4440ce24bAlexander Shiyanint mc13xxx_common_exit(struct device *dev); 51a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly 52a0c7c1d48ea9f53c67c79eda498bb8eda1422748Marc Reilly#endif /* __DRIVERS_MFD_MC13XXX_H */ 53