mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
![Mauro Carvalho Chehab](/assets/img/avatar_default.png)
Both irqnum and irqarray properties reflect the same thing: the number of bits and bytes for interrupts at this chipset. E. g.: irqnum = 8 x irqarray This can be seen by the way pending interrupts are handled: /* During probe time */ pmic->irqs = devm_kzalloc(dev, pmic->irqnum * sizeof(int), GFP_KERNEL); /* While handling IRQs */ for (i = 0; i < pmic->irqarray; i++) { pending = hi6421_spmi_pmic_read(pmic, (i + pmic->irq_addr)); pending &= 0xff; for_each_set_bit(offset, &pending, 8) generic_handle_irq(pmic->irqs[offset + i * 8]); } Going further, there are some logic at the driver which assumes that irqarray is 2: /* solve powerkey order */ if ((i == HISI_IRQ_KEY_NUM) && ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) { generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_DOWN]); generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_UP]); pending &= (~HISI_IRQ_KEY_VALUE); } As HISI_IRQ_KEY_DOWN and HISI_IRQ_KEY_UP are fixed values and don't depend on irqnum/irqarray. The IRQ addr and mask addr seem to be also fixed, based on some comments at the OF parsing code. So, get rid of them too, removing the of parsing function completely. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/e231244e42cb5b56240705cac2f987e11a078038.1597762400.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Header file for device driver Hi6421 PMIC
|
|
*
|
|
* Copyright (c) 2013 Linaro Ltd.
|
|
* Copyright (C) 2011 Hisilicon.
|
|
*
|
|
* Guodong Xu <guodong.xu@linaro.org>
|
|
*/
|
|
|
|
#ifndef __HISI_PMIC_H
|
|
#define __HISI_PMIC_H
|
|
|
|
#include <linux/irqdomain.h>
|
|
|
|
#define HISI_REGS_ENA_PROTECT_TIME (0) /* in microseconds */
|
|
#define HISI_ECO_MODE_ENABLE (1)
|
|
#define HISI_ECO_MODE_DISABLE (0)
|
|
|
|
struct hi6421_spmi_pmic {
|
|
struct resource *res;
|
|
struct device *dev;
|
|
void __iomem *regs;
|
|
spinlock_t lock;
|
|
struct irq_domain *domain;
|
|
int irq;
|
|
int gpio;
|
|
unsigned int *irqs;
|
|
};
|
|
|
|
int hi6421_spmi_pmic_read(struct hi6421_spmi_pmic *pmic, int reg);
|
|
int hi6421_spmi_pmic_write(struct hi6421_spmi_pmic *pmic, int reg, u32 val);
|
|
int hi6421_spmi_pmic_rmw(struct hi6421_spmi_pmic *pmic, int reg,
|
|
u32 mask, u32 bits);
|
|
|
|
enum hi6421_spmi_pmic_irq_list {
|
|
OTMP = 0,
|
|
VBUS_CONNECT,
|
|
VBUS_DISCONNECT,
|
|
ALARMON_R,
|
|
HOLD_6S,
|
|
HOLD_1S,
|
|
POWERKEY_UP,
|
|
POWERKEY_DOWN,
|
|
OCP_SCP_R,
|
|
COUL_R,
|
|
SIM0_HPD_R,
|
|
SIM0_HPD_F,
|
|
SIM1_HPD_R,
|
|
SIM1_HPD_F,
|
|
PMIC_IRQ_LIST_MAX,
|
|
};
|
|
#endif /* __HISI_PMIC_H */
|