diff options
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | 10 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c index db5ece10b0..e27e0be464 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | |||
@@ -23,13 +23,14 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "backlight.h" | 24 | #include "backlight.h" |
25 | #include "panic.h" | 25 | #include "panic.h" |
26 | #include "lcd.h" | 26 | #include "axp173.h" |
27 | #include "gpio-x1000.h" | 27 | #include "gpio-x1000.h" |
28 | #include "i2c-x1000.h" | 28 | #include "i2c-x1000.h" |
29 | #include <string.h> | 29 | #include <string.h> |
30 | #include <stdbool.h> | 30 | #include <stdbool.h> |
31 | 31 | ||
32 | #ifndef BOOTLOADER | 32 | #ifndef BOOTLOADER |
33 | # include "lcd.h" | ||
33 | # include "font.h" | 34 | # include "font.h" |
34 | #endif | 35 | #endif |
35 | 36 | ||
@@ -409,7 +410,7 @@ static int hp_detect_tmo_cb(struct timeout* tmo) | |||
409 | static void hp_detect_init(void) | 410 | static void hp_detect_init(void) |
410 | { | 411 | { |
411 | static struct timeout tmo; | 412 | static struct timeout tmo; |
412 | static const uint8_t gpio_reg = 0x94; | 413 | static const uint8_t gpio_reg = AXP192_REG_GPIOSTATE1; |
413 | static i2c_descriptor desc = { | 414 | static i2c_descriptor desc = { |
414 | .slave_addr = AXP173_ADDR, | 415 | .slave_addr = AXP173_ADDR, |
415 | .bus_cond = I2C_START | I2C_STOP, | 416 | .bus_cond = I2C_START | I2C_STOP, |
@@ -423,9 +424,8 @@ static void hp_detect_init(void) | |||
423 | .next = NULL, | 424 | .next = NULL, |
424 | }; | 425 | }; |
425 | 426 | ||
426 | /* Headphone detect is wired to an undocumented GPIO on the AXP173. | 427 | /* Headphone detect is wired to AXP192 GPIO: set it to input state */ |
427 | * This sets it to input mode so we can see the pin state. */ | 428 | i2c_reg_write1(AXP173_BUS, AXP173_ADDR, AXP192_REG_GPIO2FUNCTION, 0x01); |
428 | i2c_reg_write1(AXP173_BUS, AXP173_ADDR, 0x93, 0x01); | ||
429 | 429 | ||
430 | /* Get an initial reading before startup */ | 430 | /* Get an initial reading before startup */ |
431 | int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, gpio_reg); | 431 | int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, gpio_reg); |
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c index b4923835aa..a3760d145a 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c | |||
@@ -68,8 +68,14 @@ void power_init(void) | |||
68 | axp173_adc_set_enabled(bits); | 68 | axp173_adc_set_enabled(bits); |
69 | 69 | ||
70 | /* Turn on all power outputs */ | 70 | /* Turn on all power outputs */ |
71 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, 0x12, 0, 0x5f, NULL); | 71 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, |
72 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, 0x80, 0, 0xc0, NULL); | 72 | AXP173_REG_PWROUTPUTCTRL, 0, 0x5f, NULL); |
73 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, | ||
74 | AXP173_REG_DCDCWORKINGMODE, 0, 0xc0, NULL); | ||
75 | |||
76 | /* Set the default charging current. This is the same as the | ||
77 | * OF's setting, although it's not strictly within the USB spec. */ | ||
78 | axp173_set_charge_current(780); | ||
73 | 79 | ||
74 | /* Short delay to give power outputs time to stabilize */ | 80 | /* Short delay to give power outputs time to stabilize */ |
75 | mdelay(5); | 81 | mdelay(5); |
@@ -82,7 +88,8 @@ void adc_init(void) | |||
82 | void power_off(void) | 88 | void power_off(void) |
83 | { | 89 | { |
84 | /* Set the shutdown bit */ | 90 | /* Set the shutdown bit */ |
85 | i2c_reg_setbit1(AXP173_BUS, AXP173_ADDR, 0x32, 7, 1, NULL); | 91 | i2c_reg_setbit1(AXP173_BUS, AXP173_ADDR, |
92 | AXP173_REG_SHUTDOWNLEDCTRL, 7, 1, NULL); | ||
86 | while(1); | 93 | while(1); |
87 | } | 94 | } |
88 | 95 | ||