Commit 5e2f01772a87ddd8592d5a53de85261b62faa7fb

Authored by Tim Harvey
Committed by Stefano Babic
1 parent 17449272a0

power: Add support for LTC3676 PMIC

The LTC3676 PMIC includes four DC/DC converters, and three 300mA
LDO Regulators (two Adjustable). The DC/DC converters are adjustable based
on a resistor devider (board-specific).

This adds support for the LTC3676 by creating a namespace unique init function
that uses the PMIC API to allocate a pmic and defines the registers.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Stefano Babic <sbabic@denx.de>

Showing 3 changed files with 84 additions and 0 deletions Inline Diff

drivers/power/pmic/Makefile
1 # 1 #
2 # Copyright (C) 2012 Samsung Electronics 2 # Copyright (C) 2012 Samsung Electronics
3 # Lukasz Majewski <l.majewski@samsung.com> 3 # Lukasz Majewski <l.majewski@samsung.com>
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
8 obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o 9 obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
9 obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o 10 obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
10 obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o 11 obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
11 obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o 12 obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
12 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o 13 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
13 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o 14 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
14 obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o 15 obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o
15 16
drivers/power/pmic/pmic_ltc3676.c
File was created 1 /*
2 * Copyright (C) 2014 Gateworks Corporation
3 * Tim Harvey <tharvey@gateworks.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <errno.h>
10 #include <i2c.h>
11 #include <power/pmic.h>
12 #include <power/ltc3676_pmic.h>
13
14 int power_ltc3676_init(unsigned char bus)
15 {
16 static const char name[] = "LTC3676_PMIC";
17 struct pmic *p = pmic_alloc();
18
19 if (!p) {
20 printf("%s: POWER allocation error!\n", __func__);
21 return -ENOMEM;
22 }
23
24 p->name = name;
25 p->interface = PMIC_I2C;
26 p->number_of_regs = LTC3676_NUM_OF_REGS;
27 p->hw.i2c.addr = CONFIG_POWER_LTC3676_I2C_ADDR;
28 p->hw.i2c.tx_num = 1;
29 p->bus = bus;
30
31 return 0;
32 }
33
include/power/ltc3676_pmic.h
File was created 1 /*
2 * Copyright (C) 2014 Gateworks Corporation
3 * Tim Harvey <tharvey@gateworks.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #ifndef __LTC3676_PMIC_H_
9 #define __LTC3676_PMIC_H_
10
11 /* LTC3676 registers */
12 enum {
13 LTC3676_BUCK1 = 0x01,
14 LTC3676_BUCK2 = 0x02,
15 LTC3676_BUCK3 = 0x03,
16 LTC3676_BUCK4 = 0x04,
17 LTC3676_LDOA = 0x05,
18 LTC3676_LDOB = 0x06,
19 LTC3676_SQD1 = 0x07,
20 LTC3676_SQD2 = 0x08,
21 LTC3676_CNTRL = 0x09,
22 LTC3676_DVB1A = 0x0A,
23 LTC3676_DVB1B = 0x0B,
24 LTC3676_DVB2A = 0x0C,
25 LTC3676_DVB2B = 0x0D,
26 LTC3676_DVB3A = 0x0E,
27 LTC3676_DVB3B = 0x0F,
28 LTC3676_DVB4A = 0x10,
29 LTC3676_DVB4B = 0x11,
30 LTC3676_MSKIRQ = 0x12,
31 LTC3676_MSKPG = 0x13,
32 LTC3676_USER = 0x14,
33 LTC3676_HRST = 0x1E,
34 LTC3676_CLIRQ = 0x1F,
35 LTC3676_IRQSTAT = 0x15,
36 LTC3676_PGSTATL = 0x16,
37 LTC3676_PGSTATR = 0x17,
38 LTC3676_NUM_OF_REGS = 0x20,
39 };
40
41 /*
42 * SW Configuration
43 */
44
45 #define LTC3676_DVB_MASK 0x1f
46 #define LTC3676_PGOOD_MASK (1<<5)
47 #define LTC3676_REF_SELA (0<<5)
48 #define LTC3676_REF_SELB (1<<5)
49
50 int power_ltc3676_init(unsigned char bus);
51 #endif
52