1 From 15675c7082f3a80ee2a67b436fdbb6bc800e6662 Mon Sep 17 00:00:00 2001
2 From: Fabio Estevam <fabio.estevam@freescale.com>
3 Date: Tue, 20 Mar 2012 11:40:06 +0000
4 Subject: [PATCH 07/56] pmic: Add support for the Dialog DA9053 PMIC
6 Add support for the Dialog DA9053 PMIC.
8 Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
10 drivers/misc/Makefile | 1 +
11 drivers/misc/pmic_dialog.c | 37 +++++++++
12 include/dialog_pmic.h | 187 ++++++++++++++++++++++++++++++++++++++++++++
13 3 files changed, 225 insertions(+)
14 create mode 100644 drivers/misc/pmic_dialog.c
15 create mode 100644 include/dialog_pmic.h
17 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
18 index a709707..29d768b 100644
19 --- a/drivers/misc/Makefile
20 +++ b/drivers/misc/Makefile
21 @@ -35,6 +35,7 @@ COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
22 COBJS-$(CONFIG_STATUS_LED) += status_led.o
23 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
24 COBJS-$(CONFIG_PMIC) += pmic_core.o
25 +COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
26 COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
27 COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
28 COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
29 diff --git a/drivers/misc/pmic_dialog.c b/drivers/misc/pmic_dialog.c
31 index 0000000..7242073
33 +++ b/drivers/misc/pmic_dialog.c
36 + * Copyright (C) 2011 Samsung Electronics
37 + * Lukasz Majewski <l.majewski@samsung.com>
39 + * See file CREDITS for list of people who contributed to this
42 + * This program is free software; you can redistribute it and/or
43 + * modify it under the terms of the GNU General Public License as
44 + * published by the Free Software Foundation; either version 2 of
45 + * the License, or (at your option) any later version.
47 + * This program is distributed in the hope that it will be useful,
48 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 + * GNU General Public License for more details.
55 +#include <dialog_pmic.h>
59 + struct pmic *p = get_pmic();
60 + static const char name[] = "DIALOG_PMIC";
63 + p->number_of_regs = PMIC_NUM_OF_REGS;
65 + p->interface = PMIC_I2C;
66 + p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
67 + p->hw.i2c.tx_num = 1;
72 diff --git a/include/dialog_pmic.h b/include/dialog_pmic.h
74 index 0000000..b0925f5
76 +++ b/include/dialog_pmic.h
79 + * da9053 register declarations.
81 + * Copyright(c) 2009 Dialog Semiconductor Ltd.
83 + * This program is free software; you can redistribute it and/or modify
84 + * it under the terms of the GNU General Public License as published by
85 + * the Free Software Foundation; either version 2 of the License, or
86 + * (at your option) any later version.
88 + * This program is distributed in the hope that it will be useful,
89 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
90 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91 + * GNU General Public License for more details.
93 + * You should have received a copy of the GNU General Public License
94 + * along with this program; if not, write to the Free Software
95 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
99 +#ifndef __DIALOG_PMIC_H__
100 +#define __DIALOG_PMIC_H__
103 + DA9053_PAGECON0_REG = 0,
104 + DA9053_STATUSA_REG,
105 + DA9053_STATUSB_REG,
106 + DA9053_STATUSC_REG,
107 + DA9053_STATUSD_REG,
112 + DA9053_FAULTLOG_REG,
113 + DA9053_IRQMASKA_REG,
114 + DA9053_IRQMASKB_REG,
115 + DA9053_IRQMASKC_REG,
116 + DA9053_IRQMASKD_REG,
117 + DA9053_CONTROLA_REG,
118 + DA9053_CONTROLB_REG,
119 + DA9053_CONTROLC_REG,
120 + DA9053_CONTROLD_REG,
122 + DA9053_INTERFACE_REG,
124 + DA9053_GPIO0001_REG,
125 + DA9053_GPIO0203_REG,
126 + DA9053_GPIO0405_REG,
127 + DA9053_GPIO0607_REG,
128 + DA9053_GPIO0809_REG,
129 + DA9053_GPIO1011_REG,
130 + DA9053_GPIO1213_REG,
131 + DA9053_GPIO1415_REG,
143 + DA9053_SEQSTATUS_REG,
146 + DA9053_SEQTIMER_REG,
149 + DA9053_BUCKCORE_REG,
150 + DA9053_BUCKPRO_REG,
151 + DA9053_BUCKMEM_REG,
152 + DA9053_BUCKPERI_REG,
164 + DA9053_PULLDOWN_REG,
165 + DA9053_CHGBUCK_REG,
166 + DA9053_WAITCONT_REG,
169 + DA9053_CHGCONT_REG,
170 + DA9053_INPUTCONT_REG,
171 + DA9053_CHGTIME_REG,
172 + DA9053_BBATCONT_REG,
174 + DA9053_LEDCONT_REG,
175 + DA9053_LEDMIN123_REG,
176 + DA9053_LED1CONF_REG,
177 + DA9053_LED2CONF_REG,
178 + DA9053_LED3CONF_REG,
179 + DA9053_LED1CONT_REG,
180 + DA9053_LED2CONT_REG,
181 + DA9053_LED3CONT_REG,
182 + DA9053_LED4CONT_REG,
183 + DA9053_LED5CONT_REG,
185 + DA9053_ADCCONT_REG,
186 + DA9053_ADCRESL_REG,
187 + DA9053_ADCRESH_REG,
191 + DA9053_ICHGTHD_REG,
192 + DA9053_ICHGEND_REG,
193 + DA9053_TBATRES_REG,
194 + DA9053_TBATHIGHP_REG,
195 + DA9053_TBATHIGHIN_REG,
196 + DA9053_TBATLOW_REG,
197 + DA9053_TOFFSET_REG,
198 + DA9053_ADCIN4RES_REG,
199 + DA9053_AUTO4HIGH_REG,
200 + DA9053_AUTO4LOW_REG,
201 + DA9053_ADCIN5RES_REG,
202 + DA9053_AUTO5HIGH_REG,
203 + DA9053_AUTO5LOW_REG,
204 + DA9053_ADCIN6RES_REG,
205 + DA9053_AUTO6HIGH_REG,
206 + DA9053_AUTO6LOW_REG,
207 + DA9053_TJUNCRES_REG,
208 + DA9053_TSICONTA_REG,
209 + DA9053_TSICONTB_REG,
210 + DA9053_TSIXMSB_REG,
211 + DA9053_TSIYMSB_REG,
213 + DA9053_TSIZMSB_REG,
215 + DA9053_COUNTMI_REG,
218 + DA9053_COUNTMO_REG,
220 + DA9053_ALARMMI_REG,
223 + DA9053_ALARMMO_REG,
225 + DA9053_SECONDA_REG,
226 + DA9053_SECONDB_REG,
227 + DA9053_SECONDC_REG,
228 + DA9053_SECONDD_REG,
229 + DA9053_PAGECON128_REG,
231 + DA9053_CONFIGID_REG,
232 + DA9053_OTPCONT_REG,
233 + DA9053_OSCTRIM_REG,
247 +#define DA_BUCKCORE_VBCORE_1_250V 0x1E
249 +/* BUCKCORE REGISTER */
250 +#define DA9052_BUCKCORE_BCORECONF (1 << 7)
251 +#define DA9052_BUCKCORE_BCOREEN (1 << 6)
252 +#define DA9052_BUCKCORE_VBCORE 63
254 +/* SUPPLY REGISTER */
255 +#define DA9052_SUPPLY_VLOCK (1 << 7)
256 +#define DA9052_SUPPLY_VMEMSWEN (1 << 6)
257 +#define DA9052_SUPPLY_VPERISWEN (1 << 5)
258 +#define DA9052_SUPPLY_VLDO3GO (1 << 4)
259 +#define DA9052_SUPPLY_VLDO2GO (1 << 3)
260 +#define DA9052_SUPPLY_VBMEMGO (1 << 2)
261 +#define DA9052_SUPPLY_VBPROGO (1 << 1)
262 +#define DA9052_SUPPLY_VBCOREGO (1 << 0)
264 +#endif /* __DIALOG_PMIC_H__ */