Lines Matching +full:hi6421v600 +full:- +full:spmi
1 // SPDX-License-Identifier: GPL-2.0
7 * Copyright (c) 2020-2021 Huawei Technologies Co., Ltd.
63 * See drivers/irq/hi6421-irq.c.
96 #define HISI_IRQ_MASK_BIT(irq_data) BIT(irqd_to_hwirq(irq_data) & (BITS_PER_BYTE - 1))
107 regmap_read(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, &in); in hi6421v600_irq_handler()
110 regmap_write(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, in); in hi6421v600_irq_handler()
120 generic_handle_irq_safe(priv->irqs[POWERKEY_DOWN]); in hi6421v600_irq_handler()
121 generic_handle_irq_safe(priv->irqs[POWERKEY_UP]); in hi6421v600_irq_handler()
129 generic_handle_irq_safe(priv->irqs[offset + i * BITS_PER_BYTE]); in hi6421v600_irq_handler()
145 spin_lock_irqsave(&priv->lock, flags); in hi6421v600_irq_mask()
147 regmap_read(priv->regmap, offset, &data); in hi6421v600_irq_mask()
149 regmap_write(priv->regmap, offset, data); in hi6421v600_irq_mask()
151 spin_unlock_irqrestore(&priv->lock, flags); in hi6421v600_irq_mask()
162 spin_lock_irqsave(&priv->lock, flags); in hi6421v600_irq_unmask()
164 regmap_read(priv->regmap, offset, &data); in hi6421v600_irq_unmask()
166 regmap_write(priv->regmap, offset, data); in hi6421v600_irq_unmask()
168 spin_unlock_irqrestore(&priv->lock, flags); in hi6421v600_irq_unmask()
172 .name = "hi6421v600-irq",
182 struct hi6421v600_irq *priv = d->host_data; in hi6421v600_irq_map()
185 handle_simple_irq, "hi6421v600"); in hi6421v600_irq_map()
204 regmap_write(priv->regmap, SOC_PMIC_IRQ_MASK_0_ADDR + i, in hi6421v600_irq_init()
209 regmap_read(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, &pending); in hi6421v600_irq_init()
210 regmap_write(priv->regmap, SOC_PMIC_IRQ0_ADDR + i, in hi6421v600_irq_init()
217 struct device *pmic_dev = pdev->dev.parent; in hi6421v600_irq_probe()
218 struct device_node *np = pmic_dev->of_node; in hi6421v600_irq_probe()
220 struct device *dev = &pdev->dev; in hi6421v600_irq_probe()
227 * This driver is meant to be called by hi6421-spmi-core, in hi6421v600_irq_probe()
233 return -ENODEV; in hi6421v600_irq_probe()
237 return -ENOMEM; in hi6421v600_irq_probe()
239 priv->dev = dev; in hi6421v600_irq_probe()
240 priv->regmap = regmap; in hi6421v600_irq_probe()
242 spin_lock_init(&priv->lock); in hi6421v600_irq_probe()
246 priv->irq = platform_get_irq(pmic_pdev, 0); in hi6421v600_irq_probe()
247 if (priv->irq < 0) in hi6421v600_irq_probe()
248 return priv->irq; in hi6421v600_irq_probe()
254 priv->irqs = devm_kzalloc(dev, PMIC_IRQ_LIST_MAX * sizeof(int), GFP_KERNEL); in hi6421v600_irq_probe()
255 if (!priv->irqs) in hi6421v600_irq_probe()
256 return -ENOMEM; in hi6421v600_irq_probe()
258 priv->domain = irq_domain_add_simple(np, PMIC_IRQ_LIST_MAX, 0, in hi6421v600_irq_probe()
260 if (!priv->domain) { in hi6421v600_irq_probe()
262 return -ENODEV; in hi6421v600_irq_probe()
266 virq = irq_create_mapping(priv->domain, i); in hi6421v600_irq_probe()
269 return -ENODEV; in hi6421v600_irq_probe()
271 priv->irqs[i] = virq; in hi6421v600_irq_probe()
275 priv->irq, hi6421v600_irq_handler, in hi6421v600_irq_probe()
289 { .name = "hi6421v600-irq" },
297 .name = "hi6421v600-irq",
303 MODULE_DESCRIPTION("HiSilicon Hi6421v600 IRQ driver");