Skip to content

Commit

Permalink
power: oplus_vooc: Condtionally skip reading header/footer from vooc fw
Browse files Browse the repository at this point in the history
OOS seems to be loading firmware while skipping the 80 byte header due to its userspace modifications, Custom ROMs do not skip that 80 byte header which results in vooc fw not being loaded. Fix this by checking if the firmware_data still has the 80 byte header after reading it from sysfs firmware file so that we can skip the header/footer if not already done.

Co-authored-by: Abhay Singh Gill <[email protected]>
Suggested-by: jabashque <[email protected]>
Signed-off-by: Abhay Singh Gill <[email protected]>
  • Loading branch information
jabashque and HELLBOY017 committed Mar 8, 2023
1 parent 5ebb5a1 commit f6cfac0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/power/oplus/oplus_vooc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,11 @@ void fw_update_thread(struct work_struct *work)
chip->firmware_data = fw->data;
chip->fw_data_count = fw->size;
chip->fw_data_version = chip->firmware_data[chip->fw_data_count - 4];
if(!!strstr(chip->firmware_data, "FwUp")) {
chip->firmware_data = fw->data + 80 /* header */;
chip->fw_data_count = fw->size - 80 /* header */ - 128 /* footer */;
chip->fw_data_version = chip->firmware_data[chip->fw_data_count - 4];
}
chg_debug("count:0x%x, version:0x%x\n",
chip->fw_data_count,chip->fw_data_version);
if(chip->vops->fw_check_then_recover) {
Expand Down Expand Up @@ -2136,6 +2141,11 @@ void fw_update_thread_fix(struct work_struct *work)
chip->firmware_data = fw->data;
chip->fw_data_count = fw->size;
chip->fw_data_version = chip->firmware_data[chip->fw_data_count - 4];
if(!!strstr(chip->firmware_data, "FwUp")) {
chip->firmware_data = fw->data + 80 /* header */;
chip->fw_data_count = fw->size - 80 /* header */ - 128 /* footer */;
chip->fw_data_version = chip->firmware_data[chip->fw_data_count - 4];
}
chg_debug("count:0x%x, version:0x%x\n",
chip->fw_data_count, chip->fw_data_version);
if(chip->vops->fw_check_then_recover_fix) {
Expand Down

0 comments on commit f6cfac0

Please sign in to comment.