mirror of
https://github.com/torvalds/linux.git
synced 2026-11-23 23:11:40 +00:00
Input: synaptics-rmi4 - make rmi_f34v7_erase_all() use the "erase all" command
A full erase is required to recover from error conditions like "Bad Partition Table". Various individual partition erase commands can be (and need to be) omitted, as they will fail until a new partition table has been written. Signed-off-by: Matthias Schiffer <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
This commit is contained in:
committed by
Dmitry Torokhov
parent
d316e709cd
commit
d8d007f25c
@@ -608,58 +608,6 @@ static int rmi_f34v7_check_bl_config_size(struct f34_data *f34)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rmi_f34v7_erase_config(struct f34_data *f34)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dev_info(&f34->fn->dev, "Erasing config...\n");
|
||||
|
||||
init_completion(&f34->v7.cmd_done);
|
||||
|
||||
switch (f34->v7.config_area) {
|
||||
case v7_UI_CONFIG_AREA:
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_CONFIG);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
case v7_DP_CONFIG_AREA:
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_DISP_CONFIG);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
case v7_BL_CONFIG_AREA:
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_BL_CONFIG);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rmi_f34v7_erase_guest_code(struct f34_data *f34)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dev_info(&f34->fn->dev, "Erasing guest code...\n");
|
||||
|
||||
init_completion(&f34->v7.cmd_done);
|
||||
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_GUEST_CODE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rmi_f34v7_erase_all(struct f34_data *f34)
|
||||
{
|
||||
int ret;
|
||||
@@ -668,7 +616,7 @@ static int rmi_f34v7_erase_all(struct f34_data *f34)
|
||||
|
||||
init_completion(&f34->v7.cmd_done);
|
||||
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_FIRMWARE);
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_ALL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -676,24 +624,6 @@ static int rmi_f34v7_erase_all(struct f34_data *f34)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
f34->v7.config_area = v7_UI_CONFIG_AREA;
|
||||
ret = rmi_f34v7_erase_config(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (f34->v7.has_display_cfg) {
|
||||
f34->v7.config_area = v7_DP_CONFIG_AREA;
|
||||
ret = rmi_f34v7_erase_config(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (f34->v7.has_guest_code) {
|
||||
ret = rmi_f34v7_erase_guest_code(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -897,17 +827,6 @@ static int rmi_f34v7_write_flash_config(struct f34_data *f34)
|
||||
|
||||
init_completion(&f34->v7.cmd_done);
|
||||
|
||||
ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_FLASH_CONFIG);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
|
||||
"%s: Erase flash config command written\n", __func__);
|
||||
|
||||
ret = rmi_f34v7_check_command_status(f34, F34_WRITE_WAIT_MS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = rmi_f34v7_write_config(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -937,10 +856,6 @@ static int rmi_f34v7_write_partition_table(struct f34_data *f34)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = rmi_f34v7_erase_config(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = rmi_f34v7_write_flash_config(f34);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user