Lines Matching +full:out +full:- +full:masks
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * (C) 2006-2008 by Openmoko, Inc.
23 return -EINVAL; in pcf50633_register_irq()
25 if (WARN_ON(pcf->irq_handler[irq].handler)) in pcf50633_register_irq()
26 return -EBUSY; in pcf50633_register_irq()
28 mutex_lock(&pcf->lock); in pcf50633_register_irq()
29 pcf->irq_handler[irq].handler = handler; in pcf50633_register_irq()
30 pcf->irq_handler[irq].data = data; in pcf50633_register_irq()
31 mutex_unlock(&pcf->lock); in pcf50633_register_irq()
40 return -EINVAL; in pcf50633_free_irq()
42 mutex_lock(&pcf->lock); in pcf50633_free_irq()
43 pcf->irq_handler[irq].handler = NULL; in pcf50633_free_irq()
44 mutex_unlock(&pcf->lock); in pcf50633_free_irq()
61 mutex_lock(&pcf->lock); in __pcf50633_irq_mask_set()
64 pcf->mask_regs[idx] |= bit; in __pcf50633_irq_mask_set()
66 pcf->mask_regs[idx] &= ~bit; in __pcf50633_irq_mask_set()
68 mutex_unlock(&pcf->lock); in __pcf50633_irq_mask_set()
75 dev_dbg(pcf->dev, "Masking IRQ %d\n", irq); in pcf50633_irq_mask()
83 dev_dbg(pcf->dev, "Unmasking IRQ %d\n", irq); in pcf50633_irq_unmask()
96 return pcf->mask_regs[reg] & bits; in pcf50633_irq_mask_get()
102 if (pcf->irq_handler[irq].handler) in pcf50633_irq_call_handler()
103 pcf->irq_handler[irq].handler(irq, pcf->irq_handler[irq].data); in pcf50633_irq_call_handler()
119 dev_err(pcf->dev, "Error reading INT registers\n"); in pcf50633_irq()
125 goto out; in pcf50633_irq()
150 dev_dbg(pcf->dev, "INT1=0x%02x INT2=0x%02x INT3=0x%02x " in pcf50633_irq()
156 if ((pcf_int[0] & PCF50633_INT1_SECOND) && pcf->onkey1s_held) { in pcf50633_irq()
157 dev_info(pcf->dev, "ONKEY1S held for %d secs\n", in pcf50633_irq()
158 pcf->onkey1s_held); in pcf50633_irq()
159 if (pcf->onkey1s_held++ == PCF50633_ONKEY1S_TIMEOUT) in pcf50633_irq()
160 if (pcf->pdata->force_shutdown) in pcf50633_irq()
161 pcf->pdata->force_shutdown(pcf); in pcf50633_irq()
165 dev_info(pcf->dev, "ONKEY1S held\n"); in pcf50633_irq()
166 pcf->onkey1s_held = 1 ; in pcf50633_irq()
177 if ((pcf_int[1] & PCF50633_INT2_ONKEYR) && pcf->onkey1s_held) { in pcf50633_irq()
178 pcf->onkey1s_held = 0; in pcf50633_irq()
181 if (pcf->mask_regs[0] & PCF50633_INT1_SECOND) in pcf50633_irq()
187 if (pcf->mask_regs[1] & PCF50633_INT2_ONKEYR) in pcf50633_irq()
195 if (pcf->is_suspended) { in pcf50633_irq()
196 pcf->is_suspended = 0; in pcf50633_irq()
198 /* Set the resume reason filtering out non resumers */ in pcf50633_irq()
200 pcf->resume_reason[i] = pcf_int[i] & in pcf50633_irq()
201 pcf->pdata->resumers[i]; in pcf50633_irq()
210 pcf_int[i] &= ~pcf->mask_regs[i]; in pcf50633_irq()
217 out: in pcf50633_irq()
232 disable_irq(pcf->irq); in pcf50633_irq_suspend()
234 /* Save the masks */ in pcf50633_irq_suspend()
236 ARRAY_SIZE(pcf->suspend_irq_masks), in pcf50633_irq_suspend()
237 pcf->suspend_irq_masks); in pcf50633_irq_suspend()
239 dev_err(pcf->dev, "error saving irq masks\n"); in pcf50633_irq_suspend()
240 goto out; in pcf50633_irq_suspend()
243 /* Write wakeup irq masks */ in pcf50633_irq_suspend()
245 res[i] = ~pcf->pdata->resumers[i]; in pcf50633_irq_suspend()
250 dev_err(pcf->dev, "error writing wakeup irq masks\n"); in pcf50633_irq_suspend()
251 goto out; in pcf50633_irq_suspend()
254 pcf->is_suspended = 1; in pcf50633_irq_suspend()
256 out: in pcf50633_irq_suspend()
266 ARRAY_SIZE(pcf->suspend_irq_masks), in pcf50633_irq_resume()
267 pcf->suspend_irq_masks); in pcf50633_irq_resume()
269 dev_err(pcf->dev, "Error restoring saved suspend masks\n"); in pcf50633_irq_resume()
271 enable_irq(pcf->irq); in pcf50633_irq_resume()
282 pcf->irq = irq; in pcf50633_irq_init()
285 pcf->mask_regs[0] = 0x80; in pcf50633_irq_init()
286 pcf50633_reg_write(pcf, PCF50633_REG_INT1M, pcf->mask_regs[0]); in pcf50633_irq_init()
297 dev_err(pcf->dev, "Failed to request IRQ %d\n", ret); in pcf50633_irq_init()
300 dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source" in pcf50633_irq_init()
308 free_irq(pcf->irq, pcf); in pcf50633_irq_free()