diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-05 00:12:01 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-06 11:06:14 +0000 |
commit | e85bc74b307365e9a7b4adab51d646638db12fbd (patch) | |
tree | c45ba9079344b5cc0ea48a77b6aa77aacd71cdc5 /firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | |
parent | 695d1701cdd1bb4539f652c2204f7787097b2715 (diff) | |
download | rockbox-e85bc74b307365e9a7b4adab51d646638db12fbd.tar.gz rockbox-e85bc74b307365e9a7b4adab51d646638db12fbd.zip |
x1000: GPIO refactor
The GPIO API was pretty clunky and pin settings were decentralized,
making it hard to see what was happening and making GPIO stuff look
like a mess, frankly.
Instead of passing clunky (port, pin) pairs everywhere, GPIOs are now
identified with a single int. The extra overhead should be minimal as
GPIO configuration is generally not on a performance-critical path.
Pin assignments are now mostly consolidated in gpio-target.h and put
in various tables so gpio_init() can assign most pins at boot time.
Most drivers no longer need to touch GPIOs and basic pin I/O stuff
can happen without config since pins are put into the right state.
IRQ pins still need to be configured manually before use.
Change-Id: Ic5326284b0b2a2f613e9e76a41cb50e24af3aa47
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c index efc652c84f..47b5e3d6dc 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | |||
@@ -35,8 +35,6 @@ | |||
35 | # include "font.h" | 35 | # include "font.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #define FT_RST_PIN (1 << 15) | ||
39 | #define FT_INT_PIN (1 << 12) | ||
40 | #define ft_interrupt GPIOB12 | 38 | #define ft_interrupt GPIOB12 |
41 | 39 | ||
42 | /* Touch event types */ | 40 | /* Touch event types */ |
@@ -389,11 +387,13 @@ static void ft_init(void) | |||
389 | i2c_x1000_set_freq(FT6x06_BUS, I2C_FREQ_400K); | 387 | i2c_x1000_set_freq(FT6x06_BUS, I2C_FREQ_400K); |
390 | 388 | ||
391 | /* Reset chip */ | 389 | /* Reset chip */ |
392 | gpio_config(GPIO_B, FT_RST_PIN|FT_INT_PIN, GPIO_OUTPUT(0)); | 390 | gpio_set_level(GPIO_FT6x06_RESET, 0); |
393 | mdelay(5); | 391 | mdelay(5); |
394 | gpio_out_level(GPIO_B, FT_RST_PIN, 1); | 392 | gpio_set_level(GPIO_FT6x06_RESET, 1); |
395 | gpio_config(GPIO_B, FT_INT_PIN, GPIO_IRQ_EDGE(0)); | 393 | |
396 | gpio_enable_irq(GPIO_B, FT_INT_PIN); | 394 | /* Configure the interrupt pin */ |
395 | gpio_set_function(GPIO_FT6x06_INTERRUPT, GPIOF_IRQ_EDGE(0)); | ||
396 | gpio_enable_irq(GPIO_FT6x06_INTERRUPT); | ||
397 | } | 397 | } |
398 | 398 | ||
399 | void touchpad_set_sensitivity(int level) | 399 | void touchpad_set_sensitivity(int level) |
@@ -454,10 +454,6 @@ static void hp_detect_init(void) | |||
454 | /* Rockbox interface */ | 454 | /* Rockbox interface */ |
455 | void button_init_device(void) | 455 | void button_init_device(void) |
456 | { | 456 | { |
457 | /* Configure physical button GPIOs */ | ||
458 | gpio_config(GPIO_A, (1 << 17) | (1 << 19), GPIO_INPUT); | ||
459 | gpio_config(GPIO_B, (1 << 28) | (1 << 31), GPIO_INPUT); | ||
460 | |||
461 | /* Initialize touchpad */ | 457 | /* Initialize touchpad */ |
462 | ft_init(); | 458 | ft_init(); |
463 | 459 | ||