Skip to content

Commit 7303733

Browse files
wensLee Jones
authored andcommitted
mfd: axp20x: Add support for AXP813 PMIC
The X-Powers AXP813 PMIC is normally used with Allwinner's A83T SoC. It has the same range of functions as other X-Powers PMICs, such as DC-DC buck converter and linear regulator outputs, AC-IN and VBUS power supplies, power button trigger, GPIOs, ADCs, and a battery charger. Note that the IRQ table given in the datasheet is incorrect: in IRQ enable/status registers 1, there are separate IRQs for ACIN and VBUS, instead of bits [7:5] being the same as bits [4:2]. So it shares the same IRQs as the AXP803, rather than the AXP288. This patch adds basic mfd support for it, with only the power button enabled. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 7e312ff commit 7303733

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

‎drivers/mfd/axp20x-rsb.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static const struct of_device_id axp20x_rsb_of_match[] = {
6464
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
6565
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
6666
{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
67+
{ .compatible = "x-powers,axp813", .data = (void *)AXP813_ID },
6768
{ },
6869
};
6970
MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);

‎drivers/mfd/axp20x.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static const char * const axp20x_model_names[] = {
4444
"AXP803",
4545
"AXP806",
4646
"AXP809",
47+
"AXP813",
4748
};
4849

4950
static const struct regmap_range axp152_writeable_ranges[] = {
@@ -870,6 +871,14 @@ static struct mfd_cell axp809_cells[] = {
870871
},
871872
};
872873

874+
static struct mfd_cell axp813_cells[] = {
875+
{
876+
.name = "axp20x-pek",
877+
.num_resources = ARRAY_SIZE(axp803_pek_resources),
878+
.resources = axp803_pek_resources,
879+
}
880+
};
881+
873882
static struct axp20x_dev *axp20x_pm_power_off;
874883
static void axp20x_power_off(void)
875884
{
@@ -956,6 +965,19 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
956965
axp20x->regmap_cfg = &axp22x_regmap_config;
957966
axp20x->regmap_irq_chip = &axp809_regmap_irq_chip;
958967
break;
968+
case AXP813_ID:
969+
axp20x->nr_cells = ARRAY_SIZE(axp813_cells);
970+
axp20x->cells = axp813_cells;
971+
axp20x->regmap_cfg = &axp288_regmap_config;
972+
/*
973+
* The IRQ table given in the datasheet is incorrect.
974+
* In IRQ enable/status registers 1, there are separate
975+
* IRQs for ACIN and VBUS, instead of bits [7:5] being
976+
* the same as bits [4:2]. So it shares the same IRQs
977+
* as the AXP803, rather than the AXP288.
978+
*/
979+
axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
980+
break;
959981
default:
960982
dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
961983
return -EINVAL;

‎include/linux/mfd/axp20x.h‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ enum axp20x_variants {
2323
AXP803_ID,
2424
AXP806_ID,
2525
AXP809_ID,
26+
AXP813_ID,
2627
NR_AXP20X_VARIANTS,
2728
};
2829

@@ -387,6 +388,34 @@ enum {
387388
AXP803_REG_ID_MAX,
388389
};
389390

391+
enum {
392+
AXP813_DCDC1 = 0,
393+
AXP813_DCDC2,
394+
AXP813_DCDC3,
395+
AXP813_DCDC4,
396+
AXP813_DCDC5,
397+
AXP813_DCDC6,
398+
AXP813_DCDC7,
399+
AXP813_ALDO1,
400+
AXP813_ALDO2,
401+
AXP813_ALDO3,
402+
AXP813_DLDO1,
403+
AXP813_DLDO2,
404+
AXP813_DLDO3,
405+
AXP813_DLDO4,
406+
AXP813_ELDO1,
407+
AXP813_ELDO2,
408+
AXP813_ELDO3,
409+
AXP813_FLDO1,
410+
AXP813_FLDO2,
411+
AXP813_FLDO3,
412+
AXP813_RTC_LDO,
413+
AXP813_LDO_IO0,
414+
AXP813_LDO_IO1,
415+
AXP813_SW,
416+
AXP813_REG_ID_MAX,
417+
};
418+
390419
/* IRQs */
391420
enum {
392421
AXP152_IRQ_LDO0IN_CONNECT = 1,

0 commit comments

Comments
 (0)