aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/mc13783-core.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/mfd/mc13783-core.c b/drivers/mfd/mc13783-core.c
index 735c8a4d164f..a2bd44552042 100644
--- a/drivers/mfd/mc13783-core.c
+++ b/drivers/mfd/mc13783-core.c
@@ -225,7 +225,7 @@ int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset,
225} 225}
226EXPORT_SYMBOL(mc13783_reg_rmw); 226EXPORT_SYMBOL(mc13783_reg_rmw);
227 227
228int mc13783_mask(struct mc13783 *mc13783, int irq) 228int mc13783_irq_mask(struct mc13783 *mc13783, int irq)
229{ 229{
230 int ret; 230 int ret;
231 unsigned int offmask = irq < 24 ? MC13783_IRQMASK0 : MC13783_IRQMASK1; 231 unsigned int offmask = irq < 24 ? MC13783_IRQMASK0 : MC13783_IRQMASK1;
@@ -245,9 +245,9 @@ int mc13783_mask(struct mc13783 *mc13783, int irq)
245 245
246 return mc13783_reg_write(mc13783, offmask, mask | irqbit); 246 return mc13783_reg_write(mc13783, offmask, mask | irqbit);
247} 247}
248EXPORT_SYMBOL(mc13783_mask); 248EXPORT_SYMBOL(mc13783_irq_mask);
249 249
250int mc13783_unmask(struct mc13783 *mc13783, int irq) 250int mc13783_irq_unmask(struct mc13783 *mc13783, int irq)
251{ 251{
252 int ret; 252 int ret;
253 unsigned int offmask = irq < 24 ? MC13783_IRQMASK0 : MC13783_IRQMASK1; 253 unsigned int offmask = irq < 24 ? MC13783_IRQMASK0 : MC13783_IRQMASK1;
@@ -267,7 +267,18 @@ int mc13783_unmask(struct mc13783 *mc13783, int irq)
267 267
268 return mc13783_reg_write(mc13783, offmask, mask & ~irqbit); 268 return mc13783_reg_write(mc13783, offmask, mask & ~irqbit);
269} 269}
270EXPORT_SYMBOL(mc13783_unmask); 270EXPORT_SYMBOL(mc13783_irq_unmask);
271
272int mc13783_irq_ack(struct mc13783 *mc13783, int irq)
273{
274 unsigned int offstat = irq < 24 ? MC13783_IRQSTAT0 : MC13783_IRQSTAT1;
275 unsigned int val = 1 << (irq < 24 ? irq : irq - 24);
276
277 BUG_ON(irq < 0 || irq >= MC13783_NUM_IRQ);
278
279 return mc13783_reg_write(mc13783, offstat, val);
280}
281EXPORT_SYMBOL(mc13783_irq_ack);
271 282
272int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 283int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
273 irq_handler_t handler, const char *name, void *dev) 284 irq_handler_t handler, const char *name, void *dev)
@@ -297,7 +308,7 @@ int mc13783_irq_request(struct mc13783 *mc13783, int irq,
297 if (ret) 308 if (ret)
298 return ret; 309 return ret;
299 310
300 ret = mc13783_unmask(mc13783, irq); 311 ret = mc13783_irq_unmask(mc13783, irq);
301 if (ret) { 312 if (ret) {
302 mc13783->irqhandler[irq] = NULL; 313 mc13783->irqhandler[irq] = NULL;
303 mc13783->irqdata[irq] = NULL; 314 mc13783->irqdata[irq] = NULL;
@@ -317,7 +328,7 @@ int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev)
317 mc13783->irqdata[irq] != dev) 328 mc13783->irqdata[irq] != dev)
318 return -EINVAL; 329 return -EINVAL;
319 330
320 ret = mc13783_mask(mc13783, irq); 331 ret = mc13783_irq_mask(mc13783, irq);
321 if (ret) 332 if (ret)
322 return ret; 333 return ret;
323 334
@@ -333,17 +344,6 @@ static inline irqreturn_t mc13783_irqhandler(struct mc13783 *mc13783, int irq)
333 return mc13783->irqhandler[irq](irq, mc13783->irqdata[irq]); 344 return mc13783->irqhandler[irq](irq, mc13783->irqdata[irq]);
334} 345}
335 346
336int mc13783_ackirq(struct mc13783 *mc13783, int irq)
337{
338 unsigned int offstat = irq < 24 ? MC13783_IRQSTAT0 : MC13783_IRQSTAT1;
339 unsigned int val = 1 << (irq < 24 ? irq : irq - 24);
340
341 BUG_ON(irq < 0 || irq >= MC13783_NUM_IRQ);
342
343 return mc13783_reg_write(mc13783, offstat, val);
344}
345EXPORT_SYMBOL(mc13783_ackirq);
346
347/* 347/*
348 * returns: number of handled irqs or negative error 348 * returns: number of handled irqs or negative error
349 * locking: holds mc13783->lock 349 * locking: holds mc13783->lock
@@ -422,7 +422,7 @@ static irqreturn_t mc13783_handler_adcdone(int irq, void *data)
422{ 422{
423 struct mc13783_adcdone_data *adcdone_data = data; 423 struct mc13783_adcdone_data *adcdone_data = data;
424 424
425 mc13783_ackirq(adcdone_data->mc13783, irq); 425 mc13783_irq_ack(adcdone_data->mc13783, irq);
426 426
427 complete_all(&adcdone_data->done); 427 complete_all(&adcdone_data->done);
428 428
@@ -486,7 +486,7 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
486 dev_dbg(&mc13783->spidev->dev, "%s: request irq\n", __func__); 486 dev_dbg(&mc13783->spidev->dev, "%s: request irq\n", __func__);
487 mc13783_irq_request(mc13783, MC13783_IRQ_ADCDONE, 487 mc13783_irq_request(mc13783, MC13783_IRQ_ADCDONE,
488 mc13783_handler_adcdone, __func__, &adcdone_data); 488 mc13783_handler_adcdone, __func__, &adcdone_data);
489 mc13783_ackirq(mc13783, MC13783_IRQ_ADCDONE); 489 mc13783_irq_ack(mc13783, MC13783_IRQ_ADCDONE);
490 490
491 mc13783_reg_write(mc13783, MC13783_REG_ADC_0, adc0); 491 mc13783_reg_write(mc13783, MC13783_REG_ADC_0, adc0);
492 mc13783_reg_write(mc13783, MC13783_REG_ADC_1, adc1); 492 mc13783_reg_write(mc13783, MC13783_REG_ADC_1, adc1);