int qpnp_power_get_property_mains(struct power_supply *psy, enum power_supply_property prop, union power_supply_propval *val) { struct opchg_charger *chip = container_of(psy, struct opchg_charger, dc_psy); switch (prop) { case POWER_SUPPLY_PROP_PRESENT: case POWER_SUPPLY_PROP_ONLINE: if (chip->charging_disabled) return 0; if( is_project(OPPO_14005)) { if((opchg_get_prop_fast_chg_started(chip) == true) || (opchg_get_prop_fast_switch_to_normal(chip) == true) || (opchg_get_fast_normal_to_warm(chip) == true)) { val->intval = 1; } else { if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; } } else { /* [email protected], 2014/02/11 Modify for when no battery gauge present */ if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; } #ifdef OPCHARGER_DEBUG_ENABLE pr_debug("oppo_debug dc charging and fast charging sign = %d\n",val->intval); #endif break; case POWER_SUPPLY_PROP_CURRENT_MAX: val->intval = chip->fastchg_current_max_ma * 1000;//chip->maxinput_dc_ma * 1000; break; default: return -EINVAL; } return 0; }
int qpnp_power_get_property_mains(struct power_supply *psy, enum power_supply_property prop, union power_supply_propval *val) { struct opchg_charger *chip = container_of(psy, struct opchg_charger, dc_psy); switch (prop) { case POWER_SUPPLY_PROP_PRESENT: case POWER_SUPPLY_PROP_ONLINE: if (chip->charging_disabled) return 0; #if 1 if(is_project(OPPO_14005)||is_project(OPPO_14023)||is_project(OPPO_15011)||is_project(OPPO_15018)) { if((opchg_get_prop_fast_chg_started(chip) == true) || (opchg_get_prop_fast_switch_to_normal(chip) == true) || (opchg_get_fast_normal_to_warm(chip) == true)) { val->intval = 1; } else { if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; } } else { /* [email protected], 2014/02/11 Modify for when no battery gauge present */ if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; } #ifdef OPCHARGER_DEBUG_ENABLE pr_debug("oppo_debug dc charging and fast charging sign = %d\n",val->intval); #endif #else if(is_project(OPPO_14005)||is_project(OPPO_14023)||is_project(OPPO_15011)) { if(opchg_get_prop_fast_chg_started(chip) == true) { // in fast charging val->intval = 1; //pr_debug("usb_online= %d,00000 usb_check_inout = %d,vooc_start_step= %d\r\n",val->intval,chip->chg_present,vooc_start_step); } else if(vooc_start_step < OPCHG_VOOC_TO_STANDARD) { // out of fast charging val->intval = 1; //pr_debug("usb_online= %d,1111 usb_check_inout = %d,vooc_start_step= %d\r\n",val->intval,chip->chg_present,vooc_start_step); } else { if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; //pr_debug("usb_online= %d,2222 usb_check_inout = %d,vooc_start_step= %d\r\n",val->intval,chip->chg_present,vooc_start_step); } } else { /* [email protected], 2014/02/11 Modify for when no battery gauge present */ if(qpnp_charger_type_get(chip) == POWER_SUPPLY_TYPE_USB_DCP) val->intval = 1; else val->intval = 0; } #endif /*CONFIG_BATTERY_BQ27541*/ break; case POWER_SUPPLY_PROP_CURRENT_MAX: val->intval = chip->fastchg_current_max_ma * 1000;//chip->maxinput_dc_ma * 1000; break; default: return -EINVAL; } return 0; }