Commit 93a6d92cfa990240314c2299fb7a3a3a39811c07

Authored by Tim Harvey
Committed by Stefano Babic
1 parent 3deb22a484

power: make pfuze100 be able to coexist with other pmics

Avoid uding pmic_init() as this forces the model of only allowing a
single PMIC driver to be built at a time.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

Showing 2 changed files with 2 additions and 1 deletions Inline Diff

drivers/power/pmic/pmic_pfuze100.c
1 /* 1 /*
2 * Copyright (C) 2014 Gateworks Corporation 2 * Copyright (C) 2014 Gateworks Corporation
3 * Tim Harvey <tharvey@gateworks.com> 3 * Tim Harvey <tharvey@gateworks.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #include <common.h> 8 #include <common.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <i2c.h> 10 #include <i2c.h>
11 #include <power/pmic.h> 11 #include <power/pmic.h>
12 #include <power/pfuze100_pmic.h> 12 #include <power/pfuze100_pmic.h>
13 13
14 int pmic_init(unsigned char bus) 14 int power_pfuze100_init(unsigned char bus)
15 { 15 {
16 static const char name[] = "PFUZE100_PMIC"; 16 static const char name[] = "PFUZE100_PMIC";
17 struct pmic *p = pmic_alloc(); 17 struct pmic *p = pmic_alloc();
18 18
19 if (!p) { 19 if (!p) {
20 printf("%s: POWER allocation error!\n", __func__); 20 printf("%s: POWER allocation error!\n", __func__);
21 return -ENOMEM; 21 return -ENOMEM;
22 } 22 }
23 23
24 p->name = name; 24 p->name = name;
25 p->interface = PMIC_I2C; 25 p->interface = PMIC_I2C;
26 p->number_of_regs = PMIC_NUM_OF_REGS; 26 p->number_of_regs = PMIC_NUM_OF_REGS;
27 p->hw.i2c.addr = CONFIG_POWER_PFUZE100_I2C_ADDR; 27 p->hw.i2c.addr = CONFIG_POWER_PFUZE100_I2C_ADDR;
28 p->hw.i2c.tx_num = 1; 28 p->hw.i2c.tx_num = 1;
29 p->bus = bus; 29 p->bus = bus;
30 30
31 return 0; 31 return 0;
32 } 32 }
33 33
include/power/pfuze100_pmic.h
1 /* 1 /*
2 * Copyright (C) 2014 Gateworks Corporation 2 * Copyright (C) 2014 Gateworks Corporation
3 * Tim Harvey <tharvey@gateworks.com> 3 * Tim Harvey <tharvey@gateworks.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef __PFUZE100_PMIC_H_ 8 #ifndef __PFUZE100_PMIC_H_
9 #define __PFUZE100_PMIC_H_ 9 #define __PFUZE100_PMIC_H_
10 10
11 /* PFUZE100 registers */ 11 /* PFUZE100 registers */
12 enum { 12 enum {
13 PFUZE100_DEVICEID = 0x00, 13 PFUZE100_DEVICEID = 0x00,
14 PFUZE100_REVID = 0x03, 14 PFUZE100_REVID = 0x03,
15 PFUZE100_FABID = 0x04, 15 PFUZE100_FABID = 0x04,
16 16
17 PFUZE100_SW1ABVOL = 0x20, 17 PFUZE100_SW1ABVOL = 0x20,
18 PFUZE100_SW1CVOL = 0x2e, 18 PFUZE100_SW1CVOL = 0x2e,
19 PFUZE100_SW2VOL = 0x35, 19 PFUZE100_SW2VOL = 0x35,
20 PFUZE100_SW3AVOL = 0x3c, 20 PFUZE100_SW3AVOL = 0x3c,
21 PFUZE100_SW3BVOL = 0x43, 21 PFUZE100_SW3BVOL = 0x43,
22 PFUZE100_SW4VOL = 0x4a, 22 PFUZE100_SW4VOL = 0x4a,
23 PFUZE100_SWBSTCON1 = 0x66, 23 PFUZE100_SWBSTCON1 = 0x66,
24 PFUZE100_VREFDDRCON = 0x6a, 24 PFUZE100_VREFDDRCON = 0x6a,
25 PFUZE100_VSNVSVOL = 0x6b, 25 PFUZE100_VSNVSVOL = 0x6b,
26 PFUZE100_VGEN1VOL = 0x6c, 26 PFUZE100_VGEN1VOL = 0x6c,
27 PFUZE100_VGEN2VOL = 0x6d, 27 PFUZE100_VGEN2VOL = 0x6d,
28 PFUZE100_VGEN3VOL = 0x6e, 28 PFUZE100_VGEN3VOL = 0x6e,
29 PFUZE100_VGEN4VOL = 0x6f, 29 PFUZE100_VGEN4VOL = 0x6f,
30 PFUZE100_VGEN5VOL = 0x70, 30 PFUZE100_VGEN5VOL = 0x70,
31 PFUZE100_VGEN6VOL = 0x71, 31 PFUZE100_VGEN6VOL = 0x71,
32 32
33 PMIC_NUM_OF_REGS = 0x7f, 33 PMIC_NUM_OF_REGS = 0x7f,
34 }; 34 };
35 35
36 /* 36 /*
37 * LDO Configuration 37 * LDO Configuration
38 */ 38 */
39 39
40 /* VGEN1/2 Voltage Configuration */ 40 /* VGEN1/2 Voltage Configuration */
41 #define LDOA_0_80V 0 41 #define LDOA_0_80V 0
42 #define LDOA_0_85V 1 42 #define LDOA_0_85V 1
43 #define LDOA_0_90V 2 43 #define LDOA_0_90V 2
44 #define LDOA_0_95V 3 44 #define LDOA_0_95V 3
45 #define LDOA_1_00V 4 45 #define LDOA_1_00V 4
46 #define LDOA_1_05V 5 46 #define LDOA_1_05V 5
47 #define LDOA_1_10V 6 47 #define LDOA_1_10V 6
48 #define LDOA_1_15V 7 48 #define LDOA_1_15V 7
49 #define LDOA_1_20V 8 49 #define LDOA_1_20V 8
50 #define LDOA_1_25V 9 50 #define LDOA_1_25V 9
51 #define LDOA_1_30V 10 51 #define LDOA_1_30V 10
52 #define LDOA_1_35V 11 52 #define LDOA_1_35V 11
53 #define LDOA_1_40V 12 53 #define LDOA_1_40V 12
54 #define LDOA_1_45V 13 54 #define LDOA_1_45V 13
55 #define LDOA_1_50V 14 55 #define LDOA_1_50V 14
56 #define LDOA_1_55V 15 56 #define LDOA_1_55V 15
57 57
58 /* VGEN3/4/5/6 Voltage Configuration */ 58 /* VGEN3/4/5/6 Voltage Configuration */
59 #define LDOB_1_80V 0 59 #define LDOB_1_80V 0
60 #define LDOB_1_90V 1 60 #define LDOB_1_90V 1
61 #define LDOB_2_00V 2 61 #define LDOB_2_00V 2
62 #define LDOB_2_10V 3 62 #define LDOB_2_10V 3
63 #define LDOB_2_20V 4 63 #define LDOB_2_20V 4
64 #define LDOB_2_30V 5 64 #define LDOB_2_30V 5
65 #define LDOB_2_40V 6 65 #define LDOB_2_40V 6
66 #define LDOB_2_50V 7 66 #define LDOB_2_50V 7
67 #define LDOB_2_60V 8 67 #define LDOB_2_60V 8
68 #define LDOB_2_70V 9 68 #define LDOB_2_70V 9
69 #define LDOB_2_80V 10 69 #define LDOB_2_80V 10
70 #define LDOB_2_90V 11 70 #define LDOB_2_90V 11
71 #define LDOB_3_00V 12 71 #define LDOB_3_00V 12
72 #define LDOB_3_10V 13 72 #define LDOB_3_10V 13
73 #define LDOB_3_20V 14 73 #define LDOB_3_20V 14
74 #define LDOB_3_30V 15 74 #define LDOB_3_30V 15
75 75
76 #define LDO_VOL_MASK 0xf 76 #define LDO_VOL_MASK 0xf
77 #define LDO_EN 4 77 #define LDO_EN 4
78 78
79 /* 79 /*
80 * Boost Regulator 80 * Boost Regulator
81 */ 81 */
82 82
83 /* SWBST Output Voltage */ 83 /* SWBST Output Voltage */
84 #define SWBST_5_00V 0 84 #define SWBST_5_00V 0
85 #define SWBST_5_05V 1 85 #define SWBST_5_05V 1
86 #define SWBST_5_10V 2 86 #define SWBST_5_10V 2
87 #define SWBST_5_15V 3 87 #define SWBST_5_15V 3
88 88
89 #define SWBST_VOL_MASK 0x3 89 #define SWBST_VOL_MASK 0x3
90 #define SWBST_MODE_MASK 0x6 90 #define SWBST_MODE_MASK 0x6
91 #define SWBST_MODE_OFF (2 << 0) 91 #define SWBST_MODE_OFF (2 << 0)
92 #define SWBST_MODE_PFM (2 << 1) 92 #define SWBST_MODE_PFM (2 << 1)
93 #define SWBST_MODE_AUTO (2 << 2) 93 #define SWBST_MODE_AUTO (2 << 2)
94 #define SWBST_MODE_APS (2 << 3) 94 #define SWBST_MODE_APS (2 << 3)
95 95
96 int power_pfuze100_init(unsigned char bus);
96 #endif 97 #endif
97 98