mirror of
https://github.com/torvalds/linux.git
synced 2024-09-20 23:13:00 +00:00
mfd: rk808: RK818 uses DEV_OFF to power off supplies
DEV_OFF and DEV_OFF_RST functions for RK808 are designed error that only DEV_OFF_RST can power off supplies. RK818 has been fixed this issue, so that DEV_OFF is used to power off supplies. Signed-off-by: Jianhong Chen <chenjh@rock-chips.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
a893764ca8
commit
b2e2c85091
|
@ -290,6 +290,24 @@ static void rk808_device_shutdown(void)
|
||||||
dev_err(&rk808_i2c_client->dev, "power off error!\n");
|
dev_err(&rk808_i2c_client->dev, "power off error!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rk818_device_shutdown(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
|
||||||
|
|
||||||
|
if (!rk808) {
|
||||||
|
dev_warn(&rk808_i2c_client->dev,
|
||||||
|
"have no rk818, so do nothing here\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = regmap_update_bits(rk808->regmap,
|
||||||
|
RK818_DEVCTRL_REG,
|
||||||
|
DEV_OFF, DEV_OFF);
|
||||||
|
if (ret)
|
||||||
|
dev_err(&rk808_i2c_client->dev, "power off error!\n");
|
||||||
|
}
|
||||||
|
|
||||||
static const struct of_device_id rk808_of_match[] = {
|
static const struct of_device_id rk808_of_match[] = {
|
||||||
{ .compatible = "rockchip,rk808" },
|
{ .compatible = "rockchip,rk808" },
|
||||||
{ .compatible = "rockchip,rk818" },
|
{ .compatible = "rockchip,rk818" },
|
||||||
|
@ -304,6 +322,7 @@ static int rk808_probe(struct i2c_client *client,
|
||||||
struct rk808 *rk808;
|
struct rk808 *rk808;
|
||||||
const struct rk808_reg_data *pre_init_reg;
|
const struct rk808_reg_data *pre_init_reg;
|
||||||
const struct mfd_cell *cells;
|
const struct mfd_cell *cells;
|
||||||
|
void (*pm_pwroff_fn)(void);
|
||||||
int nr_pre_init_regs;
|
int nr_pre_init_regs;
|
||||||
int nr_cells;
|
int nr_cells;
|
||||||
int pm_off = 0;
|
int pm_off = 0;
|
||||||
|
@ -331,6 +350,7 @@ static int rk808_probe(struct i2c_client *client,
|
||||||
nr_pre_init_regs = ARRAY_SIZE(rk808_pre_init_reg);
|
nr_pre_init_regs = ARRAY_SIZE(rk808_pre_init_reg);
|
||||||
cells = rk808s;
|
cells = rk808s;
|
||||||
nr_cells = ARRAY_SIZE(rk808s);
|
nr_cells = ARRAY_SIZE(rk808s);
|
||||||
|
pm_pwroff_fn = rk808_device_shutdown;
|
||||||
break;
|
break;
|
||||||
case RK818_ID:
|
case RK818_ID:
|
||||||
rk808->regmap_cfg = &rk818_regmap_config;
|
rk808->regmap_cfg = &rk818_regmap_config;
|
||||||
|
@ -339,6 +359,7 @@ static int rk808_probe(struct i2c_client *client,
|
||||||
nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg);
|
nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg);
|
||||||
cells = rk818s;
|
cells = rk818s;
|
||||||
nr_cells = ARRAY_SIZE(rk818s);
|
nr_cells = ARRAY_SIZE(rk818s);
|
||||||
|
pm_pwroff_fn = rk818_device_shutdown;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(&client->dev, "Unsupported RK8XX ID %lu\n",
|
dev_err(&client->dev, "Unsupported RK8XX ID %lu\n",
|
||||||
|
@ -393,7 +414,7 @@ static int rk808_probe(struct i2c_client *client,
|
||||||
"rockchip,system-power-controller");
|
"rockchip,system-power-controller");
|
||||||
if (pm_off && !pm_power_off) {
|
if (pm_off && !pm_power_off) {
|
||||||
rk808_i2c_client = client;
|
rk808_i2c_client = client;
|
||||||
pm_power_off = rk808_device_shutdown;
|
pm_power_off = pm_pwroff_fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -290,6 +290,7 @@ enum rk818_reg {
|
||||||
#define SWITCH2_EN BIT(6)
|
#define SWITCH2_EN BIT(6)
|
||||||
#define SWITCH1_EN BIT(5)
|
#define SWITCH1_EN BIT(5)
|
||||||
#define DEV_OFF_RST BIT(3)
|
#define DEV_OFF_RST BIT(3)
|
||||||
|
#define DEV_OFF BIT(0)
|
||||||
|
|
||||||
#define VB_LO_ACT BIT(4)
|
#define VB_LO_ACT BIT(4)
|
||||||
#define VB_LO_SEL_3500MV (7 << 0)
|
#define VB_LO_SEL_3500MV (7 << 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user