Lines Matching +full:bat +full:- +full:present

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * twl6030-irq.c - TWL6030 irq support
5 * Copyright (C) 2005-2009 Texas Instruments, Inc.
17 * Jagadeesh Bhaskar Pakaravoor <j-pakaravoor@ti.com>
32 #include "twl-core.h"
41 * We set up IRQs starting at a platform-specified base. An interrupt map table,
57 BATDETECT_INTR_OFFSET, /* Bit 9 BAT */
86 BATDETECT_INTR_OFFSET, /* Bit 9 BAT */
104 /*----------------------------------------------------------------------*/
128 chained_wakeups = atomic_read(&pdata->wakeirqs); in twl6030_irq_pm_notifier()
130 if (chained_wakeups && !pdata->irq_wake_enabled) { in twl6030_irq_pm_notifier()
131 if (enable_irq_wake(pdata->twl_irq)) in twl6030_irq_pm_notifier()
134 pdata->irq_wake_enabled = true; in twl6030_irq_pm_notifier()
135 } else if (!chained_wakeups && pdata->irq_wake_enabled) { in twl6030_irq_pm_notifier()
136 disable_irq_wake(pdata->twl_irq); in twl6030_irq_pm_notifier()
137 pdata->irq_wake_enabled = false; in twl6030_irq_pm_notifier()
140 disable_irq(pdata->twl_irq); in twl6030_irq_pm_notifier()
144 enable_irq(pdata->twl_irq); in twl6030_irq_pm_notifier()
190 irq_find_mapping(pdata->irq_domain, in twl6030_irq_thread()
191 pdata->irq_mapping_tbl[i]); in twl6030_irq_thread()
217 /*----------------------------------------------------------------------*/
224 atomic_inc(&pdata->wakeirqs); in twl6030_irq_set_wake()
226 atomic_dec(&pdata->wakeirqs); in twl6030_irq_set_wake()
286 /* Configuring PullUp-PullDown register */ in twl6030_mmc_card_detect_config()
303 return irq_find_mapping(twl6030_irq->irq_domain, in twl6030_mmc_card_detect_config()
310 int ret = -EIO; in twl6030_mmc_card_detect()
314 if (pdev->id) { in twl6030_mmc_card_detect()
318 pr_err("Unknown MMC controller %d in %s\n", pdev->id, __func__); in twl6030_mmc_card_detect()
323 * 0 - Card not present ,1 - Card present in twl6030_mmc_card_detect()
336 struct twl6030_irq *pdata = d->host_data; in twl6030_irq_map()
339 irq_set_chip_and_handler(virq, &pdata->irq_chip, handle_simple_irq); in twl6030_irq_map()
341 irq_set_parent(virq, pdata->twl_irq); in twl6030_irq_map()
367 struct device_node *node = dev->of_node; in twl6030_init_irq()
374 if (!of_id || !of_id->data) { in twl6030_init_irq()
376 return -EINVAL; in twl6030_init_irq()
383 return -ENOMEM; in twl6030_init_irq()
405 twl6030_irq->irq_chip = dummy_irq_chip; in twl6030_init_irq()
406 twl6030_irq->irq_chip.name = "twl6030"; in twl6030_init_irq()
407 twl6030_irq->irq_chip.irq_set_type = NULL; in twl6030_init_irq()
408 twl6030_irq->irq_chip.irq_set_wake = twl6030_irq_set_wake; in twl6030_init_irq()
410 twl6030_irq->pm_nb.notifier_call = twl6030_irq_pm_notifier; in twl6030_init_irq()
411 atomic_set(&twl6030_irq->wakeirqs, 0); in twl6030_init_irq()
412 twl6030_irq->irq_mapping_tbl = of_id->data; in twl6030_init_irq()
414 twl6030_irq->irq_domain = in twl6030_init_irq()
417 if (!twl6030_irq->irq_domain) { in twl6030_init_irq()
419 return -ENOMEM; in twl6030_init_irq()
426 IRQF_ONESHOT, "TWL6030-PIH", twl6030_irq); in twl6030_init_irq()
432 twl6030_irq->twl_irq = irq_num; in twl6030_init_irq()
433 register_pm_notifier(&twl6030_irq->pm_nb); in twl6030_init_irq()
437 irq_domain_remove(twl6030_irq->irq_domain); in twl6030_init_irq()
443 if (twl6030_irq && twl6030_irq->twl_irq) { in twl6030_exit_irq()
444 unregister_pm_notifier(&twl6030_irq->pm_nb); in twl6030_exit_irq()
445 free_irq(twl6030_irq->twl_irq, NULL); in twl6030_exit_irq()