Source
x
/*
* pv88090-regulator.c - Regulator device driver for PV88090
* Copyright (C) 2015 Powerventure Semiconductor Ltd.
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* PV88090 REGULATOR IDs */
enum {
/* BUCKs */
PV88090_ID_BUCK1,
PV88090_ID_BUCK2,
PV88090_ID_BUCK3,
/* LDOs */
PV88090_ID_LDO1,
PV88090_ID_LDO2,
};
struct pv88090_regulator {
struct regulator_desc desc;
unsigned int conf;
unsigned int conf2;
};
struct pv88090 {
struct device *dev;
struct regmap *regmap;
struct regulator_dev *rdev[PV88090_MAX_REGULATORS];
};
struct pv88090_buck_voltage {
int min_uV;
int max_uV;
int uV_step;
};
static const struct regmap_config pv88090_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
/* Current limits array (in uA) for BUCK1, BUCK2, BUCK3.
* Entry indexes corresponds to register values.
*/
static const unsigned int pv88090_buck1_limits[] = {
220000, 440000, 660000, 880000, 1100000, 1320000, 1540000, 1760000,
1980000, 2200000, 2420000, 2640000, 2860000, 3080000, 3300000, 3520000,
3740000, 3960000, 4180000, 4400000, 4620000, 4840000, 5060000, 5280000,
5500000, 5720000, 5940000, 6160000, 6380000, 6600000, 6820000, 7040000
};
static const unsigned int pv88090_buck23_limits[] = {
1496000, 2393000, 3291000, 4189000
};
static const struct pv88090_buck_voltage pv88090_buck_vol[3] = {
{
.min_uV = 600000,
.max_uV = 1393750,
.uV_step = 6250,
},
{
.min_uV = 1400000,
.max_uV = 2193750,
.uV_step = 6250,
},