Source
x
static int max77686_buck_modes(int buck, struct dm_regulator_mode **modesp)
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2012-2015 Samsung Electronics
*
* Rajeshwari Shinde <rajeshwari.s@samsung.com>
* Przemyslaw Marczak <p.marczak@samsung.com>
*/
/* LDO: 1,3,4,5,9,17,18,19,20,21,22,23,24,26,26,27 */
static struct dm_regulator_mode max77686_ldo_mode_standby1[] = {
MODE(OPMODE_OFF, MAX77686_LDO_MODE_OFF, "OFF"),
MODE(OPMODE_LPM, MAX77686_LDO_MODE_LPM, "LPM"),
MODE(OPMODE_STANDBY_LPM, MAX77686_LDO_MODE_STANDBY_LPM, "ON/LPM"),
MODE(OPMODE_ON, MAX77686_LDO_MODE_ON, "ON"),
};
/* LDO: 2,6,7,8,10,11,12,14,15,16 */
static struct dm_regulator_mode max77686_ldo_mode_standby2[] = {
MODE(OPMODE_OFF, MAX77686_LDO_MODE_OFF, "OFF"),
MODE(OPMODE_STANDBY, MAX77686_LDO_MODE_STANDBY, "ON/OFF"),
MODE(OPMODE_STANDBY_LPM, MAX77686_LDO_MODE_STANDBY_LPM, "ON/LPM"),
MODE(OPMODE_ON, MAX77686_LDO_MODE_ON, "ON"),
};
/* Buck: 1 */
static struct dm_regulator_mode max77686_buck_mode_standby[] = {
MODE(OPMODE_OFF, MAX77686_BUCK_MODE_OFF, "OFF"),
MODE(OPMODE_STANDBY, MAX77686_BUCK_MODE_STANDBY, "ON/OFF"),
MODE(OPMODE_ON, MAX77686_BUCK_MODE_ON, "ON"),
};
/* Buck: 2,3,4 */
static struct dm_regulator_mode max77686_buck_mode_lpm[] = {
MODE(OPMODE_OFF, MAX77686_BUCK_MODE_OFF, "OFF"),
MODE(OPMODE_STANDBY, MAX77686_BUCK_MODE_STANDBY, "ON/OFF"),
MODE(OPMODE_LPM, MAX77686_BUCK_MODE_LPM, "LPM"),
MODE(OPMODE_ON, MAX77686_BUCK_MODE_ON, "ON"),
};
/* Buck: 5,6,7,8,9 */
static struct dm_regulator_mode max77686_buck_mode_onoff[] = {
MODE(OPMODE_OFF, MAX77686_BUCK_MODE_OFF, "OFF"),
MODE(OPMODE_ON, MAX77686_BUCK_MODE_ON, "ON"),
};
static const char max77686_buck_ctrl[] = {
0xff, 0x10, 0x12, 0x1c, 0x26, 0x30, 0x32, 0x34, 0x36, 0x38
};
static const char max77686_buck_out[] = {
0xff, 0x11, 0x14, 0x1e, 0x28, 0x31, 0x33, 0x35, 0x37, 0x39
};
static int max77686_buck_volt2hex(int buck, int uV)
{
int hex = 0;
int hex_max = 0;
switch (buck) {
case 2:
case 3:
case 4:
/* hex = (uV - 600000) / 12500; */
hex = (uV - MAX77686_BUCK_UV_LMIN) / MAX77686_BUCK_UV_LSTEP;
hex_max = MAX77686_BUCK234_VOLT_MAX_HEX;
break;
default:
/*
* hex = (uV - 750000) / 50000. We assume that dynamic voltage
* scaling via GPIOs is not enabled and don't support that.
* If this is enabled then the driver will need to take that
* into account and check different registers depending on
* the current setting. See the datasheet for details.
*/
hex = (uV - MAX77686_BUCK_UV_HMIN) / MAX77686_BUCK_UV_HSTEP;
hex_max = MAX77686_BUCK_VOLT_MAX_HEX;
break;