/*
* tps65910.c -- TI tps65910
*
* Copyright 2010 Texas Instruments Inc.
*
* Author: Graeme Gregory <gg@slimlogic.co.uk>
* Author: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/mfd/tps65910.h>
#define TPS65910_REG_VRTC 0
#define TPS65910_REG_VIO 1
#define TPS65910_REG_VDD1 2
#define TPS65910_REG_VDD2 3
#define TPS65910_REG_VDD3 4
#define TPS65910_REG_VDIG1 5
#define TPS65910_REG_VDIG2 6
#define TPS65910_REG_VPLL 7
#define TPS65910_REG_VDAC 8
#define TPS65910_REG_VAUX1 9
#define TPS65910_REG_VAUX2 10
#define TPS65910_REG_VAUX33 11
#define TPS65910_REG_VMMC 12
#define TPS65911_REG_VDDCTRL 4
#define TPS65911_REG_LDO1 5
#define TPS65911_REG_LDO2 6
#define TPS65911_REG_LDO3 7
#define TPS65911_REG_LDO4 8
#define TPS65911_REG_LDO5 9
#define TPS65911_REG_LDO6 10
#define TPS65911_REG_LDO7 11
#define TPS65911_REG_LDO8 12
#define TPS65910_SUPPLY_STATE_ENABLED 0x1
/* supported VIO voltages in milivolts */
static const u16 VIO_VSEL_table[] = {
1500, 1800, 2500, 3300,
};
/* VSEL tables for TPS65910 specific LDOs and dcdc's */
/* supported VDD3 voltages in milivolts */
static const u16 VDD3_VSEL_table[] = {
5000,
};
/* supported VDIG1 voltages in milivolts */
static const u16 VDIG1_VSEL_table[] = {
1200, 1500, 1800, 2700,
};
/* supported VDIG2 voltages in milivolts */
static const u16 VDIG2_VSEL_table[] = {
1000, 1100, 1200, 1800,
};
/* supported VPLL voltages in milivolts */
static const u16 VPLL_VSEL_table[] = {
1000, 1100, 1800, 2500,
};
/* supported VDAC voltages in milivolts */
static const u16 VDAC_VSEL_table[] = {
1800, 2600, 2800, 2850,
};
/* supported VAUX1 voltages in milivolts */
static const u16 VAUX1_VSEL_table[] = {
1800, 2500, 2800, 2850,
};
/* supported VAUX2 voltages in milivolts */
static const u16 VAUX2_VSEL_table[] = {
1800, 2800, 2900, 3300,
};
/* supported VAUX33 voltages in milivolts */
static const u16 VAUX33_VSEL_table[] = {
1800, 2000, 2800, 3300,
};
/* supported VMMC voltages in milivolts */
static const u16 VMMC_VSEL_table[] = {
1800, 2800, 3000, 3300,
};
struct tps_info {
const char *name;
unsigned min_uV;
unsigned max_uV;
u8 table_len;
const u16 *table;
};
static struct tps_info tps65910_regs[] = {
{
.name = "VRTC",
},
{
.name = "VIO",
.min_uV = 1500000,
.max_uV = 3300000,
.table_len = ARRAY_SIZE(VIO_VSEL_table),
.table = VIO_VSEL_table,
},
{
.name = "VDD1",
.min_uV = 600000,
.max_uV = 4500000,
},
{
.name = "VDD2",
.min_uV = 600000,
.max_uV = 4500000,
},
{
.name = "VDD3",
.min_uV = 5000000,
.max_uV = 5000000,
.table_len = ARRAY_SIZE(VDD3_VSEL_table),
.table = VDD3_VSEL_table,
},
{
.name = "VDIG1",
.min_uV = 1200000,
.max_uV = 2700000,
.table_len = ARRAY_SIZE(VDIG1_VSEL_table),
.table = VDIG1_VSEL_table,
},
{
.name = "VDIG2",
.min_uV = 1000000,
.max_uV = 1800000,
.table_len = ARRAY_SIZE(VDIG2_VSEL_table),
.table = VDIG2_VSEL_table,
},
{
.name = "VPLL",
.min_uV = 1000000,
.max_uV = 2500000,
.table_len = ARRAY_SIZE(VPLL_VSEL_table),
.table = VPLL_VSEL_table,
},
{
.name = "VDAC",
.min_uV = 1800000,
.max_uV = 2850000,
.table_len = ARRAY_SIZE(VDAC_VSEL_table),
.table = VDAC_VSEL_table,
},
{
.name = "VAUX1",
.min_uV = 1800000,
.max_uV = 2850000,
.table_len = ARRAY_SIZE(VAUX1_VSEL_table),
.table = VAUX1_VSEL_table,
},
{
.name