Lines Matching refs:fsm
43 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_req); in get_a_bus_req()
59 mutex_lock(&ci->fsm.lock); in set_a_bus_req()
61 ci->fsm.a_bus_req = 0; in set_a_bus_req()
64 if (ci->fsm.a_bus_drop) { in set_a_bus_req()
65 mutex_unlock(&ci->fsm.lock); in set_a_bus_req()
68 ci->fsm.a_bus_req = 1; in set_a_bus_req()
69 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { in set_a_bus_req()
71 mutex_unlock(&ci->fsm.lock); in set_a_bus_req()
77 mutex_unlock(&ci->fsm.lock); in set_a_bus_req()
92 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_drop); in get_a_bus_drop()
108 mutex_lock(&ci->fsm.lock); in set_a_bus_drop()
110 ci->fsm.a_bus_drop = 0; in set_a_bus_drop()
112 ci->fsm.a_bus_drop = 1; in set_a_bus_drop()
113 ci->fsm.a_bus_req = 0; in set_a_bus_drop()
117 mutex_unlock(&ci->fsm.lock); in set_a_bus_drop()
133 t = scnprintf(next, size, "%d\n", ci->fsm.b_bus_req); in get_b_bus_req()
149 mutex_lock(&ci->fsm.lock); in set_b_bus_req()
151 ci->fsm.b_bus_req = 0; in set_b_bus_req()
153 ci->fsm.b_bus_req = 1; in set_b_bus_req()
154 if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { in set_b_bus_req()
156 mutex_unlock(&ci->fsm.lock); in set_b_bus_req()
162 mutex_unlock(&ci->fsm.lock); in set_b_bus_req()
177 mutex_lock(&ci->fsm.lock); in set_a_clr_err()
179 ci->fsm.a_clr_err = 1; in set_a_clr_err()
182 mutex_unlock(&ci->fsm.lock); in set_a_clr_err()
290 ci->fsm.a_wait_vrise_tmout = 1; in a_wait_vrise_tmout()
296 ci->fsm.a_wait_vfall_tmout = 1; in a_wait_vfall_tmout()
302 ci->fsm.a_wait_bcon_tmout = 1; in a_wait_bcon_tmout()
308 ci->fsm.a_aidl_bdis_tmout = 1; in a_aidl_bdis_tmout()
314 ci->fsm.b_ase0_brst_tmout = 1; in b_ase0_brst_tmout()
320 ci->fsm.a_bidl_adis_tmout = 1; in a_bidl_adis_tmout()
326 ci->fsm.a_bus_suspend = 1; in b_aidl_bdis_tmout()
332 ci->fsm.b_se0_srp = 1; in b_se0_srp_tmout()
338 ci->fsm.b_srp_done = 1; in b_srp_fail_tmout()
344 ci->fsm.b_srp_done = 1; in b_data_pls_tmout()
345 ci->fsm.b_bus_req = 0; in b_data_pls_tmout()
346 if (ci->fsm.power_up) in b_data_pls_tmout()
347 ci->fsm.power_up = 0; in b_data_pls_tmout()
355 ci->fsm.b_ssend_srp = 1; in b_ssend_srp_tmout()
357 if (ci->fsm.otg->state == OTG_STATE_B_IDLE) in b_ssend_srp_tmout()
438 static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in ci_otg_fsm_add_timer() argument
440 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_fsm_add_timer()
447 static void ci_otg_fsm_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in ci_otg_fsm_del_timer() argument
449 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_fsm_del_timer()
460 static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) in ci_otg_drv_vbus() argument
463 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_drv_vbus()
481 fsm->a_srp_det = 0; in ci_otg_drv_vbus()
482 fsm->power_up = 0; in ci_otg_drv_vbus()
487 fsm->a_bus_drop = 1; in ci_otg_drv_vbus()
488 fsm->a_bus_req = 0; in ci_otg_drv_vbus()
495 static void ci_otg_loc_conn(struct otg_fsm *fsm, int on) in ci_otg_loc_conn() argument
497 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_loc_conn()
514 static void ci_otg_loc_sof(struct otg_fsm *fsm, int on) in ci_otg_loc_sof() argument
518 if (!fsm->otg->host) in ci_otg_loc_sof()
521 udev = usb_hub_find_child(fsm->otg->host->root_hub, 1); in ci_otg_loc_sof()
537 static void ci_otg_start_pulse(struct otg_fsm *fsm) in ci_otg_start_pulse() argument
539 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_pulse()
548 static int ci_otg_start_host(struct otg_fsm *fsm, int on) in ci_otg_start_host() argument
550 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_host()
562 static int ci_otg_start_gadget(struct otg_fsm *fsm, int on) in ci_otg_start_gadget() argument
564 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); in ci_otg_start_gadget()
591 if (ci->fsm.id && !(ci->driver) && in ci_otg_fsm_work()
592 ci->fsm.otg->state < OTG_STATE_A_IDLE) in ci_otg_fsm_work()
596 if (otg_statemachine(&ci->fsm)) { in ci_otg_fsm_work()
597 if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { in ci_otg_fsm_work()
606 if ((ci->fsm.id) || (ci->id_event) || in ci_otg_fsm_work()
607 (ci->fsm.power_up)) { in ci_otg_fsm_work()
618 } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { in ci_otg_fsm_work()
619 if (ci->fsm.b_sess_vld) { in ci_otg_fsm_work()
620 ci->fsm.power_up = 0; in ci_otg_fsm_work()
627 } else if (ci->fsm.otg->state == OTG_STATE_A_HOST) { in ci_otg_fsm_work()
644 struct otg_fsm *fsm = &ci->fsm; in ci_otg_fsm_event() local
650 switch (ci->fsm.otg->state) { in ci_otg_fsm_event()
653 fsm->b_conn = 1; in ci_otg_fsm_event()
654 fsm->a_bus_req = 1; in ci_otg_fsm_event()
660 fsm->b_sess_vld = 1; in ci_otg_fsm_event()
669 if (fsm->a_bus_suspend == 1) in ci_otg_fsm_event()
670 fsm->a_bus_suspend = 0; in ci_otg_fsm_event()
675 fsm->a_conn = 0; in ci_otg_fsm_event()
676 fsm->b_bus_req = 0; in ci_otg_fsm_event()
682 fsm->b_bus_suspend = 1; in ci_otg_fsm_event()
695 if (fsm->b_bus_suspend == 1) { in ci_otg_fsm_event()
697 fsm->b_bus_suspend = 0; in ci_otg_fsm_event()
703 fsm->b_conn = 0; in ci_otg_fsm_event()
715 fsm->b_conn = 0; in ci_otg_fsm_event()
721 fsm->a_conn = 1; in ci_otg_fsm_event()
740 struct otg_fsm *fsm = &ci->fsm; in ci_otg_fsm_irq() local
744 fsm->id = (otgsc & OTGSC_ID) ? 1 : 0; in ci_otg_fsm_irq()
749 fsm->a_srp_det = 1; in ci_otg_fsm_irq()
750 fsm->a_bus_drop = 0; in ci_otg_fsm_irq()
753 if (fsm->id == 0) { in ci_otg_fsm_irq()
754 fsm->a_bus_drop = 0; in ci_otg_fsm_irq()
755 fsm->a_bus_req = 1; in ci_otg_fsm_irq()
761 fsm->b_sess_vld = 1; in ci_otg_fsm_irq()
764 fsm->b_ssend_srp = 0; in ci_otg_fsm_irq()
766 fsm->b_sess_vld = 0; in ci_otg_fsm_irq()
767 if (fsm->id) in ci_otg_fsm_irq()
773 fsm->a_vbus_vld = 1; in ci_otg_fsm_irq()
775 fsm->a_vbus_vld = 0; in ci_otg_fsm_irq()
776 fsm->b_conn = 0; in ci_otg_fsm_irq()
803 ci->fsm.otg = &ci->otg; in ci_hdrc_otg_fsm_init()
804 ci->fsm.power_up = 1; in ci_hdrc_otg_fsm_init()
805 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; in ci_hdrc_otg_fsm_init()
806 ci->fsm.otg->state = OTG_STATE_UNDEFINED; in ci_hdrc_otg_fsm_init()
807 ci->fsm.ops = &ci_otg_ops; in ci_hdrc_otg_fsm_init()
809 ci->fsm.host_req_flag = devm_kzalloc(ci->dev, 1, GFP_KERNEL); in ci_hdrc_otg_fsm_init()
810 if (!ci->fsm.host_req_flag) in ci_hdrc_otg_fsm_init()
813 mutex_init(&ci->fsm.lock); in ci_hdrc_otg_fsm_init()
833 if (ci->fsm.id) { in ci_hdrc_otg_fsm_init()
834 ci->fsm.b_ssend_srp = in ci_hdrc_otg_fsm_init()
836 ci->fsm.b_sess_vld = in ci_hdrc_otg_fsm_init()