Lines Matching defs:fsm

14  * This file mainly handles OTG fsm, it includes OTG fsm operations
59 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_req);
75 mutex_lock(&ci->fsm.lock);
77 ci->fsm.a_bus_req = 0;
80 if (ci->fsm.a_bus_drop) {
81 mutex_unlock(&ci->fsm.lock);
84 ci->fsm.a_bus_req = 1;
88 mutex_unlock(&ci->fsm.lock);
103 t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_drop);
119 mutex_lock(&ci->fsm.lock);
121 ci->fsm.a_bus_drop = 0;
123 ci->fsm.a_bus_drop = 1;
124 ci->fsm.a_bus_req = 0;
128 mutex_unlock(&ci->fsm.lock);
144 t = scnprintf(next, size, "%d\n", ci->fsm.b_bus_req);
160 mutex_lock(&ci->fsm.lock);
162 ci->fsm.b_bus_req = 0;
164 ci->fsm.b_bus_req = 1;
167 mutex_unlock(&ci->fsm.lock);
182 mutex_lock(&ci->fsm.lock);
184 ci->fsm.a_clr_err = 1;
187 mutex_unlock(&ci->fsm.lock);
319 ci->fsm.b_sess_vld = 0;
341 ci->fsm.b_sess_vld = 0;
351 ci->fsm.b_srp_done = 1;
352 ci->fsm.b_bus_req = 0;
353 if (ci->fsm.power_up)
354 ci->fsm.power_up = 0;
364 struct otg_fsm *fsm = &ci->fsm;
369 (unsigned long)&fsm->a_wait_vrise_tmout);
375 TA_WAIT_VFALL, (unsigned long)&fsm->a_wait_vfall_tmout);
381 (unsigned long)&fsm->a_wait_bcon_tmout);
387 (unsigned long)&fsm->a_aidl_bdis_tmout);
393 (unsigned long)&fsm->a_bidl_adis_tmout);
399 (unsigned long)&fsm->b_ase0_brst_tmout);
405 (unsigned long)&fsm->b_se0_srp);
411 (unsigned long)&fsm->b_ssend_srp);
417 (unsigned long)&fsm->b_srp_done);
437 static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t)
439 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
446 static void ci_otg_fsm_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer t)
448 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
459 static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
462 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
480 fsm->a_srp_det = 0;
481 fsm->power_up = 0;
486 fsm->a_bus_drop = 1;
487 fsm->a_bus_req = 0;
494 static void ci_otg_loc_conn(struct otg_fsm *fsm, int on)
496 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
510 static void ci_otg_loc_sof(struct otg_fsm *fsm, int on)
512 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
526 static void ci_otg_start_pulse(struct otg_fsm *fsm)
528 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
536 static int ci_otg_start_host(struct otg_fsm *fsm, int on)
538 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
540 mutex_unlock(&fsm->lock);
549 mutex_lock(&fsm->lock);
553 static int ci_otg_start_gadget(struct otg_fsm *fsm, int on)
555 struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm);
557 mutex_unlock(&fsm->lock);
562 mutex_lock(&fsm->lock);
581 * Don't do fsm transition for B device
584 if (ci->fsm.id && !(ci->driver) &&
588 if (otg_statemachine(&ci->fsm)) {
598 if ((ci->fsm.id) || (ci->id_event) ||
599 (ci->fsm.power_up))
604 if (ci->fsm.b_sess_vld) {
605 ci->fsm.power_up = 0;
618 * Update fsm variables in each state if catching expected interrupts,
619 * called by otg fsm isr.
624 struct otg_fsm *fsm = &ci->fsm;
633 fsm->b_conn = 1;
634 fsm->a_bus_req = 1;
640 fsm->b_sess_vld = 1;
646 fsm->a_bus_suspend = 1;
649 if (fsm->a_bus_suspend == 1)
650 fsm->a_bus_suspend = 0;
655 fsm->a_conn = 0;
656 fsm->b_bus_req = 0;
663 fsm->b_bus_suspend = 1;
676 if (fsm->b_bus_suspend == 1) {
678 fsm->b_bus_suspend = 0;
684 fsm->b_conn = 0;
696 fsm->b_conn = 0;
702 fsm->a_conn = 1;
712 * ci_otg_irq - otg fsm related irq handling
713 * and also update otg fsm variable by monitoring usb host and udc
721 struct otg_fsm *fsm = &ci->fsm;
725 fsm->id = (otgsc & OTGSC_ID) ? 1 : 0;
734 fsm->a_srp_det = 1;
735 fsm->a_bus_drop = 0;
738 if (fsm->id == 0) {
739 fsm->a_bus_drop = 0;
740 fsm->a_bus_req = 1;
746 fsm->b_sess_vld = 1;
749 fsm->b_ssend_srp = 0;
751 fsm->b_sess_vld = 0;
752 if (fsm->id)
758 fsm->a_vbus_vld = 1;
760 fsm->a_vbus_vld = 0;
761 fsm->b_conn = 0;
793 ci->fsm.otg = otg;
794 ci->transceiver->otg = ci->fsm.otg;
795 ci->fsm.power_up = 1;
796 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0;
798 ci->fsm.ops = &ci_otg_ops;
800 mutex_init(&ci->fsm.lock);
827 if (ci->fsm.id) {
828 ci->fsm.b_ssend_srp =
830 ci->fsm.b_sess_vld =