Lines Matching full:charger
3 * Driver for the external-charger IRQ pass-through function of the
35 struct crystal_cove_charger_data *charger = data; in crystal_cove_charger_irq() local
38 handle_nested_irq(charger->charger_irq); in crystal_cove_charger_irq()
41 regmap_write(charger->regmap, CHGRIRQ_REG, BIT(0)); in crystal_cove_charger_irq()
48 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); in crystal_cove_charger_irq_bus_lock() local
50 mutex_lock(&charger->buslock); in crystal_cove_charger_irq_bus_lock()
55 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); in crystal_cove_charger_irq_bus_sync_unlock() local
57 if (charger->mask != charger->new_mask) { in crystal_cove_charger_irq_bus_sync_unlock()
58 regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask); in crystal_cove_charger_irq_bus_sync_unlock()
59 charger->mask = charger->new_mask; in crystal_cove_charger_irq_bus_sync_unlock()
62 mutex_unlock(&charger->buslock); in crystal_cove_charger_irq_bus_sync_unlock()
67 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); in crystal_cove_charger_irq_unmask() local
69 charger->new_mask &= ~BIT(data->hwirq); in crystal_cove_charger_irq_unmask()
74 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); in crystal_cove_charger_irq_mask() local
76 charger->new_mask |= BIT(data->hwirq); in crystal_cove_charger_irq_mask()
81 struct crystal_cove_charger_data *charger = data; in crystal_cove_charger_rm_irq_domain() local
83 irq_domain_remove(charger->irq_domain); in crystal_cove_charger_rm_irq_domain()
89 struct crystal_cove_charger_data *charger; in crystal_cove_charger_probe() local
92 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); in crystal_cove_charger_probe()
93 if (!charger) in crystal_cove_charger_probe()
96 charger->regmap = pmic->regmap; in crystal_cove_charger_probe()
97 mutex_init(&charger->buslock); in crystal_cove_charger_probe()
99 charger->irq = platform_get_irq(pdev, 0); in crystal_cove_charger_probe()
100 if (charger->irq < 0) in crystal_cove_charger_probe()
101 return charger->irq; in crystal_cove_charger_probe()
103 charger->irq_domain = irq_domain_create_linear(dev_fwnode(pdev->dev.parent), 1, in crystal_cove_charger_probe()
105 if (!charger->irq_domain) in crystal_cove_charger_probe()
109 irq_domain_update_bus_token(charger->irq_domain, DOMAIN_BUS_WAKEUP); in crystal_cove_charger_probe()
111 ret = devm_add_action_or_reset(&pdev->dev, crystal_cove_charger_rm_irq_domain, charger); in crystal_cove_charger_probe()
115 charger->charger_irq = irq_create_mapping(charger->irq_domain, 0); in crystal_cove_charger_probe()
116 if (!charger->charger_irq) in crystal_cove_charger_probe()
119 charger->irqchip.name = KBUILD_MODNAME; in crystal_cove_charger_probe()
120 charger->irqchip.irq_unmask = crystal_cove_charger_irq_unmask; in crystal_cove_charger_probe()
121 charger->irqchip.irq_mask = crystal_cove_charger_irq_mask; in crystal_cove_charger_probe()
122 charger->irqchip.irq_bus_lock = crystal_cove_charger_irq_bus_lock; in crystal_cove_charger_probe()
123 charger->irqchip.irq_bus_sync_unlock = crystal_cove_charger_irq_bus_sync_unlock; in crystal_cove_charger_probe()
125 irq_set_chip_data(charger->charger_irq, charger); in crystal_cove_charger_probe()
126 irq_set_chip_and_handler(charger->charger_irq, &charger->irqchip, handle_simple_irq); in crystal_cove_charger_probe()
127 irq_set_nested_thread(charger->charger_irq, true); in crystal_cove_charger_probe()
128 irq_set_noprobe(charger->charger_irq); in crystal_cove_charger_probe()
131 charger->mask = charger->new_mask = BIT(0); in crystal_cove_charger_probe()
132 regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask); in crystal_cove_charger_probe()
134 ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL, in crystal_cove_charger_probe()
136 IRQF_ONESHOT, KBUILD_MODNAME, charger); in crystal_cove_charger_probe()
152 MODULE_DESCRIPTION("Intel Bay Trail Crystal Cove external charger IRQ pass-through");