static void wcd9xxx_irq_dispatch(struct wcd9xxx_core_resource *wcd9xxx_res, struct intr_data *irqdata) { int irqbit = irqdata->intr_num; if (!wcd9xxx_res->codec_reg_write) { pr_err("%s: codec read/write callback not defined\n", __func__); return; } if (irqdata->clear_first) { wcd9xxx_nested_irq_lock(wcd9xxx_res); wcd9xxx_res->codec_reg_write(wcd9xxx_res, WCD9XXX_A_INTR_CLEAR0 + BIT_BYTE(irqbit), BYTE_BIT_MASK(irqbit)); if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C) wcd9xxx_res->codec_reg_write(wcd9xxx_res, WCD9XXX_A_INTR_MODE, 0x02); handle_nested_irq(phyirq_to_virq(wcd9xxx_res, irqbit)); wcd9xxx_nested_irq_unlock(wcd9xxx_res); } else { wcd9xxx_nested_irq_lock(wcd9xxx_res); handle_nested_irq(phyirq_to_virq(wcd9xxx_res, irqbit)); wcd9xxx_res->codec_reg_write(wcd9xxx_res, WCD9XXX_A_INTR_CLEAR0 + BIT_BYTE(irqbit), BYTE_BIT_MASK(irqbit)); if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C) wcd9xxx_res->codec_reg_write(wcd9xxx_res, WCD9XXX_A_INTR_MODE, 0x02); wcd9xxx_nested_irq_unlock(wcd9xxx_res); } }
static void wcd9xxx_irq_dispatch(struct wcd9xxx *wcd9xxx, int irqbit) { if ((irqbit <= WCD9XXX_IRQ_MBHC_INSERTION) && (irqbit >= WCD9XXX_IRQ_MBHC_REMOVAL)) { wcd9xxx_nested_irq_lock(wcd9xxx); wcd9xxx_reg_write(wcd9xxx, WCD9XXX_A_INTR_CLEAR0 + BIT_BYTE(irqbit), BYTE_BIT_MASK(irqbit)); if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C) wcd9xxx_reg_write(wcd9xxx, WCD9XXX_A_INTR_MODE, 0x02); handle_nested_irq(phyirq_to_virq(wcd9xxx, irqbit)); wcd9xxx_nested_irq_unlock(wcd9xxx); } else { wcd9xxx_nested_irq_lock(wcd9xxx); handle_nested_irq(phyirq_to_virq(wcd9xxx, irqbit)); wcd9xxx_reg_write(wcd9xxx, WCD9XXX_A_INTR_CLEAR0 + BIT_BYTE(irqbit), BYTE_BIT_MASK(irqbit)); if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C) wcd9xxx_reg_write(wcd9xxx, WCD9XXX_A_INTR_MODE, 0x02); wcd9xxx_nested_irq_unlock(wcd9xxx); } }