Ejemplo n.º 1
0
static ssize_t print_switch_state(struct switch_dev *sdev, char *buf)
{
	int usbstatus;

	if( mtp_power_off == 1 )
	{
		dmsg("USB power off for MTP\n");
		mtp_power_off = 0;
		return sprintf(buf, "%s\n", "RemoveOffline");
	}

	usbstatus = FSA9480_Get_USB_Status();

	dmsg("usbstatus = 0x%x, currentusbstatus = 0x%x\n", usbstatus, currentusbstatus);

	if(usbstatus){
		#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash
		if(currentusbstatus == USBSTATUS_VTP)
			return sprintf(buf, "%s\n", "RemoveOffline");
		else
		#endif	
			if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB) )
			return sprintf(buf, "%s\n", "ums online");
		else
			return sprintf(buf, "%s\n", "InsertOffline");
	}
	else{
		if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB))
			return sprintf(buf, "%s\n", "ums offline");
		else
			return sprintf(buf, "%s\n", "RemoveOffline");
	}		
}
Ejemplo n.º 2
0
static ssize_t tethering_switch_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
	int usbstatus;
	usbstatus = FSA9480_Get_USB_Status();
	dmsg("usbstatus = 0x%x, currentusbstatus = 0x%x\n", usbstatus, currentusbstatus);

	if (strncmp(buf, "1", 1) == 0)
	{
		dmsg("tethering On\n");

		g_tethering = 1;
		usb_switch_select(USBSTATUS_VTP);
		UsbIndicator(0);
	}
	else if (strncmp(buf, "0", 1) == 0)
	{
		dmsg("tethering Off\n");

		g_tethering = 0;
		usb_switch_select(oldusbstatus);
		if(usbstatus)
			UsbIndicator(1);
	}

	return size;
}
Ejemplo n.º 3
0
static ssize_t print_switch_state(struct switch_dev *sdev, char *buf)
{
    int usbstatus;

    if( mtp_power_off == 1 )
    {
        printk("USB power off for MTP\n");
        mtp_power_off = 0;
        return sprintf(buf, "%s\n", "RemoveOffline");
    }

    usbstatus = FSA9480_Get_USB_Status();

//TODO : each platform require different noti
#if 0 //froyo default
    if(usbstatus) {
        return sprintf(buf, "%s\n", "online");
    }
    else {
        return sprintf(buf, "%s\n", "offline");
    }
#elif 1 //P1
    if(usbstatus) {
        if(currentusbstatus == USBSTATUS_VTP)
            return sprintf(buf, "%s\n", "RemoveOffline");
        else if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB))
            return sprintf(buf, "%s\n", "ums online");
        else
            return sprintf(buf, "%s\n", "InsertOffline");
    }
    else {
        if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB))
            return sprintf(buf, "%s\n", "ums offline");
        else
            return sprintf(buf, "%s\n", "RemoveOffline");
    }
#else //S1
    if(usbstatus) {
        if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB))
            return sprintf(buf, "%s\n", "InsertOnline");
        else
            return sprintf(buf, "%s\n", "InsertOffline");
    }
    else {
        if((currentusbstatus== USBSTATUS_UMS) || (currentusbstatus== USBSTATUS_ADB))
            return sprintf(buf, "%s\n", "RemoveOnline");
        else
            return sprintf(buf, "%s\n", "RemoveOffline");
    }
#endif
}
Ejemplo n.º 4
0
static void connectivity_switching_init(struct work_struct *ignored)
{
	int usb_sel, uart_sel, samsung_kies_sel, ums_sel, mtp_sel, vtp_sel, askon_sel;
	int lpm_mode_check = charging_mode_get();
	switch_sel = 0;

	dmsg("\n");

	if (sec_get_param_value) {
		sec_get_param_value(__SWITCH_SEL, &switch_sel);
		cancel_delayed_work(&switch_init_work);
	}
	else {
		schedule_delayed_work(&switch_init_work, msecs_to_jiffies(100));		
		return;
	}

	if(BOOTUP) {
		BOOTUP = 0; 
		otg_phy_init(); //USB Power on after boot up.
	}

	usb_sel = switch_sel & (int)(USB_SEL_MASK);
	uart_sel = (switch_sel & (int)(UART_SEL_MASK)) >> 1;
	samsung_kies_sel = (switch_sel & (int)(USB_SAMSUNG_KIES_MASK)) >> 2;
	ums_sel = (switch_sel & (int)(USB_UMS_MASK)) >> 3;
	mtp_sel = (switch_sel & (int)(USB_MTP_MASK)) >> 4;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash	
	vtp_sel = (switch_sel & (int)(USB_VTP_MASK)) >> 5;
#endif
	askon_sel = (switch_sel & (int)(USB_ASKON_MASK)) >> 6;

	printk("\n[WJ] %s, %s, switch_sel=%d\n", __FILE__, __FUNCTION__, switch_sel);

	if( samsung_kies_sel )	currentusbstatus = USBSTATUS_SAMSUNG_KIES;
	else if(ums_sel) 		currentusbstatus = USBSTATUS_UMS;
	else if(mtp_sel) 		currentusbstatus = USBSTATUS_MTPONLY;
	else if(askon_sel) 		currentusbstatus = USBSTATUS_ASKON;

	if((switch_sel == 0x1) || (factoryresetstatus == 0xAE)) {
		PathSelStore(AP_USB_MODE);
		Ap_Cp_Switch_Config(AP_USB_MODE);	
		usb_switching_value_update(SWITCH_PDA);

		PathSelStore(CP_UART_MODE);
		Ap_Cp_Switch_Config(CP_UART_MODE);	
		uart_switching_value_update(SWITCH_MODEM);
	}
	else {
		if(usb_sel) {
			Ap_Cp_Switch_Config(AP_USB_MODE);	
			usb_switching_value_update(SWITCH_PDA);
		}
		else {
			if(MicroJigUARTOffStatus) {
				Ap_Cp_Switch_Config(AP_USB_MODE);
			}
			else {
				Ap_Cp_Switch_Config(CP_USB_MODE);	
				usb_switching_value_update(SWITCH_MODEM);
			}
		}
	
		if(uart_sel) {
			Ap_Cp_Switch_Config(AP_UART_MODE);	
			uart_switching_value_update(SWITCH_PDA);
		}
		else {
			Ap_Cp_Switch_Config(CP_UART_MODE);	
			uart_switching_value_update(SWITCH_MODEM);
		}
	}

/*Turn off usb power when LPM mode*/
	if(lpm_mode_check)
		otg_phy_off();
			
	switching_value_update();

	if((switch_sel == 1) || (factoryresetstatus == 0xAE)) {
		usb_switch_select(USBSTATUS_SAMSUNG_KIES);
		mtp_mode_on = 1;
		ap_usb_power_on(0);
		UsbMenuSelStore(0);	
	}
	else {
		if(usb_sel) {
				if(samsung_kies_sel) {
					usb_switch_select(USBSTATUS_SAMSUNG_KIES);
					/*USB Power off till MTP Appl launching*/
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
					//mtp_mode_on = 1;
					//ap_usb_power_on(0);
#else
					mtp_mode_on = 1;
					ap_usb_power_on(0);
#endif
				}
				else if(mtp_sel) {
					usb_switch_select(USBSTATUS_MTPONLY);
					/*USB Power off till MTP Appl launching*/
					mtp_mode_on = 1;
					ap_usb_power_on(0);
				}
				else if(ums_sel) {
					usb_switch_select(USBSTATUS_UMS);
				}
		#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash
			else if(vtp_sel) {
				usb_switch_select(USBSTATUS_VTP);
			}
		#endif		
				else if(askon_sel) {
					usb_switch_select(USBSTATUS_ASKON);
			}
		}
	}

	if(!FSA9480_Get_USB_Status()) {
		s3c_usb_cable(1);
		mdelay(5);
		s3c_usb_cable(0);
	}
    else {
		s3c_usb_cable(1);
        indicator_dev.state = 1;
    }

	dmsg("switch_sel : 0x%x\n", switch_sel);
	microusb_uart_status(1);
	
    connectivity_switching_init_state=1;

}