/* usb cable call back function */ void max77693_muic_usb_cb(u8 usb_mode) { #ifdef CONFIG_USB_HOST_NOTIFY struct host_notifier_platform_data *host_noti_pdata = host_notifier_device.dev.platform_data; #endif if (usb_mode == USB_CABLE_ATTACHED) { #ifdef CONFIG_MFD_MAX77693 g_usbvbus = USB_CABLE_ATTACHED; #endif max77693_set_vbus_state(USB_CABLE_ATTACHED); pr_info("%s - USB_CABLE_ATTACHED\n", __func__); } else if (usb_mode == USB_CABLE_DETACHED) { #ifdef CONFIG_MFD_MAX77693 g_usbvbus = USB_CABLE_DETACHED; #endif max77693_set_vbus_state(USB_CABLE_DETACHED); pr_info("%s - USB_CABLE_DETACHED\n", __func__); } else if (usb_mode == USB_OTGHOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->booster(1); host_noti_pdata->ndev.mode = NOTIFY_HOST_MODE; if (host_noti_pdata->usbhostd_start) host_noti_pdata->usbhostd_start(); #endif #if defined(CONFIG_MACH_J_CHN_CTC) /* defense code for otg mis-detecing issue */ msleep(40); #endif max77693_check_id_state(0); pr_info("%s - USB_OTGHOST_ATTACHED\n", __func__); } else if (usb_mode == USB_OTGHOST_DETACHED) { max77693_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->ndev.mode = NOTIFY_NONE_MODE; if (host_noti_pdata->usbhostd_stop) host_noti_pdata->usbhostd_stop(); host_noti_pdata->booster(0); #endif pr_info("%s - USB_OTGHOST_DETACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(1); start_usbhostd_wakelock(); #endif max77693_check_id_state(0); pr_info("%s - USB_POWERED_HOST_ATTACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_DETACHED) { max77693_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(0); stop_usbhostd_wakelock(); #endif pr_info("%s - USB_POWERED_HOST_DETACHED\n", __func__); } }
static void host_notifier_early_suspend(struct early_suspend *h) { if (fake_shut_down) { pr_info("%s: fake shut down ", __func__); host_notifier_booster(0); stop_usbhostd_wakelock(); restart_hostd = true; } }
/* usb cable call back function */ void max77803_muic_usb_cb(u8 usb_mode) { #ifdef CONFIG_USB_HOST_NOTIFY struct host_notifier_platform_data *host_noti_pdata = host_notifier_device.dev.platform_data; int cable_type = max77803_muic_get_charging_type(); #endif if (is_usb_locked) { pr_info("%s: usb locked by mdm\n", __func__); return; } if (usb_mode == USB_CABLE_ATTACHED) { #if defined(CONFIG_MFD_MAX77803) || defined(CONFIG_MFD_MAX77888) g_usbvbus = USB_CABLE_ATTACHED; #endif #ifdef CONFIG_HA_3G if(system_rev >= 6) usb30_redriver_en(1); #elif defined(CONFIG_V1A) || defined(CONFIG_V2A) usb30_redriver_en(1); #endif max77803_set_vbus_state(USB_CABLE_ATTACHED); pr_info("%s - USB_CABLE_ATTACHED\n", __func__); } else if (usb_mode == USB_CABLE_DETACHED) { #if defined(CONFIG_MFD_MAX77803) || defined(CONFIG_MFD_MAX77888) g_usbvbus = USB_CABLE_DETACHED; #endif #ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE #ifdef CONFIG_HA_3G usb30en = 0; #endif #endif #ifdef CONFIG_HA_3G if(system_rev >= 6) usb30_redriver_en(0); #elif defined(CONFIG_V1A) || defined(CONFIG_V2A) usb30_redriver_en(0); #endif max77803_set_vbus_state(USB_CABLE_DETACHED); pr_info("%s - USB_CABLE_DETACHED\n", __func__); } else if (usb_mode == USB_OTGHOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->booster(1); host_noti_pdata->ndev.mode = NOTIFY_HOST_MODE; if (host_noti_pdata->usbhostd_start) host_noti_pdata->usbhostd_start(); /* defense code for otg mis-detecing issue */ msleep(50); #endif max77803_check_id_state(0); pr_info("%s - USB_OTGHOST_ATTACHED\n", __func__); } else if (usb_mode == USB_OTGHOST_DETACHED) { max77803_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->ndev.mode = NOTIFY_NONE_MODE; if (host_noti_pdata->usbhostd_stop) host_noti_pdata->usbhostd_stop(); host_noti_pdata->booster(0); #endif pr_info("%s - USB_OTGHOST_DETACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(1); if (cable_type == CABLE_TYPE_MMDOCK_MUIC) { enable_ovc(1); host_state_notify(&host_noti_pdata->ndev, NOTIFY_HOST_NONE); } if (cable_type == CABLE_TYPE_LANHUB_MUIC) { host_noti_pdata->ndev.mode = NOTIFY_HOST_MODE; if (host_noti_pdata->usbhostd_start) host_noti_pdata->usbhostd_start(); } else start_usbhostd_wakelock(); #endif max77803_check_id_state(0); pr_info("%s - USB_POWERED_HOST_ATTACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_DETACHED) { max77803_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(0); if (cable_type == CABLE_TYPE_MMDOCK_MUIC) { enable_ovc(0); } if (host_noti_pdata->ndev.mode == NOTIFY_HOST_MODE) { host_noti_pdata->ndev.mode = NOTIFY_NONE_MODE; if (host_noti_pdata->usbhostd_stop) host_noti_pdata->usbhostd_stop(); } else stop_usbhostd_wakelock(); #endif pr_info("%s - USB_POWERED_HOST_DETACHED\n", __func__); } }
/* usb cable call back function */ void max77693_muic_usb_cb(u8 usb_mode) { struct usb_gadget *gadget = platform_get_drvdata(&s3c_device_usbgadget); #ifdef CONFIG_USB_HOST_NOTIFY struct host_notifier_platform_data *host_noti_pdata = host_notifier_device.dev.platform_data; #endif #ifdef CONFIG_TARGET_LOCALE_KOR if (is_usb_locked) { pr_info("%s: usb locked by mdm\n", __func__); return; } #endif pr_info("MUIC usb_cb:%d\n", usb_mode); if (gadget) { switch (usb_mode) { case USB_CABLE_DETACHED: pr_info("usb: muic: USB_CABLE_DETACHED(%d)\n", usb_mode); usb_gadget_vbus_disconnect(gadget); break; case USB_CABLE_ATTACHED: pr_info("usb: muic: USB_CABLE_ATTACHED(%d)\n", usb_mode); usb_gadget_vbus_connect(gadget); break; default: pr_info("usb: muic: invalid mode%d\n", usb_mode); } } if (usb_mode == USB_OTGHOST_ATTACHED || usb_mode == USB_POWERED_HOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY if (usb_mode == USB_OTGHOST_ATTACHED) { host_noti_pdata->booster(1); host_noti_pdata->ndev.mode = NOTIFY_HOST_MODE; if (host_noti_pdata->usbhostd_start) host_noti_pdata->usbhostd_start(); } else { host_noti_pdata->powered_booster(1); start_usbhostd_wakelock(); } #endif #ifdef CONFIG_USB_EHCI_S5P #if defined(CONFIG_MACH_T0_CHN_CTC) || \ defined(CONFIG_MACH_T0_CHN_CMCC) msleep(40); #endif pm_runtime_get_sync(&s5p_device_ehci.dev); #endif #ifdef CONFIG_USB_OHCI_S5P pm_runtime_get_sync(&s5p_device_ohci.dev); #endif #if defined(CONFIG_FAST_BOOT) host_noti_pdata->is_host_working = 1; #endif } else if (usb_mode == USB_OTGHOST_DETACHED || usb_mode == USB_POWERED_HOST_DETACHED) { #ifdef CONFIG_USB_OHCI_S5P pm_runtime_put_sync(&s5p_device_ohci.dev); #endif #ifdef CONFIG_USB_EHCI_S5P pm_runtime_put_sync(&s5p_device_ehci.dev); #endif #ifdef CONFIG_USB_HOST_NOTIFY if (usb_mode == USB_OTGHOST_DETACHED) { host_noti_pdata->ndev.mode = NOTIFY_NONE_MODE; if (host_noti_pdata->usbhostd_stop) host_noti_pdata->usbhostd_stop(); host_noti_pdata->booster(0); } else { host_noti_pdata->powered_booster(0); stop_usbhostd_wakelock(); } #endif #if defined(CONFIG_FAST_BOOT) host_noti_pdata->is_host_working = 0; #endif } #ifdef CONFIG_JACK_MON if (usb_mode == USB_OTGHOST_ATTACHED || usb_mode == USB_POWERED_HOST_ATTACHED) jack_event_handler("host", USB_CABLE_ATTACHED); else if (usb_mode == USB_OTGHOST_DETACHED || usb_mode == USB_POWERED_HOST_DETACHED) jack_event_handler("host", USB_CABLE_DETACHED); else if ((usb_mode == USB_CABLE_ATTACHED) || (usb_mode == USB_CABLE_DETACHED)) jack_event_handler("usb", usb_mode); #endif }
/* usb cable call back function */ void max77803_muic_usb_cb(u8 usb_mode) { #ifdef CONFIG_USB_HOST_NOTIFY struct host_notifier_platform_data *host_noti_pdata = host_notifier_device.dev.platform_data; #endif #ifdef CONFIG_USB_GADGET_SWITCH struct usb_gadget *gadget = platform_get_drvdata(&s3c_device_usb_hsotg); int g_state; #endif printk(KERN_ERR "%s - %d\n", __func__, __LINE__); if (usb_mode == USB_CABLE_ATTACHED) { #ifdef CONFIG_USB_GADGET_SWITCH g_state = usb_gadget_vbus_connect(gadget); if (g_state < 0) { pr_err("%s:gadget_vbus connect failed(%d)\n", __func__, g_state); return; } #endif #ifdef CONFIG_MFD_MAX77803 g_usbvbus = USB_CABLE_ATTACHED; #endif max77803_set_vbus_state(USB_CABLE_ATTACHED); pr_info("%s - USB_CABLE_ATTACHED\n", __func__); #ifdef CONFIG_SWITCH switch_set_state(&switch_usb, usb_mode); #endif } else if (usb_mode == USB_CABLE_DETACHED) { #ifdef CONFIG_MFD_MAX77803 g_usbvbus = USB_CABLE_DETACHED; #endif max77803_set_vbus_state(USB_CABLE_DETACHED); pr_info("%s - USB_CABLE_DETACHED\n", __func__); #ifdef CONFIG_SWITCH switch_set_state(&switch_usb, usb_mode); #endif #ifdef CONFIG_USB_GADGET_SWITCH g_state = usb_gadget_vbus_disconnect(gadget); if (g_state < 0) { pr_err("%s:gadget_vbus disconnect failed(%d)\n", __func__, g_state); } #endif } else if (usb_mode == USB_OTGHOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->booster(1); host_noti_pdata->ndev.mode = NOTIFY_HOST_MODE; if (host_noti_pdata->usbhostd_start) host_noti_pdata->usbhostd_start(); /* defense code for otg mis-detecing issue */ msleep(50); #endif max77803_check_id_state(0); pr_err("%s - USB_OTGHOST_ATTACHED\n", __func__); } else if (usb_mode == USB_OTGHOST_DETACHED) { max77803_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->ndev.mode = NOTIFY_NONE_MODE; if (host_noti_pdata->usbhostd_stop) host_noti_pdata->usbhostd_stop(); host_noti_pdata->booster(0); #endif pr_err("%s - USB_OTGHOST_DETACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_ATTACHED) { #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(1); start_usbhostd_wakelock(); #endif max77803_check_id_state(0); pr_info("%s - USB_POWERED_HOST_ATTACHED\n", __func__); } else if (usb_mode == USB_POWERED_HOST_DETACHED) { max77803_check_id_state(1); #ifdef CONFIG_USB_HOST_NOTIFY host_noti_pdata->powered_booster(0); stop_usbhostd_wakelock(); #endif pr_info("%s - USB_POWERED_HOST_DETACHED\n", __func__); } }