summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c')
-rw-r--r--firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c b/firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c
index 65d1bc163f..9637ceef2f 100644
--- a/firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c
+++ b/firmware/target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c
@@ -86,7 +86,7 @@ void power_init(void)
86 (1 << AXP_SUPPLY_DCDC2) | /* LCD (1.2 V) */ 86 (1 << AXP_SUPPLY_DCDC2) | /* LCD (1.2 V) */
87 (1 << AXP_SUPPLY_DCDC3) | /* CPU (1.8 V) */ 87 (1 << AXP_SUPPLY_DCDC3) | /* CPU (1.8 V) */
88 (1 << AXP_SUPPLY_LDO2) | /* Touchscreen (3.3 V) */ 88 (1 << AXP_SUPPLY_LDO2) | /* Touchscreen (3.3 V) */
89 (1 << AXP_SUPPLY_LDO3)); /* not sure (2.5 V) */ 89 (1 << AXP_SUPPLY_LDO3)); /* USB analog (2.5 V) */
90 90
91 /* Enable required ADCs */ 91 /* Enable required ADCs */
92 axp_set_enabled_adcs( 92 axp_set_enabled_adcs(
@@ -98,6 +98,10 @@ void power_init(void)
98 (1 << AXP_ADC_INTERNAL_TEMP) | 98 (1 << AXP_ADC_INTERNAL_TEMP) |
99 (1 << AXP_ADC_APS_VOLTAGE)); 99 (1 << AXP_ADC_APS_VOLTAGE));
100 100
101 /* Configure USB charging */
102 axp_set_vhold_level(4400);
103 usb_charging_maxcurrent_change(100);
104
101 /* Delay to give power output time to stabilize */ 105 /* Delay to give power output time to stabilize */
102 mdelay(20); 106 mdelay(20);
103} 107}
@@ -105,7 +109,22 @@ void power_init(void)
105#ifdef HAVE_USB_CHARGING_ENABLE 109#ifdef HAVE_USB_CHARGING_ENABLE
106void usb_charging_maxcurrent_change(int maxcurrent) 110void usb_charging_maxcurrent_change(int maxcurrent)
107{ 111{
108 axp_set_charge_current(maxcurrent); 112 int vbus_limit;
113 int charge_current;
114
115 /* Note that the charge current setting is a maximum: it will be
116 * reduced dynamically by the AXP192 so the combined load is less
117 * than the set VBUS current limit. */
118 if(maxcurrent <= 100) {
119 vbus_limit = AXP_VBUS_LIMIT_100mA;
120 charge_current = 550;
121 } else {
122 vbus_limit = AXP_VBUS_LIMIT_500mA;
123 charge_current = 550;
124 }
125
126 axp_set_vbus_limit(vbus_limit);
127 axp_set_charge_current(charge_current);
109} 128}
110#endif 129#endif
111 130