kernel: update 4.1 to 4.1.5
[openwrt.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 --- a/drivers/mfd/axp20x.c
30 +++ b/drivers/mfd/axp20x.c
31 @@ -39,10 +39,16 @@ static const char * const axp20x_model_n
32  static const struct regmap_range axp20x_writeable_ranges[] = {
33         regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
34         regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
35 +       regmap_reg_range(AXP20X_RDC_H, AXP20X_OCV(15)),
36  };
37  
38  static const struct regmap_range axp20x_volatile_ranges[] = {
39 +       regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_USB_OTG_STATUS),
40 +       regmap_reg_range(AXP20X_CHRG_CTRL1, AXP20X_CHRG_CTRL2),
41         regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
42 +       regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
43 +       regmap_reg_range(AXP20X_GPIO20_SS, AXP20X_GPIO3_CTRL),
44 +       regmap_reg_range(AXP20X_FG_RES, AXP20X_RDC_L),
45  };
46  
47  static const struct regmap_access_table axp20x_writeable_table = {
48 @@ -159,7 +165,7 @@ static const struct regmap_config axp20x
49         .val_bits       = 8,
50         .wr_table       = &axp20x_writeable_table,
51         .volatile_table = &axp20x_volatile_table,
52 -       .max_register   = AXP20X_FG_RES,
53 +       .max_register   = AXP20X_OCV(AXP20X_OCV_MAX),
54         .cache_type     = REGCACHE_RBTREE,
55  };
56  
57 --- a/include/linux/mfd/axp20x.h
58 +++ b/include/linux/mfd/axp20x.h
59 @@ -151,6 +151,12 @@ enum {
60  #define AXP20X_CC_CTRL                 0xb8
61  #define AXP20X_FG_RES                  0xb9
62  
63 +/* OCV */
64 +#define AXP20X_RDC_H                   0xba
65 +#define AXP20X_RDC_L                   0xbb
66 +#define AXP20X_OCV(m)                  (0xc0 + (m))
67 +#define AXP20X_OCV_MAX                 0xf
68 +
69  /* AXP22X specific registers */
70  #define AXP22X_BATLOW_THRES1           0xe6
71