1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Header file for device driver Hi6421 PMIC
4  *
5  * Copyright (c) 2013 Linaro Ltd.
6  * Copyright (C) 2011 Hisilicon.
7  *
8  * Guodong Xu <guodong.xu@linaro.org>
9  */
10 
11 #ifndef	__HISI_PMIC_H
12 #define	__HISI_PMIC_H
13 
14 #include <linux/irqdomain.h>
15 
16 #define HISI_REGS_ENA_PROTECT_TIME	(0)	/* in microseconds */
17 #define HISI_ECO_MODE_ENABLE		(1)
18 #define HISI_ECO_MODE_DISABLE		(0)
19 
20 struct hi6421_spmi_pmic {
21 	struct resource				*res;
22 	struct device				*dev;
23 	void __iomem				*regs;
24 	spinlock_t				lock;
25 	struct irq_domain			*domain;
26 	int					irq;
27 	int					gpio;
28 	unsigned int				*irqs;
29 };
30 
31 int hi6421_spmi_pmic_read(struct hi6421_spmi_pmic *pmic, int reg);
32 int hi6421_spmi_pmic_write(struct hi6421_spmi_pmic *pmic, int reg, u32 val);
33 int hi6421_spmi_pmic_rmw(struct hi6421_spmi_pmic *pmic, int reg,
34 			 u32 mask, u32 bits);
35 
36 enum hi6421_spmi_pmic_irq_list {
37 	OTMP = 0,
38 	VBUS_CONNECT,
39 	VBUS_DISCONNECT,
40 	ALARMON_R,
41 	HOLD_6S,
42 	HOLD_1S,
43 	POWERKEY_UP,
44 	POWERKEY_DOWN,
45 	OCP_SCP_R,
46 	COUL_R,
47 	SIM0_HPD_R,
48 	SIM0_HPD_F,
49 	SIM1_HPD_R,
50 	SIM1_HPD_F,
51 	PMIC_IRQ_LIST_MAX,
52 };
53 #endif		/* __HISI_PMIC_H */
54