예제 #1
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;
}
예제 #2
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;
}
예제 #3
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;
	int ret = 0;
	int samsung_kies_sel,ums_sel,mtp_sel,vtp_sel,askon_sel;

//	printk("%s : called!!\n", __func__);
         if (sec_get_param_value &&
            secsw->pdata &&
            secsw->pdata->set_regulator &&
            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 if (!regulator_get(NULL, "vbus_ap")  || !(secsw->pdata->get_phy_init_status())) {
         else  {
		schedule_delayed_work(&wq->work_q, msecs_to_jiffies(1000));
		return ;
	       }

	if(secsw->pdata && secsw->pdata->get_regulator) {
		ret = secsw->pdata->get_regulator();
		if(ret != 0) {
			pr_err("%s : failed to get regulators\n", __func__);
			return ;
		}
	}

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

	usb_sel = secsw->switch_sel & (int)(USB_SEL_MASK);
	uart_sel = (secsw->switch_sel & (int)(UART_SEL_MASK)) >> 1;

	printk("%s : initial usb_sel(%d), uart_sel(%d)\n", __func__, usb_sel, uart_sel);

	// init UART/USB path.
	if(usb_sel) {
		usb_switch_mode(secsw, SWITCH_PDA);
	}
	else {
		usb_switch_mode(secsw, SWITCH_MODEM);
	}

	if(uart_sel) {
		gpio_set_value(GPIO_UART_SEL, 1);
		secsw->uart_owner = 1;
	}
	else {
		gpio_set_value(GPIO_UART_SEL, 0);
		secsw->uart_owner = 0;
	}
예제 #4
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;
}
예제 #5
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;
}
예제 #6
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;
}
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;
예제 #9
0
static void microusb_uart_status(int status)
{
	int switch_sel;
	int uart_sel;
	int usb_sel;

	if(!FSA9480_Get_JIG_UART_Status())	
		return;
	
	if (sec_get_param_value)
		sec_get_param_value(__SWITCH_SEL, &switch_sel);

	uart_sel = (switch_sel & (int)(UART_SEL_MASK)) >> 1;
	usb_sel = switch_sel & (int)(USB_SEL_MASK);

	if(status) {
		if(uart_sel)
			Ap_Cp_Switch_Config(AP_UART_MODE);	
		else
			Ap_Cp_Switch_Config(CP_UART_MODE);	
	}
	else {
		if(!usb_sel)
			Ap_Cp_Switch_Config(AP_USB_MODE);
	}
}
예제 #10
0
static ssize_t uart_debug_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	int switch_sel = 0;

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

	return sprintf(buf, "%s\n", (switch_sel & UART_DEBUG_MASK) ? "ENABLE" : "DISABLE");
}
예제 #11
0
// TODO : remove this.
int  FSA9480_PMIC_CP_USB(void)
{
	int usb_sel = 0;

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

	usb_sel = switch_sel & (int)(USB_SEL_MASK);

	return usb_sel;
}
예제 #12
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);
}
예제 #13
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;
}
예제 #14
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;
}
예제 #15
0
void uart_insert_switch_state(void)
{
	int usb_sel = 0;

	if(!connectivity_switching_init_state)
		return;

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

	usb_sel = switch_sel & (int)(USB_SEL_MASK);

	if(!usb_sel)
		Ap_Cp_Switch_Config(AP_USB_MODE);
}
예제 #16
0
void sec_usb_switch(void)
{
	int switch_sel = USB_PATH_PDA;

	if (!finish_sec_switch_init) {
		pr_info("%s : skip for initialing\n", __func__);
		initial_path_sel = USB_PATH_MASK;
		return;
	}

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

	usb_switch_mode(dev_get_drvdata(switch_dev), switch_sel & USB_PATH_MASK);
}
예제 #17
0
static void sio_switch_init_worker(struct work_struct *ignored)
{
	int switch_sel;

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

	if (switch_sel & USB_SEL_MASK)
		usb_path = SWITCH_PDA;
	else
		usb_path = SWITCH_MODEM;

	if (switch_sel & UART_SEL_MASK)
		uart_current_owner = SWITCH_PDA;
	else
		uart_current_owner = SWITCH_MODEM;

#ifdef _FMC_DM_
	if (switch_sel & USB_LOCK_MASK) {
		usb_access_lock = 1;
		android_usb_set_connected(0);
	}
#endif

	if (uart_current_owner == SWITCH_PDA)
	{
		sio_switch_config(AP_UART_MODE);
	}
	else if (uart_current_owner == SWITCH_MODEM)
	{
		printk("----------------- Cutting off PDA UART ---------------------\n");
		sio_switch_config(CP_UART_MODE);
	}

	if (usb_path == SWITCH_MODEM)
	{
		sio_switch_config(CP_USB_MODE);
	}

	microusb_init();
}
예제 #18
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;
}
예제 #19
0
static void sio_switch_init_worker(struct work_struct *ignored)
{
	int switch_sel;

	if (sec_get_param_value) {
		sec_get_param_value(__SWITCH_SEL, &switch_sel);
		cancel_delayed_work(&sio_switch_init_work);

	} else {
		schedule_delayed_work(&sio_switch_init_work, msecs_to_jiffies(100));		
		return;
	}

	if (switch_sel & USB_SEL_MASK)
		{
		usb_path = SWITCH_PDA;
		sio_switch_config(AP_USB_MODE);
		}
	else
		usb_path = SWITCH_MODEM;

	if (switch_sel & UART_SEL_MASK)
		uart_current_owner = SWITCH_PDA;
	else
		uart_current_owner = SWITCH_MODEM;

	if (uart_current_owner == SWITCH_PDA)
	{
		sio_switch_config(AP_UART_MODE);
	}
	else if (uart_current_owner == SWITCH_MODEM)
	{
		printk("----------------- Cutting off PDA UART ---------------------\n");
		sio_switch_config(CP_UART_MODE);
	}

	if (usb_path == SWITCH_MODEM)
	{
		sio_switch_config(CP_USB_MODE);
	}
}
예제 #20
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);
}
예제 #21
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;
}
예제 #22
0
void usb_switch_state(void)
{
	int usb_sel = 0;

	if(!connectivity_switching_init_state)
		return;

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

	usb_sel = switch_sel & (int)(USB_SEL_MASK);
	
	if(usb_sel) {
		usb_switch_mode(SWITCH_PDA);
		usb_switching_value_update(SWITCH_PDA);
	}
	else {
		usb_switch_mode(SWITCH_MODEM);
		usb_switching_value_update(SWITCH_MODEM);
	}
}
예제 #23
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;
}
예제 #24
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;
}
예제 #25
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_debug("%s : initial sec switch value = 0x%X\n", __func__, secsw->switch_sel);

	usb_sel = secsw->switch_sel & USB_SEL_MASK;
	uart_sel = secsw->switch_sel & UART_SEL_MASK;

	/* init UART/USB path */
	if (usb_sel)
		usb_switch_mode(secsw, SWITCH_PDA);
	else
		usb_switch_mode(secsw, SWITCH_MODEM);

	if (uart_sel)
		gpio_set_value(GPIO_UART_SEL, 1);
	else
		gpio_set_value(GPIO_UART_SEL, 0);
}
예제 #26
0
static int __devinit battery_probe( struct platform_device *pdev )
// ----------------------------------------------------------------------------
// Description    : probe function for battery driver.
// Input Argument :  
// Return Value   : 
{
	int ret = 0;
	int i = 0;
	int Debug_Usepopup = 1;

	struct battery_device_info *di;
	
	printk( "[BR] Battery Probe...\n\n" );

	this_dev = &pdev->dev; 

	di = kzalloc( sizeof(*di), GFP_KERNEL );
	if(!di)
		return -ENOMEM;

	platform_set_drvdata( pdev, di );
	
	di->dev = &pdev->dev;
	device_config = pdev->dev.platform_data;

	INIT_DELAYED_WORK( &di->battery_monitor_work, battery_monitor_work_handler );

// [ USE_REGULATOR
	di->usb3v1 = regulator_get( &pdev->dev, "usb3v1" );
	if( IS_ERR( di->usb3v1 ) )
		goto fail_regulator1;

	di->usb1v8 = regulator_get( &pdev->dev, "usb1v8" );
	if( IS_ERR( di->usb1v8 ) )
		goto fail_regulator2;

	di->usb1v5 = regulator_get( &pdev->dev, "usb1v5" );
	if( IS_ERR( di->usb1v5 ) )
		goto fail_regulator3;
// ]

	/*Create power supplies*/
	di->sec_battery.name = "battery";
	di->sec_battery.type = POWER_SUPPLY_TYPE_BATTERY;
	di->sec_battery.properties = samsung_battery_props;
	di->sec_battery.num_properties = ARRAY_SIZE( samsung_battery_props );
	di->sec_battery.get_property = samsung_battery_get_property;
	di->sec_battery.external_power_changed = 
	samsung_pwr_external_power_changed;
	//di->sec_battery.use_for_apm = 1;

	di->sec_ac.name = "ac";
	di->sec_ac.type = POWER_SUPPLY_TYPE_MAINS;
	di->sec_ac.supplied_to = samsung_bci_supplied_to;
	di->sec_ac.num_supplicants = ARRAY_SIZE( samsung_bci_supplied_to );
	di->sec_ac.properties = samsung_ac_props;
	di->sec_ac.num_properties = ARRAY_SIZE( samsung_ac_props );
	di->sec_ac.get_property = samsung_ac_get_property;
	di->sec_ac.external_power_changed = 
	samsung_pwr_external_power_changed;

	di->sec_usb.name = "usb";
	di->sec_usb.type = POWER_SUPPLY_TYPE_USB;
	di->sec_usb.supplied_to = samsung_bci_supplied_to;
	di->sec_usb.num_supplicants = ARRAY_SIZE( samsung_bci_supplied_to );
	di->sec_usb.properties = samsung_usb_props;
	di->sec_usb.num_properties = ARRAY_SIZE( samsung_usb_props );
	di->sec_usb.get_property = samsung_usb_get_property;
	di->sec_usb.external_power_changed = 
	samsung_pwr_external_power_changed;

	ret = power_supply_register( &pdev->dev, &di->sec_battery );
	if( ret )
	{
		printk( "failed to register main battery, charger\n" );
		goto batt_regi_fail1;
	}

	ret = power_supply_register( &pdev->dev, &di->sec_ac );
	if( ret )
	{
		printk( "failed to register ac\n" );
		goto batt_regi_fail2;
	}

	ret = power_supply_register( &pdev->dev, &di->sec_usb );
	if( ret )
	{
		printk( "failed to register usb\n" );
		goto batt_regi_fail3;
	}

	ret = sysfs_create_file( &di->sec_battery.dev->kobj, 
				 &batt_vol_toolow.attr );
	if ( ret )
	{
		printk( "sysfs create fail - %s\n", batt_vol_toolow.attr.name );
	}

	ret = sysfs_create_file( &di->sec_battery.dev->kobj, 
				 &charging_source.attr );
	if ( ret )
	{
		printk( "sysfs create fail - %s\n", charging_source.attr.name );
	}

	for( i = 0; i < ARRAY_SIZE( batt_sysfs_testmode ); i++ )
	{
		ret = sysfs_create_file( &di->sec_battery.dev->kobj, 
					 &batt_sysfs_testmode[i].attr );
		if ( ret )
		{
			printk( "sysfs create fail - %s\n", batt_sysfs_testmode[i].attr.name );
		}
	}

	// Init. ADC
	turn_resources_on_for_adc();
	twl_i2c_write_u8( TWL4030_MODULE_USB, SEL_MADC_MCPC, CARKIT_ANA_CTRL );
	turn_resources_off_for_adc();

	batt_gptimer_12.name = "samsung_battery_timer";
	batt_gptimer_12.expire_time =(unsigned int) MONITOR_DURATION_DUR_SLEEP;
	batt_gptimer_12.expire_callback = &battery_monitor_fleeting_wakeup_handler;
	batt_gptimer_12.data = (unsigned long) di;
#if defined(CONFIG_SAMSUNG_ARCHER_TARGET_SK)
	if ( sec_get_param_value )
	{
		sec_get_param_value(__DEBUG_BLOCKPOPUP, &Debug_Usepopup);
	}
#endif
	if ( (Debug_Usepopup & 0x1) == 1 )
	{
		sec_bci.battery.support_monitor_temp = 1;
		sec_bci.battery.support_monitor_timeout = 1;
		sec_bci.battery.support_monitor_full = 1;
	}
	else if ( (Debug_Usepopup & 0x1) == 0 )
	{
		sec_bci.battery.support_monitor_temp = 0;
		sec_bci.battery.support_monitor_timeout = 0;
		sec_bci.battery.support_monitor_full = 0;
	}

	//schedule_delayed_work( &di->battery_monitor_work, 3*HZ );
	queue_delayed_work( sec_bci.sec_battery_workq, &di->battery_monitor_work, 3*HZ );

	// ready to go!!
	sec_bci.ready = true;

	return 0;

batt_regi_fail3:
	power_supply_unregister( &di->sec_ac );

batt_regi_fail2:
	power_supply_unregister( &di->sec_battery );

batt_regi_fail1:
// [ USE_REGULATOR
	regulator_put( di->usb1v5 );
	di->usb1v5 = NULL;

fail_regulator3:
	regulator_put( di->usb1v8 );
	di->usb1v8 = NULL;

fail_regulator2:
	regulator_put( di->usb3v1 );
	di->usb3v1 = NULL;

fail_regulator1:
// ]
	kfree(di);

	return ret;
}
예제 #27
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;

}
예제 #28
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;
}
예제 #29
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 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() &&
	    check_for_cp_boot()) {
		sec_get_param_value(__SWITCH_SEL, &secsw->switch_sel);
#endif
	if (secsw->pdata &&
	    secsw->pdata->set_vbus_status &&
	    secsw->pdata->get_phy_init_status &&
	    secsw->pdata->get_phy_init_status()) {
#ifdef CONFIG_SEC_MISC
		if ( (!sec_get_param(param_index_uartsel, &secsw->switch_sel)) && (gRetryCount++ < 9) )
		{	
			pr_err("%s error value = %d \n", __func__, secsw->switch_sel);
			schedule_delayed_work(&wq->work_q, msecs_to_jiffies(1000));
			return;
		}

		//To prevent lock up during getting parameter about switch_sel.
		if(gRetryCount > 9)
		{
			secsw->switch_sel = 1; // default modem
			pr_err("%s failed 10 times... So switch_sel is set by [1]\n", __func__);
		}
		gRetryCount = 0;
#endif
		pr_err("%s value = %d \n", __func__, secsw->switch_sel);
		cancel_delayed_work(&wq->work_q);
	} else {
		schedule_delayed_work(&wq->work_q, msecs_to_jiffies(1000));
		return;
	}
	usb_sel = secsw->switch_sel & USB_SEL_MASK;
	uart_sel = secsw->switch_sel & UART_SEL_MASK;


// USB switch not use LTE

	if (usb_sel)
		usb_switch_mode(secsw, SWITCH_PDA);
	else
		usb_switch_mode(secsw, SWITCH_MODEM);


// UART switch mode
	if (uart_sel)
		uart_switch_mode(secsw, SWITCH_PDA);
	else
		uart_switch_mode(secsw, SWITCH_MODEM);
	
}

static int sec_switch_probe(struct platform_device *pdev)
{
	struct sec_switch_struct *secsw;
	struct sec_switch_platform_data *pdata = pdev->dev.platform_data;
	struct sec_switch_wq *wq;

	pr_err("sec_switch_probe enter %s\n", __func__);

	if (!pdata) {
		pr_err("%s : pdata is NULL.\n", __func__);
		return -ENODEV;
	}

	secsw = kzalloc(sizeof(struct sec_switch_struct), GFP_KERNEL);
	if (!secsw) {
		pr_err("%s : failed to allocate memory\n", __func__);
		return -ENOMEM;
	}

	secsw->pdata = pdata;
	
#if defined (CONFIG_TARGET_LOCALE_US_ATT_REV01) || defined(CONFIG_KOR_MODEL_SHV_E160S)|| defined (CONFIG_KOR_MODEL_SHV_E160K) || defined (CONFIG_KOR_MODEL_SHV_E160L) || defined (CONFIG_JPN_MODEL_SC_05D)
	secsw->switch_sel = 3;
#else
	secsw->switch_sel = 1;
#endif

	dev_set_drvdata(switch_dev, secsw);

	/* create sysfs files */
	if (device_create_file(switch_dev, &dev_attr_uart_sel) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_uart_sel.attr.name);

	if (device_create_file(switch_dev, &dev_attr_usb_sel) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_usb_sel.attr.name);

	if (device_create_file(switch_dev, &dev_attr_usb_state) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_usb_state.attr.name);

	if (device_create_file(switch_dev, &dev_attr_disable_vbus) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_usb_state.attr.name);

	if (device_create_file(switch_dev, &dev_attr_device_type) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_device_type.attr.name);

#ifdef _SEC_DM_
	usb_lock = device_create(sec_class, switch_dev, MKDEV(0, 0), NULL, ".usb_lock");

	if (IS_ERR(usb_lock)) {
		pr_err("Failed to create device (usb_lock)!\n");
		return PTR_ERR(usb_lock);
	}

	dev_set_drvdata(usb_lock, secsw);

	if (device_create_file(usb_lock, &dev_attr_enable) < 0)	{
		pr_err("Failed to create device file(%s)!\n", dev_attr_enable.attr.name);
		device_destroy((struct class *)usb_lock, MKDEV(0, 0));
	}
#endif

	/* run work queue */
	wq = kmalloc(sizeof(struct sec_switch_wq), GFP_ATOMIC);
	if (wq) {
		wq->sdata = secsw;
		INIT_DELAYED_WORK(&wq->work_q, sec_switch_init_work);
		schedule_delayed_work(&wq->work_q, msecs_to_jiffies(100));
	} else
		return -ENOMEM;
	return 0;
}