2012-01-09 17:10:25 +07:00
|
|
|
/*
|
|
|
|
* s5m8767.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Samsung Electronics Co., Ltd
|
|
|
|
* http://www.samsung.com
|
|
|
|
*
|
|
|
|
* 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/bug.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/gpio.h>
|
2013-02-04 06:49:47 +07:00
|
|
|
#include <linux/of_gpio.h>
|
2012-01-09 17:10:25 +07:00
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/regulator/driver.h>
|
|
|
|
#include <linux/regulator/machine.h>
|
2012-07-11 19:07:16 +07:00
|
|
|
#include <linux/mfd/samsung/core.h>
|
|
|
|
#include <linux/mfd/samsung/s5m8767.h>
|
2013-02-04 06:49:47 +07:00
|
|
|
#include <linux/regulator/of_regulator.h>
|
|
|
|
|
|
|
|
#define S5M8767_OPMODE_NORMAL_MODE 0x1
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
struct s5m8767_info {
|
|
|
|
struct device *dev;
|
2012-07-11 19:06:55 +07:00
|
|
|
struct sec_pmic_dev *iodev;
|
2012-01-09 17:10:25 +07:00
|
|
|
int num_regulators;
|
|
|
|
struct regulator_dev **rdev;
|
2012-07-11 19:06:55 +07:00
|
|
|
struct sec_opmode_data *opmode;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
int ramp_delay;
|
|
|
|
bool buck2_ramp;
|
|
|
|
bool buck3_ramp;
|
|
|
|
bool buck4_ramp;
|
|
|
|
|
|
|
|
bool buck2_gpiodvs;
|
|
|
|
bool buck3_gpiodvs;
|
|
|
|
bool buck4_gpiodvs;
|
|
|
|
u8 buck2_vol[8];
|
|
|
|
u8 buck3_vol[8];
|
|
|
|
u8 buck4_vol[8];
|
|
|
|
int buck_gpios[3];
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
int buck_ds[3];
|
2012-01-09 17:10:25 +07:00
|
|
|
int buck_gpioindex;
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
struct sec_voltage_desc {
|
2012-01-09 17:10:25 +07:00
|
|
|
int max;
|
|
|
|
int min;
|
|
|
|
int step;
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc buck_voltage_val1 = {
|
2012-01-09 17:10:25 +07:00
|
|
|
.max = 2225000,
|
|
|
|
.min = 650000,
|
|
|
|
.step = 6250,
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc buck_voltage_val2 = {
|
2012-01-09 17:10:25 +07:00
|
|
|
.max = 1600000,
|
|
|
|
.min = 600000,
|
|
|
|
.step = 6250,
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc buck_voltage_val3 = {
|
2012-01-09 17:10:25 +07:00
|
|
|
.max = 3000000,
|
|
|
|
.min = 750000,
|
|
|
|
.step = 12500,
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc ldo_voltage_val1 = {
|
2012-01-09 17:10:25 +07:00
|
|
|
.max = 3950000,
|
|
|
|
.min = 800000,
|
|
|
|
.step = 50000,
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc ldo_voltage_val2 = {
|
2012-01-09 17:10:25 +07:00
|
|
|
.max = 2375000,
|
|
|
|
.min = 800000,
|
|
|
|
.step = 25000,
|
|
|
|
};
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
static const struct sec_voltage_desc *reg_voltage_map[] = {
|
2012-01-09 17:10:25 +07:00
|
|
|
[S5M8767_LDO1] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO2] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO3] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO4] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO5] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO6] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO7] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO8] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO9] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO10] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO11] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO12] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO13] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO14] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO15] = &ldo_voltage_val2,
|
|
|
|
[S5M8767_LDO16] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO17] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO18] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO19] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO20] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO21] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO22] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO23] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO24] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO25] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO26] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO27] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_LDO28] = &ldo_voltage_val1,
|
|
|
|
[S5M8767_BUCK1] = &buck_voltage_val1,
|
|
|
|
[S5M8767_BUCK2] = &buck_voltage_val2,
|
|
|
|
[S5M8767_BUCK3] = &buck_voltage_val2,
|
|
|
|
[S5M8767_BUCK4] = &buck_voltage_val2,
|
|
|
|
[S5M8767_BUCK5] = &buck_voltage_val1,
|
|
|
|
[S5M8767_BUCK6] = &buck_voltage_val1,
|
|
|
|
[S5M8767_BUCK7] = NULL,
|
|
|
|
[S5M8767_BUCK8] = NULL,
|
|
|
|
[S5M8767_BUCK9] = &buck_voltage_val3,
|
|
|
|
};
|
|
|
|
|
2012-05-10 02:37:51 +07:00
|
|
|
static unsigned int s5m8767_opmode_reg[][4] = {
|
2012-03-09 15:55:34 +07:00
|
|
|
/* {OFF, ON, LOWPOWER, SUSPEND} */
|
|
|
|
/* LDO1 ... LDO28 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO1 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x0, 0x0, 0x0},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO5 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO10 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO15 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x0, 0x0, 0x0},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO20 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x0, 0x0, 0x0},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO25 */
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* LDO28 */
|
|
|
|
|
|
|
|
/* BUCK1 ... BUCK9 */
|
|
|
|
{0x0, 0x3, 0x1, 0x1}, /* BUCK1 */
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x2, 0x1}, /* BUCK5 */
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x1, 0x1},
|
|
|
|
{0x0, 0x3, 0x1, 0x1}, /* BUCK9 */
|
|
|
|
};
|
|
|
|
|
|
|
|
static int s5m8767_get_register(struct regulator_dev *rdev, int *reg,
|
|
|
|
int *enable_ctrl)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
2012-12-10 19:49:39 +07:00
|
|
|
int i, reg_id = rdev_get_id(rdev);
|
2012-03-09 15:55:34 +07:00
|
|
|
unsigned int mode;
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
switch (reg_id) {
|
|
|
|
case S5M8767_LDO1 ... S5M8767_LDO2:
|
|
|
|
*reg = S5M8767_REG_LDO1CTRL + (reg_id - S5M8767_LDO1);
|
|
|
|
break;
|
|
|
|
case S5M8767_LDO3 ... S5M8767_LDO28:
|
|
|
|
*reg = S5M8767_REG_LDO3CTRL + (reg_id - S5M8767_LDO3);
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK1:
|
|
|
|
*reg = S5M8767_REG_BUCK1CTRL1;
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK2 ... S5M8767_BUCK4:
|
|
|
|
*reg = S5M8767_REG_BUCK2CTRL + (reg_id - S5M8767_BUCK2) * 9;
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK5:
|
|
|
|
*reg = S5M8767_REG_BUCK5CTRL1;
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK6 ... S5M8767_BUCK9:
|
|
|
|
*reg = S5M8767_REG_BUCK6CTRL1 + (reg_id - S5M8767_BUCK6) * 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2012-12-10 19:49:39 +07:00
|
|
|
for (i = 0; i < s5m8767->num_regulators; i++) {
|
|
|
|
if (s5m8767->opmode[i].id == reg_id) {
|
|
|
|
mode = s5m8767->opmode[i].mode;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < s5m8767->num_regulators)
|
|
|
|
*enable_ctrl =
|
|
|
|
s5m8767_opmode_reg[reg_id][mode] << S5M8767_ENCTRL_SHIFT;
|
|
|
|
|
2012-01-09 17:10:25 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
|
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
|
|
|
int ret, reg;
|
2012-03-09 15:55:34 +07:00
|
|
|
int mask = 0xc0, enable_ctrl;
|
2012-12-12 10:27:00 +07:00
|
|
|
unsigned int val;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2012-03-09 15:55:34 +07:00
|
|
|
ret = s5m8767_get_register(rdev, ®, &enable_ctrl);
|
2012-01-09 17:10:25 +07:00
|
|
|
if (ret == -EINVAL)
|
|
|
|
return 1;
|
|
|
|
else if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
ret = sec_reg_read(s5m8767->iodev, reg, &val);
|
2012-01-09 17:10:25 +07:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2012-03-09 15:55:34 +07:00
|
|
|
return (val & mask) == enable_ctrl;
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int s5m8767_reg_enable(struct regulator_dev *rdev)
|
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
|
|
|
int ret, reg;
|
2012-03-09 15:55:34 +07:00
|
|
|
int mask = 0xc0, enable_ctrl;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2012-03-09 15:55:34 +07:00
|
|
|
ret = s5m8767_get_register(rdev, ®, &enable_ctrl);
|
2012-01-09 17:10:25 +07:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
return sec_reg_update(s5m8767->iodev, reg, enable_ctrl, mask);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int s5m8767_reg_disable(struct regulator_dev *rdev)
|
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
|
|
|
int ret, reg;
|
2012-03-09 15:55:34 +07:00
|
|
|
int mask = 0xc0, enable_ctrl;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2012-03-09 15:55:34 +07:00
|
|
|
ret = s5m8767_get_register(rdev, ®, &enable_ctrl);
|
2012-01-09 17:10:25 +07:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2012-07-11 19:06:55 +07:00
|
|
|
return sec_reg_update(s5m8767->iodev, reg, ~mask, mask);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
2013-01-18 08:55:06 +07:00
|
|
|
static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
|
|
|
switch (reg_id) {
|
|
|
|
case S5M8767_LDO1 ... S5M8767_LDO2:
|
|
|
|
reg = S5M8767_REG_LDO1CTRL + (reg_id - S5M8767_LDO1);
|
|
|
|
break;
|
|
|
|
case S5M8767_LDO3 ... S5M8767_LDO28:
|
|
|
|
reg = S5M8767_REG_LDO3CTRL + (reg_id - S5M8767_LDO3);
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK1:
|
|
|
|
reg = S5M8767_REG_BUCK1CTRL2;
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK2:
|
2012-12-10 19:49:40 +07:00
|
|
|
reg = S5M8767_REG_BUCK2DVS1;
|
2012-03-10 09:59:43 +07:00
|
|
|
if (s5m8767->buck2_gpiodvs)
|
|
|
|
reg += s5m8767->buck_gpioindex;
|
2012-01-09 17:10:25 +07:00
|
|
|
break;
|
|
|
|
case S5M8767_BUCK3:
|
2012-12-10 19:49:40 +07:00
|
|
|
reg = S5M8767_REG_BUCK3DVS1;
|
2012-03-10 09:59:43 +07:00
|
|
|
if (s5m8767->buck3_gpiodvs)
|
|
|
|
reg += s5m8767->buck_gpioindex;
|
2012-01-09 17:10:25 +07:00
|
|
|
break;
|
|
|
|
case S5M8767_BUCK4:
|
2012-12-10 19:49:40 +07:00
|
|
|
reg = S5M8767_REG_BUCK4DVS1;
|
2012-03-10 09:59:43 +07:00
|
|
|
if (s5m8767->buck4_gpiodvs)
|
|
|
|
reg += s5m8767->buck_gpioindex;
|
2012-01-09 17:10:25 +07:00
|
|
|
break;
|
|
|
|
case S5M8767_BUCK5:
|
|
|
|
reg = S5M8767_REG_BUCK5CTRL2;
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK6 ... S5M8767_BUCK9:
|
|
|
|
reg = S5M8767_REG_BUCK6CTRL2 + (reg_id - S5M8767_BUCK6) * 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2013-01-18 08:55:06 +07:00
|
|
|
return reg;
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
2012-12-29 08:38:50 +07:00
|
|
|
static int s5m8767_convert_voltage_to_sel(const struct sec_voltage_desc *desc,
|
|
|
|
int min_vol)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
2012-03-09 10:31:08 +07:00
|
|
|
int selector = 0;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
if (desc == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2012-12-29 08:38:50 +07:00
|
|
|
if (min_vol > desc->max)
|
2012-01-09 17:10:25 +07:00
|
|
|
return -EINVAL;
|
|
|
|
|
2012-04-13 08:30:05 +07:00
|
|
|
if (min_vol < desc->min)
|
|
|
|
min_vol = desc->min;
|
|
|
|
|
|
|
|
selector = DIV_ROUND_UP(min_vol - desc->min, desc->step);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2012-12-29 08:38:50 +07:00
|
|
|
if (desc->min + desc->step * selector > desc->max)
|
2012-01-09 17:10:25 +07:00
|
|
|
return -EINVAL;
|
|
|
|
|
2012-03-09 10:31:08 +07:00
|
|
|
return selector;
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
2012-06-13 15:28:18 +07:00
|
|
|
static inline int s5m8767_set_high(struct s5m8767_info *s5m8767)
|
2012-04-10 13:05:44 +07:00
|
|
|
{
|
|
|
|
int temp_index = s5m8767->buck_gpioindex;
|
|
|
|
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[0], (temp_index >> 2) & 0x1);
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[1], (temp_index >> 1) & 0x1);
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[2], temp_index & 0x1);
|
2012-06-13 15:28:18 +07:00
|
|
|
|
|
|
|
return 0;
|
2012-04-10 13:05:44 +07:00
|
|
|
}
|
|
|
|
|
2012-06-13 15:28:18 +07:00
|
|
|
static inline int s5m8767_set_low(struct s5m8767_info *s5m8767)
|
2012-04-10 13:05:44 +07:00
|
|
|
{
|
|
|
|
int temp_index = s5m8767->buck_gpioindex;
|
|
|
|
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[2], temp_index & 0x1);
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[1], (temp_index >> 1) & 0x1);
|
|
|
|
gpio_set_value(s5m8767->buck_gpios[0], (temp_index >> 2) & 0x1);
|
2012-06-13 15:28:18 +07:00
|
|
|
|
|
|
|
return 0;
|
2012-04-10 13:05:44 +07:00
|
|
|
}
|
|
|
|
|
2012-06-13 15:28:18 +07:00
|
|
|
static int s5m8767_set_voltage_sel(struct regulator_dev *rdev,
|
|
|
|
unsigned selector)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
2012-01-31 14:13:31 +07:00
|
|
|
int reg_id = rdev_get_id(rdev);
|
2013-01-18 08:55:06 +07:00
|
|
|
int old_index, index = 0;
|
2012-04-10 13:05:44 +07:00
|
|
|
u8 *buck234_vol = NULL;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
switch (reg_id) {
|
|
|
|
case S5M8767_LDO1 ... S5M8767_LDO28:
|
|
|
|
break;
|
|
|
|
case S5M8767_BUCK1 ... S5M8767_BUCK6:
|
2012-04-10 13:05:44 +07:00
|
|
|
if (reg_id == S5M8767_BUCK2 && s5m8767->buck2_gpiodvs)
|
|
|
|
buck234_vol = &s5m8767->buck2_vol[0];
|
|
|
|
else if (reg_id == S5M8767_BUCK3 && s5m8767->buck3_gpiodvs)
|
|
|
|
buck234_vol = &s5m8767->buck3_vol[0];
|
|
|
|
else if (reg_id == S5M8767_BUCK4 && s5m8767->buck4_gpiodvs)
|
|
|
|
buck234_vol = &s5m8767->buck4_vol[0];
|
2012-01-09 17:10:25 +07:00
|
|
|
break;
|
|
|
|
case S5M8767_BUCK7 ... S5M8767_BUCK8:
|
|
|
|
return -EINVAL;
|
|
|
|
case S5M8767_BUCK9:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2012-04-10 13:05:44 +07:00
|
|
|
/* buck234_vol != NULL means to control buck234 voltage via DVS GPIO */
|
|
|
|
if (buck234_vol) {
|
2012-06-13 15:28:18 +07:00
|
|
|
while (*buck234_vol != selector) {
|
2012-04-10 13:05:44 +07:00
|
|
|
buck234_vol++;
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
old_index = s5m8767->buck_gpioindex;
|
|
|
|
s5m8767->buck_gpioindex = index;
|
|
|
|
|
|
|
|
if (index > old_index)
|
2012-06-13 15:28:18 +07:00
|
|
|
return s5m8767_set_high(s5m8767);
|
2012-04-10 13:05:44 +07:00
|
|
|
else
|
2012-06-13 15:28:18 +07:00
|
|
|
return s5m8767_set_low(s5m8767);
|
2012-04-10 13:05:44 +07:00
|
|
|
} else {
|
2013-01-18 08:55:06 +07:00
|
|
|
return regulator_set_voltage_sel_regmap(rdev, selector);
|
2012-04-10 13:05:44 +07:00
|
|
|
}
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,
|
|
|
|
unsigned int old_sel,
|
|
|
|
unsigned int new_sel)
|
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
|
2012-07-11 19:06:55 +07:00
|
|
|
const struct sec_voltage_desc *desc;
|
2012-01-31 14:13:31 +07:00
|
|
|
int reg_id = rdev_get_id(rdev);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
desc = reg_voltage_map[reg_id];
|
|
|
|
|
2012-06-13 15:27:16 +07:00
|
|
|
if ((old_sel < new_sel) && s5m8767->ramp_delay)
|
2012-02-24 13:52:45 +07:00
|
|
|
return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
|
2012-03-09 14:28:10 +07:00
|
|
|
s5m8767->ramp_delay * 1000);
|
2012-02-24 13:52:45 +07:00
|
|
|
return 0;
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
2012-04-10 13:07:15 +07:00
|
|
|
static struct regulator_ops s5m8767_ops = {
|
2012-06-18 13:25:27 +07:00
|
|
|
.list_voltage = regulator_list_voltage_linear,
|
2012-01-09 17:10:25 +07:00
|
|
|
.is_enabled = s5m8767_reg_is_enabled,
|
|
|
|
.enable = s5m8767_reg_enable,
|
|
|
|
.disable = s5m8767_reg_disable,
|
2013-01-18 08:55:06 +07:00
|
|
|
.get_voltage_sel = regulator_get_voltage_sel_regmap,
|
2012-06-13 15:28:18 +07:00
|
|
|
.set_voltage_sel = s5m8767_set_voltage_sel,
|
2012-01-09 17:10:25 +07:00
|
|
|
.set_voltage_time_sel = s5m8767_set_voltage_time_sel,
|
|
|
|
};
|
|
|
|
|
2012-06-18 13:25:27 +07:00
|
|
|
static struct regulator_ops s5m8767_buck78_ops = {
|
|
|
|
.is_enabled = s5m8767_reg_is_enabled,
|
|
|
|
.enable = s5m8767_reg_enable,
|
|
|
|
.disable = s5m8767_reg_disable,
|
|
|
|
};
|
|
|
|
|
2012-04-10 13:08:19 +07:00
|
|
|
#define s5m8767_regulator_desc(_name) { \
|
|
|
|
.name = #_name, \
|
|
|
|
.id = S5M8767_##_name, \
|
|
|
|
.ops = &s5m8767_ops, \
|
2012-01-09 17:10:25 +07:00
|
|
|
.type = REGULATOR_VOLTAGE, \
|
|
|
|
.owner = THIS_MODULE, \
|
|
|
|
}
|
|
|
|
|
2012-06-18 13:25:27 +07:00
|
|
|
#define s5m8767_regulator_buck78_desc(_name) { \
|
|
|
|
.name = #_name, \
|
|
|
|
.id = S5M8767_##_name, \
|
|
|
|
.ops = &s5m8767_buck78_ops, \
|
|
|
|
.type = REGULATOR_VOLTAGE, \
|
|
|
|
.owner = THIS_MODULE, \
|
|
|
|
}
|
|
|
|
|
2012-01-09 17:10:25 +07:00
|
|
|
static struct regulator_desc regulators[] = {
|
2012-04-10 13:08:19 +07:00
|
|
|
s5m8767_regulator_desc(LDO1),
|
|
|
|
s5m8767_regulator_desc(LDO2),
|
|
|
|
s5m8767_regulator_desc(LDO3),
|
|
|
|
s5m8767_regulator_desc(LDO4),
|
|
|
|
s5m8767_regulator_desc(LDO5),
|
|
|
|
s5m8767_regulator_desc(LDO6),
|
|
|
|
s5m8767_regulator_desc(LDO7),
|
|
|
|
s5m8767_regulator_desc(LDO8),
|
|
|
|
s5m8767_regulator_desc(LDO9),
|
|
|
|
s5m8767_regulator_desc(LDO10),
|
|
|
|
s5m8767_regulator_desc(LDO11),
|
|
|
|
s5m8767_regulator_desc(LDO12),
|
|
|
|
s5m8767_regulator_desc(LDO13),
|
|
|
|
s5m8767_regulator_desc(LDO14),
|
|
|
|
s5m8767_regulator_desc(LDO15),
|
|
|
|
s5m8767_regulator_desc(LDO16),
|
|
|
|
s5m8767_regulator_desc(LDO17),
|
|
|
|
s5m8767_regulator_desc(LDO18),
|
|
|
|
s5m8767_regulator_desc(LDO19),
|
|
|
|
s5m8767_regulator_desc(LDO20),
|
|
|
|
s5m8767_regulator_desc(LDO21),
|
|
|
|
s5m8767_regulator_desc(LDO22),
|
|
|
|
s5m8767_regulator_desc(LDO23),
|
|
|
|
s5m8767_regulator_desc(LDO24),
|
|
|
|
s5m8767_regulator_desc(LDO25),
|
|
|
|
s5m8767_regulator_desc(LDO26),
|
|
|
|
s5m8767_regulator_desc(LDO27),
|
|
|
|
s5m8767_regulator_desc(LDO28),
|
|
|
|
s5m8767_regulator_desc(BUCK1),
|
|
|
|
s5m8767_regulator_desc(BUCK2),
|
|
|
|
s5m8767_regulator_desc(BUCK3),
|
|
|
|
s5m8767_regulator_desc(BUCK4),
|
|
|
|
s5m8767_regulator_desc(BUCK5),
|
|
|
|
s5m8767_regulator_desc(BUCK6),
|
2012-06-18 13:25:27 +07:00
|
|
|
s5m8767_regulator_buck78_desc(BUCK7),
|
|
|
|
s5m8767_regulator_buck78_desc(BUCK8),
|
2012-04-10 13:08:19 +07:00
|
|
|
s5m8767_regulator_desc(BUCK9),
|
2012-01-09 17:10:25 +07:00
|
|
|
};
|
|
|
|
|
2013-02-04 06:49:47 +07:00
|
|
|
#ifdef CONFIG_OF
|
|
|
|
static int s5m8767_pmic_dt_parse_dvs_gpio(struct sec_pmic_dev *iodev,
|
|
|
|
struct sec_platform_data *pdata,
|
|
|
|
struct device_node *pmic_np)
|
|
|
|
{
|
|
|
|
int i, gpio;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
gpio = of_get_named_gpio(pmic_np,
|
|
|
|
"s5m8767,pmic-buck-dvs-gpios", i);
|
|
|
|
if (!gpio_is_valid(gpio)) {
|
|
|
|
dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
pdata->buck_gpios[i] = gpio;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int s5m8767_pmic_dt_parse_ds_gpio(struct sec_pmic_dev *iodev,
|
|
|
|
struct sec_platform_data *pdata,
|
|
|
|
struct device_node *pmic_np)
|
|
|
|
{
|
|
|
|
int i, gpio;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
gpio = of_get_named_gpio(pmic_np,
|
|
|
|
"s5m8767,pmic-buck-ds-gpios", i);
|
|
|
|
if (!gpio_is_valid(gpio)) {
|
|
|
|
dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
pdata->buck_ds[i] = gpio;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-02-13 08:29:45 +07:00
|
|
|
static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
|
2013-02-04 06:49:47 +07:00
|
|
|
struct sec_platform_data *pdata)
|
|
|
|
{
|
2013-02-13 08:29:45 +07:00
|
|
|
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
2013-02-04 06:49:47 +07:00
|
|
|
struct device_node *pmic_np, *regulators_np, *reg_np;
|
|
|
|
struct sec_regulator_data *rdata;
|
|
|
|
struct sec_opmode_data *rmode;
|
|
|
|
unsigned int i, dvs_voltage_nr = 1, ret;
|
|
|
|
|
|
|
|
pmic_np = iodev->dev->of_node;
|
|
|
|
if (!pmic_np) {
|
|
|
|
dev_err(iodev->dev, "could not find pmic sub-node\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
regulators_np = of_find_node_by_name(pmic_np, "regulators");
|
|
|
|
if (!regulators_np) {
|
|
|
|
dev_err(iodev->dev, "could not find regulators sub-node\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* count the number of regulators to be supported in pmic */
|
2013-02-06 09:55:05 +07:00
|
|
|
pdata->num_regulators = of_get_child_count(regulators_np);
|
2013-02-04 06:49:47 +07:00
|
|
|
|
2013-02-13 08:29:45 +07:00
|
|
|
rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
|
2013-02-04 06:49:47 +07:00
|
|
|
pdata->num_regulators, GFP_KERNEL);
|
|
|
|
if (!rdata) {
|
|
|
|
dev_err(iodev->dev,
|
|
|
|
"could not allocate memory for regulator data\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2013-02-13 08:29:45 +07:00
|
|
|
rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) *
|
2013-02-04 06:49:47 +07:00
|
|
|
pdata->num_regulators, GFP_KERNEL);
|
2013-02-24 18:55:34 +07:00
|
|
|
if (!rmode) {
|
2013-02-04 06:49:47 +07:00
|
|
|
dev_err(iodev->dev,
|
|
|
|
"could not allocate memory for regulator mode\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdata->regulators = rdata;
|
|
|
|
pdata->opmode = rmode;
|
|
|
|
for_each_child_of_node(regulators_np, reg_np) {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(regulators); i++)
|
|
|
|
if (!of_node_cmp(reg_np->name, regulators[i].name))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == ARRAY_SIZE(regulators)) {
|
|
|
|
dev_warn(iodev->dev,
|
|
|
|
"don't know how to configure regulator %s\n",
|
|
|
|
reg_np->name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
rdata->id = i;
|
|
|
|
rdata->initdata = of_get_regulator_init_data(
|
2013-02-13 08:29:45 +07:00
|
|
|
&pdev->dev, reg_np);
|
2013-02-04 06:49:47 +07:00
|
|
|
rdata->reg_node = reg_np;
|
|
|
|
rdata++;
|
|
|
|
rmode->id = i;
|
|
|
|
if (of_property_read_u32(reg_np, "op_mode",
|
|
|
|
&rmode->mode)) {
|
|
|
|
dev_warn(iodev->dev,
|
|
|
|
"no op_mode property property at %s\n",
|
|
|
|
reg_np->full_name);
|
|
|
|
|
|
|
|
rmode->mode = S5M8767_OPMODE_NORMAL_MODE;
|
|
|
|
}
|
|
|
|
rmode++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL))
|
|
|
|
pdata->buck2_gpiodvs = true;
|
|
|
|
|
|
|
|
if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL))
|
|
|
|
pdata->buck3_gpiodvs = true;
|
|
|
|
|
|
|
|
if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL))
|
|
|
|
pdata->buck4_gpiodvs = true;
|
|
|
|
|
|
|
|
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
|
|
|
|
pdata->buck4_gpiodvs) {
|
|
|
|
ret = s5m8767_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np);
|
|
|
|
if (ret)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (of_property_read_u32(pmic_np,
|
|
|
|
"s5m8767,pmic-buck-default-dvs-idx",
|
|
|
|
&pdata->buck_default_idx)) {
|
|
|
|
pdata->buck_default_idx = 0;
|
|
|
|
} else {
|
|
|
|
if (pdata->buck_default_idx >= 8) {
|
|
|
|
pdata->buck_default_idx = 0;
|
|
|
|
dev_info(iodev->dev,
|
|
|
|
"invalid value for default dvs index, use 0\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dvs_voltage_nr = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = s5m8767_pmic_dt_parse_ds_gpio(iodev, pdata, pmic_np);
|
|
|
|
if (ret)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (of_property_read_u32_array(pmic_np,
|
|
|
|
"s5m8767,pmic-buck2-dvs-voltage",
|
|
|
|
pdata->buck2_voltage, dvs_voltage_nr)) {
|
|
|
|
dev_err(iodev->dev, "buck2 voltages not specified\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (of_property_read_u32_array(pmic_np,
|
|
|
|
"s5m8767,pmic-buck3-dvs-voltage",
|
|
|
|
pdata->buck3_voltage, dvs_voltage_nr)) {
|
|
|
|
dev_err(iodev->dev, "buck3 voltages not specified\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (of_property_read_u32_array(pmic_np,
|
|
|
|
"s5m8767,pmic-buck4-dvs-voltage",
|
|
|
|
pdata->buck4_voltage, dvs_voltage_nr)) {
|
|
|
|
dev_err(iodev->dev, "buck4 voltages not specified\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
2013-02-13 08:29:45 +07:00
|
|
|
static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
|
2013-02-04 06:49:47 +07:00
|
|
|
struct sec_platform_data *pdata)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_OF */
|
|
|
|
|
2012-11-20 01:22:22 +07:00
|
|
|
static int s5m8767_pmic_probe(struct platform_device *pdev)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
2012-07-11 19:06:55 +07:00
|
|
|
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
2013-02-04 06:49:47 +07:00
|
|
|
struct sec_platform_data *pdata = iodev->pdata;
|
2012-04-04 06:50:22 +07:00
|
|
|
struct regulator_config config = { };
|
2012-01-09 17:10:25 +07:00
|
|
|
struct regulator_dev **rdev;
|
|
|
|
struct s5m8767_info *s5m8767;
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
int i, ret, size, buck_init;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2013-02-13 08:31:31 +07:00
|
|
|
if (!pdata) {
|
|
|
|
dev_err(pdev->dev.parent, "Platform data not supplied\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2013-02-04 06:49:47 +07:00
|
|
|
if (iodev->dev->of_node) {
|
2013-02-13 08:29:45 +07:00
|
|
|
ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata);
|
2013-02-04 06:49:47 +07:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-03-10 07:43:02 +07:00
|
|
|
if (pdata->buck2_gpiodvs) {
|
|
|
|
if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
|
|
|
|
dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pdata->buck3_gpiodvs) {
|
|
|
|
if (pdata->buck2_gpiodvs || pdata->buck4_gpiodvs) {
|
|
|
|
dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pdata->buck4_gpiodvs) {
|
|
|
|
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs) {
|
|
|
|
dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-09 17:10:25 +07:00
|
|
|
s5m8767 = devm_kzalloc(&pdev->dev, sizeof(struct s5m8767_info),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!s5m8767)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
size = sizeof(struct regulator_dev *) * (S5M8767_REG_MAX - 2);
|
|
|
|
s5m8767->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
|
|
|
|
if (!s5m8767->rdev)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
rdev = s5m8767->rdev;
|
|
|
|
s5m8767->dev = &pdev->dev;
|
|
|
|
s5m8767->iodev = iodev;
|
2012-12-10 19:49:39 +07:00
|
|
|
s5m8767->num_regulators = pdata->num_regulators;
|
2012-01-09 17:10:25 +07:00
|
|
|
platform_set_drvdata(pdev, s5m8767);
|
|
|
|
|
|
|
|
s5m8767->buck_gpioindex = pdata->buck_default_idx;
|
|
|
|
s5m8767->buck2_gpiodvs = pdata->buck2_gpiodvs;
|
|
|
|
s5m8767->buck3_gpiodvs = pdata->buck3_gpiodvs;
|
|
|
|
s5m8767->buck4_gpiodvs = pdata->buck4_gpiodvs;
|
|
|
|
s5m8767->buck_gpios[0] = pdata->buck_gpios[0];
|
|
|
|
s5m8767->buck_gpios[1] = pdata->buck_gpios[1];
|
|
|
|
s5m8767->buck_gpios[2] = pdata->buck_gpios[2];
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
s5m8767->buck_ds[0] = pdata->buck_ds[0];
|
|
|
|
s5m8767->buck_ds[1] = pdata->buck_ds[1];
|
|
|
|
s5m8767->buck_ds[2] = pdata->buck_ds[2];
|
|
|
|
|
2012-01-09 17:10:25 +07:00
|
|
|
s5m8767->ramp_delay = pdata->buck_ramp_delay;
|
|
|
|
s5m8767->buck2_ramp = pdata->buck2_ramp_enable;
|
|
|
|
s5m8767->buck3_ramp = pdata->buck3_ramp_enable;
|
|
|
|
s5m8767->buck4_ramp = pdata->buck4_ramp_enable;
|
2012-03-09 15:55:34 +07:00
|
|
|
s5m8767->opmode = pdata->opmode;
|
2012-01-09 17:10:25 +07:00
|
|
|
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck2_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-07-31 05:36:16 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK2DVS2, buck_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
|
|
|
buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck3_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-07-31 05:36:16 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK3DVS2, buck_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
|
|
|
buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck4_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-07-31 05:36:16 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK4DVS2, buck_init);
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-01-09 17:10:25 +07:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
if (s5m8767->buck2_gpiodvs) {
|
|
|
|
s5m8767->buck2_vol[i] =
|
2012-03-09 10:31:08 +07:00
|
|
|
s5m8767_convert_voltage_to_sel(
|
2012-01-09 17:10:25 +07:00
|
|
|
&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck2_voltage[i]);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s5m8767->buck3_gpiodvs) {
|
|
|
|
s5m8767->buck3_vol[i] =
|
2012-03-09 10:31:08 +07:00
|
|
|
s5m8767_convert_voltage_to_sel(
|
2012-01-09 17:10:25 +07:00
|
|
|
&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck3_voltage[i]);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s5m8767->buck4_gpiodvs) {
|
|
|
|
s5m8767->buck4_vol[i] =
|
2012-03-09 10:31:08 +07:00
|
|
|
s5m8767_convert_voltage_to_sel(
|
2012-01-09 17:10:25 +07:00
|
|
|
&buck_voltage_val2,
|
2012-12-29 08:38:50 +07:00
|
|
|
pdata->buck4_voltage[i]);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-10 19:49:41 +07:00
|
|
|
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
|
|
|
|
pdata->buck4_gpiodvs) {
|
|
|
|
|
|
|
|
if (!gpio_is_valid(pdata->buck_gpios[0]) ||
|
|
|
|
!gpio_is_valid(pdata->buck_gpios[1]) ||
|
|
|
|
!gpio_is_valid(pdata->buck_gpios[2])) {
|
|
|
|
dev_err(&pdev->dev, "GPIO NOT VALID\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2012-07-05 22:12:49 +07:00
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0],
|
|
|
|
"S5M8767 SET1");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[1],
|
|
|
|
"S5M8767 SET2");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[2],
|
|
|
|
"S5M8767 SET3");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
/* SET1 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_gpios[0],
|
|
|
|
(s5m8767->buck_gpioindex >> 2) & 0x1);
|
|
|
|
/* SET2 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_gpios[1],
|
|
|
|
(s5m8767->buck_gpioindex >> 1) & 0x1);
|
|
|
|
/* SET3 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_gpios[2],
|
|
|
|
(s5m8767->buck_gpioindex >> 0) & 0x1);
|
2012-01-09 17:10:25 +07:00
|
|
|
}
|
|
|
|
|
2012-07-05 22:12:49 +07:00
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[0], "S5M8767 DS2");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-07-05 22:12:49 +07:00
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[1], "S5M8767 DS3");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
2012-07-05 22:12:49 +07:00
|
|
|
ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[2], "S5M8767 DS4");
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
|
|
|
|
/* DS2 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_ds[0], 0x0);
|
|
|
|
/* DS3 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_ds[1], 0x0);
|
|
|
|
/* DS4 GPIO */
|
|
|
|
gpio_direction_output(pdata->buck_ds[2], 0x0);
|
|
|
|
|
|
|
|
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
|
|
|
|
pdata->buck4_gpiodvs) {
|
MFD bits for the 3.6 merge window.
We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQFpGVAAoJEIqAPN1PVmxKFNoP/1dkYngrxxV6cxdyLJ74APhG
lVKPgaDxQhdgfwCZJmMeZK1UphZo80cWnEXG6sTHZUEQdTaslSJu5SuPfUM+fo7e
52/dU0nx0ZE04pwPQLHbidS4TmHlbLg9oM2kmIf9RO5rg34GodwVgRL/4+k1qvhz
aWYJt9erFhQOpqaSX66mXHSuhvzHypbcE7d2B2Ykmh3NoYiH2w9H9KmIbbb+ZLq8
+Bp/i5Ys/vfooo+8IE2w6KZfIzMwsmmtWjjr/38yuQJaKZCh/zn23DM9HsdrVf++
RzfniRF4YBxmeKi7zi8MFIYys8filTCXA9dXbGSAKCuUCT37yZRnUxTeN1bn7Bux
A7KRpG7pUKQKVKqCTndvK5LcQKlT33XyW2ZzV1wVWX2JkCJ+gilPeykb8IabNvGX
nIp0STEGR/WdCLEAKo8pJF7Usn0RuUzAug02SG/mQ6dpnLoZqp0Od5W7gRhT7M7h
hXr/xKJ6cG5YwicpAdy5kJJ0dRgQrtaHwxrF0B68AXZ7CmAtkPuEGCYhUCFnGQUH
XJ0CodAqqVBRyYiQS4zIpIh2nqhIdsgv4OC1+kVLbubQk+PR88zG9Jvg6i1HQi/A
OHi7N5Wite3YUrs3sBzDKnEc/Il2YRhVaz2SLVNfZR0PS7hywHN3rK/tVFINTgei
jNEz1H6hu7ToNLfs0UzP
=c28c
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD bits from Samuel Ortiz:
"We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core."
Fix up mostly trivial conflicts, with the exception of
drivers/usb/host/ehci-omap.c in particular, which had some
re-organization of the reset sequence (commit 1a49e2ac9651: "EHCI:
centralize controller initialization") that clashed with commit
2761a6394516 ("mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix
issues").
In particular, commit 2761a6394516 moved the usb_add_hcd() to the
*middle* of the reset sequence, which clashes fairly badly with the
reset sequence re-organization (although it could have been done inside
the new omap_ehci_init() function).
I left that part of commit 2761a6394516 just undone.
* tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (110 commits)
mfd: Ensure AB8500 platform data is passed through db8500-prcmu to MFD Core
mfd: Arizone core should select MFD_CORE
mfd: Fix arizona-irq.c build by selecting REGMAP_IRQ
mfd: Add debug trace on entering and leaving arizone runtime suspend
mfd: Correct tps65090 cell names
mfd: Remove gpio support from tps6586x core driver
ARM: tegra: defconfig: Enable tps6586x gpio
gpio: tps6586x: Add gpio support through platform driver
mfd: Cache tps6586x register through regmap
mfd: Use regmap for tps6586x register access.
mfd: Use devm managed resources for tps6586x
input: Add onkey support for 88PM80X PMIC
mfd: Add support for twl6041
mfd: Fix twl6040 revision information
mfd: Matches should be NULL when populate anatop child devices
input: ab8500-ponkey: Create AB8500 domain IRQ mapping
mfd: Add missing out of memory check for pcf50633
Documentation: Describe the AB8500 Device Tree bindings
mfd: Add tps65910 32-kHz-crystal-input init
mfd: Drop modifying mc13xxx driver's id_table in probe
...
2012-07-31 02:41:17 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK2CTRL,
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1),
|
|
|
|
1 << 1);
|
MFD bits for the 3.6 merge window.
We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQFpGVAAoJEIqAPN1PVmxKFNoP/1dkYngrxxV6cxdyLJ74APhG
lVKPgaDxQhdgfwCZJmMeZK1UphZo80cWnEXG6sTHZUEQdTaslSJu5SuPfUM+fo7e
52/dU0nx0ZE04pwPQLHbidS4TmHlbLg9oM2kmIf9RO5rg34GodwVgRL/4+k1qvhz
aWYJt9erFhQOpqaSX66mXHSuhvzHypbcE7d2B2Ykmh3NoYiH2w9H9KmIbbb+ZLq8
+Bp/i5Ys/vfooo+8IE2w6KZfIzMwsmmtWjjr/38yuQJaKZCh/zn23DM9HsdrVf++
RzfniRF4YBxmeKi7zi8MFIYys8filTCXA9dXbGSAKCuUCT37yZRnUxTeN1bn7Bux
A7KRpG7pUKQKVKqCTndvK5LcQKlT33XyW2ZzV1wVWX2JkCJ+gilPeykb8IabNvGX
nIp0STEGR/WdCLEAKo8pJF7Usn0RuUzAug02SG/mQ6dpnLoZqp0Od5W7gRhT7M7h
hXr/xKJ6cG5YwicpAdy5kJJ0dRgQrtaHwxrF0B68AXZ7CmAtkPuEGCYhUCFnGQUH
XJ0CodAqqVBRyYiQS4zIpIh2nqhIdsgv4OC1+kVLbubQk+PR88zG9Jvg6i1HQi/A
OHi7N5Wite3YUrs3sBzDKnEc/Il2YRhVaz2SLVNfZR0PS7hywHN3rK/tVFINTgei
jNEz1H6hu7ToNLfs0UzP
=c28c
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD bits from Samuel Ortiz:
"We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core."
Fix up mostly trivial conflicts, with the exception of
drivers/usb/host/ehci-omap.c in particular, which had some
re-organization of the reset sequence (commit 1a49e2ac9651: "EHCI:
centralize controller initialization") that clashed with commit
2761a6394516 ("mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix
issues").
In particular, commit 2761a6394516 moved the usb_add_hcd() to the
*middle* of the reset sequence, which clashes fairly badly with the
reset sequence re-organization (although it could have been done inside
the new omap_ehci_init() function).
I left that part of commit 2761a6394516 just undone.
* tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (110 commits)
mfd: Ensure AB8500 platform data is passed through db8500-prcmu to MFD Core
mfd: Arizone core should select MFD_CORE
mfd: Fix arizona-irq.c build by selecting REGMAP_IRQ
mfd: Add debug trace on entering and leaving arizone runtime suspend
mfd: Correct tps65090 cell names
mfd: Remove gpio support from tps6586x core driver
ARM: tegra: defconfig: Enable tps6586x gpio
gpio: tps6586x: Add gpio support through platform driver
mfd: Cache tps6586x register through regmap
mfd: Use regmap for tps6586x register access.
mfd: Use devm managed resources for tps6586x
input: Add onkey support for 88PM80X PMIC
mfd: Add support for twl6041
mfd: Fix twl6040 revision information
mfd: Matches should be NULL when populate anatop child devices
input: ab8500-ponkey: Create AB8500 domain IRQ mapping
mfd: Add missing out of memory check for pcf50633
Documentation: Describe the AB8500 Device Tree bindings
mfd: Add tps65910 32-kHz-crystal-input init
mfd: Drop modifying mc13xxx driver's id_table in probe
...
2012-07-31 02:41:17 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK3CTRL,
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1),
|
|
|
|
1 << 1);
|
MFD bits for the 3.6 merge window.
We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQFpGVAAoJEIqAPN1PVmxKFNoP/1dkYngrxxV6cxdyLJ74APhG
lVKPgaDxQhdgfwCZJmMeZK1UphZo80cWnEXG6sTHZUEQdTaslSJu5SuPfUM+fo7e
52/dU0nx0ZE04pwPQLHbidS4TmHlbLg9oM2kmIf9RO5rg34GodwVgRL/4+k1qvhz
aWYJt9erFhQOpqaSX66mXHSuhvzHypbcE7d2B2Ykmh3NoYiH2w9H9KmIbbb+ZLq8
+Bp/i5Ys/vfooo+8IE2w6KZfIzMwsmmtWjjr/38yuQJaKZCh/zn23DM9HsdrVf++
RzfniRF4YBxmeKi7zi8MFIYys8filTCXA9dXbGSAKCuUCT37yZRnUxTeN1bn7Bux
A7KRpG7pUKQKVKqCTndvK5LcQKlT33XyW2ZzV1wVWX2JkCJ+gilPeykb8IabNvGX
nIp0STEGR/WdCLEAKo8pJF7Usn0RuUzAug02SG/mQ6dpnLoZqp0Od5W7gRhT7M7h
hXr/xKJ6cG5YwicpAdy5kJJ0dRgQrtaHwxrF0B68AXZ7CmAtkPuEGCYhUCFnGQUH
XJ0CodAqqVBRyYiQS4zIpIh2nqhIdsgv4OC1+kVLbubQk+PR88zG9Jvg6i1HQi/A
OHi7N5Wite3YUrs3sBzDKnEc/Il2YRhVaz2SLVNfZR0PS7hywHN3rK/tVFINTgei
jNEz1H6hu7ToNLfs0UzP
=c28c
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD bits from Samuel Ortiz:
"We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core."
Fix up mostly trivial conflicts, with the exception of
drivers/usb/host/ehci-omap.c in particular, which had some
re-organization of the reset sequence (commit 1a49e2ac9651: "EHCI:
centralize controller initialization") that clashed with commit
2761a6394516 ("mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix
issues").
In particular, commit 2761a6394516 moved the usb_add_hcd() to the
*middle* of the reset sequence, which clashes fairly badly with the
reset sequence re-organization (although it could have been done inside
the new omap_ehci_init() function).
I left that part of commit 2761a6394516 just undone.
* tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (110 commits)
mfd: Ensure AB8500 platform data is passed through db8500-prcmu to MFD Core
mfd: Arizone core should select MFD_CORE
mfd: Fix arizona-irq.c build by selecting REGMAP_IRQ
mfd: Add debug trace on entering and leaving arizone runtime suspend
mfd: Correct tps65090 cell names
mfd: Remove gpio support from tps6586x core driver
ARM: tegra: defconfig: Enable tps6586x gpio
gpio: tps6586x: Add gpio support through platform driver
mfd: Cache tps6586x register through regmap
mfd: Use regmap for tps6586x register access.
mfd: Use devm managed resources for tps6586x
input: Add onkey support for 88PM80X PMIC
mfd: Add support for twl6041
mfd: Fix twl6040 revision information
mfd: Matches should be NULL when populate anatop child devices
input: ab8500-ponkey: Create AB8500 domain IRQ mapping
mfd: Add missing out of memory check for pcf50633
Documentation: Describe the AB8500 Device Tree bindings
mfd: Add tps65910 32-kHz-crystal-input init
mfd: Drop modifying mc13xxx driver's id_table in probe
...
2012-07-31 02:41:17 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK4CTRL,
|
regulator: s5m8767a: Support AP watchdog reset operation
The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.
Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v
Solution
- Basic concept:
After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-18 07:49:20 +07:00
|
|
|
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1),
|
|
|
|
1 << 1);
|
|
|
|
}
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
/* Initialize GPIO DVS registers */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
if (s5m8767->buck2_gpiodvs) {
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK2DVS1 + i,
|
2012-01-09 17:10:25 +07:00
|
|
|
s5m8767->buck2_vol[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s5m8767->buck3_gpiodvs) {
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK3DVS1 + i,
|
2012-01-09 17:10:25 +07:00
|
|
|
s5m8767->buck3_vol[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s5m8767->buck4_gpiodvs) {
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK4DVS1 + i,
|
2012-01-09 17:10:25 +07:00
|
|
|
s5m8767->buck4_vol[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s5m8767->buck2_ramp)
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x08, 0x08);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
if (s5m8767->buck3_ramp)
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x04, 0x04);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
if (s5m8767->buck4_ramp)
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x02, 0x02);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
if (s5m8767->buck2_ramp || s5m8767->buck3_ramp
|
|
|
|
|| s5m8767->buck4_ramp) {
|
|
|
|
switch (s5m8767->ramp_delay) {
|
2012-06-13 15:27:54 +07:00
|
|
|
case 5:
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-06-13 15:27:54 +07:00
|
|
|
0x40, 0xf0);
|
|
|
|
break;
|
|
|
|
case 10:
|
MFD bits for the 3.6 merge window.
We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQFpGVAAoJEIqAPN1PVmxKFNoP/1dkYngrxxV6cxdyLJ74APhG
lVKPgaDxQhdgfwCZJmMeZK1UphZo80cWnEXG6sTHZUEQdTaslSJu5SuPfUM+fo7e
52/dU0nx0ZE04pwPQLHbidS4TmHlbLg9oM2kmIf9RO5rg34GodwVgRL/4+k1qvhz
aWYJt9erFhQOpqaSX66mXHSuhvzHypbcE7d2B2Ykmh3NoYiH2w9H9KmIbbb+ZLq8
+Bp/i5Ys/vfooo+8IE2w6KZfIzMwsmmtWjjr/38yuQJaKZCh/zn23DM9HsdrVf++
RzfniRF4YBxmeKi7zi8MFIYys8filTCXA9dXbGSAKCuUCT37yZRnUxTeN1bn7Bux
A7KRpG7pUKQKVKqCTndvK5LcQKlT33XyW2ZzV1wVWX2JkCJ+gilPeykb8IabNvGX
nIp0STEGR/WdCLEAKo8pJF7Usn0RuUzAug02SG/mQ6dpnLoZqp0Od5W7gRhT7M7h
hXr/xKJ6cG5YwicpAdy5kJJ0dRgQrtaHwxrF0B68AXZ7CmAtkPuEGCYhUCFnGQUH
XJ0CodAqqVBRyYiQS4zIpIh2nqhIdsgv4OC1+kVLbubQk+PR88zG9Jvg6i1HQi/A
OHi7N5Wite3YUrs3sBzDKnEc/Il2YRhVaz2SLVNfZR0PS7hywHN3rK/tVFINTgei
jNEz1H6hu7ToNLfs0UzP
=c28c
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD bits from Samuel Ortiz:
"We have support for a few new drivers:
- Samsung s2mps11
- Wolfson Microelectronics wm5102 and wm5110
- Marvell 88PM800 and 88PM805
- TI twl6041
We also have our regular driver improvements:
- Device tree and IRQ domain support for STE AB8500
- Regmap and devm_* API conversion for TI tps6586x
- Device tree support for Samsung max77686
- devm_* API conversion for STE AB3100
Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
tps65090, da9052 and twl-core."
Fix up mostly trivial conflicts, with the exception of
drivers/usb/host/ehci-omap.c in particular, which had some
re-organization of the reset sequence (commit 1a49e2ac9651: "EHCI:
centralize controller initialization") that clashed with commit
2761a6394516 ("mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix
issues").
In particular, commit 2761a6394516 moved the usb_add_hcd() to the
*middle* of the reset sequence, which clashes fairly badly with the
reset sequence re-organization (although it could have been done inside
the new omap_ehci_init() function).
I left that part of commit 2761a6394516 just undone.
* tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (110 commits)
mfd: Ensure AB8500 platform data is passed through db8500-prcmu to MFD Core
mfd: Arizone core should select MFD_CORE
mfd: Fix arizona-irq.c build by selecting REGMAP_IRQ
mfd: Add debug trace on entering and leaving arizone runtime suspend
mfd: Correct tps65090 cell names
mfd: Remove gpio support from tps6586x core driver
ARM: tegra: defconfig: Enable tps6586x gpio
gpio: tps6586x: Add gpio support through platform driver
mfd: Cache tps6586x register through regmap
mfd: Use regmap for tps6586x register access.
mfd: Use devm managed resources for tps6586x
input: Add onkey support for 88PM80X PMIC
mfd: Add support for twl6041
mfd: Fix twl6040 revision information
mfd: Matches should be NULL when populate anatop child devices
input: ab8500-ponkey: Create AB8500 domain IRQ mapping
mfd: Add missing out of memory check for pcf50633
Documentation: Describe the AB8500 Device Tree bindings
mfd: Add tps65910 32-kHz-crystal-input init
mfd: Drop modifying mc13xxx driver's id_table in probe
...
2012-07-31 02:41:17 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-06-13 15:27:54 +07:00
|
|
|
0x90, 0xf0);
|
2012-01-12 13:57:09 +07:00
|
|
|
break;
|
2012-01-09 17:10:25 +07:00
|
|
|
case 25:
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-01-09 17:10:25 +07:00
|
|
|
0xd0, 0xf0);
|
2012-01-12 13:57:09 +07:00
|
|
|
break;
|
2012-01-09 17:10:25 +07:00
|
|
|
case 50:
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-01-09 17:10:25 +07:00
|
|
|
0xe0, 0xf0);
|
2012-01-12 13:57:09 +07:00
|
|
|
break;
|
2012-01-09 17:10:25 +07:00
|
|
|
case 100:
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-01-09 17:10:25 +07:00
|
|
|
0xf0, 0xf0);
|
2012-01-12 13:57:09 +07:00
|
|
|
break;
|
2012-01-09 17:10:25 +07:00
|
|
|
default:
|
2012-07-11 19:06:55 +07:00
|
|
|
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
|
2012-01-09 17:10:25 +07:00
|
|
|
0x90, 0xf0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < pdata->num_regulators; i++) {
|
2012-07-11 19:06:55 +07:00
|
|
|
const struct sec_voltage_desc *desc;
|
2012-01-09 17:10:25 +07:00
|
|
|
int id = pdata->regulators[i].id;
|
|
|
|
|
|
|
|
desc = reg_voltage_map[id];
|
2012-06-18 13:25:27 +07:00
|
|
|
if (desc) {
|
2012-01-09 17:10:25 +07:00
|
|
|
regulators[id].n_voltages =
|
|
|
|
(desc->max - desc->min) / desc->step + 1;
|
2012-06-18 13:25:27 +07:00
|
|
|
regulators[id].min_uV = desc->min;
|
|
|
|
regulators[id].uV_step = desc->step;
|
2013-01-18 08:55:06 +07:00
|
|
|
regulators[id].vsel_reg =
|
|
|
|
s5m8767_get_vsel_reg(id, s5m8767);
|
|
|
|
if (id < S5M8767_BUCK1)
|
|
|
|
regulators[id].vsel_mask = 0x3f;
|
|
|
|
else
|
|
|
|
regulators[id].vsel_mask = 0xff;
|
2012-06-18 13:25:27 +07:00
|
|
|
}
|
2012-01-09 17:10:25 +07:00
|
|
|
|
2012-04-04 06:50:22 +07:00
|
|
|
config.dev = s5m8767->dev;
|
|
|
|
config.init_data = pdata->regulators[i].initdata;
|
|
|
|
config.driver_data = s5m8767;
|
2013-01-18 08:55:06 +07:00
|
|
|
config.regmap = iodev->regmap;
|
2013-02-04 06:49:47 +07:00
|
|
|
config.of_node = pdata->regulators[i].reg_node;
|
2012-04-04 06:50:22 +07:00
|
|
|
|
|
|
|
rdev[i] = regulator_register(®ulators[id], &config);
|
2012-01-09 17:10:25 +07:00
|
|
|
if (IS_ERR(rdev[i])) {
|
|
|
|
ret = PTR_ERR(rdev[i]);
|
|
|
|
dev_err(s5m8767->dev, "regulator init failed for %d\n",
|
|
|
|
id);
|
|
|
|
rdev[i] = NULL;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
err:
|
|
|
|
for (i = 0; i < s5m8767->num_regulators; i++)
|
2013-04-27 12:58:08 +07:00
|
|
|
regulator_unregister(rdev[i]);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-20 01:26:10 +07:00
|
|
|
static int s5m8767_pmic_remove(struct platform_device *pdev)
|
2012-01-09 17:10:25 +07:00
|
|
|
{
|
|
|
|
struct s5m8767_info *s5m8767 = platform_get_drvdata(pdev);
|
|
|
|
struct regulator_dev **rdev = s5m8767->rdev;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < s5m8767->num_regulators; i++)
|
2013-04-27 12:58:08 +07:00
|
|
|
regulator_unregister(rdev[i]);
|
2012-01-09 17:10:25 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct platform_device_id s5m8767_pmic_id[] = {
|
|
|
|
{ "s5m8767-pmic", 0},
|
|
|
|
{ },
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(platform, s5m8767_pmic_id);
|
|
|
|
|
|
|
|
static struct platform_driver s5m8767_pmic_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "s5m8767-pmic",
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
},
|
|
|
|
.probe = s5m8767_pmic_probe,
|
2012-11-20 01:20:42 +07:00
|
|
|
.remove = s5m8767_pmic_remove,
|
2012-01-09 17:10:25 +07:00
|
|
|
.id_table = s5m8767_pmic_id,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init s5m8767_pmic_init(void)
|
|
|
|
{
|
|
|
|
return platform_driver_register(&s5m8767_pmic_driver);
|
|
|
|
}
|
|
|
|
subsys_initcall(s5m8767_pmic_init);
|
|
|
|
|
|
|
|
static void __exit s5m8767_pmic_exit(void)
|
|
|
|
{
|
|
|
|
platform_driver_unregister(&s5m8767_pmic_driver);
|
|
|
|
}
|
|
|
|
module_exit(s5m8767_pmic_exit);
|
|
|
|
|
|
|
|
/* Module information */
|
|
|
|
MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
|
|
|
|
MODULE_DESCRIPTION("SAMSUNG S5M8767 Regulator Driver");
|
|
|
|
MODULE_LICENSE("GPL");
|