Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chen-Yu Tsai and committed by
Lee Jones
7303733a 7e312ffd

+52
+1
drivers/mfd/axp20x-rsb.c
··· 64 64 { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID }, 65 65 { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID }, 66 66 { .compatible = "x-powers,axp809", .data = (void *)AXP809_ID }, 67 + { .compatible = "x-powers,axp813", .data = (void *)AXP813_ID }, 67 68 { }, 68 69 }; 69 70 MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
+22
drivers/mfd/axp20x.c
··· 44 44 "AXP803", 45 45 "AXP806", 46 46 "AXP809", 47 + "AXP813", 47 48 }; 48 49 49 50 static const struct regmap_range axp152_writeable_ranges[] = { ··· 871 870 }, 872 871 }; 873 872 873 + static struct mfd_cell axp813_cells[] = { 874 + { 875 + .name = "axp20x-pek", 876 + .num_resources = ARRAY_SIZE(axp803_pek_resources), 877 + .resources = axp803_pek_resources, 878 + } 879 + }; 880 + 874 881 static struct axp20x_dev *axp20x_pm_power_off; 875 882 static void axp20x_power_off(void) 876 883 { ··· 964 955 axp20x->cells = axp809_cells; 965 956 axp20x->regmap_cfg = &axp22x_regmap_config; 966 957 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; 958 + break; 959 + case AXP813_ID: 960 + axp20x->nr_cells = ARRAY_SIZE(axp813_cells); 961 + axp20x->cells = axp813_cells; 962 + axp20x->regmap_cfg = &axp288_regmap_config; 963 + /* 964 + * The IRQ table given in the datasheet is incorrect. 965 + * In IRQ enable/status registers 1, there are separate 966 + * IRQs for ACIN and VBUS, instead of bits [7:5] being 967 + * the same as bits [4:2]. So it shares the same IRQs 968 + * as the AXP803, rather than the AXP288. 969 + */ 970 + axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; 967 971 break; 968 972 default: 969 973 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
+29
include/linux/mfd/axp20x.h
··· 23 23 AXP803_ID, 24 24 AXP806_ID, 25 25 AXP809_ID, 26 + AXP813_ID, 26 27 NR_AXP20X_VARIANTS, 27 28 }; 28 29 ··· 386 385 AXP803_LDO_IO0, 387 386 AXP803_LDO_IO1, 388 387 AXP803_REG_ID_MAX, 388 + }; 389 + 390 + enum { 391 + AXP813_DCDC1 = 0, 392 + AXP813_DCDC2, 393 + AXP813_DCDC3, 394 + AXP813_DCDC4, 395 + AXP813_DCDC5, 396 + AXP813_DCDC6, 397 + AXP813_DCDC7, 398 + AXP813_ALDO1, 399 + AXP813_ALDO2, 400 + AXP813_ALDO3, 401 + AXP813_DLDO1, 402 + AXP813_DLDO2, 403 + AXP813_DLDO3, 404 + AXP813_DLDO4, 405 + AXP813_ELDO1, 406 + AXP813_ELDO2, 407 + AXP813_ELDO3, 408 + AXP813_FLDO1, 409 + AXP813_FLDO2, 410 + AXP813_FLDO3, 411 + AXP813_RTC_LDO, 412 + AXP813_LDO_IO0, 413 + AXP813_LDO_IO1, 414 + AXP813_SW, 415 + AXP813_REG_ID_MAX, 389 416 }; 390 417 391 418 /* IRQs */