X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=blobdiff_plain;f=board%2Fkaro%2Ftx6%2Fpmic.c;fp=board%2Fkaro%2Ftx6%2Fpmic.c;h=2743dadd3232a1bd341bfeca2a33fe8b213b81fc;hp=0000000000000000000000000000000000000000;hb=8f02caac64980faa73b2bf00462b400c86257d04;hpb=f411b8f2270bc75113d60f2ad662f25de6242b7d diff --git a/board/karo/tx6/pmic.c b/board/karo/tx6/pmic.c new file mode 100644 index 0000000000..2743dadd32 --- /dev/null +++ b/board/karo/tx6/pmic.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2015 Lothar Waßmann + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include + +#include "pmic.h" + +static struct { + uchar addr; + int (*init)(uchar addr); +} i2c_addrs[] = { +#ifdef CONFIG_LTC3676 + { 0x3c, ltc3676_pmic_setup, }, +#endif +#ifdef CONFIG_RN5T618 + { 0x32, rn5t618_pmic_setup, }, +#endif +#ifdef CONFIG_RN5T567 + { 0x33, rn5t567_pmic_setup, }, +#endif +}; + +int tx6_pmic_init(void) +{ + int ret = -ENODEV; + int i; + + for (i = 0; i < ARRAY_SIZE(i2c_addrs); i++) { + ret = i2c_probe(i2c_addrs[i].addr); + if (ret == 0) { + i2c_addrs[i].init(i2c_addrs[i].addr); + break; + } + } + return ret; +}