sunxi: add support for 4.1
[openwrt/svn-archive/archive.git] / target / linux / sunxi / patches-4.1 / 103-mfd-axp20x-add-missing-registers.patch
1 From 5469e15c9a0025e8822762ab9acfc3ee50e55c2c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Bruno=20Pr=C3=A9mont?= <bonbons@linux-vserver.org>
3 Date: Tue, 9 Jun 2015 08:30:48 +0200
4 Subject: [PATCH] mfd: axp20x: Add missing registers, and mark more registers
5 volatile
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Add an extra set of registers which is necessary tu support the PMICs
11 battery charger function, and mark registers which contain status bits,
12 gpio status, and adc readings as volatile.
13
14 Cc: Bruno Prémont <bonbons@linux-vserver.org>
15 Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
16 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
17 Acked-by: Lee Jones <lee.jones@linaro.org>
18 Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
19 ---
20 Changes in v2:
21 -Add a AXP20X_OCV_MAX define
22 Changes in v3:
23 -Add Bruno's S-o-b
24 ---
25 drivers/mfd/axp20x.c | 8 +++++++-
26 include/linux/mfd/axp20x.h | 6 ++++++
27 2 files changed, 13 insertions(+), 1 deletion(-)
28
29 diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
30 index b369cfc..8bd3283 100644
31 --- a/drivers/mfd/axp20x.c
32 +++ b/drivers/mfd/axp20x.c
33 @@ -61,10 +61,16 @@ static const struct regmap_access_table axp152_volatile_table = {
34 static const struct regmap_range axp20x_writeable_ranges[] = {
35 regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
36 regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
37 + regmap_reg_range(AXP20X_RDC_H, AXP20X_OCV(15)),
38 };
39
40 static const struct regmap_range axp20x_volatile_ranges[] = {
41 + regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_USB_OTG_STATUS),
42 + regmap_reg_range(AXP20X_CHRG_CTRL1, AXP20X_CHRG_CTRL2),
43 regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
44 + regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
45 + regmap_reg_range(AXP20X_GPIO20_SS, AXP20X_GPIO3_CTRL),
46 + regmap_reg_range(AXP20X_FG_RES, AXP20X_RDC_L),
47 };
48
49 static const struct regmap_access_table axp20x_writeable_table = {
50 @@ -195,7 +201,7 @@ static const struct regmap_config axp20x_regmap_config = {
51 .val_bits = 8,
52 .wr_table = &axp20x_writeable_table,
53 .volatile_table = &axp20x_volatile_table,
54 - .max_register = AXP20X_FG_RES,
55 + .max_register = AXP20X_OCV(AXP20X_OCV_MAX),
56 .cache_type = REGCACHE_RBTREE,
57 };
58
59 diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
60 index 52203d5..cc8ad1e 100644
61 --- a/include/linux/mfd/axp20x.h
62 +++ b/include/linux/mfd/axp20x.h
63 @@ -190,6 +190,12 @@ enum {
64 #define AXP20X_CC_CTRL 0xb8
65 #define AXP20X_FG_RES 0xb9
66
67 +/* OCV */
68 +#define AXP20X_RDC_H 0xba
69 +#define AXP20X_RDC_L 0xbb
70 +#define AXP20X_OCV(m) (0xc0 + (m))
71 +#define AXP20X_OCV_MAX 0xf
72 +
73 /* AXP22X specific registers */
74 #define AXP22X_BATLOW_THRES1 0xe6
75