Lines Matching +full:hi6421v600 +full:- +full:spmi
1 // SPDX-License-Identifier: GPL-2.0
7 * Copyright (c) 2020-2021 Huawei Technologies Co., Ltd.
62 * See drivers/irq/hi6421-irq.c.
95 #define HISI_IRQ_MASK_BIT(irq_data) BIT(irqd_to_hwirq(irq_data) & (BITS_PER_BYTE - 1))
106 regmap_read(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, &in); in hi6421v600_irq_handler()
109 regmap_write(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, in); in hi6421v600_irq_handler()
119 generic_handle_irq_safe(priv->irqs[POWERKEY_DOWN]); in hi6421v600_irq_handler()
120 generic_handle_irq_safe(priv->irqs[POWERKEY_UP]); in hi6421v600_irq_handler()
128 generic_handle_irq_safe(priv->irqs[offset + i * BITS_PER_BYTE]); in hi6421v600_irq_handler()
144 spin_lock_irqsave(&priv->lock, flags); in hi6421v600_irq_mask()
146 regmap_read(priv->regmap, offset, &data); in hi6421v600_irq_mask()
148 regmap_write(priv->regmap, offset, data); in hi6421v600_irq_mask()
150 spin_unlock_irqrestore(&priv->lock, flags); in hi6421v600_irq_mask()
161 spin_lock_irqsave(&priv->lock, flags); in hi6421v600_irq_unmask()
163 regmap_read(priv->regmap, offset, &data); in hi6421v600_irq_unmask()
165 regmap_write(priv->regmap, offset, data); in hi6421v600_irq_unmask()
167 spin_unlock_irqrestore(&priv->lock, flags); in hi6421v600_irq_unmask()
171 .name = "hi6421v600-irq",
181 struct hi6421v600_irq *priv = d->host_data; in hi6421v600_irq_map()
184 handle_simple_irq, "hi6421v600"); in hi6421v600_irq_map()
203 regmap_write(priv->regmap, SOC_PMIC_IRQ_MASK_0_ADDR + i, in hi6421v600_irq_init()
208 regmap_read(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, &pending); in hi6421v600_irq_init()
209 regmap_write(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, in hi6421v600_irq_init()
216 struct device *pmic_dev = pdev->dev.parent; in hi6421v600_irq_probe()
217 struct device_node *np = pmic_dev->of_node; in hi6421v600_irq_probe()
219 struct device *dev = &pdev->dev; in hi6421v600_irq_probe()
226 * This driver is meant to be called by hi6421-spmi-core, in hi6421v600_irq_probe()
232 return -ENODEV; in hi6421v600_irq_probe()
236 return -ENOMEM; in hi6421v600_irq_probe()
238 priv->dev = dev; in hi6421v600_irq_probe()
239 priv->regmap = regmap; in hi6421v600_irq_probe()
241 spin_lock_init(&priv->lock); in hi6421v600_irq_probe()
245 priv->irq = platform_get_irq(pmic_pdev, 0); in hi6421v600_irq_probe()
246 if (priv->irq < 0) in hi6421v600_irq_probe()
247 return priv->irq; in hi6421v600_irq_probe()
253 priv->irqs = devm_kzalloc(dev, PMIC_IRQ_LIST_MAX * sizeof(int), GFP_KERNEL); in hi6421v600_irq_probe()
254 if (!priv->irqs) in hi6421v600_irq_probe()
255 return -ENOMEM; in hi6421v600_irq_probe()
257 priv->domain = irq_domain_add_simple(np, PMIC_IRQ_LIST_MAX, 0, in hi6421v600_irq_probe()
259 if (!priv->domain) { in hi6421v600_irq_probe()
261 return -ENODEV; in hi6421v600_irq_probe()
265 virq = irq_create_mapping(priv->domain, i); in hi6421v600_irq_probe()
268 return -ENODEV; in hi6421v600_irq_probe()
270 priv->irqs[i] = virq; in hi6421v600_irq_probe()
274 priv->irq, hi6421v600_irq_handler, in hi6421v600_irq_probe()
288 { .name = "hi6421v600-irq" },
296 .name = "hi6421v600-irq",
302 MODULE_DESCRIPTION("HiSilicon Hi6421v600 IRQ driver");