static int zw_slimport_notifier_call(struct notifier_block *nb, unsigned long state, void *ptr) { struct anx7808_data *anx7808 = (struct anx7808_data *)nb->ptr; switch (state) { case ZW_STATE_OFF: if (gpio_get_value(anx7808->pdata->gpio_cbl_det)) { wake_lock(&anx7808->slimport_lock); anx7808->slimport_connected = true; dwc3_ref_clk_set(true); queue_delayed_work(anx7808->workqueue, &anx7808->work, 0); } break; case ZW_STATE_ON_SYSTEM: case ZW_STATE_ON_USER: if (anx7808->slimport_connected) { /* we must go to suspend in the ZeroWait mdoe*/ dwc3_ref_clk_set(false); cancel_delayed_work_sync(&anx7808->work); anx7808->slimport_connected = false; wake_unlock(&anx7808->slimport_lock); } break; } return NOTIFY_DONE; }
static void dwc3_ref_clk_work_func(struct work_struct *work) { struct anx7808_data *td = container_of(work, struct anx7808_data, dwc3_ref_clk_work.work); if(td->slimport_connected) dwc3_ref_clk_set(true); else dwc3_ref_clk_set(false); }
static void dwc3_ref_clk_work_func(struct work_struct *work) { struct anx7808_data *td = container_of(work, struct anx7808_data, dwc3_ref_clk_work.work); bool is_connected = slimport_is_connected(); if (!td->slimport_connected && is_connected) { td->slimport_connected = true; dwc3_ref_clk_set(true); } else if (td->slimport_connected && !is_connected) { td->slimport_connected = false; dwc3_ref_clk_set(false); } else pr_info("%s %s : ignore incorrect irq\n", LOG_TAG, __func__); }