aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-27 23:07:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-27 23:07:01 -0400
commit551b0bda46d4caf74755a018e2cdb1d093e000c9 (patch)
treeaafdf32ae629903c2f200b090de4b36e598d406c /include
parent4329510c22af1d0cfcc291dc4ce6274abebfe170 (diff)
parent8317d5178e7491589693693e5a7f64442cf46ca2 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: mfd: Clean up max8997 IRQ namespace mfd: Fold irq_set_chip/irq_set_handler mfd: Cleanup irq namespace mfd: twl6030: Cleanup interrupt handling mfd: twl4030: Cleanup interrupt handling mfd: mx8925: Remove irq_desc leftovers mfd: htc-i2cpld: Cleanup interrupt handling mfd: htc-egpio: Cleanup interrupt handling mfd: ezx-pcap: Remvove open coded irq handling mfd: 88pm860x: Remove unused irq_desc leftovers mfd: asic3: Cleanup irq handling mfd: Select MFD_CORE if TPS6105X driver is configured mfd: Add MODULE_DEVICE_TABLE to rdc321x-southbridge mfd: Add MAX8997/8966 IRQ control mfd: Constify i2c_device_id tables mfd: OLPC: Clean up names to match what OLPC actually uses mfd: Add mfd_clone_cell(), convert cs5535-mfd/olpc-xo1 to it
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/core.h27
-rw-r--r--include/linux/mfd/max8997-private.h21
-rw-r--r--include/linux/mfd/max8997.h7
3 files changed, 44 insertions, 11 deletions
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 1408bf8eed5f..ad1b19aa6508 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -63,6 +63,24 @@ extern int mfd_cell_enable(struct platform_device *pdev);
63extern int mfd_cell_disable(struct platform_device *pdev); 63extern int mfd_cell_disable(struct platform_device *pdev);
64 64
65/* 65/*
66 * "Clone" multiple platform devices for a single cell. This is to be used
67 * for devices that have multiple users of a cell. For example, if an mfd
68 * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver,
69 * and a platform driver, the following bit of code would be use after first
70 * calling mfd_add_devices():
71 *
72 * const char *fclones[] = { "foo-gpio", "foo-mtd" };
73 * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones));
74 *
75 * Each driver (MTD, GPIO, and platform driver) would then register
76 * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively.
77 * The cell's .enable/.disable hooks should be used to deal with hardware
78 * resource contention.
79 */
80extern int mfd_clone_cell(const char *cell, const char **clones,
81 size_t n_clones);
82
83/*
66 * Given a platform device that's been created by mfd_add_devices(), fetch 84 * Given a platform device that's been created by mfd_add_devices(), fetch
67 * the mfd_cell that created it. 85 * the mfd_cell that created it.
68 */ 86 */
@@ -87,13 +105,4 @@ extern int mfd_add_devices(struct device *parent, int id,
87 105
88extern void mfd_remove_devices(struct device *parent); 106extern void mfd_remove_devices(struct device *parent);
89 107
90/*
91 * For MFD drivers with clients sharing access to resources, these create
92 * multiple platform devices per cell. Contention handling must still be
93 * handled via drivers (ie, with enable/disable hooks).
94 */
95extern int mfd_shared_platform_driver_register(struct platform_driver *drv,
96 const char *cellname);
97extern void mfd_shared_platform_driver_unregister(struct platform_driver *drv);
98
99#endif 108#endif
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 93a9477e075f..69d1010e2e51 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -24,6 +24,8 @@
24 24
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26 26
27#define MAX8997_REG_INVALID (0xff)
28
27enum max8997_pmic_reg { 29enum max8997_pmic_reg {
28 MAX8997_REG_PMIC_ID0 = 0x00, 30 MAX8997_REG_PMIC_ID0 = 0x00,
29 MAX8997_REG_PMIC_ID1 = 0x01, 31 MAX8997_REG_PMIC_ID1 = 0x01,
@@ -313,6 +315,7 @@ enum max8997_irq {
313#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1) 315#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1)
314#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1) 316#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1)
315 317
318#define MAX8997_NUM_GPIO 12
316struct max8997_dev { 319struct max8997_dev {
317 struct device *dev; 320 struct device *dev;
318 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 321 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
@@ -324,11 +327,19 @@ struct max8997_dev {
324 int type; 327 int type;
325 struct platform_device *battery; /* battery control (not fuel gauge) */ 328 struct platform_device *battery; /* battery control (not fuel gauge) */
326 329
330 int irq;
331 int ono;
332 int irq_base;
327 bool wakeup; 333 bool wakeup;
334 struct mutex irqlock;
335 int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
336 int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
328 337
329 /* For hibernation */ 338 /* For hibernation */
330 u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END + 339 u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END +
331 MAX8997_HAPTIC_REG_END]; 340 MAX8997_HAPTIC_REG_END];
341
342 bool gpio_status[MAX8997_NUM_GPIO];
332}; 343};
333 344
334enum max8997_types { 345enum max8997_types {
@@ -336,6 +347,10 @@ enum max8997_types {
336 TYPE_MAX8966, 347 TYPE_MAX8966,
337}; 348};
338 349
350extern int max8997_irq_init(struct max8997_dev *max8997);
351extern void max8997_irq_exit(struct max8997_dev *max8997);
352extern int max8997_irq_resume(struct max8997_dev *max8997);
353
339extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest); 354extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
340extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count, 355extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
341 u8 *buf); 356 u8 *buf);
@@ -344,4 +359,10 @@ extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
344 u8 *buf); 359 u8 *buf);
345extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask); 360extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
346 361
362#define MAX8997_GPIO_INT_BOTH (0x3 << 4)
363#define MAX8997_GPIO_INT_RISE (0x2 << 4)
364#define MAX8997_GPIO_INT_FALL (0x1 << 4)
365
366#define MAX8997_GPIO_INT_MASK (0x3 << 4)
367#define MAX8997_GPIO_DATA_MASK (0x1 << 2)
347#endif /* __LINUX_MFD_MAX8997_PRIV_H */ 368#endif /* __LINUX_MFD_MAX8997_PRIV_H */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index cb671b3451bf..60931d089422 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -78,8 +78,11 @@ struct max8997_regulator_data {
78}; 78};
79 79
80struct max8997_platform_data { 80struct max8997_platform_data {
81 bool wakeup; 81 /* IRQ */
82 /* IRQ: Not implemented */ 82 int irq_base;
83 int ono;
84 int wakeup;
85
83 /* ---- PMIC ---- */ 86 /* ---- PMIC ---- */
84 struct max8997_regulator_data *regulators; 87 struct max8997_regulator_data *regulators;
85 int num_regulators; 88 int num_regulators;