int sec_bat_check_cable_callback(void) { union power_supply_propval value; msleep(750); if (ta_int_gpio == 0) { pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n", __func__, current_cable_type); } else if (!mhl_connection_state()){ if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY && !gpio_get_value_cansleep(ta_int_gpio)) { pr_info("%s : VBUS IN\n", __func__); value.intval = POWER_SUPPLY_TYPE_UARTOFF<<ONLINE_TYPE_MAIN_SHIFT; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); return POWER_SUPPLY_TYPE_UARTOFF; } if ((current_cable_type == POWER_SUPPLY_TYPE_UARTOFF || current_cable_type == POWER_SUPPLY_TYPE_CARDOCK) && gpio_get_value_cansleep(ta_int_gpio)) { pr_info("%s : VBUS OUT\n", __func__); value.intval = POWER_SUPPLY_TYPE_BATTERY<<ONLINE_TYPE_MAIN_SHIFT; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); return POWER_SUPPLY_TYPE_BATTERY; } } return current_cable_type; }
static void sec_bat_initial_check(void) { union power_supply_propval value; msm8974_get_cable_type(); if (POWER_SUPPLY_TYPE_BATTERY < current_cable_type) { value.intval = current_cable_type<<ONLINE_TYPE_MAIN_SHIFT; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); } if (ta_int_gpio == 0) { pr_err("%s: ta_int_gpio is 0 or not assigned yet\n", __func__); } else { if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY && !gpio_get_value_cansleep(ta_int_gpio) && !mhl_connection_state()) { pr_info("%s : VBUS IN\n", __func__); value.intval = POWER_SUPPLY_TYPE_UARTOFF<<ONLINE_TYPE_MAIN_SHIFT; } if (value.intval) psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); } }
void cable_initial_check(struct sec_battery_info *battery) { union power_supply_propval value; pr_info("%s : current_cable_type : (%d)\n", __func__, current_cable_type); if (POWER_SUPPLY_TYPE_BATTERY != current_cable_type) { value.intval = current_cable_type; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); } else { psy_do_property(battery->pdata->charger_name, get, POWER_SUPPLY_PROP_ONLINE, value); if (value.intval == POWER_SUPPLY_TYPE_WIRELESS) { value.intval = 1; psy_do_property("wireless", set, POWER_SUPPLY_PROP_ONLINE, value); } if (battery->pdata->ta_irq_gpio == 0) { pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n", __func__, current_cable_type); } else { if (battery->wire_status == POWER_SUPPLY_TYPE_BATTERY && !gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) { #if defined(CONFIG_USB_SWITCH_FSA9485) if (!mhl_connection_state()) { #endif pr_info("%s : VBUS IN\n", __func__); value.intval = POWER_SUPPLY_TYPE_UARTOFF; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); current_cable_type = POWER_SUPPLY_TYPE_UARTOFF; #if defined(CONFIG_USB_SWITCH_FSA9485) } #endif } if ((battery->wire_status == POWER_SUPPLY_TYPE_UARTOFF || battery->wire_status == POWER_SUPPLY_TYPE_CARDOCK) && gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) { pr_info("%s : VBUS OUT\n", __func__); value.intval = POWER_SUPPLY_TYPE_BATTERY; psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value); current_cable_type = POWER_SUPPLY_TYPE_BATTERY; } } } }