Lines Matching +full:out +full:- +full:masks
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * (C) 2006-2008 by Openmoko, Inc.
24 return -EINVAL; in pcf50633_register_irq()
26 if (WARN_ON(pcf->irq_handler[irq].handler)) in pcf50633_register_irq()
27 return -EBUSY; in pcf50633_register_irq()
29 mutex_lock(&pcf->lock); in pcf50633_register_irq()
30 pcf->irq_handler[irq].handler = handler; in pcf50633_register_irq()
31 pcf->irq_handler[irq].data = data; in pcf50633_register_irq()
32 mutex_unlock(&pcf->lock); in pcf50633_register_irq()
41 return -EINVAL; in pcf50633_free_irq()
43 mutex_lock(&pcf->lock); in pcf50633_free_irq()
44 pcf->irq_handler[irq].handler = NULL; in pcf50633_free_irq()
45 mutex_unlock(&pcf->lock); in pcf50633_free_irq()
62 mutex_lock(&pcf->lock); in __pcf50633_irq_mask_set()
65 pcf->mask_regs[idx] |= bit; in __pcf50633_irq_mask_set()
67 pcf->mask_regs[idx] &= ~bit; in __pcf50633_irq_mask_set()
69 mutex_unlock(&pcf->lock); in __pcf50633_irq_mask_set()
76 dev_dbg(pcf->dev, "Masking IRQ %d\n", irq); in pcf50633_irq_mask()
84 dev_dbg(pcf->dev, "Unmasking IRQ %d\n", irq); in pcf50633_irq_unmask()
97 return pcf->mask_regs[reg] & bits; in pcf50633_irq_mask_get()
103 if (pcf->irq_handler[irq].handler) in pcf50633_irq_call_handler()
104 pcf->irq_handler[irq].handler(irq, pcf->irq_handler[irq].data); in pcf50633_irq_call_handler()
120 dev_err(pcf->dev, "Error reading INT registers\n"); in pcf50633_irq()
126 goto out; in pcf50633_irq()
151 dev_dbg(pcf->dev, "INT1=0x%02x INT2=0x%02x INT3=0x%02x " in pcf50633_irq()
157 if ((pcf_int[0] & PCF50633_INT1_SECOND) && pcf->onkey1s_held) { in pcf50633_irq()
158 dev_info(pcf->dev, "ONKEY1S held for %d secs\n", in pcf50633_irq()
159 pcf->onkey1s_held); in pcf50633_irq()
160 if (pcf->onkey1s_held++ == PCF50633_ONKEY1S_TIMEOUT) in pcf50633_irq()
161 if (pcf->pdata->force_shutdown) in pcf50633_irq()
162 pcf->pdata->force_shutdown(pcf); in pcf50633_irq()
166 dev_info(pcf->dev, "ONKEY1S held\n"); in pcf50633_irq()
167 pcf->onkey1s_held = 1 ; in pcf50633_irq()
178 if ((pcf_int[1] & PCF50633_INT2_ONKEYR) && pcf->onkey1s_held) { in pcf50633_irq()
179 pcf->onkey1s_held = 0; in pcf50633_irq()
182 if (pcf->mask_regs[0] & PCF50633_INT1_SECOND) in pcf50633_irq()
188 if (pcf->mask_regs[1] & PCF50633_INT2_ONKEYR) in pcf50633_irq()
196 if (pcf->is_suspended) { in pcf50633_irq()
197 pcf->is_suspended = 0; in pcf50633_irq()
199 /* Set the resume reason filtering out non resumers */ in pcf50633_irq()
201 pcf->resume_reason[i] = pcf_int[i] & in pcf50633_irq()
202 pcf->pdata->resumers[i]; in pcf50633_irq()
211 pcf_int[i] &= ~pcf->mask_regs[i]; in pcf50633_irq()
218 out: in pcf50633_irq()
233 disable_irq(pcf->irq); in pcf50633_suspend()
235 /* Save the masks */ in pcf50633_suspend()
237 ARRAY_SIZE(pcf->suspend_irq_masks), in pcf50633_suspend()
238 pcf->suspend_irq_masks); in pcf50633_suspend()
240 dev_err(pcf->dev, "error saving irq masks\n"); in pcf50633_suspend()
241 goto out; in pcf50633_suspend()
244 /* Write wakeup irq masks */ in pcf50633_suspend()
246 res[i] = ~pcf->pdata->resumers[i]; in pcf50633_suspend()
251 dev_err(pcf->dev, "error writing wakeup irq masks\n"); in pcf50633_suspend()
252 goto out; in pcf50633_suspend()
255 pcf->is_suspended = 1; in pcf50633_suspend()
257 out: in pcf50633_suspend()
269 ARRAY_SIZE(pcf->suspend_irq_masks), in pcf50633_resume()
270 pcf->suspend_irq_masks); in pcf50633_resume()
272 dev_err(pcf->dev, "Error restoring saved suspend masks\n"); in pcf50633_resume()
274 enable_irq(pcf->irq); in pcf50633_resume()
285 pcf->irq = irq; in pcf50633_irq_init()
288 pcf->mask_regs[0] = 0x80; in pcf50633_irq_init()
289 pcf50633_reg_write(pcf, PCF50633_REG_INT1M, pcf->mask_regs[0]); in pcf50633_irq_init()
300 dev_err(pcf->dev, "Failed to request IRQ %d\n", ret); in pcf50633_irq_init()
303 dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source" in pcf50633_irq_init()
311 free_irq(pcf->irq, pcf); in pcf50633_irq_free()