diff options
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/fiiom3k')
6 files changed, 50 insertions, 25 deletions
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c index 542d1745dc..8528b803f7 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c | |||
@@ -87,5 +87,5 @@ void audiohw_set_power_mode(int mode) | |||
87 | 87 | ||
88 | void ak4376_set_pdn_pin(int level) | 88 | void ak4376_set_pdn_pin(int level) |
89 | { | 89 | { |
90 | gpio_config(GPIO_A, 1 << 16, GPIO_OUTPUT(level ? 1 : 0)); | 90 | gpio_set_level(GPIO_AK4376_POWER, level ? 1 : 0); |
91 | } | 91 | } |
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 | ||
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/gpio-target.h b/firmware/target/mips/ingenic_x1000/fiiom3k/gpio-target.h new file mode 100644 index 0000000000..f580cd9167 --- /dev/null +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/gpio-target.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* Name Port Pins Function */ | ||
2 | DEFINE_PINGROUP(LCD_DATA, GPIO_A, 0xffff << 0, GPIOF_DEVICE(1)) | ||
3 | DEFINE_PINGROUP(LCD_CONTROL, GPIO_B, 0x1a << 16, GPIOF_DEVICE(1)) | ||
4 | DEFINE_PINGROUP(MSC0, GPIO_A, 0x3f << 20, GPIOF_DEVICE(1)) | ||
5 | DEFINE_PINGROUP(SFC, GPIO_A, 0x3f << 26, GPIOF_DEVICE(1)) | ||
6 | DEFINE_PINGROUP(I2S, GPIO_B, 0x1f << 0, GPIOF_DEVICE(1)) | ||
7 | DEFINE_PINGROUP(DMIC, GPIO_B, 3 << 21, GPIOF_DEVICE(0)) | ||
8 | DEFINE_PINGROUP(I2C0, GPIO_B, 3 << 23, GPIOF_DEVICE(0)) | ||
9 | DEFINE_PINGROUP(I2C1, GPIO_C, 3 << 26, GPIOF_DEVICE(0)) | ||
10 | DEFINE_PINGROUP(I2C2, GPIO_D, 3 << 0, GPIOF_DEVICE(1)) | ||
11 | |||
12 | /* Name Pin Function */ | ||
13 | DEFINE_GPIO(AK4376_POWER, GPIO_PA(16), GPIOF_OUTPUT(0)) | ||
14 | DEFINE_GPIO(BTN_PLAY, GPIO_PA(17), GPIOF_INPUT) | ||
15 | DEFINE_GPIO(BTN_VOL_UP, GPIO_PA(19), GPIOF_INPUT) | ||
16 | DEFINE_GPIO(MSC0_CD, GPIO_PB(6), GPIOF_INPUT) | ||
17 | DEFINE_GPIO(USB_ID, GPIO_PB(7), GPIOF_INPUT) | ||
18 | DEFINE_GPIO(AXP_IRQ, GPIO_PB(10), GPIOF_INPUT) | ||
19 | DEFINE_GPIO(USB_DETECT, GPIO_PB(11), GPIOF_INPUT) | ||
20 | DEFINE_GPIO(FT6x06_INTERRUPT, GPIO_PB(12), GPIOF_INPUT) | ||
21 | DEFINE_GPIO(FT6x06_RESET, GPIO_PB(15), GPIOF_OUTPUT(0)) | ||
22 | DEFINE_GPIO(LCD_RD, GPIO_PB(16), GPIOF_OUTPUT(1)) | ||
23 | DEFINE_GPIO(LCD_CE, GPIO_PB(18), GPIOF_OUTPUT(1)) | ||
24 | DEFINE_GPIO(USB_DRVVBUS, GPIO_PB(25), GPIOF_OUTPUT(0)) | ||
25 | DEFINE_GPIO(BTN_VOL_DOWN, GPIO_PB(28), GPIOF_INPUT) | ||
26 | DEFINE_GPIO(BTN_POWER, GPIO_PB(31), GPIOF_INPUT) | ||
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c index 96f794d7df..29e72286ff 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c | |||
@@ -25,9 +25,6 @@ | |||
25 | #include "gpio-x1000.h" | 25 | #include "gpio-x1000.h" |
26 | #include "system.h" | 26 | #include "system.h" |
27 | 27 | ||
28 | #define CS_PIN (1 << 18) | ||
29 | #define RD_PIN (1 << 16) | ||
30 | |||
31 | static const uint32_t fiio_lcd_cmd_enable[] = { | 28 | static const uint32_t fiio_lcd_cmd_enable[] = { |
32 | /* Software reset */ | 29 | /* Software reset */ |
33 | LCD_INSTR_CMD, 0x01, | 30 | LCD_INSTR_CMD, 0x01, |
@@ -169,17 +166,27 @@ const struct lcd_tgt_config lcd_tgt_config = { | |||
169 | void lcd_tgt_enable(bool enable) | 166 | void lcd_tgt_enable(bool enable) |
170 | { | 167 | { |
171 | if(enable) { | 168 | if(enable) { |
172 | gpio_config(GPIO_A, 0xffff, GPIO_DEVICE(1)); | 169 | /* reset controller, probably */ |
173 | gpio_config(GPIO_B, 0x1f << 16, GPIO_DEVICE(1)); | 170 | gpio_set_level(GPIO_LCD_CE, 1); |
174 | gpio_config(GPIO_B, CS_PIN|RD_PIN, GPIO_OUTPUT(1)); | 171 | gpio_set_level(GPIO_LCD_RD, 1); |
175 | mdelay(5); | 172 | mdelay(5); |
176 | gpio_out_level(GPIO_B, CS_PIN, 0); | 173 | gpio_set_level(GPIO_LCD_CE, 0); |
174 | |||
175 | /* set the clock whatever it is... */ | ||
177 | lcd_set_clock(X1000_CLK_SCLK_A, 30000000); | 176 | lcd_set_clock(X1000_CLK_SCLK_A, 30000000); |
177 | |||
178 | /* program the initial configuration */ | ||
178 | lcd_exec_commands(&fiio_lcd_cmd_enable[0]); | 179 | lcd_exec_commands(&fiio_lcd_cmd_enable[0]); |
179 | } else { | 180 | } else { |
181 | /* go to sleep mode first */ | ||
180 | lcd_exec_commands(&fiio_lcd_cmd_sleep[0]); | 182 | lcd_exec_commands(&fiio_lcd_cmd_sleep[0]); |
181 | mdelay(115); /* ensure we wait a total of 120ms before power off */ | 183 | |
182 | gpio_config(GPIO_B, CS_PIN|RD_PIN, 0); | 184 | /* ensure we wait a total of 120ms before power off */ |
185 | mdelay(115); | ||
186 | |||
187 | /* this is intended to power off the panel but I'm not sure it does */ | ||
188 | gpio_set_level(GPIO_LCD_CE, 0); | ||
189 | gpio_set_level(GPIO_LCD_RD, 0); | ||
183 | } | 190 | } |
184 | } | 191 | } |
185 | 192 | ||
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c index a7f6165980..6b1ad2dbb5 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #endif | 28 | #endif |
29 | #include "axp-pmu.h" | 29 | #include "axp-pmu.h" |
30 | #include "i2c-x1000.h" | 30 | #include "i2c-x1000.h" |
31 | #include "gpio-x1000.h" | ||
32 | 31 | ||
33 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 32 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
34 | { | 33 | { |
@@ -53,9 +52,6 @@ const unsigned short percent_to_volt_charge[11] = | |||
53 | 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 | 52 | 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 |
54 | }; | 53 | }; |
55 | 54 | ||
56 | #define AXP_IRQ_PORT GPIO_B | ||
57 | #define AXP_IRQ_PIN (1 << 10) | ||
58 | |||
59 | void power_init(void) | 55 | void power_init(void) |
60 | { | 56 | { |
61 | /* Initialize driver */ | 57 | /* Initialize driver */ |
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c index efea5aa323..85ce4da8f6 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c | |||
@@ -116,7 +116,7 @@ int spl_get_boot_option(void) | |||
116 | const int max_iter_count = 30; | 116 | const int max_iter_count = 30; |
117 | 117 | ||
118 | /* Configure the button GPIOs as inputs */ | 118 | /* Configure the button GPIOs as inputs */ |
119 | gpio_config(GPIO_A, pinmask, GPIO_INPUT); | 119 | gpioz_configure(GPIO_A, pinmask, GPIOF_INPUT); |
120 | 120 | ||
121 | /* Poll the pins for a short duration to detect a keypress */ | 121 | /* Poll the pins for a short duration to detect a keypress */ |
122 | do { | 122 | do { |