From ef258573b320e79014102251cc808137382d27cd Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 10 Feb 2018 22:32:01 +0000 Subject: [PATCH] Add AXP803 support. --- sys/dev/fdt/axppmic.c | 57 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/sys/dev/fdt/axppmic.c b/sys/dev/fdt/axppmic.c index 2714d5df959..697a5d7e468 100644 --- a/sys/dev/fdt/axppmic.c +++ b/sys/dev/fdt/axppmic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: axppmic.c,v 1.5 2018/01/05 22:04:35 kettenis Exp $ */ +/* $OpenBSD: axppmic.c,v 1.6 2018/02/10 22:32:01 kettenis Exp $ */ /* * Copyright (c) 2017 Mark Kettenis * @@ -107,6 +107,51 @@ struct axppmic_regdata axp221_regdata[] = { { NULL } }; +struct axppmic_regdata axp803_regdata[] = { + { "dcdc1", 0x10, (1 << 0), (1 << 0), (0 << 0), + 0x20, 0x1f, 1600000, 100000 }, + { "dcdc2", 0x10, (1 << 1), (1 << 1), (0 << 1), + 0x21, 0x7f, 500000, 10000, 1220000, 20000 }, + { "dcdc3", 0x10, (1 << 2), (1 << 2), (0 << 2), + 0x22, 0x7f, 500000, 10000, 1220000, 20000 }, + { "dcdc4", 0x10, (1 << 3), (1 << 3), (0 << 3), + 0x23, 0x7f, 500000, 10000, 1220000, 20000 }, + { "dcdc5", 0x10, (1 << 4), (1 << 4), (0 << 4), + 0x24, 0x7f, 800000, 10000, 1140000, 20000 }, + { "dcdc6", 0x10, (1 << 5), (1 << 5), (0 << 5), + 0x25, 0x7f, 600000, 10000, 1120000, 20000 }, + { "dc1sw", 0x12, (1 << 7), (1 << 7), (0 << 7) }, + { "aldo1", 0x13, (1 << 5), (1 << 5), (0 << 5), + 0x28, 0x1f, 700000, 100000 }, + { "aldo2", 0x13, (1 << 6), (1 << 6), (0 << 6), + 0x29, 0x1f, 700000, 100000 }, + { "aldo3", 0x13, (1 << 7), (1 << 7), (0 << 7), + 0x2a, 0x1f, 700000, 100000 }, + { "dldo1", 0x12, (1 << 3), (1 << 3), (0 << 3), + 0x15, 0x1f, 700000, 100000 }, + { "dldo2", 0x12, (1 << 4), (1 << 4), (0 << 4), + 0x16, 0x1f, 700000, 100000, 3400000, 200000 }, + { "dldo3", 0x12, (1 << 5), (1 << 5), (0 << 5), + 0x17, 0x1f, 700000, 100000 }, + { "dldo4", 0x12, (1 << 6), (1 << 6), (0 << 6), + 0x18, 0x1f, 700000, 100000 }, + { "eldo1", 0x12, (1 << 0), (1 << 0), (0 << 0), + 0x19, 0x1f, 700000, 50000 }, + { "eldo2", 0x12, (1 << 1), (1 << 1), (0 << 1), + 0x1a, 0x1f, 700000, 50000 }, + { "eldo3", 0x12, (1 << 2), (1 << 2), (0 << 2), + 0x1b, 0x1f, 700000, 50000 }, + { "fldo1", 0x13, (1 << 2), (1 << 2), (0 << 2), + 0x1c, 0x0f, 700000, 50000 }, + { "fldo2", 0x13, (1 << 3), (1 << 3), (0 << 3), + 0x1d, 0x0f, 700000, 50000 }, + { "ldo-io0", 0x90, 0x07, 0x03, 0x04, + 0x91, 0x1f, 700000, 100000 }, + { "ldo-io1", 0x92, 0x07, 0x03, 0x04, + 0x93, 0x1f, 700000, 100000 }, + { NULL } +}; + struct axppmic_regdata axp806_regdata[] = { { "dcdca", 0x10, (1 << 0), (1 << 0), (0 << 0), 0x12, 0x7f, 600000, 10000, 1120000, 20000 }, @@ -208,6 +253,13 @@ struct axppmic_sensdata axp221_sensdata[] = { { NULL } }; +struct axppmic_sensdata axp803_sensdata[] = { + { "ACIN", SENSOR_INDICATOR, 0x00, (1 << 7), (1 << 6) }, + { "VBUS", SENSOR_INDICATOR, 0x00, (1 << 5), (1 << 4) }, + { "", SENSOR_TEMP, 0x56, 5450000, 106250 }, + { NULL } +}; + struct axppmic_device { const char *name; const char *chip; @@ -220,6 +272,7 @@ struct axppmic_device axppmic_devices[] = { { "x-powers,axp209", "AXP209", axp209_regdata, axp209_sensdata }, { "x-powers,axp221", "AXP221", axp221_regdata, axp221_sensdata }, { "x-powers,axp223", "AXP223", axp221_regdata, axp221_sensdata }, + { "x-powers,axp803", "AXP803", axp803_regdata, axp803_sensdata }, { "x-powers,axp806", "AXP806", axp806_regdata }, { "x-powers,axp809", "AXP809", axp809_regdata, axp221_sensdata } }; @@ -445,8 +498,8 @@ axppmic_attach_common(struct axppmic_softc *sc, const char *name, int node) strcmp(name, "x-powers,axp209") == 0) { axppmic_sc = sc; powerdownfn = axp209_powerdown; -#endif } +#endif } /* Regulators */ -- 2.20.1