* @vbus: vbus 5V used by host mode
 * @edev: external connector used to detect vbus and iddig changes
 * @vbus_nb: notifier for vbus detection
-* @vbus_nb: notifier for iddig(idpin) detection
+* @vbus_work : work of vbus detection notifier, used to avoid sleep in
+*              notifier callback which is atomic context
+* @vbus_event : event of vbus detecion notifier
+* @id_nb : notifier for iddig(idpin) detection
+* @id_work : work of iddig detection notifier
+* @id_event : event of iddig detecion notifier
 * @is_u3_drd: whether port0 supports usb3.0 dual-role device or not
 * @manual_drd_enabled: it's true when supports dual-role device by debugfs
 *              to switch host/device modes depending on user input.
        struct regulator *vbus;
        struct extcon_dev *edev;
        struct notifier_block vbus_nb;
+       struct work_struct vbus_work;
+       unsigned long vbus_event;
        struct notifier_block id_nb;
+       struct work_struct id_work;
+       unsigned long id_event;
        bool is_u3_drd;
        bool manual_drd_enabled;
 };
 
        }
 }
 
-static int ssusb_id_notifier(struct notifier_block *nb,
-       unsigned long event, void *ptr)
+static void ssusb_id_work(struct work_struct *work)
 {
        struct otg_switch_mtk *otg_sx =
-               container_of(nb, struct otg_switch_mtk, id_nb);
+               container_of(work, struct otg_switch_mtk, id_work);
 
-       if (event)
+       if (otg_sx->id_event)
                ssusb_set_mailbox(otg_sx, MTU3_ID_GROUND);
        else
                ssusb_set_mailbox(otg_sx, MTU3_ID_FLOAT);
+}
+
+static void ssusb_vbus_work(struct work_struct *work)
+{
+       struct otg_switch_mtk *otg_sx =
+               container_of(work, struct otg_switch_mtk, vbus_work);
+
+       if (otg_sx->vbus_event)
+               ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
+       else
+               ssusb_set_mailbox(otg_sx, MTU3_VBUS_OFF);
+}
+
+/*
+ * @ssusb_id_notifier is called in atomic context, but @ssusb_set_mailbox
+ * may sleep, so use work queue here
+ */
+static int ssusb_id_notifier(struct notifier_block *nb,
+       unsigned long event, void *ptr)
+{
+       struct otg_switch_mtk *otg_sx =
+               container_of(nb, struct otg_switch_mtk, id_nb);
+
+       otg_sx->id_event = event;
+       schedule_work(&otg_sx->id_work);
 
        return NOTIFY_DONE;
 }
        struct otg_switch_mtk *otg_sx =
                container_of(nb, struct otg_switch_mtk, vbus_nb);
 
-       if (event)
-               ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
-       else
-               ssusb_set_mailbox(otg_sx, MTU3_VBUS_OFF);
+       otg_sx->vbus_event = event;
+       schedule_work(&otg_sx->vbus_work);
 
        return NOTIFY_DONE;
 }
 {
        struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
 
+       INIT_WORK(&otg_sx->id_work, ssusb_id_work);
+       INIT_WORK(&otg_sx->vbus_work, ssusb_vbus_work);
+
        if (otg_sx->manual_drd_enabled)
                ssusb_debugfs_init(ssusb);
        else
 
        if (otg_sx->manual_drd_enabled)
                ssusb_debugfs_exit(ssusb);
+
+       cancel_work_sync(&otg_sx->id_work);
+       cancel_work_sync(&otg_sx->vbus_work);
 }