diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2010-09-10 12:36:39 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:29:03 -0400 |
commit | 2c7e6f5797140b33ec2b967ff28941e1c7eff4b2 (patch) | |
tree | c05033ac7712ab253981dc43ac512577113c91c4 /include/linux/mfd | |
parent | 676e02d7a2ed9bb02994670a07df533a29a99de6 (diff) |
mfd: Add MAX8998 interrupts support
Use genirq and provide seperated file for interrupts support.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/max8998-private.h | 72 | ||||
-rw-r--r-- | include/linux/mfd/max8998.h | 11 |
2 files changed, 77 insertions, 6 deletions
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h index f0a20cdc288c..3bd2371a05f7 100644 --- a/include/linux/mfd/max8998-private.h +++ b/include/linux/mfd/max8998-private.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * max8698.h - Voltage regulator driver for the Maxim 8998 | 2 | * max8998.h - Voltage regulator driver for the Maxim 8998 |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Samsung Electrnoics | 4 | * Copyright (C) 2009-2010 Samsung Electrnoics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
@@ -23,6 +23,8 @@ | |||
23 | #ifndef __LINUX_MFD_MAX8998_PRIV_H | 23 | #ifndef __LINUX_MFD_MAX8998_PRIV_H |
24 | #define __LINUX_MFD_MAX8998_PRIV_H | 24 | #define __LINUX_MFD_MAX8998_PRIV_H |
25 | 25 | ||
26 | #define MAX8998_NUM_IRQ_REGS 4 | ||
27 | |||
26 | /* MAX 8998 registers */ | 28 | /* MAX 8998 registers */ |
27 | enum { | 29 | enum { |
28 | MAX8998_REG_IRQ1, | 30 | MAX8998_REG_IRQ1, |
@@ -72,20 +74,86 @@ enum { | |||
72 | MAX8998_REG_LBCNFG2, | 74 | MAX8998_REG_LBCNFG2, |
73 | }; | 75 | }; |
74 | 76 | ||
77 | /* IRQ definitions */ | ||
78 | enum { | ||
79 | MAX8998_IRQ_DCINF, | ||
80 | MAX8998_IRQ_DCINR, | ||
81 | MAX8998_IRQ_JIGF, | ||
82 | MAX8998_IRQ_JIGR, | ||
83 | MAX8998_IRQ_PWRONF, | ||
84 | MAX8998_IRQ_PWRONR, | ||
85 | |||
86 | MAX8998_IRQ_WTSREVNT, | ||
87 | MAX8998_IRQ_SMPLEVNT, | ||
88 | MAX8998_IRQ_ALARM1, | ||
89 | MAX8998_IRQ_ALARM0, | ||
90 | |||
91 | MAX8998_IRQ_ONKEY1S, | ||
92 | MAX8998_IRQ_TOPOFFR, | ||
93 | MAX8998_IRQ_DCINOVPR, | ||
94 | MAX8998_IRQ_CHGRSTF, | ||
95 | MAX8998_IRQ_DONER, | ||
96 | MAX8998_IRQ_CHGFAULT, | ||
97 | |||
98 | MAX8998_IRQ_LOBAT1, | ||
99 | MAX8998_IRQ_LOBAT2, | ||
100 | |||
101 | MAX8998_IRQ_NR, | ||
102 | }; | ||
103 | |||
104 | #define MAX8998_IRQ_DCINF_MASK (1 << 2) | ||
105 | #define MAX8998_IRQ_DCINR_MASK (1 << 3) | ||
106 | #define MAX8998_IRQ_JIGF_MASK (1 << 4) | ||
107 | #define MAX8998_IRQ_JIGR_MASK (1 << 5) | ||
108 | #define MAX8998_IRQ_PWRONF_MASK (1 << 6) | ||
109 | #define MAX8998_IRQ_PWRONR_MASK (1 << 7) | ||
110 | |||
111 | #define MAX8998_IRQ_WTSREVNT_MASK (1 << 0) | ||
112 | #define MAX8998_IRQ_SMPLEVNT_MASK (1 << 1) | ||
113 | #define MAX8998_IRQ_ALARM1_MASK (1 << 2) | ||
114 | #define MAX8998_IRQ_ALARM0_MASK (1 << 3) | ||
115 | |||
116 | #define MAX8998_IRQ_ONKEY1S_MASK (1 << 0) | ||
117 | #define MAX8998_IRQ_TOPOFFR_MASK (1 << 2) | ||
118 | #define MAX8998_IRQ_DCINOVPR_MASK (1 << 3) | ||
119 | #define MAX8998_IRQ_CHGRSTF_MASK (1 << 4) | ||
120 | #define MAX8998_IRQ_DONER_MASK (1 << 5) | ||
121 | #define MAX8998_IRQ_CHGFAULT_MASK (1 << 7) | ||
122 | |||
123 | #define MAX8998_IRQ_LOBAT1_MASK (1 << 0) | ||
124 | #define MAX8998_IRQ_LOBAT2_MASK (1 << 1) | ||
125 | |||
75 | /** | 126 | /** |
76 | * struct max8998_dev - max8998 master device for sub-drivers | 127 | * struct max8998_dev - max8998 master device for sub-drivers |
77 | * @dev: master device of the chip (can be used to access platform data) | 128 | * @dev: master device of the chip (can be used to access platform data) |
78 | * @i2c: i2c client private data | 129 | * @i2c: i2c client private data |
79 | * @iolock: mutex for serializing io access | 130 | * @iolock: mutex for serializing io access |
131 | * @irqlock: mutex for buslock | ||
132 | * @irq_base: base IRQ number for max8998, required for IRQs | ||
133 | * @irq: generic IRQ number for max8998 | ||
134 | * @ono: power onoff IRQ number for max8998 | ||
135 | * @irq_masks_cur: currently active value | ||
136 | * @irq_masks_cache: cached hardware value | ||
80 | */ | 137 | */ |
81 | |||
82 | struct max8998_dev { | 138 | struct max8998_dev { |
83 | struct device *dev; | 139 | struct device *dev; |
84 | struct i2c_client *i2c; | 140 | struct i2c_client *i2c; |
85 | struct mutex iolock; | 141 | struct mutex iolock; |
142 | struct mutex irqlock; | ||
143 | |||
144 | int irq_base; | ||
145 | int irq; | ||
146 | int ono; | ||
147 | u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; | ||
148 | u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS]; | ||
86 | }; | 149 | }; |
87 | 150 | ||
151 | int max8998_irq_init(struct max8998_dev *max8998); | ||
152 | void max8998_irq_exit(struct max8998_dev *max8998); | ||
153 | |||
88 | extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest); | 154 | extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest); |
155 | extern int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count, | ||
156 | u8 *buf); | ||
89 | extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value); | 157 | extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value); |
90 | extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask); | 158 | extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask); |
91 | 159 | ||
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h index 1d3601a2d853..d47ed4c190fe 100644 --- a/include/linux/mfd/max8998.h +++ b/include/linux/mfd/max8998.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * max8698.h - Voltage regulator driver for the Maxim 8998 | 2 | * max8998.h - Voltage regulator driver for the Maxim 8998 |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Samsung Electrnoics | 4 | * Copyright (C) 2009-2010 Samsung Electrnoics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
@@ -66,13 +66,16 @@ struct max8998_regulator_data { | |||
66 | 66 | ||
67 | /** | 67 | /** |
68 | * struct max8998_board - packages regulator init data | 68 | * struct max8998_board - packages regulator init data |
69 | * @num_regulators: number of regultors used | ||
70 | * @regulators: array of defined regulators | 69 | * @regulators: array of defined regulators |
70 | * @num_regulators: number of regultors used | ||
71 | * @irq_base: base IRQ number for max8998, required for IRQs | ||
72 | * @ono: power onoff IRQ number for max8998 | ||
71 | */ | 73 | */ |
72 | |||
73 | struct max8998_platform_data { | 74 | struct max8998_platform_data { |
74 | int num_regulators; | ||
75 | struct max8998_regulator_data *regulators; | 75 | struct max8998_regulator_data *regulators; |
76 | int num_regulators; | ||
77 | int irq_base; | ||
78 | int ono; | ||
76 | }; | 79 | }; |
77 | 80 | ||
78 | #endif /* __LINUX_MFD_MAX8998_H */ | 81 | #endif /* __LINUX_MFD_MAX8998_H */ |