Lines Matching +full:on +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0+
31 * Table:6-4
36 * Table:6-5
62 * struct otg_fsm - OTG state machine according to the OTG spec
66 * Common inputs for A and B device
67 * @id: TRUE for B-device, FALSE for A-device.
69 * ADP measurement taken at n-2, differs by more than CADP_THR
70 * @power_up: TRUE when the OTG device first powers up its USB system and
73 * A-Device state inputs
74 * @a_srp_det: TRUE if the A-device detects SRP
76 * @b_conn: TRUE if the A-device detects connection from the B-device
77 * @a_bus_resume: TRUE when the B-device detects that the A-device is signaling
79 * B-Device state inputs
80 * @a_bus_suspend: TRUE when the B-device detects that the A-device has put the
82 * @a_conn: TRUE if the B-device detects a connection from the A-device
87 * @b_sess_vld: TRUE when the B-device detects that the voltage on VBUS is
89 * @test_device: TRUE when the B-device switches to B-Host and detects an OTG
90 * test device. This must be set by host/hub driver
92 * Application inputs (A-Device)
93 * @a_bus_drop: TRUE when A-device application needs to power down the bus
94 * @a_bus_req: TRUE when A-device application wants to use the bus.
97 * Application inputs (B-Device)
98 * @b_bus_req: TRUE during the time that the Application running on the
99 * B-device wants to use the bus
102 * @a_sess_vld: TRUE if the A-device detects that VBUS is above VA_SESS_VLD
103 * @b_bus_suspend: TRUE when the A-device detects that the B-device has put
105 * @b_bus_resume: TRUE when the A-device detects that the B-device is signaling
106 * resume on the bus
111 * Outputs for Both A and B device
112 * @drv_vbus: TRUE when A-device is driving VBUS
113 * @loc_conn: TRUE when the local device has signaled that it is connected
115 * @loc_sof: TRUE when the local device is generating activity on the bus
116 * @adp_prb: TRUE when the local device is in the process of doing
119 * Outputs for B-device state
120 * @adp_sns: TRUE when the B-device is in the process of carrying out
122 * @data_pulse: TRUE when the B-device is performing data line pulsing
126 * a_set_b_hnp_en: TRUE when the A-device has successfully set the
127 * b_hnp_enable bit in the B-device.
128 * Unused as OTG fsm uses otg->host->b_hnp_enable instead
129 * b_srp_done: TRUE when the B-device has completed initiating SRP
130 * b_hnp_enable: TRUE when the B-device has accepted the
131 * SetFeature(b_hnp_enable) B-device.
132 * Unused as OTG fsm uses otg->gadget->b_hnp_enable instead
134 * overcurrent condition and causes the A-device to transition
203 void (*chrg_vbus)(struct otg_fsm *fsm, int on);
204 void (*drv_vbus)(struct otg_fsm *fsm, int on);
205 void (*loc_conn)(struct otg_fsm *fsm, int on);
206 void (*loc_sof)(struct otg_fsm *fsm, int on);
212 int (*start_host)(struct otg_fsm *fsm, int on);
213 int (*start_gadget)(struct otg_fsm *fsm, int on);
217 static inline int otg_chrg_vbus(struct otg_fsm *fsm, int on) in otg_chrg_vbus() argument
219 if (!fsm->ops->chrg_vbus) in otg_chrg_vbus()
220 return -EOPNOTSUPP; in otg_chrg_vbus()
221 fsm->ops->chrg_vbus(fsm, on); in otg_chrg_vbus()
225 static inline int otg_drv_vbus(struct otg_fsm *fsm, int on) in otg_drv_vbus() argument
227 if (!fsm->ops->drv_vbus) in otg_drv_vbus()
228 return -EOPNOTSUPP; in otg_drv_vbus()
229 if (fsm->drv_vbus != on) { in otg_drv_vbus()
230 fsm->drv_vbus = on; in otg_drv_vbus()
231 fsm->ops->drv_vbus(fsm, on); in otg_drv_vbus()
236 static inline int otg_loc_conn(struct otg_fsm *fsm, int on) in otg_loc_conn() argument
238 if (!fsm->ops->loc_conn) in otg_loc_conn()
239 return -EOPNOTSUPP; in otg_loc_conn()
240 if (fsm->loc_conn != on) { in otg_loc_conn()
241 fsm->loc_conn = on; in otg_loc_conn()
242 fsm->ops->loc_conn(fsm, on); in otg_loc_conn()
247 static inline int otg_loc_sof(struct otg_fsm *fsm, int on) in otg_loc_sof() argument
249 if (!fsm->ops->loc_sof) in otg_loc_sof()
250 return -EOPNOTSUPP; in otg_loc_sof()
251 if (fsm->loc_sof != on) { in otg_loc_sof()
252 fsm->loc_sof = on; in otg_loc_sof()
253 fsm->ops->loc_sof(fsm, on); in otg_loc_sof()
260 if (!fsm->ops->start_pulse) in otg_start_pulse()
261 return -EOPNOTSUPP; in otg_start_pulse()
262 if (!fsm->data_pulse) { in otg_start_pulse()
263 fsm->data_pulse = 1; in otg_start_pulse()
264 fsm->ops->start_pulse(fsm); in otg_start_pulse()
271 if (!fsm->ops->start_adp_prb) in otg_start_adp_prb()
272 return -EOPNOTSUPP; in otg_start_adp_prb()
273 if (!fsm->adp_prb) { in otg_start_adp_prb()
274 fsm->adp_sns = 0; in otg_start_adp_prb()
275 fsm->adp_prb = 1; in otg_start_adp_prb()
276 fsm->ops->start_adp_prb(fsm); in otg_start_adp_prb()
283 if (!fsm->ops->start_adp_sns) in otg_start_adp_sns()
284 return -EOPNOTSUPP; in otg_start_adp_sns()
285 if (!fsm->adp_sns) { in otg_start_adp_sns()
286 fsm->adp_sns = 1; in otg_start_adp_sns()
287 fsm->ops->start_adp_sns(fsm); in otg_start_adp_sns()
294 if (!fsm->ops->add_timer) in otg_add_timer()
295 return -EOPNOTSUPP; in otg_add_timer()
296 fsm->ops->add_timer(fsm, timer); in otg_add_timer()
302 if (!fsm->ops->del_timer) in otg_del_timer()
303 return -EOPNOTSUPP; in otg_del_timer()
304 fsm->ops->del_timer(fsm, timer); in otg_del_timer()
308 static inline int otg_start_host(struct otg_fsm *fsm, int on) in otg_start_host() argument
310 if (!fsm->ops->start_host) in otg_start_host()
311 return -EOPNOTSUPP; in otg_start_host()
312 return fsm->ops->start_host(fsm, on); in otg_start_host()
315 static inline int otg_start_gadget(struct otg_fsm *fsm, int on) in otg_start_gadget() argument
317 if (!fsm->ops->start_gadget) in otg_start_gadget()
318 return -EOPNOTSUPP; in otg_start_gadget()
319 return fsm->ops->start_gadget(fsm, on); in otg_start_gadget()