aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-11-11 17:44:31 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-11-11 17:44:31 -0500
commit90b128ed1557c2f523995a379a53e5105891ecf8 (patch)
treed64cc5dc7448b0dba62b14565e2d187245f7874e /drivers/mfd
parent5e90169c5a02da69a1ef721bea7a823e9e48fcb6 (diff)
parent9a46847aeac1148d8b15f0db629c8bbd754dfe24 (diff)
Merge tag 'mfd-lee-3.13-3' of git://git.linaro.org/people/ljones/mfd
mfd-lee-3.13-3 MFD patches due for v3.13 - 2nd round.
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/mfd-core.c29
-rw-r--r--drivers/mfd/pm8921-core.c9
-rw-r--r--drivers/mfd/wm5110-tables.c8
3 files changed, 30 insertions, 16 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index f421586f29fb..968775da638a 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -63,7 +63,8 @@ int mfd_cell_disable(struct platform_device *pdev)
63EXPORT_SYMBOL(mfd_cell_disable); 63EXPORT_SYMBOL(mfd_cell_disable);
64 64
65static int mfd_platform_add_cell(struct platform_device *pdev, 65static int mfd_platform_add_cell(struct platform_device *pdev,
66 const struct mfd_cell *cell) 66 const struct mfd_cell *cell,
67 atomic_t *usage_count)
67{ 68{
68 if (!cell) 69 if (!cell)
69 return 0; 70 return 0;
@@ -72,11 +73,12 @@ static int mfd_platform_add_cell(struct platform_device *pdev,
72 if (!pdev->mfd_cell) 73 if (!pdev->mfd_cell)
73 return -ENOMEM; 74 return -ENOMEM;
74 75
76 pdev->mfd_cell->usage_count = usage_count;
75 return 0; 77 return 0;
76} 78}
77 79
78static int mfd_add_device(struct device *parent, int id, 80static int mfd_add_device(struct device *parent, int id,
79 const struct mfd_cell *cell, 81 const struct mfd_cell *cell, atomic_t *usage_count,
80 struct resource *mem_base, 82 struct resource *mem_base,
81 int irq_base, struct irq_domain *domain) 83 int irq_base, struct irq_domain *domain)
82{ 84{
@@ -115,7 +117,7 @@ static int mfd_add_device(struct device *parent, int id,
115 goto fail_res; 117 goto fail_res;
116 } 118 }
117 119
118 ret = mfd_platform_add_cell(pdev, cell); 120 ret = mfd_platform_add_cell(pdev, cell, usage_count);
119 if (ret) 121 if (ret)
120 goto fail_res; 122 goto fail_res;
121 123
@@ -180,12 +182,12 @@ fail_alloc:
180} 182}
181 183
182int mfd_add_devices(struct device *parent, int id, 184int mfd_add_devices(struct device *parent, int id,
183 struct mfd_cell *cells, int n_devs, 185 const struct mfd_cell *cells, int n_devs,
184 struct resource *mem_base, 186 struct resource *mem_base,
185 int irq_base, struct irq_domain *domain) 187 int irq_base, struct irq_domain *domain)
186{ 188{
187 int i; 189 int i;
188 int ret = 0; 190 int ret;
189 atomic_t *cnts; 191 atomic_t *cnts;
190 192
191 /* initialize reference counting for all cells */ 193 /* initialize reference counting for all cells */
@@ -195,16 +197,19 @@ int mfd_add_devices(struct device *parent, int id,
195 197
196 for (i = 0; i < n_devs; i++) { 198 for (i = 0; i < n_devs; i++) {
197 atomic_set(&cnts[i], 0); 199 atomic_set(&cnts[i], 0);
198 cells[i].usage_count = &cnts[i]; 200 ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base,
199 ret = mfd_add_device(parent, id, cells + i, mem_base,
200 irq_base, domain); 201 irq_base, domain);
201 if (ret) 202 if (ret)
202 break; 203 goto fail;
203 } 204 }
204 205
205 if (ret) 206 return 0;
206 mfd_remove_devices(parent);
207 207
208fail:
209 if (i)
210 mfd_remove_devices(parent);
211 else
212 kfree(cnts);
208 return ret; 213 return ret;
209} 214}
210EXPORT_SYMBOL(mfd_add_devices); 215EXPORT_SYMBOL(mfd_add_devices);
@@ -259,8 +264,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones)
259 for (i = 0; i < n_clones; i++) { 264 for (i = 0; i < n_clones; i++) {
260 cell_entry.name = clones[i]; 265 cell_entry.name = clones[i];
261 /* don't give up if a single call fails; just report error */ 266 /* don't give up if a single call fails; just report error */
262 if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0, 267 if (mfd_add_device(pdev->dev.parent, -1, &cell_entry,
263 NULL)) 268 cell_entry.usage_count, NULL, 0, NULL))
264 dev_err(dev, "failed to create platform device '%s'\n", 269 dev_err(dev, "failed to create platform device '%s'\n",
265 clones[i]); 270 clones[i]);
266 } 271 }
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index a6841f77aa5e..484fe66e6c88 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -171,11 +171,12 @@ static int pm8921_remove(struct platform_device *pdev)
171 drvdata = platform_get_drvdata(pdev); 171 drvdata = platform_get_drvdata(pdev);
172 if (drvdata) 172 if (drvdata)
173 pmic = drvdata->pm_chip_data; 173 pmic = drvdata->pm_chip_data;
174 if (pmic) 174 if (pmic) {
175 mfd_remove_devices(pmic->dev); 175 mfd_remove_devices(pmic->dev);
176 if (pmic->irq_chip) { 176 if (pmic->irq_chip) {
177 pm8xxx_irq_exit(pmic->irq_chip); 177 pm8xxx_irq_exit(pmic->irq_chip);
178 pmic->irq_chip = NULL; 178 pmic->irq_chip = NULL;
179 }
179 } 180 }
180 181
181 return 0; 182 return 0;
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index c5c116a7b5ff..bf8b3b5ad1fe 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -243,6 +243,12 @@ int wm5110_patch(struct arizona *arizona)
243EXPORT_SYMBOL_GPL(wm5110_patch); 243EXPORT_SYMBOL_GPL(wm5110_patch);
244 244
245static const struct regmap_irq wm5110_aod_irqs[ARIZONA_NUM_IRQ] = { 245static const struct regmap_irq wm5110_aod_irqs[ARIZONA_NUM_IRQ] = {
246 [ARIZONA_IRQ_MICD_CLAMP_FALL] = {
247 .mask = ARIZONA_MICD_CLAMP_FALL_EINT1
248 },
249 [ARIZONA_IRQ_MICD_CLAMP_RISE] = {
250 .mask = ARIZONA_MICD_CLAMP_RISE_EINT1
251 },
246 [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 }, 252 [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 },
247 [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 }, 253 [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 },
248 [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 }, 254 [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 },
@@ -505,6 +511,7 @@ static const struct reg_default wm5110_reg_default[] = {
505 { 0x00000293, 0x0000 }, /* R659 - Accessory Detect Mode 1 */ 511 { 0x00000293, 0x0000 }, /* R659 - Accessory Detect Mode 1 */
506 { 0x0000029B, 0x0020 }, /* R667 - Headphone Detect 1 */ 512 { 0x0000029B, 0x0020 }, /* R667 - Headphone Detect 1 */
507 { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */ 513 { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */
514 { 0x000002A2, 0x0000 }, /* R674 - Micd clamp control */
508 { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ 515 { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */
509 { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ 516 { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */
510 { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */ 517 { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */
@@ -1439,6 +1446,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
1439 case ARIZONA_ACCESSORY_DETECT_MODE_1: 1446 case ARIZONA_ACCESSORY_DETECT_MODE_1:
1440 case ARIZONA_HEADPHONE_DETECT_1: 1447 case ARIZONA_HEADPHONE_DETECT_1:
1441 case ARIZONA_HEADPHONE_DETECT_2: 1448 case ARIZONA_HEADPHONE_DETECT_2:
1449 case ARIZONA_MICD_CLAMP_CONTROL:
1442 case ARIZONA_MIC_DETECT_1: 1450 case ARIZONA_MIC_DETECT_1:
1443 case ARIZONA_MIC_DETECT_2: 1451 case ARIZONA_MIC_DETECT_2:
1444 case ARIZONA_MIC_DETECT_3: 1452 case ARIZONA_MIC_DETECT_3: