diff options
Diffstat (limited to 'firmware/target/mips/ingenic_x1000')
4 files changed, 29 insertions, 27 deletions
diff --git a/firmware/target/mips/ingenic_x1000/debug-x1000.c b/firmware/target/mips/ingenic_x1000/debug-x1000.c index 74bbcd77a6..fe469b1a72 100644 --- a/firmware/target/mips/ingenic_x1000/debug-x1000.c +++ b/firmware/target/mips/ingenic_x1000/debug-x1000.c | |||
@@ -148,7 +148,9 @@ static bool dbg_cpuidle(void) | |||
148 | 148 | ||
149 | #ifdef FIIO_M3K | 149 | #ifdef FIIO_M3K |
150 | extern bool dbg_fiiom3k_touchpad(void); | 150 | extern bool dbg_fiiom3k_touchpad(void); |
151 | extern bool axp173_debug_menu(void); | 151 | #endif |
152 | #ifdef HAVE_AXP_PMU | ||
153 | extern bool axp_debug_menu(void); | ||
152 | #endif | 154 | #endif |
153 | 155 | ||
154 | /* Menu definition */ | 156 | /* Menu definition */ |
@@ -164,7 +166,9 @@ static const struct { | |||
164 | {"Audio", &dbg_audio}, | 166 | {"Audio", &dbg_audio}, |
165 | #ifdef FIIO_M3K | 167 | #ifdef FIIO_M3K |
166 | {"Touchpad", &dbg_fiiom3k_touchpad}, | 168 | {"Touchpad", &dbg_fiiom3k_touchpad}, |
167 | {"Power stats", &axp173_debug_menu}, | 169 | #endif |
170 | #ifdef HAVE_AXP_PMU | ||
171 | {"Power stats", &axp_debug_menu}, | ||
168 | #endif | 172 | #endif |
169 | }; | 173 | }; |
170 | 174 | ||
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c index 85ccc5cf65..efc652c84f 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "backlight.h" | 24 | #include "backlight.h" |
25 | #include "powermgmt.h" | 25 | #include "powermgmt.h" |
26 | #include "panic.h" | 26 | #include "panic.h" |
27 | #include "axp173.h" | 27 | #include "axp-pmu.h" |
28 | #include "gpio-x1000.h" | 28 | #include "gpio-x1000.h" |
29 | #include "i2c-x1000.h" | 29 | #include "i2c-x1000.h" |
30 | #include <string.h> | 30 | #include <string.h> |
@@ -418,7 +418,7 @@ static uint8_t hp_detect_reg = 0x00; | |||
418 | static int hp_detect_tmo_cb(struct timeout* tmo) | 418 | static int hp_detect_tmo_cb(struct timeout* tmo) |
419 | { | 419 | { |
420 | i2c_descriptor* d = (i2c_descriptor*)tmo->data; | 420 | i2c_descriptor* d = (i2c_descriptor*)tmo->data; |
421 | i2c_async_queue(AXP173_BUS, TIMEOUT_NOBLOCK, I2C_Q_ADD, 0, d); | 421 | i2c_async_queue(AXP_PMU_BUS, TIMEOUT_NOBLOCK, I2C_Q_ADD, 0, d); |
422 | return HPD_POLL_TIME; | 422 | return HPD_POLL_TIME; |
423 | } | 423 | } |
424 | 424 | ||
@@ -427,7 +427,7 @@ static void hp_detect_init(void) | |||
427 | static struct timeout tmo; | 427 | static struct timeout tmo; |
428 | static const uint8_t gpio_reg = AXP192_REG_GPIOSTATE1; | 428 | static const uint8_t gpio_reg = AXP192_REG_GPIOSTATE1; |
429 | static i2c_descriptor desc = { | 429 | static i2c_descriptor desc = { |
430 | .slave_addr = AXP173_ADDR, | 430 | .slave_addr = AXP_PMU_ADDR, |
431 | .bus_cond = I2C_START | I2C_STOP, | 431 | .bus_cond = I2C_START | I2C_STOP, |
432 | .tran_mode = I2C_READ, | 432 | .tran_mode = I2C_READ, |
433 | .buffer[0] = (void*)&gpio_reg, | 433 | .buffer[0] = (void*)&gpio_reg, |
@@ -440,10 +440,10 @@ static void hp_detect_init(void) | |||
440 | }; | 440 | }; |
441 | 441 | ||
442 | /* Headphone detect is wired to AXP192 GPIO: set it to input state */ | 442 | /* Headphone detect is wired to AXP192 GPIO: set it to input state */ |
443 | i2c_reg_write1(AXP173_BUS, AXP173_ADDR, AXP192_REG_GPIO2FUNCTION, 0x01); | 443 | i2c_reg_write1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP192_REG_GPIO2FUNCTION, 0x01); |
444 | 444 | ||
445 | /* Get an initial reading before startup */ | 445 | /* Get an initial reading before startup */ |
446 | int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, gpio_reg); | 446 | int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, gpio_reg); |
447 | if(r >= 0) | 447 | if(r >= 0) |
448 | hp_detect_reg = r; | 448 | hp_detect_reg = r; |
449 | 449 | ||
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/i2c-target.h b/firmware/target/mips/ingenic_x1000/fiiom3k/i2c-target.h index a389d2af42..1e8ebfbb15 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/i2c-target.h +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/i2c-target.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #define FT6x06_BUS 1 | 31 | #define FT6x06_BUS 1 |
32 | #define FT6x06_ADDR 0x38 | 32 | #define FT6x06_ADDR 0x38 |
33 | 33 | ||
34 | #define AXP173_BUS 2 | 34 | #define AXP_PMU_BUS 2 |
35 | #define AXP173_ADDR 0x34 | 35 | #define AXP_PMU_ADDR 0x34 |
36 | 36 | ||
37 | #endif /* __I2C_TARGET_H__ */ | 37 | #endif /* __I2C_TARGET_H__ */ |
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c index c346d16890..a7f6165980 100644 --- a/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #ifdef HAVE_USB_CHARGING_ENABLE | 26 | #ifdef HAVE_USB_CHARGING_ENABLE |
27 | # include "usb_core.h" | 27 | # include "usb_core.h" |
28 | #endif | 28 | #endif |
29 | #include "axp173.h" | 29 | #include "axp-pmu.h" |
30 | #include "i2c-x1000.h" | 30 | #include "i2c-x1000.h" |
31 | #include "gpio-x1000.h" | 31 | #include "gpio-x1000.h" |
32 | 32 | ||
@@ -53,32 +53,32 @@ const unsigned short percent_to_volt_charge[11] = | |||
53 | 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 | 53 | 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 |
54 | }; | 54 | }; |
55 | 55 | ||
56 | #define AXP173_IRQ_PORT GPIO_B | 56 | #define AXP_IRQ_PORT GPIO_B |
57 | #define AXP173_IRQ_PIN (1 << 10) | 57 | #define AXP_IRQ_PIN (1 << 10) |
58 | 58 | ||
59 | void power_init(void) | 59 | void power_init(void) |
60 | { | 60 | { |
61 | /* Initialize driver */ | 61 | /* Initialize driver */ |
62 | i2c_x1000_set_freq(2, I2C_FREQ_400K); | 62 | i2c_x1000_set_freq(2, I2C_FREQ_400K); |
63 | axp173_init(); | 63 | axp_init(); |
64 | 64 | ||
65 | /* Set lowest sample rate */ | 65 | /* Set lowest sample rate */ |
66 | axp173_adc_set_rate(AXP173_ADC_RATE_25HZ); | 66 | axp_adc_set_rate(AXP_ADC_RATE_25HZ); |
67 | 67 | ||
68 | /* Ensure battery voltage ADC is enabled */ | 68 | /* Ensure battery voltage ADC is enabled */ |
69 | int bits = axp173_adc_get_enabled(); | 69 | int bits = axp_adc_get_enabled(); |
70 | bits |= (1 << ADC_BATTERY_VOLTAGE); | 70 | bits |= (1 << ADC_BATTERY_VOLTAGE); |
71 | axp173_adc_set_enabled(bits); | 71 | axp_adc_set_enabled(bits); |
72 | 72 | ||
73 | /* Turn on all power outputs */ | 73 | /* Turn on all power outputs */ |
74 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, | 74 | i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR, |
75 | AXP173_REG_PWROUTPUTCTRL, 0, 0x5f, NULL); | 75 | AXP_REG_PWROUTPUTCTRL2, 0, 0x5f, NULL); |
76 | i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, | 76 | i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR, |
77 | AXP173_REG_DCDCWORKINGMODE, 0, 0xc0, NULL); | 77 | AXP_REG_DCDCWORKINGMODE, 0, 0xc0, NULL); |
78 | 78 | ||
79 | /* Set the default charging current. This is the same as the | 79 | /* Set the default charging current. This is the same as the |
80 | * OF's setting, although it's not strictly within the USB spec. */ | 80 | * OF's setting, although it's not strictly within the USB spec. */ |
81 | axp173_set_charge_current(780); | 81 | axp_set_charge_current(780); |
82 | 82 | ||
83 | /* Short delay to give power outputs time to stabilize */ | 83 | /* Short delay to give power outputs time to stabilize */ |
84 | mdelay(5); | 84 | mdelay(5); |
@@ -87,7 +87,7 @@ void power_init(void) | |||
87 | #ifdef HAVE_USB_CHARGING_ENABLE | 87 | #ifdef HAVE_USB_CHARGING_ENABLE |
88 | void usb_charging_maxcurrent_change(int maxcurrent) | 88 | void usb_charging_maxcurrent_change(int maxcurrent) |
89 | { | 89 | { |
90 | axp173_set_charge_current(maxcurrent); | 90 | axp_set_charge_current(maxcurrent); |
91 | } | 91 | } |
92 | #endif | 92 | #endif |
93 | 93 | ||
@@ -97,18 +97,16 @@ void adc_init(void) | |||
97 | 97 | ||
98 | void power_off(void) | 98 | void power_off(void) |
99 | { | 99 | { |
100 | /* Set the shutdown bit */ | 100 | axp_power_off(); |
101 | i2c_reg_setbit1(AXP173_BUS, AXP173_ADDR, | ||
102 | AXP173_REG_SHUTDOWNLEDCTRL, 7, 1, NULL); | ||
103 | while(1); | 101 | while(1); |
104 | } | 102 | } |
105 | 103 | ||
106 | bool charging_state(void) | 104 | bool charging_state(void) |
107 | { | 105 | { |
108 | return axp173_battery_status() == AXP173_BATT_CHARGING; | 106 | return axp_battery_status() == AXP_BATT_CHARGING; |
109 | } | 107 | } |
110 | 108 | ||
111 | int _battery_voltage(void) | 109 | int _battery_voltage(void) |
112 | { | 110 | { |
113 | return axp173_adc_read(ADC_BATTERY_VOLTAGE); | 111 | return axp_adc_read(ADC_BATTERY_VOLTAGE); |
114 | } | 112 | } |