Ejemplo n.º 1
0
void otg_accessory_power(int enable)
{
	u8 on = (u8)!!enable;

	/* max77803 otg power control */
	otg_control(enable);

	pr_info("%s: otg accessory power = %d\n", __func__, on);
}
Ejemplo n.º 2
0
static void sii9234_otg_control(bool onoff)
{
	otg_control(onoff);

	gpio_request(GPIO_OTG_EN, "USB_OTG_EN");
	gpio_direction_output(GPIO_OTG_EN, onoff);
	gpio_free(GPIO_OTG_EN);

	printk(KERN_INFO "[MHL] %s: onoff =%d\n", __func__, onoff);

	return;
}
Ejemplo n.º 3
0
static void otg_accessory_power(int enable)
{
	u8 on = (u8)!!enable;

	/* max77693 otg power control */
	otg_control(enable);

	gpio_request(GPIO_OTG_EN, "USB_OTG_EN");
	gpio_direction_output(GPIO_OTG_EN, on);
	gpio_free(GPIO_OTG_EN);
	pr_info("%s: otg accessory power = %d\n", __func__, on);
}
Ejemplo n.º 4
0
void otg_accessory_power(int enable)
{
    u8 on = (u8)!!enable;

    /* USB3.0 Redriver gpio setting Disable Redriver always works USB2.0
    if(system_rev >= 6)
    	usb30_redriver_en(enable);
    */
    /* max77803 otg power control */
    otg_control(enable);

    pr_info("%s: otg accessory power = %d\n", __func__, on);
}
static void otg_accessory_power(int enable)
{
	u8 on = (u8)!!enable;

	/* max77693 otg power control */
	otg_control(enable);

#if defined(CONFIG_FAST_BOOT)
	if (fake_shut_down) {
		gpio_request(GPIO_OTG_EN, "USB_OTG_EN");
		gpio_direction_output(GPIO_OTG_EN, 0);
		gpio_free(GPIO_OTG_EN);
	} else {
#endif
		gpio_request(GPIO_OTG_EN, "USB_OTG_EN");
		gpio_direction_output(GPIO_OTG_EN, on);
		gpio_free(GPIO_OTG_EN);
#if defined(CONFIG_FAST_BOOT)
	}
#endif
	pr_info("%s: otg accessory power = %d\n", __func__, on);
}
static void muic_mhl_cb(bool otg_enable, int plim)
{
	union power_supply_propval value;
	int i, ret = 0;
	struct power_supply *psy;
	int current_cable_type = POWER_SUPPLY_TYPE_MISC;
	int sub_type = ONLINE_SUB_TYPE_MHL;
	int power_type = ONLINE_POWER_TYPE_UNKNOWN;
	int muic_cable_type = max77803_muic_get_charging_type();

	pr_info("%s: muic cable_type = %d\n",
		__func__, muic_cable_type);
	switch (muic_cable_type) {
	case CABLE_TYPE_SMARTDOCK_MUIC:
	case CABLE_TYPE_SMARTDOCK_TA_MUIC:
	case CABLE_TYPE_SMARTDOCK_USB_MUIC:
		return;
	default:
		break;
	}
	pr_info("muic_mhl_cb:otg_enable=%d, plim=%d\n", otg_enable, plim);

	if (plim == 0x00) {
		pr_info("TA charger 500mA\n");
		power_type = ONLINE_POWER_TYPE_MHL_500;
	} else if (plim == 0x01) {
		pr_info("TA charger 900mA\n");
		power_type = ONLINE_POWER_TYPE_MHL_900;
	} else if (plim == 0x02) {
		pr_info("TA charger 1500mA\n");
		power_type = ONLINE_POWER_TYPE_MHL_1500;
	} else if (plim == 0x03) {
		pr_info("USB charger\n");
		power_type = ONLINE_POWER_TYPE_USB;
	} else
		current_cable_type = POWER_SUPPLY_TYPE_BATTERY;

	if (otg_enable) {
		psy_do_property("sec-charger", get,
					POWER_SUPPLY_PROP_ONLINE, value);
		pr_info("sec-charger : %d\n", value.intval);
		if (value.intval == POWER_SUPPLY_TYPE_BATTERY ||
				value.intval == POWER_SUPPLY_TYPE_WPC) {
			if (!lpcharge) {
				otg_control(true);
				current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
				power_type = ONLINE_POWER_TYPE_UNKNOWN;
			}
		}
	} else
		otg_control(false);

	for (i = 0; i < 10; i++) {
		psy = power_supply_get_by_name("battery");
		if (psy)
			break;
	}
	if (i == 10) {
		pr_err("%s: fail to get battery ps\n", __func__);
		return;
	}

	value.intval = current_cable_type<<ONLINE_TYPE_MAIN_SHIFT
		| sub_type<<ONLINE_TYPE_SUB_SHIFT
		| power_type<<ONLINE_TYPE_PWR_SHIFT;
	ret = psy->set_property(psy, POWER_SUPPLY_PROP_ONLINE,
		&value);
	if (ret) {
		pr_err("%s: fail to set power_suppy ONLINE property(%d)\n",
			__func__, ret);
	}
}