MSM8909 + Android5 --- DC cannot wake up the system, cannot charge, and the charging indication is abnormal

Source: Internet
Author: User

MSM8909 + Android5 --- DC cannot wake up the system, cannot charge, and the charging indication is abnormal

DC charger: There are only 5 V And GND cables. That is to say, the USB detection D + and D-are suspended.

1. Access the DC charger to display the charging icon, but there is no problem with the lightning logo

/Frameworks/base/services/core/java/com/android/server/BatteryService. sendIntentLocked () function in java // intent. putExtra (BatteryManager. EXTRA_PLUGGED, mPlugType); // kandi mark // kandi add if (mBatteryProps. batteryStatus = BatteryManager. BATTERY_STATUS_CHARGING | mBatteryProps. batteryStatus = BatteryManager. BATTERY_STATUS_FULL) {intent. putExtra (BatteryManager. EXTRA_PLUGGED, mPlugType | BatteryManager. BATTERY_PLUGGED_AC | BatteryManager. BATTERY_PLUGGED_USB | BatteryManager. BATTERY_PLUGGED_WIRELESS);} else {intent. putExtra (BatteryManager. EXTRA_PLUGGED, BATTERY_PLUGGED_NONE );}

This function is broadcast by ACTION_BATTERY_CHANGED. The above solution is provided by our core board manufacturer, but there are several problems:

(1) Whether it is AC, USB, WIRELESS or DC, the Battery status of the device displays Charging.

Because of mPlugType, AC, USB, or WIRELESS, the APP layer determines the type as unknown. For details, see \ packages \ apps \ Settings \ src \ com \ android \ setting \ Utils. java onReceive () Code

public static String getBatteryStatus(Resources res, IntentbatteryChangedIntent) {       final Intent intent = batteryChangedIntent;        int plugType = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);       int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,               BatteryManager.BATTERY_STATUS_UNKNOWN);       String statusString;       if (status == BatteryManager.BATTERY_STATUS_CHARGING) {           int resId;           if (plugType == BatteryManager.BATTERY_PLUGGED_AC) {                resId =R.string.battery_info_status_charging_ac;           } else if (plugType == BatteryManager.BATTERY_PLUGGED_USB) {                resId =R.string.battery_info_status_charging_usb;           } else if (plugType == BatteryManager.BATTERY_PLUGGED_WIRELESS) {                resId =R.string.battery_info_status_charging_wireless;           } else {                resId =R.string.battery_info_status_charging;//Charging           }           statusString = res.getString(resId);       } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) {           statusString = res.getString(R.string.battery_info_status_discharging);       } else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {           statusString =res.getString(R.string.battery_info_status_not_charging);       } else if (status == BatteryManager.BATTERY_STATUS_FULL) {           statusString = res.getString(R.string.battery_info_status_full);       } else {           statusString = res.getString(R.string.battery_info_status_unknown);       }        return statusString;    }

(2) if it is full, a lightning mark is displayed. For details, see the conditions in if.

2. DC cannot be charged

Although the display charging, but the actual cannot charge, the solution provided by the manufacturer is in the kernel \ drivers \ power \ qpnp-linear-charger.c

Add the following code to the qpnp_batt_external_power_changed function:

if (qpnp_lbc_is_usb_chg_plugged_in(chip)) {              chip->usb_psy->get_property(chip->usb_psy,                            POWER_SUPPLY_PROP_CURRENT_MAX,&ret);              current_ma= ret.intval / 1000;               pr_debug("simcomcurent ma =%d \n",current_ma);              //kandiadd start              chip->usb_psy->get_property(chip->usb_psy,                            POWER_SUPPLY_PROP_TYPE,&ret);              pr_debug("simcomusb type =%d \n",ret.intval);                           if(USB_SDP_CHARGER== ret.intval ){    // already checked asusb                     current_ma=500;              }elseif (USB_DCP_CHARGER == ret.intval ||  USB_CDP_CHARGER == ret.intval){   // checked as AC                     current_ma=1500;              }else{                     current_ma=1500;   //charging and can't  be reginazed, type as DC,              }              //kandiadd end

3. Failed to wake up the system when the sleeping status is connected to DC

\ Kernel \ drivers \ usb \ phy \ phy-msm-usb.c to floated_charger_enable assigned to 1 can solve this problem, that is:

Static bool floated_charger_enable = 1;

For the relevant code, see the following in the case of USB_CHG_STATE_DCD_DONE of msm_chg_detect_work:

if (line_state) /* DP > VLGC or/and DM> VLGC */                            motg->chg_type= USB_PROPRIETARY_CHARGER;                     elseif (!dcd && floated_charger_enable)                            motg->chg_type= USB_FLOATED_CHARGER;                     else                            motg->chg_type= USB_SDP_CHARGER;                      motg->chg_state= USB_CHG_STATE_DETECTED;                     delay= 0;

Floated charger is enabled, and the corresponding chg_type is USB_FLOATED_CHARGER. If this type is used, REMAP it to Handler through msm_otg_policy_chg_type (),/* Dedicated Charging Port */, and then send it to the user layer.

After this problem is solved, it is normal that no additional code needs to be added in both the preceding sections.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.