diff options
author | Tom Cherry <tcherry@nvidia.com> | 2011-01-21 14:44:49 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:42:58 -0800 |
commit | d10ab1cfc666f68dbed0b277bb871f055f9cd88a (patch) | |
tree | 042970bc49f4d568eec77cb3ea7d62260c2fb4a5 /include/linux/mfd | |
parent | ac19e4fde4b3928ae4b666f47a1d46aa875f68ca (diff) |
max8907c MFD driver: add second i2c bus and irq handling
Clean up portions of max8907c.c driver
Add capability for bulk i2c read and write
Add capability for second i2c bus for rtc
Add capability for irq handling for rtc and battery charger
Original-Change-Id: I6c2c2c42591aee766635a2e32a7404bb2591f4a7
Reviewed-on: http://git-master/r/16613
Tested-by: Thomas Cherry <tcherry@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: Rb2215121adf39249e1c0f5fe88534179077cae1f
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/max8907c.h | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/include/linux/mfd/max8907c.h b/include/linux/mfd/max8907c.h index c78849a32860..d4d62d4a6421 100644 --- a/include/linux/mfd/max8907c.h +++ b/include/linux/mfd/max8907c.h @@ -145,7 +145,7 @@ #define MAX8907C_REG_RTC_STATUS 0x1A #define MAX8907C_REG_RTC_CNTL 0x1B #define MAX8907C_REG_RTC_IRQ 0x1C -#define MAX8907C_REG_IRQ_IRQ_MASK 0x1D +#define MAX8907C_REG_RTC_IRQ_MASK 0x1D #define MAX8907C_REG_MPL_CNTL 0x1E /* ADC and Touch Screen Controller register map */ @@ -162,22 +162,60 @@ #define MAX8907C_MASK_OUT5V_ENSRC 0x0E #define MAX8907C_MASK_OUT5V_EN 0x01 -struct max8907c { - struct device *dev; +#define RTC_I2C_ADDR 0x68 - int (*read_dev) (void *io_data, u8 reg, u8 count, u8 * dst); - int (*write_dev) (void *io_data, u8 reg, u8 count, const u8 * src); +/* IRQ definitions */ +enum { + MAX8907C_IRQ_VCHG_DC_OVP, + MAX8907C_IRQ_VCHG_DC_F, + MAX8907C_IRQ_VCHG_DC_R, + MAX8907C_IRQ_VCHG_THM_OK_R, + MAX8907C_IRQ_VCHG_THM_OK_F, + MAX8907C_IRQ_VCHG_MBATTLOW_F, + MAX8907C_IRQ_VCHG_MBATTLOW_R, + MAX8907C_IRQ_VCHG_RST, + MAX8907C_IRQ_VCHG_DONE, + MAX8907C_IRQ_VCHG_TOPOFF, + MAX8907C_IRQ_VCHG_TMR_FAULT, + MAX8907C_IRQ_GPM_RSTIN, + MAX8907C_IRQ_GPM_MPL, + MAX8907C_IRQ_GPM_SW_3SEC, + MAX8907C_IRQ_GPM_EXTON_F, + MAX8907C_IRQ_GPM_EXTON_R, + MAX8907C_IRQ_GPM_SW_1SEC, + MAX8907C_IRQ_GPM_SW_F, + MAX8907C_IRQ_GPM_SW_R, + MAX8907C_IRQ_GPM_SYSCKEN_F, + MAX8907C_IRQ_GPM_SYSCKEN_R, + MAX8907C_IRQ_RTC_ALARM1, + MAX8907C_IRQ_RTC_ALARM0, + MAX8907C_NR_IRQS, +}; - struct mutex io_lock; +struct max8907c { + struct device *dev; + struct mutex io_lock; + struct mutex irq_lock; + struct i2c_client *i2c_power; + struct i2c_client *i2c_rtc; + int irq_base; + int core_irq; }; struct max8907c_platform_data { int num_subdevs; struct platform_device **subdevs; + int irq_base; }; -int max8907c_reg_read(struct device *dev, u8 reg); -int max8907c_reg_write(struct device *dev, u8 reg, u8 val); -int max8907c_set_bits(struct device *dev, u8 reg, u8 mask, u8 val); +int max8907c_reg_read(struct i2c_client *i2c, u8 reg); +int max8907c_reg_bulk_read(struct i2c_client *i2c, u8 reg, u8 count, u8 *val); +int max8907c_reg_write(struct i2c_client *i2c, u8 reg, u8 val); +int max8907c_reg_bulk_write(struct i2c_client *i2c, u8 reg, u8 count, u8 *val); +int max8907c_set_bits(struct i2c_client *i2c, u8 reg, u8 mask, u8 val); +int max8907c_irq_init(struct max8907c *chip, int irq, int irq_base); +void max8907c_irq_free(struct max8907c *chip); +int max8907c_suspend(struct i2c_client *i2c, pm_message_t state); +int max8907c_resume(struct i2c_client *i2c); #endif |