Lines Matching refs:fsm
40 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_req); in a_bus_req_show()
56 mutex_lock(&ci->fsm.lock); in a_bus_req_store()
58 ci->fsm.a_bus_req = 0; in a_bus_req_store()
61 if (ci->fsm.a_bus_drop) { in a_bus_req_store()
62 mutex_unlock(&ci->fsm.lock); in a_bus_req_store()
65 ci->fsm.a_bus_req = 1; in a_bus_req_store()
66 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { in a_bus_req_store()
68 mutex_unlock(&ci->fsm.lock); in a_bus_req_store()
74 mutex_unlock(&ci->fsm.lock); in a_bus_req_store()
89 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_drop); in a_bus_drop_show()
105 mutex_lock(&ci->fsm.lock); in a_bus_drop_store()
107 ci->fsm.a_bus_drop = 0; in a_bus_drop_store()
109 ci->fsm.a_bus_drop = 1; in a_bus_drop_store()
110 ci->fsm.a_bus_req = 0; in a_bus_drop_store()
114 mutex_unlock(&ci->fsm.lock); in a_bus_drop_store()
129 t = scnprintf(next, size, "%d\n", ci->fsm.b_bus_req); in b_bus_req_show()
145 mutex_lock(&ci->fsm.lock); in b_bus_req_store()
147 ci->fsm.b_bus_req = 0; in b_bus_req_store()
149 ci->fsm.b_bus_req = 1; in b_bus_req_store()
150 if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { in b_bus_req_store()
152 mutex_unlock(&ci->fsm.lock); in b_bus_req_store()
158 mutex_unlock(&ci->fsm.lock); in b_bus_req_store()
173 mutex_lock(&ci->fsm.lock); in a_clr_err_store()
175 ci->fsm.a_clr_err = 1; in a_clr_err_store()
178 mutex_unlock(&ci->fsm.lock); in a_clr_err_store()
286 ci->fsm.a_wait_vrise_tmout = 1; in a_wait_vrise_tmout()
292 ci->fsm.a_wait_vfall_tmout = 1; in a_wait_vfall_tmout()
298 ci->fsm.a_wait_bcon_tmout = 1; in a_wait_bcon_tmout()
304 ci->fsm.a_aidl_bdis_tmout = 1; in a_aidl_bdis_tmout()
310 ci->fsm.b_ase0_brst_tmout = 1; in b_ase0_brst_tmout()
316 ci->fsm.a_bidl_adis_tmout = 1; in a_bidl_adis_tmout()
322 ci->fsm.a_bus_suspend = 1; in b_aidl_bdis_tmout()
328 ci->fsm.b_se0_srp = 1; in b_se0_srp_tmout()
334 ci->fsm.b_srp_done = 1; in b_srp_fail_tmout()
340 ci->fsm.b_srp_done = 1; in b_data_pls_tmout()
341 ci->fsm.b_bus_req = 0; in b_data_pls_tmout()
342 if (ci->fsm.power_up) in b_data_pls_tmout()
343 ci->fsm.power_up = 0; in b_data_pls_tmout()
351 ci->fsm.b_ssend_srp = 1; in b_ssend_srp_tmout()
353 if (ci->fsm.otg->state == OTG_STATE_B_IDLE) in b_ssend_srp_tmout()
434 static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in ci_otg_fsm_add_timer() argument
436 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_fsm_add_timer()
443 static void ci_otg_fsm_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in ci_otg_fsm_del_timer() argument
445 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_fsm_del_timer()
456 static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) in ci_otg_drv_vbus() argument
459 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_drv_vbus()
477 fsm->a_srp_det = 0; in ci_otg_drv_vbus()
478 fsm->power_up = 0; in ci_otg_drv_vbus()
483 fsm->a_bus_drop = 1; in ci_otg_drv_vbus()
484 fsm->a_bus_req = 0; in ci_otg_drv_vbus()
491 static void ci_otg_loc_conn(struct otg_fsm *fsm, int on) in ci_otg_loc_conn() argument
493 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_loc_conn()
510 static void ci_otg_loc_sof(struct otg_fsm *fsm, int on) in ci_otg_loc_sof() argument
514 if (!fsm->otg->host) in ci_otg_loc_sof()
517 udev = usb_hub_find_child(fsm->otg->host->root_hub, 1); in ci_otg_loc_sof()
533 static void ci_otg_start_pulse(struct otg_fsm *fsm) in ci_otg_start_pulse() argument
535 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_pulse()
544 static int ci_otg_start_host(struct otg_fsm *fsm, int on) in ci_otg_start_host() argument
546 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_host()
558 static int ci_otg_start_gadget(struct otg_fsm *fsm, int on) in ci_otg_start_gadget() argument
560 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_gadget()
587 if (ci->fsm.id && !(ci->driver) && in ci_otg_fsm_work()
588 ci->fsm.otg->state < OTG_STATE_A_IDLE) in ci_otg_fsm_work()
592 if (otg_statemachine(&ci->fsm)) { in ci_otg_fsm_work()
593 if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { in ci_otg_fsm_work()
602 if ((ci->fsm.id) || (ci->id_event) || in ci_otg_fsm_work()
603 (ci->fsm.power_up)) { in ci_otg_fsm_work()
614 } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { in ci_otg_fsm_work()
615 if (ci->fsm.b_sess_vld) { in ci_otg_fsm_work()
616 ci->fsm.power_up = 0; in ci_otg_fsm_work()
623 } else if (ci->fsm.otg->state == OTG_STATE_A_HOST) { in ci_otg_fsm_work()
640 struct otg_fsm *fsm = &ci->fsm; in ci_otg_fsm_event() local
646 switch (ci->fsm.otg->state) { in ci_otg_fsm_event()
649 fsm->b_conn = 1; in ci_otg_fsm_event()
650 fsm->a_bus_req = 1; in ci_otg_fsm_event()
656 fsm->b_sess_vld = 1; in ci_otg_fsm_event()
665 if (fsm->a_bus_suspend == 1) in ci_otg_fsm_event()
666 fsm->a_bus_suspend = 0; in ci_otg_fsm_event()
671 fsm->a_conn = 0; in ci_otg_fsm_event()
672 fsm->b_bus_req = 0; in ci_otg_fsm_event()
678 fsm->b_bus_suspend = 1; in ci_otg_fsm_event()
691 if (fsm->b_bus_suspend == 1) { in ci_otg_fsm_event()
693 fsm->b_bus_suspend = 0; in ci_otg_fsm_event()
699 fsm->b_conn = 0; in ci_otg_fsm_event()
711 fsm->b_conn = 0; in ci_otg_fsm_event()
717 fsm->a_conn = 1; in ci_otg_fsm_event()
736 struct otg_fsm *fsm = &ci->fsm; in ci_otg_fsm_irq() local
740 fsm->id = (otgsc & OTGSC_ID) ? 1 : 0; in ci_otg_fsm_irq()
745 fsm->a_srp_det = 1; in ci_otg_fsm_irq()
746 fsm->a_bus_drop = 0; in ci_otg_fsm_irq()
749 if (fsm->id == 0) { in ci_otg_fsm_irq()
750 fsm->a_bus_drop = 0; in ci_otg_fsm_irq()
751 fsm->a_bus_req = 1; in ci_otg_fsm_irq()
757 fsm->b_sess_vld = 1; in ci_otg_fsm_irq()
760 fsm->b_ssend_srp = 0; in ci_otg_fsm_irq()
762 fsm->b_sess_vld = 0; in ci_otg_fsm_irq()
763 if (fsm->id) in ci_otg_fsm_irq()
769 fsm->a_vbus_vld = 1; in ci_otg_fsm_irq()
771 fsm->a_vbus_vld = 0; in ci_otg_fsm_irq()
772 fsm->b_conn = 0; in ci_otg_fsm_irq()
799 ci->fsm.otg = &ci->otg; in ci_hdrc_otg_fsm_init()
800 ci->fsm.power_up = 1; in ci_hdrc_otg_fsm_init()
801 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; in ci_hdrc_otg_fsm_init()
802 ci->fsm.otg->state = OTG_STATE_UNDEFINED; in ci_hdrc_otg_fsm_init()
803 ci->fsm.ops = &ci_otg_ops; in ci_hdrc_otg_fsm_init()
805 ci->fsm.host_req_flag = devm_kzalloc(ci->dev, 1, GFP_KERNEL); in ci_hdrc_otg_fsm_init()
806 if (!ci->fsm.host_req_flag) in ci_hdrc_otg_fsm_init()
809 mutex_init(&ci->fsm.lock); in ci_hdrc_otg_fsm_init()
829 if (ci->fsm.id) { in ci_hdrc_otg_fsm_init()
830 ci->fsm.b_ssend_srp = in ci_hdrc_otg_fsm_init()
832 ci->fsm.b_sess_vld = in ci_hdrc_otg_fsm_init()