Commit 9f7b07d6 authored by Daniel Ribeiro's avatar Daniel Ribeiro Committed by Samuel Ortiz

mfd: Introduce irq_to_pcap()

Export an irq_to_pcap function to get pcap irq number, for the keypad driver.
Signed-off-by: default avatarDaniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent dfc3aa72
...@@ -107,10 +107,11 @@ int ezx_pcap_read(struct pcap_chip *pcap, u8 reg_num, u32 *value) ...@@ -107,10 +107,11 @@ int ezx_pcap_read(struct pcap_chip *pcap, u8 reg_num, u32 *value)
EXPORT_SYMBOL_GPL(ezx_pcap_read); EXPORT_SYMBOL_GPL(ezx_pcap_read);
/* IRQ */ /* IRQ */
static inline unsigned int irq2pcap(struct pcap_chip *pcap, int irq) int irq_to_pcap(struct pcap_chip *pcap, int irq)
{ {
return 1 << (irq - pcap->irq_base); return irq - pcap->irq_base;
} }
EXPORT_SYMBOL_GPL(irq_to_pcap);
int pcap_to_irq(struct pcap_chip *pcap, int irq) int pcap_to_irq(struct pcap_chip *pcap, int irq)
{ {
...@@ -122,7 +123,7 @@ static void pcap_mask_irq(unsigned int irq) ...@@ -122,7 +123,7 @@ static void pcap_mask_irq(unsigned int irq)
{ {
struct pcap_chip *pcap = get_irq_chip_data(irq); struct pcap_chip *pcap = get_irq_chip_data(irq);
pcap->msr |= irq2pcap(pcap, irq); pcap->msr |= 1 << irq_to_pcap(pcap, irq);
queue_work(pcap->workqueue, &pcap->msr_work); queue_work(pcap->workqueue, &pcap->msr_work);
} }
...@@ -130,7 +131,7 @@ static void pcap_unmask_irq(unsigned int irq) ...@@ -130,7 +131,7 @@ static void pcap_unmask_irq(unsigned int irq)
{ {
struct pcap_chip *pcap = get_irq_chip_data(irq); struct pcap_chip *pcap = get_irq_chip_data(irq);
pcap->msr &= ~irq2pcap(pcap, irq); pcap->msr &= ~(1 << irq_to_pcap(pcap, irq));
queue_work(pcap->workqueue, &pcap->msr_work); queue_work(pcap->workqueue, &pcap->msr_work);
} }
......
...@@ -26,6 +26,7 @@ struct pcap_chip; ...@@ -26,6 +26,7 @@ struct pcap_chip;
int ezx_pcap_write(struct pcap_chip *, u8, u32); int ezx_pcap_write(struct pcap_chip *, u8, u32);
int ezx_pcap_read(struct pcap_chip *, u8, u32 *); int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
int pcap_to_irq(struct pcap_chip *, int); int pcap_to_irq(struct pcap_chip *, int);
int irq_to_pcap(struct pcap_chip *, int);
int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *); int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]); int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment