static void instinctq_pm_power_off(void)
{
	int	mode = REBOOT_MODE_NONE;
	char reset_mode = 'r';
	int cnt = 0;

//	if (!gpio_get_value(GPIO_TA_CONNECTED_N)) {	/* Reboot Charging */
	if (0) {	// FIXME: TA_CONNECTED GPIO unknown
		mode = REBOOT_MODE_CHARGING;
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);
		/* Watchdog Reset */
		printk(KERN_EMERG "%s: TA is connected, rebooting...\n", __func__);
		arch_reset(reset_mode);
		printk(KERN_EMERG "%s: waiting for reset!\n", __func__);
	}
	else {	/* Power Off or Reboot */
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);
		if (get_usb_cable_state() & (JIG_UART_ON | JIG_UART_OFF | JIG_USB_OFF | JIG_USB_ON)) {
			/* Watchdog Reset */
			printk(KERN_EMERG "%s: JIG is connected, rebooting...\n", __func__);
			arch_reset(reset_mode);
			printk(KERN_EMERG "%s: waiting for reset!\n", __func__);
		}
		else {
			/* POWER_N -> Input */
			gpio_direction_input(GPIO_POWER_N);
			/* PHONE_ACTIVE -> Input */
			gpio_direction_input(GPIO_PHONE_ACTIVE);
			/* Check Power Off Condition */
			if (!gpio_get_value(GPIO_POWER_N) || gpio_get_value(GPIO_PHONE_ACTIVE)) {
				/* Wait Power Button Release */
				printk(KERN_EMERG "%s: waiting for GPIO_POWER_N high.\n", __func__);
				while (!gpio_get_value(GPIO_POWER_N)); 

				/* Wait Phone Power Off */
				printk(KERN_EMERG "%s: waiting for GPIO_PHONE_ACTIVE low.\n", __func__);
				while (gpio_get_value(GPIO_PHONE_ACTIVE)) {
					if (cnt++ < 5) {
						printk(KERN_EMERG "%s: GPIO_PHONE_ACTIVE is high(%d)\n", __func__, cnt);
						mdelay(1000);
					} else {
						printk(KERN_EMERG "%s: GPIO_PHONE_ACTIVE TIMED OUT!!!\n", __func__);
						break;
					}
				}	
			}
			/* PS_HOLD -> Output Low */
			printk(KERN_EMERG "%s: setting GPIO_PDA_PS_HOLD low.\n", __func__);
			gpio_direction_output(GPIO_PDA_PS_HOLD, GPIO_LEVEL_HIGH);
			s3c_gpio_setpull(GPIO_PDA_PS_HOLD, S3C_GPIO_PULL_NONE);
			gpio_set_value(GPIO_PDA_PS_HOLD, GPIO_LEVEL_LOW);

			printk(KERN_EMERG "%s: should not reach here!\n", __func__);
		}
	}

	while (1);
}
Beispiel #2
0
static ssize_t uart_switch_store
(
	struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t size
)
{
	int switch_sel;
	int console_mode;
	int path_save = 1;

	if (sec_get_param_value)
	{
		sec_get_param_value(__SWITCH_SEL, &switch_sel);
		sec_get_param_value(__CONSOLE_MODE, &console_mode);
	}

	if (strstr(buf, "PDA") || strstr(buf, "pda"))
	{
		if(uart_current_owner != SWITCH_PDA)
		{
			sio_switch_config(AP_UART_MODE);
		}
		uart_current_owner = SWITCH_PDA;
		switch_sel |= UART_SEL_MASK;
		console_mode = 1;
		printk("[UART Switch] Path : PDA\n");
	}
	else if (strstr(buf, "MODEM") || strstr(buf, "modem"))
	{
		if(uart_current_owner != SWITCH_MODEM)
		{
			sio_switch_config(CP_UART_MODE);
		}
		uart_current_owner = SWITCH_MODEM;
		switch_sel &= ~UART_SEL_MASK;
		console_mode = 0;
		printk("[UART Switch] Path : MODEM\n");
	}

	if(strstr(buf, "NOSAVE") || strstr(buf, "nosave"))
	{
		path_save = 0;
		printk("[UART Switch] path is not saved\n");
	}

	if(path_save)
	{
		if (sec_set_param_value)
		{
			sec_set_param_value(__SWITCH_SEL, &switch_sel);
			sec_set_param_value(__CONSOLE_MODE, &console_mode);
		}
	}

	return size;
}
static void spica_pm_power_off(void)
{
	int	mode = REBOOT_MODE_NONE;
	char reset_mode = 'r';

	if (!gpio_get_value(GPIO_TA_CONNECTED_N)) {	/* Reboot Charging */
		mode = REBOOT_MODE_CHARGING;
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);
		/* Watchdog Reset */
		arch_reset(reset_mode);
	}
	else {	/* Power Off or Reboot */
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);

		if (get_usb_cable_state() & (JIG_UART_ON | JIG_UART_OFF | JIG_USB_OFF | JIG_USB_ON)) {
			/* Watchdog Reset */
			arch_reset(reset_mode);
		}
		else {
			/* POWER_N -> Input */
			gpio_direction_input(GPIO_POWER_N);
			/* VREG_MSMP_26V -> Input */
			//gpio_direction_input(GPIO_VREG_MSMP_26V);
			/* Check Power Off Condition */
			//if (!gpio_get_value(GPIO_POWER_N)) {// || gpio_get_value(GPIO_VREG_MSMP_26V)) {
				while (!gpio_get_value(GPIO_POWER_N));  /* Wait Power Button Release */
#if 0
				/* Wait Phone Power Off */	
				while (gpio_get_value(GPIO_VREG_MSMP_26V)); 
#endif	
			//}

			if (!gpio_get_value(GPIO_TA_CONNECTED_N) || !gpio_get_value(GPIO_TA_CHG_N) ) {
				mode = REBOOT_MODE_CHARGING;
				if (sec_set_param_value)
					sec_set_param_value(__REBOOT_MODE, &mode);
				/* Watchdog Reset */
				arch_reset(reset_mode);			
			}
			else
			{
				msleep(50);
				if (sec_set_param_value)
					sec_set_param_value(__REBOOT_MODE, &mode);				
				/* PS_HOLD -> Output Low */
				gpio_direction_output(GPIO_PDA_PS_HOLD, GPIO_LEVEL_HIGH);
				s3c_gpio_setpull(GPIO_PDA_PS_HOLD, S3C_GPIO_PULL_NONE);
				gpio_set_value(GPIO_PDA_PS_HOLD, GPIO_LEVEL_LOW);
			}
		}
	}

	while (1);
}
static ssize_t usb_sel_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);

	printk("\n");

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &(secsw->switch_sel));

	if(strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0) {
		usb_switch_mode(secsw, SWITCH_PDA);
//		usb_switching_value_update(SWITCH_PDA);
		secsw->switch_sel |= USB_SEL_MASK;
	}

	if(strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {
		usb_switch_mode(secsw, SWITCH_MODEM);
//		usb_switching_value_update(SWITCH_MODEM);
		secsw->switch_sel &= ~USB_SEL_MASK;
	}

//	switching_value_update();

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &(secsw->switch_sel));

	// update shared variable.
	if(secsw->pdata && secsw->pdata->set_switch_status)
		secsw->pdata->set_switch_status(secsw->switch_sel);

	return size;
static ssize_t uart_switch_store(struct device *dev, struct device_attribute *attr,	const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &(secsw->switch_sel));

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0) {
		gpio_set_value(GPIO_UART_SEL, 1);
//		uart_switching_value_update(SWITCH_PDA);
		secsw->uart_owner = 1;
		secsw->switch_sel |= UART_SEL_MASK;
		printk("[UART Switch] Path : PDA\n");
	}

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {
		gpio_set_value(GPIO_UART_SEL, 0);
//		uart_switching_value_update(SWITCH_MODEM);
		secsw->uart_owner = 0;
		secsw->switch_sel &= ~UART_SEL_MASK;
		printk("[UART Switch] Path : MODEM\n");
	}

//	switching_value_update();

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &(secsw->switch_sel));

	// update shared variable.
	if(secsw->pdata && secsw->pdata->set_switch_status)
		secsw->pdata->set_switch_status(secsw->switch_sel);

	return size;
Beispiel #6
0
static ssize_t uart_switch_store(struct device *dev, struct device_attribute *attr,	const char *buf, size_t size)
{	
	int switch_sel = 1;

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &switch_sel);

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0)	{		
		gpio_set_value(GPIO_UART_SEL, GPIO_LEVEL_HIGH);		
		uart_current_owner = 1;		
		switch_sel |= UART_SEL_MASK;
		printk("[UART Switch] Path : PDA\n");	
	}	

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {		
		gpio_set_value(GPIO_UART_SEL, GPIO_LEVEL_LOW);		
		uart_current_owner = 0;		
		switch_sel &= ~UART_SEL_MASK;
		printk("[UART Switch] Path : MODEM\n");	
	}	

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &switch_sel);

	return size;
}
Beispiel #7
0
static ssize_t uart_sel_store(struct device *dev, struct device_attribute *attr,
				 const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0) {
		gpio_set_value(GPIO_UART_SEL, 1);
		secsw->switch_sel |= UART_SEL_MASK;
		pr_debug("[UART Switch] Path : PDA\n");
	}

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {
		gpio_set_value(GPIO_UART_SEL, 0);
		secsw->switch_sel &= ~UART_SEL_MASK;
		pr_debug("[UART Switch] Path : MODEM\n");
	}

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &secsw->switch_sel);

	return size;
}
Beispiel #8
0
static ssize_t usb_sel_store(
		struct device *dev, struct device_attribute *attr,
		const char *buf, size_t size)
{
	dmsg("\n");

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &switch_sel);

	if(strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0)
	{
		usb_switch_mode(SWITCH_PDA);
		usb_switching_value_update(SWITCH_PDA);
		switch_sel |= USB_SEL_MASK;
	}

	if(strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0)
	{
		usb_switch_mode(SWITCH_MODEM);
		usb_switching_value_update(SWITCH_MODEM);		
		switch_sel &= ~USB_SEL_MASK;
	}

	switching_value_update();

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &switch_sel);

	microusb_uart_status(0);

	return size;
}
Beispiel #9
0
static ssize_t uart_switch_store(struct device *dev, struct device_attribute *attr,	const char *buf, size_t size)
{	

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &switch_sel);

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0)	{		
		Ap_Cp_Switch_Config(AP_UART_MODE);
		uart_switching_value_update(SWITCH_PDA);
		uart_current_owner = 1;		
		switch_sel |= UART_SEL_MASK;
		printk("[UART Switch] Path : PDA\n");	
	}	

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {		
		Ap_Cp_Switch_Config(CP_UART_MODE);
		uart_switching_value_update(SWITCH_MODEM);
		uart_current_owner = 0;		
		switch_sel &= ~UART_SEL_MASK;
		printk("[UART Switch] Path : MODEM\n");	
	}

	switching_value_update();	

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &switch_sel);

	return size;
}
Beispiel #10
0
void UsbMenuSelStore(int sel)
{
    if (sec_get_param_value)
        sec_get_param_value(__SWITCH_SEL, &switch_sel);

    if(sel == 0) {
        switch_sel &= ~(int)USB_UMS_MASK;
        switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_ARIES_NTT) // disable tethering xmoondash
        switch_sel &= ~(int)USB_VTP_MASK;
#endif
        switch_sel &= ~(int)USB_ASKON_MASK;
        switch_sel |= (int)USB_SAMSUNG_KIES_MASK;
    }
    else if(sel == 1) {
        switch_sel &= ~(int)USB_UMS_MASK;
        switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
#if !defined(CONFIG_ARIES_NTT) // disable tethering xmoondash
        switch_sel &= ~(int)USB_VTP_MASK;
#endif
        switch_sel &= ~(int)USB_ASKON_MASK;
        switch_sel |= (int)USB_MTP_MASK;
    }
    else if(sel == 2) {
        switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
        switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_ARIES_NTT) // disable tethering xmoondash
        switch_sel &= ~(int)USB_VTP_MASK;
#endif
        switch_sel &= ~(int)USB_ASKON_MASK;
        switch_sel |= (int)USB_UMS_MASK;
    }
    else if(sel == 3) {
        switch_sel &= ~(int)USB_UMS_MASK;
        switch_sel &= ~(int)USB_MTP_MASK;
        switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
        switch_sel &= ~(int)USB_ASKON_MASK;
#if !defined(CONFIG_ARIES_NTT) // disable tethering xmoondash
        switch_sel |= (int)USB_VTP_MASK;
#endif
    }
    else if(sel == 4) {
        switch_sel &= ~(int)USB_UMS_MASK;
        switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_ARIES_NTT) // disable tethering xmoondash
        switch_sel &= ~(int)USB_VTP_MASK;
#endif
        switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
        switch_sel |= (int)USB_ASKON_MASK;
    }

    if (sec_set_param_value)
        sec_set_param_value(__SWITCH_SEL, &switch_sel);
}
Beispiel #11
0
/* test codes for debugging */
static int param_run_test(void)
{
#if 1  /* For the purpose of testing... */
	int val=3;
	if (!sec_set_param_value)
		return -1;

	sec_set_param_value(__SWITCH_SEL, &val);
#endif
	return 0;
}
Beispiel #12
0
static ssize_t usb_sel_store
(
	struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t size
)
{
	int switch_sel;
	int path_save = 1;

	if (sec_get_param_value)
	{
		sec_get_param_value(__SWITCH_SEL, &switch_sel);
	}

	if(strstr(buf, "PDA") || strstr(buf, "pda"))
	{
		if(usb_path != SWITCH_PDA)
		{
			sio_switch_config(AP_USB_MODE);
		}
		usb_path = SWITCH_PDA;
		switch_sel |= USB_SEL_MASK;
		printk("[USB Switch] Path : PDA\n");
	}
	else if(strstr(buf, "MODEM") || strstr(buf, "modem"))
	{
		if(usb_path != SWITCH_MODEM)
		{
			sio_switch_config(CP_USB_MODE);
		}
		usb_path = SWITCH_MODEM;
		switch_sel &= ~USB_SEL_MASK;
		printk("[USB Switch] Path : MODEM\n");
	}

	if(strstr(buf, "NOSAVE") || strstr(buf, "nosave"))
	{
		path_save = 0;
		printk("[USB Switch] path is not saved\n");
	}

	if(path_save)
	{
		if (sec_set_param_value)
		{
			sec_set_param_value(__SWITCH_SEL, &switch_sel);
		}
	}

	return size;
}
Beispiel #13
0
static ssize_t usb_sel_store(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);
	int value;
	value = usb_cable;

	pr_info("%s\n", __func__);
	pr_info("%s the device type detected is %x\n", __func__, value);

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0) {
		if (value == CABLE_CONNECTED) {
			usb_switch_mode(secsw, SWITCH_PDA);
			pr_info("[USB Switch] Path : PDA\n");
		} else {
			pr_info("[USB Switch] Path is not change (PDA) Connect = %d\n", value);
		}

		secsw->switch_sel = (secsw->switch_sel & ~USB_PATH_MASK) | USB_PATH_PDA;
	}

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {
		if (value == CABLE_CONNECTED) {
			usb_switch_mode(secsw, SWITCH_MODEM);
			pr_info("[USB Switch] Path : MODEM\n");
		} else {
			pr_info("[USB Switch] Path is not change (MODEM) Connect = %d\n", value);
		}

		secsw->switch_sel = (secsw->switch_sel & ~USB_PATH_MASK) | USB_PATH_MODEM;
	}

	if (strncmp(buf, "LTEMODEM", 3) == 0 || strncmp(buf, "ltemodem", 3) == 0) {
		if (value == CABLE_CONNECTED) {
			usb_switch_mode(secsw, SWITCH_LTE);
			pr_info("[USB Switch] Path : LTEMODEM\n");
		} else {
			pr_info("[USB Switch] Path is not change (LTEMODEM) Connect = %d\n", value);
		}

		secsw->switch_sel = (secsw->switch_sel & ~USB_PATH_MASK) | USB_PATH_LTE;
	}

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &secsw->switch_sel);

	return size;
}
Beispiel #14
0
static ssize_t enable_store
(
	struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t size
)
{
	int value;
	int switch_sel;

	if (sscanf(buf, "%d", &value) != 1) {
		printk(KERN_ERR "enable_store: Invalid value\n");
		return -EINVAL;
	}

	if((value < 0) || (value > 1)) {
		printk(KERN_ERR "enable_store: Invalid value\n");
		return -EINVAL;
	}

	if(value != usb_access_lock) {
		if (sec_get_param_value) {
			sec_get_param_value(__SWITCH_SEL, &switch_sel);
			switch_sel &= ~USB_LOCK_MASK;
			if(value == 1) {
				switch_sel |= USB_LOCK_MASK;
				android_usb_set_connected(0);
			} else {
				android_usb_set_connected(0);
				android_usb_set_connected(1);
			}
		}

		usb_access_lock = value;

		if (sec_set_param_value) {
			sec_set_param_value(__SWITCH_SEL, &switch_sel);
		}
	}

	return size;
}
Beispiel #15
0
static ssize_t uart_debug_store(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);

	if (strncmp(buf, "DISABLE", 7) == 0 || strncmp(buf, "disable", 7) == 0) {
		pr_info("%s : uart debug disable\n", __func__);
		secsw->switch_sel &= ~UART_DEBUG_MASK;
	} else if (strncmp(buf, "ENABLE", 6) == 0 || strncmp(buf, "enable", 6) == 0) {
		pr_info("%s : uart debug enable\n", __func__);
		secsw->switch_sel |=  UART_DEBUG_MASK;
	}

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &secsw->switch_sel);

	return size;
}
Beispiel #16
0
void PathSelStore(int sel)
{
    if (sec_get_param_value)
        sec_get_param_value(__SWITCH_SEL, &switch_sel);

    if(sel == AP_USB_MODE) {
        switch_sel |= USB_SEL_MASK;
    }
    else if(sel == CP_USB_MODE) {
        switch_sel &= ~USB_SEL_MASK;
    }
    else if(sel == AP_UART_MODE) {
        switch_sel |= UART_SEL_MASK;
    }
    else if(sel == CP_UART_MODE) {
        switch_sel &= ~UART_SEL_MASK;
    }

    if (sec_set_param_value)
        sec_set_param_value(__SWITCH_SEL, &switch_sel);
}
Beispiel #17
0
static void sec_switch_init_work(struct work_struct *work)
{
	struct delayed_work *dw = container_of(work, struct delayed_work, work);
	struct sec_switch_wq *wq = container_of(dw, struct sec_switch_wq, work_q);
	struct sec_switch_struct *secsw = wq->sdata;
	int usb_sel = 0;
	int uart_sel = 0;

	if (sec_get_param_value && secsw->pdata && secsw->pdata->set_vbus_status &&
		secsw->pdata->get_phy_init_status && secsw->pdata->get_phy_init_status()) {
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);
		cancel_delayed_work(&wq->work_q);
	} else {
		schedule_delayed_work(&wq->work_q, msecs_to_jiffies(1000));
		return;
	}

	pr_info("%s : initial sec switch value = 0x%X\n", __func__, secsw->switch_sel);

	if (!(secsw->switch_sel & UART_DEBUG_MASK) ||
		((secsw->switch_sel & UART_PATH_MASK) == UART_PATH_MASK))
		secsw->switch_sel = (secsw->switch_sel & ~UART_PATH_MASK) | UART_PATH_MODEM;

	if ((secsw->switch_sel & USB_PATH_MASK) == USB_PATH_MASK)
		secsw->switch_sel = (secsw->switch_sel & ~USB_PATH_MASK) | USB_PATH_PDA;

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &secsw->switch_sel);

	usb_sel = secsw->switch_sel & USB_PATH_MASK;
	uart_sel = (secsw->switch_sel & UART_PATH_MASK) >> 2;

	if (initial_path_sel == USB_PATH_MASK)
		usb_switch_mode(secsw, usb_sel);
	else if (initial_path_sel == UART_PATH_MASK)
		uart_switch_mode(secsw, uart_sel);

	finish_sec_switch_init = 1;
}
Beispiel #18
0
static ssize_t usb_sel_store(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t size)
{
	struct sec_switch_struct *secsw = dev_get_drvdata(dev);

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);

	if (strncmp(buf, "PDA", 3) == 0 || strncmp(buf, "pda", 3) == 0) {
		usb_switch_mode(secsw, SWITCH_PDA);
		secsw->switch_sel |= USB_SEL_MASK;
	}

	if (strncmp(buf, "MODEM", 5) == 0 || strncmp(buf, "modem", 5) == 0) {
		usb_switch_mode(secsw, SWITCH_MODEM);
		secsw->switch_sel &= ~USB_SEL_MASK;
	}

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &secsw->switch_sel);

	return size;
}
Beispiel #19
0
static void omnia_II_pm_power_off(void)
{
	int	mode = REBOOT_MODE_NONE;
	char reset_mode = 'r';
	int cnt = 0;

	if (!gpio_get_value(GPIO_TA_CONNECTED_N)) 
	{	/* Reboot Charging */
		mode = REBOOT_MODE_CHARGING;
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);
		/* Watchdog Reset */
		arch_reset(reset_mode);
	}
	else 
	{	/* Power Off or Reboot */
		if (sec_set_param_value)
			sec_set_param_value(__REBOOT_MODE, &mode);
		if (/*get_usb_cable_state() &*/ (JIG_UART_ON | JIG_UART_OFF | JIG_USB_OFF | JIG_USB_ON)) {
			/* Watchdog Reset */
			arch_reset(reset_mode);
		}
		else 
		{
			/* POWER_N -> Input */
			gpio_direction_input(GPIO_POWER_N);
			gpio_direction_input(GPIO_PHONE_ACTIVE);

			if (!gpio_get_value(GPIO_POWER_N) || gpio_get_value(GPIO_PHONE_ACTIVE))
			{	
				/* Wait Power Button Release */
				while (gpio_get_value(GPIO_PHONE_ACTIVE)) 
				{
					if (cnt++ < 5) 
					{
						printk(KERN_EMERG "%s: GPIO_PHONE_ACTIVE is high(%d)\n", __func__, cnt);
						mdelay(1000);

					} 
					else 
					{
						printk(KERN_EMERG "%s: GPIO_PHONE_ACTIVE TIMED OUT!!!\n", __func__);
						
						// Display Yellow LED 	
						// (PHONE_RST: Output Low) -> (nPHONE_RST: Low) -> (MSM_PSHOLD: Low) -> CP PMIC Off
						gpio_direction_output(GPIO_PHONE_RST_N, GPIO_LEVEL_HIGH);
						s3c_gpio_setpull(GPIO_PHONE_RST_N, S3C_GPIO_PULL_NONE);
						gpio_set_value(GPIO_PHONE_RST_N, GPIO_LEVEL_LOW);
						break;
					}
				}	
				while (!gpio_get_value(GPIO_POWER_N));
			}

			if (!gpio_get_value(GPIO_TA_CONNECTED_N) || !gpio_get_value(GPIO_CHG_ING_N) ) 
			{
	        		mode = REBOOT_MODE_CHARGING;
				if (sec_set_param_value)
					sec_set_param_value(__REBOOT_MODE, &mode);
				/* Watchdog Reset */
				arch_reset(reset_mode);
			}			
			else
			{
				if (sec_set_param_value)
					sec_set_param_value(__REBOOT_MODE, &mode);				
				/* PS_HOLD -> Output Low */
				gpio_direction_output(GPIO_PDA_PS_HOLD, GPIO_LEVEL_HIGH);
				s3c_gpio_setpull(GPIO_PDA_PS_HOLD, S3C_GPIO_PULL_NONE);
				gpio_set_value(GPIO_PDA_PS_HOLD, GPIO_LEVEL_LOW);
			}	
		}
	}
	
	while (1);
}
Beispiel #20
0
static int UsbMenuSelStore(int sel)
{	
	int switch_sel, ret;

	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &switch_sel);	

	if(sel == 0){
		switch_sel &= ~(int)USB_UMS_MASK;
		switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash
		switch_sel &= ~(int)USB_VTP_MASK;
#endif
		switch_sel &= ~(int)USB_ASKON_MASK;		
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
		switch_sel &= ~(int)USB_SAMSUNG_KIES_REAL_MASK;
#endif
		switch_sel |= (int)USB_SAMSUNG_KIES_MASK;	
	}
	else if(sel == 1){
		switch_sel &= ~(int)USB_UMS_MASK;
		switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash		
		switch_sel &= ~(int)USB_VTP_MASK;
#endif
		switch_sel &= ~(int)USB_ASKON_MASK;				
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
		switch_sel &= ~(int)USB_SAMSUNG_KIES_REAL_MASK;
#endif
		switch_sel |= (int)USB_MTP_MASK;		
	}
	else if(sel == 2){
		switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
		switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash		
		switch_sel &= ~(int)USB_VTP_MASK;
#endif
		switch_sel &= ~(int)USB_ASKON_MASK;				
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
		switch_sel &= ~(int)USB_SAMSUNG_KIES_REAL_MASK;
#endif
		switch_sel |= (int)USB_UMS_MASK;
	}
	else if(sel == 3){
		switch_sel &= ~(int)USB_UMS_MASK;
		switch_sel &= ~(int)USB_MTP_MASK;
		switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;
		switch_sel &= ~(int)USB_ASKON_MASK;				
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
		switch_sel &= ~(int)USB_SAMSUNG_KIES_REAL_MASK;
#endif
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash
		switch_sel |= (int)USB_VTP_MASK;	
#endif
	}
	else if(sel == 4){
		switch_sel &= ~(int)USB_UMS_MASK;
		switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash		
		switch_sel &= ~(int)USB_VTP_MASK;
#endif
		switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;				
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
		switch_sel &= ~(int)USB_SAMSUNG_KIES_REAL_MASK;	
#endif
		switch_sel |= (int)USB_ASKON_MASK;	
	}
#ifdef _SUPPORT_SAMSUNG_AUTOINSTALLER_
	// KIES_REAL
	else if(sel == 5){
		switch_sel &= ~(int)USB_UMS_MASK;
		switch_sel &= ~(int)USB_MTP_MASK;
#if !defined(CONFIG_TARGET_LOCALE_NTT) // disable tethering xmoondash		
		switch_sel &= ~(int)USB_VTP_MASK;
#endif
		switch_sel &= ~(int)USB_ASKON_MASK;		
		switch_sel &= ~(int)USB_SAMSUNG_KIES_MASK;	
		switch_sel |= (int)USB_SAMSUNG_KIES_REAL_MASK;	
	}
#endif

	if (sec_set_param_value)
		sec_set_param_value(__SWITCH_SEL, &switch_sel);


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

	// returns current USB Mode setting...
	ret = switch_sel;
	ret &= ~(UART_SEL_MASK|USB_SEL_MASK);

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

	return ret;
}