nyan: PMIC: Slam default init values for SDOs/LDOs in AS3722

BUG=chrome-os-partner:24258
TEST=built/booted on Norrin/Nyan1 OK, loaded 3.10 kernel, and
did a shutdown -r. Next boot was OK.

Note that if other regs in the PMIC need to be (re)initialized,
it's a simple matter of adding more entries to the init_reg table.

Change-Id: I8cb4721da90673216f0a771d72c6d81590532837
Signed-off-by: Tom Warren <twarren@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/178226
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Tom Warren 2013-11-27 11:12:29 -07:00 committed by chrome-internal-fetch
commit c536b0d82f
2 changed files with 61 additions and 0 deletions

View file

@ -30,12 +30,47 @@ enum {
AS3722_I2C_ADDR = 0x40
};
struct as3722_init_reg {
u8 reg;
u8 val;
};
static struct as3722_init_reg init_list[] = {
{AS3722_SDO0, 0x3C},
{AS3722_SDO1, 0x32},
{AS3722_SDO2, 0x3C},
{AS3722_SDO3, 0x00},
{AS3722_SDO4, 0x00},
{AS3722_SDO5, 0x50},
{AS3722_SDO6, 0x28},
{AS3722_LDO0, 0x8A},
{AS3722_LDO1, 0x00},
{AS3722_LDO2, 0x10},
{AS3722_LDO3, 0x59},
{AS3722_LDO4, 0x00},
{AS3722_LDO5, 0x00},
{AS3722_LDO6, 0x3F},
{AS3722_LDO7, 0x00},
{AS3722_LDO9, 0x00},
{AS3722_LDO10, 0x00},
{AS3722_LDO11, 0x00},
};
#define AS3722_INIT_REG_LEN ARRAY_SIZE(init_list)
static void pmic_write_reg(unsigned bus, uint8_t reg, uint8_t val)
{
i2c_write(bus, AS3722_I2C_ADDR, reg, 1, &val, 1);
udelay(10 * 1000);
}
static void pmic_slam_defaults(unsigned bus)
{
int i;
for (i = 0; i < AS3722_INIT_REG_LEN; i++)
pmic_write_reg(bus, init_list[i].reg, init_list[i].val);
}
void pmic_init(unsigned bus)
{
/*
@ -44,6 +79,9 @@ void pmic_init(unsigned bus)
* Don't write LDCONTROL - it's already 0xFF, i.e. all LDOs enabled.
*/
/* Restore PMIC POR defaults, in case kernel changed 'em */
pmic_slam_defaults(bus);
/* First set VDD_CPU to 1.2V, then enable the VDD_CPU regulator. */
if (board_id() == 0)
pmic_write_reg(bus, 0x00, 0x3c);

View file

@ -20,6 +20,29 @@
#ifndef __MAINBOARD_GOOGLE_NYAN_PMIC_H__
#define __MAINBOARD_GOOGLE_NYAN_PMIC_H__
enum {
AS3722_SDO0 = 0,
AS3722_SDO1,
AS3722_SDO2,
AS3722_SDO3,
AS3722_SDO4,
AS3722_SDO5,
AS3722_SDO6,
AS3722_LDO0 = 0x10,
AS3722_LDO1,
AS3722_LDO2,
AS3722_LDO3,
AS3722_LDO4,
AS3722_LDO5,
AS3722_LDO6,
AS3722_LDO7,
AS3722_LDO9 = 0x19,
AS3722_LDO10,
AS3722_LDO11,
};
void pmic_init(unsigned bus);
#endif /* __MAINBOARD_GOOGLE_NYAN_PMIC_H__ */