mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
mfd: rk806: The shutdown pin of RK806 is configurable
Configure which pin controls the shutdown function via the shutown_by_pwrctrln property in the DTS. Change-Id: I7bb3adf28ff7e93fd318d08274cb88271b925027 Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
This commit is contained in:
@@ -789,6 +789,18 @@ static int rk806_parse_dt(struct rk806 *rk806)
|
||||
if (device_property_read_bool(dev, "vdc-wakeup-enable"))
|
||||
pdata->vdc_wakeup_enable = 1;
|
||||
|
||||
ret = device_property_read_u32(dev,
|
||||
"shutown_by_pwrctrln",
|
||||
&pdata->shutown_by_pwrctrln);
|
||||
if (ret < 0) {
|
||||
dev_info(dev, "shutown_by_pwrctrln missing!\n");
|
||||
pdata->shutown_by_pwrctrln = 1;
|
||||
}
|
||||
if ((pdata->shutown_by_pwrctrln < 1) || (pdata->shutown_by_pwrctrln > 3)) {
|
||||
dev_err(dev, "shutown_by_pwrctrln out [1 3]!\n");
|
||||
pdata->shutown_by_pwrctrln = 1;
|
||||
}
|
||||
|
||||
pdata->shutdown_sequence = devm_kzalloc(dev,
|
||||
RK806_ID_END * sizeof(int),
|
||||
GFP_KERNEL);
|
||||
|
||||
@@ -1252,9 +1252,19 @@ static void rk806_regulator_shutdown(struct platform_device *pdev)
|
||||
|
||||
if (system_state == SYSTEM_POWER_OFF) {
|
||||
rk806_shutdown_requence_config(rk806);
|
||||
rk806_field_write(rk806, PWRCTRL1_FUN, PWRCTRL_NULL_FUN);
|
||||
rk806_field_write(rk806, PWRCTRL1_POL, POL_HIGH);
|
||||
rk806_field_write(rk806, PWRCTRL1_FUN, PWRCTRL_POWOFF_FUN);
|
||||
if (rk806->pdata->shutown_by_pwrctrln == 2) {
|
||||
rk806_field_write(rk806, PWRCTRL2_FUN, PWRCTRL_NULL_FUN);
|
||||
rk806_field_write(rk806, PWRCTRL2_POL, POL_HIGH);
|
||||
rk806_field_write(rk806, PWRCTRL2_FUN, PWRCTRL_POWOFF_FUN);
|
||||
} else if (rk806->pdata->shutown_by_pwrctrln == 3) {
|
||||
rk806_field_write(rk806, PWRCTRL3_FUN, PWRCTRL_NULL_FUN);
|
||||
rk806_field_write(rk806, PWRCTRL3_POL, POL_HIGH);
|
||||
rk806_field_write(rk806, PWRCTRL3_FUN, PWRCTRL_POWOFF_FUN);
|
||||
} else {
|
||||
rk806_field_write(rk806, PWRCTRL1_FUN, PWRCTRL_NULL_FUN);
|
||||
rk806_field_write(rk806, PWRCTRL1_POL, POL_HIGH);
|
||||
rk806_field_write(rk806, PWRCTRL1_FUN, PWRCTRL_POWOFF_FUN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -505,6 +505,7 @@ struct rk806_platform_data {
|
||||
int hotdie_temperture_threshold;
|
||||
int vdc_wakeup_enable;
|
||||
|
||||
int shutown_by_pwrctrln;
|
||||
int *shutdown_sequence;
|
||||
int *vb_shutdown_sequence;
|
||||
int *dvs_control_suspend;
|
||||
|
||||
Reference in New Issue
Block a user