/*! otg_workitem_start * Signal work work to run. * @param workitem - workitem pointer */ static void inline otg_workitem_start(struct otg_workitem *workitem) { //TRACE_STRING(workitem->tag, "START: %s", workitem->name); if (workitem->debug) printk(KERN_INFO"%s: %s\n", __FUNCTION__, workitem->name); workitem->proc(workitem->data); workitem->terminated = FALSE; SCHEDULE_WORK(workitem->work); }
/*! otg_tasklet_start * Signal work task to re-start. * @param tasklet - otg_tasklet instance pointer */ static void inline otg_tasklet_start(struct otg_tasklet *tasklet) { //TRACE_STRING(tag, "START: %s", name); if (tasklet->debug) printk(KERN_INFO"%s: %s\n", __FUNCTION__, tasklet->name); tasklet->terminated = FALSE; #ifdef OTG_TASKLET_WORK SCHEDULE_WORK(tasklet->work); #else /* OTG_TASKLET_WORK */ tasklet_schedule(&tasklet->tasklet); #endif /* OTG_TASKLET_WORK */ }
/*! otg_up_work * Signal work param taskto re-start. * @param task - otg_task instance pointer */ void otg_up_work(struct otg_task *task) { //TRACE_STRING(task->tag, "UP WORK: %s", task->name); if (task->debug) printk(KERN_INFO"%s: %s\n", __FUNCTION__, task->name); #if defined(OTG_TASK_WORK) task->terminated = FALSE; SCHEDULE_WORK(task->work); #else /* defined(OTG_TASK_WORK) */ up(&task->work_sem); #endif /* defined(OTG_TASK_WORK) */ }
void mc13783_otg_wakeup(void) { TRACE_MSG0(TCD, "start"); SCHEDULE_WORK(mc13783_otg_wq); TRACE_MSG0(TCD, "finsih"); }
/*! mc13783_bh_wakeup - wakeup the mc13783 bottom half * */ void mc13783_bh_wakeup(void) { TRACE_MSG0(TCD, "--"); SCHEDULE_WORK(mc13783_work_bh); }
/*! mc13783_bh * */ void mc13783_bh(void *arg) { TRACE_MSG0(TCD, "--"); global_flag = global_flag_array[start_flag]; if (global_flag & PUDP_FLAG_SET){ //set DP pullup //mc13783_convity_set_speed_mode (FALSE); //set high speed //mc13783_convity_set_pull_down_switch(PD_PU, TRUE); //variable 1.5K pull-up switch in power_ic_periph_set_usb_pull_up(TRUE); } if (global_flag & PUDP_FLAG_RESET){ //reset DP pullup //mc13783_convity_set_speed_mode (FALSE); //set high speed //mc13783_convity_set_pull_down_switch(PD_PU, FALSE); //variable 1.5K pull-up switch off power_ic_periph_set_usb_pull_up(FALSE); // Turn off the USB pullup } if (global_flag & PUDM_FLAG_SET){ //set DM pullup //mc13783_convity_set_speed_mode (TRUE); //set low speed //mc13783_convity_set_pull_down_switch(PD_PU, TRUE); //variable 1.5K pull-up switch in power_ic_periph_set_usb_pull_up(TRUE); } if (global_flag & PUDM_FLAG_RESET){ //reset DM pullup //mc13783_convity_set_speed_mode (TRUE); //set low speed //mc13783_convity_set_pull_down_switch(PD_PU, FALSE); //variable 1.5K pull-up switch off power_ic_periph_set_usb_pull_up(FALSE); // Turn off the USB pullup } if (global_flag & UPD_FLAG_SET){ //set DP pulldown power_ic_set_reg_bit(POWER_IC_REG_ATLAS_USB_0, BIT_UDPPD, TRUE); //mc13783_convity_set_pull_down_switch(PD_UPD_15, TRUE); //DP pull down switch is on } if (global_flag & UPD_FLAG_RESET){ //reset DP pulldown power_ic_set_reg_bit(POWER_IC_REG_ATLAS_USB_0, BIT_UDPPD, FALSE); //mc13783_convity_set_pull_down_switch(PD_UPD_15, FALSE); //DP pull down switch is off } if (global_flag & UDM_FLAG_SET){ //set DM pulldown power_ic_set_reg_bit(POWER_IC_REG_ATLAS_USB_0, BIT_UDMPD, TRUE); //mc13783_convity_set_pull_down_switch(PD_UDM_15, TRUE); //DP pull down switch is on } if (global_flag & UDM_FLAG_RESET){ //reset DM pulldown power_ic_set_reg_bit(POWER_IC_REG_ATLAS_USB_0, BIT_UDMPD, FALSE); //mc13783_convity_set_pull_down_switch(PD_UDM_15, FALSE); //DP pull down switch is off } /* Used for OTG if (global_flag & DRV_VBUS_SET){ //enable vbus voltage // mc13783_convity_set_output (FALSE, FALSE); //disable VUSB mc13783_convity_set_output (TRUE, TRUE); //enable VBUS } if (global_flag & DRV_VBUS_RESET){ //disable vbus voltage // mc13783_convity_set_output (FALSE, FALSE); //disable VUSB mc13783_convity_set_output (TRUE, FALSE); //disable VBUS } if (global_flag & CHRG_VBUS_SET){ //enable vbus #ifndef VBUS_TIMER mc13783_convity_set_output (TRUE, TRUE); //enable VBUS #else mc13783_convity_set_vbus_reg (3); //set VBUS on for 30 ms #endif } if (global_flag & CHRG_VBUS_RESET){ //disable vbus mc13783_convity_set_output (TRUE, FALSE); //disable VBUS } if (global_flag & DISCHRG_VBUS_SET){ //discharge vbus mc13783_convity_set_output (TRUE, FALSE); //disable VBUS mc13783_convity_set_vusb_voltage (TRUE); //set the VUSB voltage to 3.3 mc13783_convity_set_output (FALSE, TRUE); //enable VUSB } if (global_flag & DISCHRG_VBUS_RESET){ //discharge vbus disable mc13783_convity_set_output (TRUE, FALSE); //disable VBUS mc13783_convity_set_output (FALSE, TRUE); //enable VUSB // mc13783convity_set_output (FALSE, FALSE); //disable VUSB } */ TRACE_MSG3 (TCD, "gloabl flag %d start_flag %d end_flag %d", global_flag, start_flag, end_flag); global_flag = 0; global_flag_array[start_flag] = 0; if (start_flag ++ > 15) start_flag = 0; if (start_flag != end_flag) SCHEDULE_WORK(mc13783_work_bh); }