1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Header file for device driver Hi6421 PMIC
*
* Copyright (c) 2013 Linaro Ltd.
* Copyright (C) 2011 Hisilicon.
*
* Guodong Xu <guodong.xu@linaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define OCP_DEB_CTRL_REG (0x51)
#define OCP_DEB_SEL_MASK (0x0C)
#define OCP_DEB_SEL_8MS (0x00)
#define OCP_DEB_SEL_16MS (0x04)
#define OCP_DEB_SEL_32MS (0x08)
#define OCP_DEB_SEL_64MS (0x0C)
#define OCP_EN_DEBOUNCE_MASK (0x02)
#define OCP_EN_DEBOUNCE_ENABLE (0x02)
#define OCP_AUTO_STOP_MASK (0x01)
#define OCP_AUTO_STOP_ENABLE (0x01)
#define HI6421_REGS_ENA_PROTECT_TIME (100) /* in microseconds */
#define HI6421_ECO_MODE_ENABLE (1)
#define HI6421_ECO_MODE_DISABLE (0)
struct hi6421_pmic {
struct resource *res;
struct device *dev;
void __iomem *regs;
spinlock_t lock;
};
/* Register Access Helpers */
static inline u32 hi6421_pmic_read(struct hi6421_pmic *pmic, int reg)
{
return readl(pmic->regs + (reg << 2));
}
static inline void hi6421_pmic_write(struct hi6421_pmic *pmic, int reg, u32 val)
{
writel(val, pmic->regs + (reg << 2));
}
void hi6421_pmic_rmw(struct hi6421_pmic *pmic, int reg, u32 mask, u32 bits);
|