Commit 20831061d8cec4ec537fada6b9abe263e208b4ae

Authored by Fabio Estevam
Committed by Albert ARIBAUD
1 parent f92e4e6c19

pmic: Add support for the Dialog DA9053 PMIC

Add support for the Dialog DA9053 PMIC.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Showing 3 changed files with 225 additions and 0 deletions Side-by-side Diff

drivers/misc/Makefile
... ... @@ -35,6 +35,7 @@
35 35 COBJS-$(CONFIG_STATUS_LED) += status_led.o
36 36 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
37 37 COBJS-$(CONFIG_PMIC) += pmic_core.o
  38 +COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
38 39 COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
39 40 COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
40 41 COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
drivers/misc/pmic_dialog.c
  1 +/*
  2 + * Copyright (C) 2011 Samsung Electronics
  3 + * Lukasz Majewski <l.majewski@samsung.com>
  4 + *
  5 + * See file CREDITS for list of people who contributed to this
  6 + * project.
  7 + *
  8 + * This program is free software; you can redistribute it and/or
  9 + * modify it under the terms of the GNU General Public License as
  10 + * published by the Free Software Foundation; either version 2 of
  11 + * the License, or (at your option) any later version.
  12 + *
  13 + * This program is distributed in the hope that it will be useful,
  14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16 + * GNU General Public License for more details.
  17 + */
  18 +
  19 +#include <common.h>
  20 +#include <pmic.h>
  21 +#include <dialog_pmic.h>
  22 +
  23 +int pmic_init(void)
  24 +{
  25 + struct pmic *p = get_pmic();
  26 + static const char name[] = "DIALOG_PMIC";
  27 +
  28 + p->name = name;
  29 + p->number_of_regs = PMIC_NUM_OF_REGS;
  30 +
  31 + p->interface = PMIC_I2C;
  32 + p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
  33 + p->hw.i2c.tx_num = 1;
  34 + p->bus = I2C_PMIC;
  35 +
  36 + return 0;
  37 +}
include/dialog_pmic.h
  1 +/*
  2 + * da9053 register declarations.
  3 + *
  4 + * Copyright(c) 2009 Dialog Semiconductor Ltd.
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this program; if not, write to the Free Software
  18 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19 + *
  20 + */
  21 +
  22 +#ifndef __DIALOG_PMIC_H__
  23 +#define __DIALOG_PMIC_H__
  24 +
  25 +enum {
  26 + DA9053_PAGECON0_REG = 0,
  27 + DA9053_STATUSA_REG,
  28 + DA9053_STATUSB_REG,
  29 + DA9053_STATUSC_REG,
  30 + DA9053_STATUSD_REG,
  31 + DA9053_EVENTA_REG,
  32 + DA9053_EVENTB_REG,
  33 + DA9053_EVENTC_REG,
  34 + DA9053_EVENTD_REG,
  35 + DA9053_FAULTLOG_REG,
  36 + DA9053_IRQMASKA_REG,
  37 + DA9053_IRQMASKB_REG,
  38 + DA9053_IRQMASKC_REG,
  39 + DA9053_IRQMASKD_REG,
  40 + DA9053_CONTROLA_REG,
  41 + DA9053_CONTROLB_REG,
  42 + DA9053_CONTROLC_REG,
  43 + DA9053_CONTROLD_REG,
  44 + DA9053_PDDIS_REG,
  45 + DA9053_INTERFACE_REG,
  46 + DA9053_RESET_REG,
  47 + DA9053_GPIO0001_REG,
  48 + DA9053_GPIO0203_REG,
  49 + DA9053_GPIO0405_REG,
  50 + DA9053_GPIO0607_REG,
  51 + DA9053_GPIO0809_REG,
  52 + DA9053_GPIO1011_REG,
  53 + DA9053_GPIO1213_REG,
  54 + DA9053_GPIO1415_REG,
  55 + DA9053_ID01_REG,
  56 + DA9053_ID23_REG,
  57 + DA9053_ID45_REG,
  58 + DA9053_ID67_REG,
  59 + DA9053_ID89_REG,
  60 + DA9053_ID1011_REG,
  61 + DA9053_ID1213_REG,
  62 + DA9053_ID1415_REG,
  63 + DA9053_ID1617_REG,
  64 + DA9053_ID1819_REG,
  65 + DA9053_ID2021_REG,
  66 + DA9053_SEQSTATUS_REG,
  67 + DA9053_SEQA_REG,
  68 + DA9053_SEQB_REG,
  69 + DA9053_SEQTIMER_REG,
  70 + DA9053_BUCKA_REG,
  71 + DA9053_BUCKB_REG,
  72 + DA9053_BUCKCORE_REG,
  73 + DA9053_BUCKPRO_REG,
  74 + DA9053_BUCKMEM_REG,
  75 + DA9053_BUCKPERI_REG,
  76 + DA9053_LDO1_REG,
  77 + DA9053_LDO2_REG,
  78 + DA9053_LDO3_REG,
  79 + DA9053_LDO4_REG,
  80 + DA9053_LDO5_REG,
  81 + DA9053_LDO6_REG,
  82 + DA9053_LDO7_REG,
  83 + DA9053_LDO8_REG,
  84 + DA9053_LDO9_REG,
  85 + DA9053_LDO10_REG,
  86 + DA9053_SUPPLY_REG,
  87 + DA9053_PULLDOWN_REG,
  88 + DA9053_CHGBUCK_REG,
  89 + DA9053_WAITCONT_REG,
  90 + DA9053_ISET_REG,
  91 + DA9053_BATCHG_REG,
  92 + DA9053_CHGCONT_REG,
  93 + DA9053_INPUTCONT_REG,
  94 + DA9053_CHGTIME_REG,
  95 + DA9053_BBATCONT_REG,
  96 + DA9053_BOOST_REG,
  97 + DA9053_LEDCONT_REG,
  98 + DA9053_LEDMIN123_REG,
  99 + DA9053_LED1CONF_REG,
  100 + DA9053_LED2CONF_REG,
  101 + DA9053_LED3CONF_REG,
  102 + DA9053_LED1CONT_REG,
  103 + DA9053_LED2CONT_REG,
  104 + DA9053_LED3CONT_REG,
  105 + DA9053_LED4CONT_REG,
  106 + DA9053_LED5CONT_REG,
  107 + DA9053_ADCMAN_REG,
  108 + DA9053_ADCCONT_REG,
  109 + DA9053_ADCRESL_REG,
  110 + DA9053_ADCRESH_REG,
  111 + DA9053_VDDRES_REG,
  112 + DA9053_VDDMON_REG,
  113 + DA9053_ICHGAV_REG,
  114 + DA9053_ICHGTHD_REG,
  115 + DA9053_ICHGEND_REG,
  116 + DA9053_TBATRES_REG,
  117 + DA9053_TBATHIGHP_REG,
  118 + DA9053_TBATHIGHIN_REG,
  119 + DA9053_TBATLOW_REG,
  120 + DA9053_TOFFSET_REG,
  121 + DA9053_ADCIN4RES_REG,
  122 + DA9053_AUTO4HIGH_REG,
  123 + DA9053_AUTO4LOW_REG,
  124 + DA9053_ADCIN5RES_REG,
  125 + DA9053_AUTO5HIGH_REG,
  126 + DA9053_AUTO5LOW_REG,
  127 + DA9053_ADCIN6RES_REG,
  128 + DA9053_AUTO6HIGH_REG,
  129 + DA9053_AUTO6LOW_REG,
  130 + DA9053_TJUNCRES_REG,
  131 + DA9053_TSICONTA_REG,
  132 + DA9053_TSICONTB_REG,
  133 + DA9053_TSIXMSB_REG,
  134 + DA9053_TSIYMSB_REG,
  135 + DA9053_TSILSB_REG,
  136 + DA9053_TSIZMSB_REG,
  137 + DA9053_COUNTS_REG,
  138 + DA9053_COUNTMI_REG,
  139 + DA9053_COUNTH_REG,
  140 + DA9053_COUNTD_REG,
  141 + DA9053_COUNTMO_REG,
  142 + DA9053_COUNTY_REG,
  143 + DA9053_ALARMMI_REG,
  144 + DA9053_ALARMH_REG,
  145 + DA9053_ALARMD_REG,
  146 + DA9053_ALARMMO_REG,
  147 + DA9053_ALARMY_REG,
  148 + DA9053_SECONDA_REG,
  149 + DA9053_SECONDB_REG,
  150 + DA9053_SECONDC_REG,
  151 + DA9053_SECONDD_REG,
  152 + DA9053_PAGECON128_REG,
  153 + DA9053_CHIPID_REG,
  154 + DA9053_CONFIGID_REG,
  155 + DA9053_OTPCONT_REG,
  156 + DA9053_OSCTRIM_REG,
  157 + DA9053_GPID0_REG,
  158 + DA9053_GPID1_REG,
  159 + DA9053_GPID2_REG,
  160 + DA9053_GPID3_REG,
  161 + DA9053_GPID4_REG,
  162 + DA9053_GPID5_REG,
  163 + DA9053_GPID6_REG,
  164 + DA9053_GPID7_REG,
  165 + DA9053_GPID8_REG,
  166 + DA9053_GPID9_REG,
  167 + PMIC_NUM_OF_REGS,
  168 +};
  169 +
  170 +#define DA_BUCKCORE_VBCORE_1_250V 0x1E
  171 +
  172 +/* BUCKCORE REGISTER */
  173 +#define DA9052_BUCKCORE_BCORECONF (1 << 7)
  174 +#define DA9052_BUCKCORE_BCOREEN (1 << 6)
  175 +#define DA9052_BUCKCORE_VBCORE 63
  176 +
  177 +/* SUPPLY REGISTER */
  178 +#define DA9052_SUPPLY_VLOCK (1 << 7)
  179 +#define DA9052_SUPPLY_VMEMSWEN (1 << 6)
  180 +#define DA9052_SUPPLY_VPERISWEN (1 << 5)
  181 +#define DA9052_SUPPLY_VLDO3GO (1 << 4)
  182 +#define DA9052_SUPPLY_VLDO2GO (1 << 3)
  183 +#define DA9052_SUPPLY_VBMEMGO (1 << 2)
  184 +#define DA9052_SUPPLY_VBPROGO (1 << 1)
  185 +#define DA9052_SUPPLY_VBCOREGO (1 << 0)
  186 +
  187 +#endif /* __DIALOG_PMIC_H__ */