summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-05-23 15:20:07 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-06-01 00:26:20 +0100
commit2066465b78ab737f0a9e7388adc4a97b4e4d904e (patch)
treec2391e0fe1599daa0218738faa58d124e54ac640
parent663c5268ace48cc4be03b4c43355038f06d4b3c5 (diff)
FiiO M3K: minor fixes
- Drop obsolete NAND patch script (it's simpler to use 'dd' directly) - Remove an outdated comment - Fix missing 'void' in a function definition - Reset the poweroff timer when we poke the backlight Change-Id: I752624386f30ac95f41a731d2b6be837e12275a9
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c1
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c4
-rwxr-xr-xutils/fiio_m3k_tools/nand_patcher.py69
3 files changed, 3 insertions, 71 deletions
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c
index f02fcaaee8..a158f615e0 100644
--- a/firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c
+++ b/firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c
@@ -43,7 +43,6 @@ bool backlight_hw_init(void)
pwm_enable(BL_BTN_CHN);
backlight_hw_brightness(MAX_BRIGHTNESS_SETTING);
buttonlight_hw_brightness(MAX_BRIGHTNESS_SETTING);
- /* TODO: avoid buttonlight flicker when powering up the machine */
return true;
}
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
index b5193152a2..85ccc5cf65 100644
--- a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
+++ b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
@@ -22,6 +22,7 @@
#include "button.h"
#include "kernel.h"
#include "backlight.h"
+#include "powermgmt.h"
#include "panic.h"
#include "axp173.h"
#include "gpio-x1000.h"
@@ -313,6 +314,7 @@ static void ft_step_state(uint32_t t, int evt, int tx, int ty)
/* Poke the backlight */
backlight_on();
buttonlight_on();
+ reset_poweroff_timer();
fsm.orig_x = fsm.cur_x;
fsm.orig_y = fsm.cur_y;
@@ -481,7 +483,7 @@ int button_read_device(void)
return r;
}
-bool headphones_inserted()
+bool headphones_inserted(void)
{
return hp_detect_reg & 0x40 ? true : false;
}
diff --git a/utils/fiio_m3k_tools/nand_patcher.py b/utils/fiio_m3k_tools/nand_patcher.py
deleted file mode 100755
index 261a4de678..0000000000
--- a/utils/fiio_m3k_tools/nand_patcher.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python3
-
-import sys
-
-IMAGE_SIZE = 128 * 1024 # image is an 128 KiB erase block
-SPL_SIZE = 12 * 1024 # SPL is at most 12 KiB
-BOOT_SIZE = 102 * 1024 # bootloader at most 102 KiB
-BOOT_OFF = 26 * 1024 # offset of bootloader in image
-BOOT_END = BOOT_OFF+BOOT_SIZE
-
-def patch(in_path, boot_path, spl_path, out_path):
- # Open the input files
- in_file = open(in_path, 'rb')
- boot_file = open(boot_path, 'rb')
- spl_file = open(spl_path, 'rb')
-
- # Read the data
- in_data = in_file.read()
- boot_data = boot_file.read()
- spl_data = spl_file.read()
-
- # Close input files
- in_file.close()
- boot_file.close()
- spl_file.close()
-
- if len(in_data) != IMAGE_SIZE:
- print("error: input image is %d bytes, expected %d" % (len(in_data), IMAGE_SIZE))
- sys.exit(1)
-
- if len(spl_data) > SPL_SIZE:
- print("error: SPL is %d bytes, maximum is %d" % (len(spl_data), SPL_SIZE))
- sys.exit(1)
-
- if len(boot_data) > BOOT_SIZE:
- print("error: bootloader is %d bytes, maximum is %d" % (len(boot_data), SPL_SIZE))
- sys.exit(1)
-
- print('Patching input image %s' % in_path)
- print('- SPL size %d' % len(spl_data))
- print('- Boot size %d' % len(boot_data))
-
- # Construct output image
- out_data = b''
- out_data += spl_data
- out_data += b'\xff' * (SPL_SIZE - len(spl_data))
- out_data += in_data[SPL_SIZE:BOOT_OFF]
- out_data += boot_data
- out_data += b'\xff' * (BOOT_SIZE - len(boot_data))
-
- # Sanity check
- assert( len(out_data) == IMAGE_SIZE )
-
- # Write output
- print('Writing output image %s' % out_path)
- out_file = open(out_path, 'wb')
- out_file.write(out_data)
- out_file.close()
-
-
-def main():
- if len(sys.argv) != 5:
- print("usage: nand_patcher.py IN_FILE BOOT_FILE SPL_FILE OUT_FILE")
- sys.exit(1)
-
- patch(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
-
-if __name__ == '__main__':
- main()