Re: [PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-23 Thread Chen-Yu Tsai
Hi,

On Mon, Mar 23, 2015 at 4:52 AM, Lee Jones  wrote:
> On Tue, 10 Mar 2015, Chen-Yu Tsai wrote:
>
>> From: Boris BREZILLON 
>>
>> Add support for the AXP22x PMIC devices to the existing AXP20x driver.
>> This includes the AXP221 and AXP223, which are identical except for
>> the external data bus. Only AXP221 is added for now. AXP223 will be
>> added after it's Reduced Serial Bus (RSB) interface is supported.
>>
>> AXP22x defines a new set of registers, power supplies and regulators,
>> but most of the API is similar to the AXP20x ones.
>>
>> A new irq chip definition is used, even though the available interrupts
>> on AXP22x is a subset of those on AXP20x. This is done so the interrupt
>> numbers match those on the datasheet.
>>
>> This patch only enables the interrupts, system power-off function, and PEK
>> sub-device. The regulator driver must first support different variants
>> before we enable it from the mfd driver.
>>
>> Signed-off-by: Boris BREZILLON 
>> [w...@csie.org: fix interrupts and move regulators to separate patch]
>> Signed-off-by: Chen-Yu Tsai 
>> ---
>>  drivers/mfd/axp20x.c   | 98 
>> ++
>>  include/linux/mfd/axp20x.h | 86 
>>  2 files changed, 184 insertions(+)
>
> For my own reference:
>
> Acked-by: Lee Jones 
>
> How do you wish for these patches to be managed?  Are they okay to be
> sucked up individually, or do you wish for them to go through together
> through a single tree?  If the latter, when which tree?

The driver code (both mfd and regulator) have compile time dependencies
which need to go through the same tree Mark already reviewed the
regulator patches, so if you could take all the mfd and regulator
patches, that would be great.

Maxime already merged some of the dt patches. I still need to fix
up one comment, but he can merge them individually.

Thanks!


Regards
ChenYu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-23 Thread Lee Jones
On Tue, 10 Mar 2015, Chen-Yu Tsai wrote:

> From: Boris BREZILLON 
> 
> Add support for the AXP22x PMIC devices to the existing AXP20x driver.
> This includes the AXP221 and AXP223, which are identical except for
> the external data bus. Only AXP221 is added for now. AXP223 will be
> added after it's Reduced Serial Bus (RSB) interface is supported.
> 
> AXP22x defines a new set of registers, power supplies and regulators,
> but most of the API is similar to the AXP20x ones.
> 
> A new irq chip definition is used, even though the available interrupts
> on AXP22x is a subset of those on AXP20x. This is done so the interrupt
> numbers match those on the datasheet.
> 
> This patch only enables the interrupts, system power-off function, and PEK
> sub-device. The regulator driver must first support different variants
> before we enable it from the mfd driver.
> 
> Signed-off-by: Boris BREZILLON 
> [w...@csie.org: fix interrupts and move regulators to separate patch]
> Signed-off-by: Chen-Yu Tsai 
> ---
>  drivers/mfd/axp20x.c   | 98 
> ++
>  include/linux/mfd/axp20x.h | 86 
>  2 files changed, 184 insertions(+)

For my own reference:

Acked-by: Lee Jones 

How do you wish for these patches to be managed?  Are they okay to be
sucked up individually, or do you wish for them to go through together
through a single tree?  If the latter, when which tree?

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index b1b580a88654..0ec27d5023df 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -32,6 +32,7 @@
>  static const char const *axp20x_model_names[] = {
>   "AXP202",
>   "AXP209",
> + "AXP221",
>   "AXP288",
>  };
>  
> @@ -54,6 +55,25 @@ static const struct regmap_access_table 
> axp20x_volatile_table = {
>   .n_yes_ranges   = ARRAY_SIZE(axp20x_volatile_ranges),
>  };
>  
> +static const struct regmap_range axp22x_writeable_ranges[] = {
> + regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
> + regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
> +};
> +
> +static const struct regmap_range axp22x_volatile_ranges[] = {
> + regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
> +};
> +
> +static const struct regmap_access_table axp22x_writeable_table = {
> + .yes_ranges = axp22x_writeable_ranges,
> + .n_yes_ranges   = ARRAY_SIZE(axp22x_writeable_ranges),
> +};
> +
> +static const struct regmap_access_table axp22x_volatile_table = {
> + .yes_ranges = axp22x_volatile_ranges,
> + .n_yes_ranges   = ARRAY_SIZE(axp22x_volatile_ranges),
> +};
> +
>  static const struct regmap_range axp288_writeable_ranges[] = {
>   regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
>   regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
> @@ -87,6 +107,20 @@ static struct resource axp20x_pek_resources[] = {
>   },
>  };
>  
> +static struct resource axp22x_pek_resources[] = {
> + {
> + .name   = "PEK_DBR",
> + .start  = AXP22X_IRQ_PEK_RIS_EDGE,
> + .end= AXP22X_IRQ_PEK_RIS_EDGE,
> + .flags  = IORESOURCE_IRQ,
> + }, {
> + .name   = "PEK_DBF",
> + .start  = AXP22X_IRQ_PEK_FAL_EDGE,
> + .end= AXP22X_IRQ_PEK_FAL_EDGE,
> + .flags  = IORESOURCE_IRQ,
> + },
> +};
> +
>  static struct resource axp288_battery_resources[] = {
>   {
>   .start = AXP288_IRQ_QWBTU,
> @@ -129,6 +163,15 @@ static const struct regmap_config axp20x_regmap_config = 
> {
>   .cache_type = REGCACHE_RBTREE,
>  };
>  
> +static const struct regmap_config axp22x_regmap_config = {
> + .reg_bits   = 8,
> + .val_bits   = 8,
> + .wr_table   = _writeable_table,
> + .volatile_table = _volatile_table,
> + .max_register   = AXP22X_BATLOW_THRES1,
> + .cache_type = REGCACHE_RBTREE,
> +};
> +
>  static const struct regmap_config axp288_regmap_config = {
>   .reg_bits   = 8,
>   .val_bits   = 8,
> @@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
>   INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT,4, 0),
>  };
>  
> +static const struct regmap_irq axp22x_regmap_irqs[] = {
> + INIT_REGMAP_IRQ(AXP22X, ACIN_OVER_V,0, 7),
> + INIT_REGMAP_IRQ(AXP22X, ACIN_PLUGIN,0, 6),
> + INIT_REGMAP_IRQ(AXP22X, ACIN_REMOVAL,   0, 5),
> + INIT_REGMAP_IRQ(AXP22X, VBUS_OVER_V,0, 4),
> + INIT_REGMAP_IRQ(AXP22X, VBUS_PLUGIN,0, 3),
> + INIT_REGMAP_IRQ(AXP22X, VBUS_REMOVAL,   0, 2),
> + INIT_REGMAP_IRQ(AXP22X, VBUS_V_LOW, 0, 1),
> + INIT_REGMAP_IRQ(AXP22X, BATT_PLUGIN,1, 7),
> + INIT_REGMAP_IRQ(AXP22X, BATT_REMOVAL,   1, 6),
> + INIT_REGMAP_IRQ(AXP22X, BATT_ENT_ACT_MODE,  1, 5),
> + INIT_REGMAP_IRQ(AXP22X, BATT_EXIT_ACT_MODE, 1, 4),
> + 

Re: [PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-23 Thread Lee Jones
On Tue, 10 Mar 2015, Chen-Yu Tsai wrote:

 From: Boris BREZILLON boris.brezil...@free-electrons.com
 
 Add support for the AXP22x PMIC devices to the existing AXP20x driver.
 This includes the AXP221 and AXP223, which are identical except for
 the external data bus. Only AXP221 is added for now. AXP223 will be
 added after it's Reduced Serial Bus (RSB) interface is supported.
 
 AXP22x defines a new set of registers, power supplies and regulators,
 but most of the API is similar to the AXP20x ones.
 
 A new irq chip definition is used, even though the available interrupts
 on AXP22x is a subset of those on AXP20x. This is done so the interrupt
 numbers match those on the datasheet.
 
 This patch only enables the interrupts, system power-off function, and PEK
 sub-device. The regulator driver must first support different variants
 before we enable it from the mfd driver.
 
 Signed-off-by: Boris BREZILLON boris.brezil...@free-electrons.com
 [w...@csie.org: fix interrupts and move regulators to separate patch]
 Signed-off-by: Chen-Yu Tsai w...@csie.org
 ---
  drivers/mfd/axp20x.c   | 98 
 ++
  include/linux/mfd/axp20x.h | 86 
  2 files changed, 184 insertions(+)

For my own reference:

Acked-by: Lee Jones lee.jo...@linaro.org

How do you wish for these patches to be managed?  Are they okay to be
sucked up individually, or do you wish for them to go through together
through a single tree?  If the latter, when which tree?

 diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
 index b1b580a88654..0ec27d5023df 100644
 --- a/drivers/mfd/axp20x.c
 +++ b/drivers/mfd/axp20x.c
 @@ -32,6 +32,7 @@
  static const char const *axp20x_model_names[] = {
   AXP202,
   AXP209,
 + AXP221,
   AXP288,
  };
  
 @@ -54,6 +55,25 @@ static const struct regmap_access_table 
 axp20x_volatile_table = {
   .n_yes_ranges   = ARRAY_SIZE(axp20x_volatile_ranges),
  };
  
 +static const struct regmap_range axp22x_writeable_ranges[] = {
 + regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
 + regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
 +};
 +
 +static const struct regmap_range axp22x_volatile_ranges[] = {
 + regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
 +};
 +
 +static const struct regmap_access_table axp22x_writeable_table = {
 + .yes_ranges = axp22x_writeable_ranges,
 + .n_yes_ranges   = ARRAY_SIZE(axp22x_writeable_ranges),
 +};
 +
 +static const struct regmap_access_table axp22x_volatile_table = {
 + .yes_ranges = axp22x_volatile_ranges,
 + .n_yes_ranges   = ARRAY_SIZE(axp22x_volatile_ranges),
 +};
 +
  static const struct regmap_range axp288_writeable_ranges[] = {
   regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
   regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
 @@ -87,6 +107,20 @@ static struct resource axp20x_pek_resources[] = {
   },
  };
  
 +static struct resource axp22x_pek_resources[] = {
 + {
 + .name   = PEK_DBR,
 + .start  = AXP22X_IRQ_PEK_RIS_EDGE,
 + .end= AXP22X_IRQ_PEK_RIS_EDGE,
 + .flags  = IORESOURCE_IRQ,
 + }, {
 + .name   = PEK_DBF,
 + .start  = AXP22X_IRQ_PEK_FAL_EDGE,
 + .end= AXP22X_IRQ_PEK_FAL_EDGE,
 + .flags  = IORESOURCE_IRQ,
 + },
 +};
 +
  static struct resource axp288_battery_resources[] = {
   {
   .start = AXP288_IRQ_QWBTU,
 @@ -129,6 +163,15 @@ static const struct regmap_config axp20x_regmap_config = 
 {
   .cache_type = REGCACHE_RBTREE,
  };
  
 +static const struct regmap_config axp22x_regmap_config = {
 + .reg_bits   = 8,
 + .val_bits   = 8,
 + .wr_table   = axp22x_writeable_table,
 + .volatile_table = axp22x_volatile_table,
 + .max_register   = AXP22X_BATLOW_THRES1,
 + .cache_type = REGCACHE_RBTREE,
 +};
 +
  static const struct regmap_config axp288_regmap_config = {
   .reg_bits   = 8,
   .val_bits   = 8,
 @@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
   INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT,4, 0),
  };
  
 +static const struct regmap_irq axp22x_regmap_irqs[] = {
 + INIT_REGMAP_IRQ(AXP22X, ACIN_OVER_V,0, 7),
 + INIT_REGMAP_IRQ(AXP22X, ACIN_PLUGIN,0, 6),
 + INIT_REGMAP_IRQ(AXP22X, ACIN_REMOVAL,   0, 5),
 + INIT_REGMAP_IRQ(AXP22X, VBUS_OVER_V,0, 4),
 + INIT_REGMAP_IRQ(AXP22X, VBUS_PLUGIN,0, 3),
 + INIT_REGMAP_IRQ(AXP22X, VBUS_REMOVAL,   0, 2),
 + INIT_REGMAP_IRQ(AXP22X, VBUS_V_LOW, 0, 1),
 + INIT_REGMAP_IRQ(AXP22X, BATT_PLUGIN,1, 7),
 + INIT_REGMAP_IRQ(AXP22X, BATT_REMOVAL,   1, 6),
 + INIT_REGMAP_IRQ(AXP22X, BATT_ENT_ACT_MODE,  1, 5),
 + INIT_REGMAP_IRQ(AXP22X, BATT_EXIT_ACT_MODE, 1, 4),
 + INIT_REGMAP_IRQ(AXP22X, 

Re: [PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-23 Thread Chen-Yu Tsai
Hi,

On Mon, Mar 23, 2015 at 4:52 AM, Lee Jones lee.jo...@linaro.org wrote:
 On Tue, 10 Mar 2015, Chen-Yu Tsai wrote:

 From: Boris BREZILLON boris.brezil...@free-electrons.com

 Add support for the AXP22x PMIC devices to the existing AXP20x driver.
 This includes the AXP221 and AXP223, which are identical except for
 the external data bus. Only AXP221 is added for now. AXP223 will be
 added after it's Reduced Serial Bus (RSB) interface is supported.

 AXP22x defines a new set of registers, power supplies and regulators,
 but most of the API is similar to the AXP20x ones.

 A new irq chip definition is used, even though the available interrupts
 on AXP22x is a subset of those on AXP20x. This is done so the interrupt
 numbers match those on the datasheet.

 This patch only enables the interrupts, system power-off function, and PEK
 sub-device. The regulator driver must first support different variants
 before we enable it from the mfd driver.

 Signed-off-by: Boris BREZILLON boris.brezil...@free-electrons.com
 [w...@csie.org: fix interrupts and move regulators to separate patch]
 Signed-off-by: Chen-Yu Tsai w...@csie.org
 ---
  drivers/mfd/axp20x.c   | 98 
 ++
  include/linux/mfd/axp20x.h | 86 
  2 files changed, 184 insertions(+)

 For my own reference:

 Acked-by: Lee Jones lee.jo...@linaro.org

 How do you wish for these patches to be managed?  Are they okay to be
 sucked up individually, or do you wish for them to go through together
 through a single tree?  If the latter, when which tree?

The driver code (both mfd and regulator) have compile time dependencies
which need to go through the same tree Mark already reviewed the
regulator patches, so if you could take all the mfd and regulator
patches, that would be great.

Maxime already merged some of the dt patches. I still need to fix
up one comment, but he can merge them individually.

Thanks!


Regards
ChenYu
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-10 Thread Chen-Yu Tsai
From: Boris BREZILLON 

Add support for the AXP22x PMIC devices to the existing AXP20x driver.
This includes the AXP221 and AXP223, which are identical except for
the external data bus. Only AXP221 is added for now. AXP223 will be
added after it's Reduced Serial Bus (RSB) interface is supported.

AXP22x defines a new set of registers, power supplies and regulators,
but most of the API is similar to the AXP20x ones.

A new irq chip definition is used, even though the available interrupts
on AXP22x is a subset of those on AXP20x. This is done so the interrupt
numbers match those on the datasheet.

This patch only enables the interrupts, system power-off function, and PEK
sub-device. The regulator driver must first support different variants
before we enable it from the mfd driver.

Signed-off-by: Boris BREZILLON 
[w...@csie.org: fix interrupts and move regulators to separate patch]
Signed-off-by: Chen-Yu Tsai 
---
 drivers/mfd/axp20x.c   | 98 ++
 include/linux/mfd/axp20x.h | 86 
 2 files changed, 184 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index b1b580a88654..0ec27d5023df 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -32,6 +32,7 @@
 static const char const *axp20x_model_names[] = {
"AXP202",
"AXP209",
+   "AXP221",
"AXP288",
 };
 
@@ -54,6 +55,25 @@ static const struct regmap_access_table 
axp20x_volatile_table = {
.n_yes_ranges   = ARRAY_SIZE(axp20x_volatile_ranges),
 };
 
+static const struct regmap_range axp22x_writeable_ranges[] = {
+   regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+   regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
+};
+
+static const struct regmap_range axp22x_volatile_ranges[] = {
+   regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+};
+
+static const struct regmap_access_table axp22x_writeable_table = {
+   .yes_ranges = axp22x_writeable_ranges,
+   .n_yes_ranges   = ARRAY_SIZE(axp22x_writeable_ranges),
+};
+
+static const struct regmap_access_table axp22x_volatile_table = {
+   .yes_ranges = axp22x_volatile_ranges,
+   .n_yes_ranges   = ARRAY_SIZE(axp22x_volatile_ranges),
+};
+
 static const struct regmap_range axp288_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -87,6 +107,20 @@ static struct resource axp20x_pek_resources[] = {
},
 };
 
+static struct resource axp22x_pek_resources[] = {
+   {
+   .name   = "PEK_DBR",
+   .start  = AXP22X_IRQ_PEK_RIS_EDGE,
+   .end= AXP22X_IRQ_PEK_RIS_EDGE,
+   .flags  = IORESOURCE_IRQ,
+   }, {
+   .name   = "PEK_DBF",
+   .start  = AXP22X_IRQ_PEK_FAL_EDGE,
+   .end= AXP22X_IRQ_PEK_FAL_EDGE,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
 static struct resource axp288_battery_resources[] = {
{
.start = AXP288_IRQ_QWBTU,
@@ -129,6 +163,15 @@ static const struct regmap_config axp20x_regmap_config = {
.cache_type = REGCACHE_RBTREE,
 };
 
+static const struct regmap_config axp22x_regmap_config = {
+   .reg_bits   = 8,
+   .val_bits   = 8,
+   .wr_table   = _writeable_table,
+   .volatile_table = _volatile_table,
+   .max_register   = AXP22X_BATLOW_THRES1,
+   .cache_type = REGCACHE_RBTREE,
+};
+
 static const struct regmap_config axp288_regmap_config = {
.reg_bits   = 8,
.val_bits   = 8,
@@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT,4, 0),
 };
 
+static const struct regmap_irq axp22x_regmap_irqs[] = {
+   INIT_REGMAP_IRQ(AXP22X, ACIN_OVER_V,0, 7),
+   INIT_REGMAP_IRQ(AXP22X, ACIN_PLUGIN,0, 6),
+   INIT_REGMAP_IRQ(AXP22X, ACIN_REMOVAL,   0, 5),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_OVER_V,0, 4),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_PLUGIN,0, 3),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_REMOVAL,   0, 2),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_V_LOW, 0, 1),
+   INIT_REGMAP_IRQ(AXP22X, BATT_PLUGIN,1, 7),
+   INIT_REGMAP_IRQ(AXP22X, BATT_REMOVAL,   1, 6),
+   INIT_REGMAP_IRQ(AXP22X, BATT_ENT_ACT_MODE,  1, 5),
+   INIT_REGMAP_IRQ(AXP22X, BATT_EXIT_ACT_MODE, 1, 4),
+   INIT_REGMAP_IRQ(AXP22X, CHARG,  1, 3),
+   INIT_REGMAP_IRQ(AXP22X, CHARG_DONE, 1, 2),
+   INIT_REGMAP_IRQ(AXP22X, BATT_TEMP_HIGH, 1, 1),
+   INIT_REGMAP_IRQ(AXP22X, BATT_TEMP_LOW,  1, 0),
+   INIT_REGMAP_IRQ(AXP22X, DIE_TEMP_HIGH,  2, 7),
+   INIT_REGMAP_IRQ(AXP22X, PEK_SHORT,  2, 1),
+   INIT_REGMAP_IRQ(AXP22X, PEK_LONG,   2, 0),

[PATCH v5 03/12] mfd: axp20x: add AXP22x PMIC support

2015-03-10 Thread Chen-Yu Tsai
From: Boris BREZILLON boris.brezil...@free-electrons.com

Add support for the AXP22x PMIC devices to the existing AXP20x driver.
This includes the AXP221 and AXP223, which are identical except for
the external data bus. Only AXP221 is added for now. AXP223 will be
added after it's Reduced Serial Bus (RSB) interface is supported.

AXP22x defines a new set of registers, power supplies and regulators,
but most of the API is similar to the AXP20x ones.

A new irq chip definition is used, even though the available interrupts
on AXP22x is a subset of those on AXP20x. This is done so the interrupt
numbers match those on the datasheet.

This patch only enables the interrupts, system power-off function, and PEK
sub-device. The regulator driver must first support different variants
before we enable it from the mfd driver.

Signed-off-by: Boris BREZILLON boris.brezil...@free-electrons.com
[w...@csie.org: fix interrupts and move regulators to separate patch]
Signed-off-by: Chen-Yu Tsai w...@csie.org
---
 drivers/mfd/axp20x.c   | 98 ++
 include/linux/mfd/axp20x.h | 86 
 2 files changed, 184 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index b1b580a88654..0ec27d5023df 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -32,6 +32,7 @@
 static const char const *axp20x_model_names[] = {
AXP202,
AXP209,
+   AXP221,
AXP288,
 };
 
@@ -54,6 +55,25 @@ static const struct regmap_access_table 
axp20x_volatile_table = {
.n_yes_ranges   = ARRAY_SIZE(axp20x_volatile_ranges),
 };
 
+static const struct regmap_range axp22x_writeable_ranges[] = {
+   regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+   regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
+};
+
+static const struct regmap_range axp22x_volatile_ranges[] = {
+   regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+};
+
+static const struct regmap_access_table axp22x_writeable_table = {
+   .yes_ranges = axp22x_writeable_ranges,
+   .n_yes_ranges   = ARRAY_SIZE(axp22x_writeable_ranges),
+};
+
+static const struct regmap_access_table axp22x_volatile_table = {
+   .yes_ranges = axp22x_volatile_ranges,
+   .n_yes_ranges   = ARRAY_SIZE(axp22x_volatile_ranges),
+};
+
 static const struct regmap_range axp288_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -87,6 +107,20 @@ static struct resource axp20x_pek_resources[] = {
},
 };
 
+static struct resource axp22x_pek_resources[] = {
+   {
+   .name   = PEK_DBR,
+   .start  = AXP22X_IRQ_PEK_RIS_EDGE,
+   .end= AXP22X_IRQ_PEK_RIS_EDGE,
+   .flags  = IORESOURCE_IRQ,
+   }, {
+   .name   = PEK_DBF,
+   .start  = AXP22X_IRQ_PEK_FAL_EDGE,
+   .end= AXP22X_IRQ_PEK_FAL_EDGE,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
 static struct resource axp288_battery_resources[] = {
{
.start = AXP288_IRQ_QWBTU,
@@ -129,6 +163,15 @@ static const struct regmap_config axp20x_regmap_config = {
.cache_type = REGCACHE_RBTREE,
 };
 
+static const struct regmap_config axp22x_regmap_config = {
+   .reg_bits   = 8,
+   .val_bits   = 8,
+   .wr_table   = axp22x_writeable_table,
+   .volatile_table = axp22x_volatile_table,
+   .max_register   = AXP22X_BATLOW_THRES1,
+   .cache_type = REGCACHE_RBTREE,
+};
+
 static const struct regmap_config axp288_regmap_config = {
.reg_bits   = 8,
.val_bits   = 8,
@@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT,4, 0),
 };
 
+static const struct regmap_irq axp22x_regmap_irqs[] = {
+   INIT_REGMAP_IRQ(AXP22X, ACIN_OVER_V,0, 7),
+   INIT_REGMAP_IRQ(AXP22X, ACIN_PLUGIN,0, 6),
+   INIT_REGMAP_IRQ(AXP22X, ACIN_REMOVAL,   0, 5),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_OVER_V,0, 4),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_PLUGIN,0, 3),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_REMOVAL,   0, 2),
+   INIT_REGMAP_IRQ(AXP22X, VBUS_V_LOW, 0, 1),
+   INIT_REGMAP_IRQ(AXP22X, BATT_PLUGIN,1, 7),
+   INIT_REGMAP_IRQ(AXP22X, BATT_REMOVAL,   1, 6),
+   INIT_REGMAP_IRQ(AXP22X, BATT_ENT_ACT_MODE,  1, 5),
+   INIT_REGMAP_IRQ(AXP22X, BATT_EXIT_ACT_MODE, 1, 4),
+   INIT_REGMAP_IRQ(AXP22X, CHARG,  1, 3),
+   INIT_REGMAP_IRQ(AXP22X, CHARG_DONE, 1, 2),
+   INIT_REGMAP_IRQ(AXP22X, BATT_TEMP_HIGH, 1, 1),
+   INIT_REGMAP_IRQ(AXP22X, BATT_TEMP_LOW,  1, 0),
+   INIT_REGMAP_IRQ(AXP22X, DIE_TEMP_HIGH,  2, 7),
+   INIT_REGMAP_IRQ(AXP22X, PEK_SHORT,