~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/usb/otg-fsm.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/usb/otg-fsm.h (Version linux-6.12-rc7) and /include/linux/usb/otg-fsm.h (Version linux-4.9.337)


  1 // SPDX-License-Identifier: GPL-2.0+           !!   1 /* Copyright (C) 2007,2008 Freescale Semiconductor, Inc.
  2 /*                                             !!   2  *
  3  * Copyright (C) 2007,2008 Freescale Semicondu !!   3  * This program is free software; you can redistribute  it and/or modify it
                                                   >>   4  * under  the terms of  the GNU General  Public License as published by the
                                                   >>   5  * Free Software Foundation;  either version 2 of the  License, or (at your
                                                   >>   6  * option) any later version.
                                                   >>   7  *
                                                   >>   8  * This program is distributed in the hope that it will be useful, but
                                                   >>   9  * WITHOUT ANY WARRANTY; without even the implied warranty of
                                                   >>  10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                                                   >>  11  * General Public License for more details.
                                                   >>  12  *
                                                   >>  13  * You should have received a copy of the  GNU General Public License along
                                                   >>  14  * with this program; if not, write  to the Free Software Foundation, Inc.,
                                                   >>  15  * 675 Mass Ave, Cambridge, MA 02139, USA.
  4  */                                                16  */
  5                                                    17 
  6 #ifndef __LINUX_USB_OTG_FSM_H                      18 #ifndef __LINUX_USB_OTG_FSM_H
  7 #define __LINUX_USB_OTG_FSM_H                      19 #define __LINUX_USB_OTG_FSM_H
  8                                                    20 
  9 #include <linux/mutex.h>                           21 #include <linux/mutex.h>
 10 #include <linux/errno.h>                           22 #include <linux/errno.h>
 11                                                    23 
                                                   >>  24 #undef VERBOSE
                                                   >>  25 
                                                   >>  26 #ifdef VERBOSE
                                                   >>  27 #define VDBG(fmt, args...) pr_debug("[%s]  " fmt , \
                                                   >>  28                                  __func__, ## args)
                                                   >>  29 #else
                                                   >>  30 #define VDBG(stuff...)  do {} while (0)
                                                   >>  31 #endif
                                                   >>  32 
                                                   >>  33 #ifdef VERBOSE
                                                   >>  34 #define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__)
                                                   >>  35 #else
                                                   >>  36 #define MPC_LOC do {} while (0)
                                                   >>  37 #endif
                                                   >>  38 
 12 #define PROTO_UNDEF     (0)                        39 #define PROTO_UNDEF     (0)
 13 #define PROTO_HOST      (1)                        40 #define PROTO_HOST      (1)
 14 #define PROTO_GADGET    (2)                        41 #define PROTO_GADGET    (2)
 15                                                    42 
 16 #define OTG_STS_SELECTOR        0xF000  /* OTG     43 #define OTG_STS_SELECTOR        0xF000  /* OTG status selector, according to
 17                                          * OTG     44                                          * OTG and EH 2.0 Chapter 6.2.3
 18                                          * Tab     45                                          * Table:6-4
 19                                          */        46                                          */
 20                                                    47 
 21 #define HOST_REQUEST_FLAG       1       /* Hos     48 #define HOST_REQUEST_FLAG       1       /* Host request flag, according to
 22                                          * OTG     49                                          * OTG and EH 2.0 Charpter 6.2.3
 23                                          * Tab     50                                          * Table:6-5
 24                                          */        51                                          */
 25                                                    52 
 26 #define T_HOST_REQ_POLL         (1500)  /* 150     53 #define T_HOST_REQ_POLL         (1500)  /* 1500ms, HNP polling interval */
 27                                                    54 
 28 enum otg_fsm_timer {                               55 enum otg_fsm_timer {
 29         /* Standard OTG timers */                  56         /* Standard OTG timers */
 30         A_WAIT_VRISE,                              57         A_WAIT_VRISE,
 31         A_WAIT_VFALL,                              58         A_WAIT_VFALL,
 32         A_WAIT_BCON,                               59         A_WAIT_BCON,
 33         A_AIDL_BDIS,                               60         A_AIDL_BDIS,
 34         B_ASE0_BRST,                               61         B_ASE0_BRST,
 35         A_BIDL_ADIS,                               62         A_BIDL_ADIS,
 36         B_AIDL_BDIS,                               63         B_AIDL_BDIS,
 37                                                    64 
 38         /* Auxiliary timers */                     65         /* Auxiliary timers */
 39         B_SE0_SRP,                                 66         B_SE0_SRP,
 40         B_SRP_FAIL,                                67         B_SRP_FAIL,
 41         A_WAIT_ENUM,                               68         A_WAIT_ENUM,
 42         B_DATA_PLS,                                69         B_DATA_PLS,
 43         B_SSEND_SRP,                               70         B_SSEND_SRP,
 44                                                    71 
 45         NUM_OTG_FSM_TIMERS,                        72         NUM_OTG_FSM_TIMERS,
 46 };                                                 73 };
 47                                                    74 
 48 /**                                                75 /**
 49  * struct otg_fsm - OTG state machine accordin     76  * struct otg_fsm - OTG state machine according to the OTG spec
 50  *                                                 77  *
 51  * OTG hardware Inputs                             78  * OTG hardware Inputs
 52  *                                                 79  *
 53  *      Common inputs for A and B device           80  *      Common inputs for A and B device
 54  * @id:         TRUE for B-device, FALSE for A     81  * @id:         TRUE for B-device, FALSE for A-device.
 55  * @adp_change: TRUE when current ADP measurem     82  * @adp_change: TRUE when current ADP measurement (n) value, compared to the
 56  *              ADP measurement taken at n-2,      83  *              ADP measurement taken at n-2, differs by more than CADP_THR
 57  * @power_up:   TRUE when the OTG device first     84  * @power_up:   TRUE when the OTG device first powers up its USB system and
 58  *              ADP measurement taken if ADP c     85  *              ADP measurement taken if ADP capable
 59  *                                                 86  *
 60  *      A-Device state inputs                      87  *      A-Device state inputs
 61  * @a_srp_det:  TRUE if the A-device detects S     88  * @a_srp_det:  TRUE if the A-device detects SRP
 62  * @a_vbus_vld: TRUE when VBUS voltage is in r     89  * @a_vbus_vld: TRUE when VBUS voltage is in regulation
 63  * @b_conn:     TRUE if the A-device detects c     90  * @b_conn:     TRUE if the A-device detects connection from the B-device
 64  * @a_bus_resume: TRUE when the B-device detec     91  * @a_bus_resume: TRUE when the B-device detects that the A-device is signaling
 65  *                a resume (K state)               92  *                a resume (K state)
 66  *      B-Device state inputs                      93  *      B-Device state inputs
 67  * @a_bus_suspend: TRUE when the B-device dete     94  * @a_bus_suspend: TRUE when the B-device detects that the A-device has put the
 68  *              bus into suspend                   95  *              bus into suspend
 69  * @a_conn:     TRUE if the B-device detects a     96  * @a_conn:     TRUE if the B-device detects a connection from the A-device
 70  * @b_se0_srp:  TRUE when the line has been at     97  * @b_se0_srp:  TRUE when the line has been at SE0 for more than the minimum
 71  *              time before generating SRP         98  *              time before generating SRP
 72  * @b_ssend_srp: TRUE when the VBUS has been b     99  * @b_ssend_srp: TRUE when the VBUS has been below VOTG_SESS_VLD for more than
 73  *               the minimum time before gener    100  *               the minimum time before generating SRP
 74  * @b_sess_vld: TRUE when the B-device detects    101  * @b_sess_vld: TRUE when the B-device detects that the voltage on VBUS is
 75  *              above VOTG_SESS_VLD               102  *              above VOTG_SESS_VLD
 76  * @test_device: TRUE when the B-device switch    103  * @test_device: TRUE when the B-device switches to B-Host and detects an OTG
 77  *              test device. This must be set     104  *              test device. This must be set by host/hub driver
 78  *                                                105  *
 79  *      Application inputs (A-Device)             106  *      Application inputs (A-Device)
 80  * @a_bus_drop: TRUE when A-device application    107  * @a_bus_drop: TRUE when A-device application needs to power down the bus
 81  * @a_bus_req:  TRUE when A-device application    108  * @a_bus_req:  TRUE when A-device application wants to use the bus.
 82  *              FALSE to suspend the bus          109  *              FALSE to suspend the bus
 83  *                                                110  *
 84  *      Application inputs (B-Device)             111  *      Application inputs (B-Device)
 85  * @b_bus_req:  TRUE during the time that the     112  * @b_bus_req:  TRUE during the time that the Application running on the
 86  *              B-device wants to use the bus     113  *              B-device wants to use the bus
 87  *                                                114  *
 88  *      Auxiliary inputs (OTG v1.3 only. Obsol !! 115  *      Auxilary inputs (OTG v1.3 only. Obsolete now.)
 89  * @a_sess_vld: TRUE if the A-device detects t    116  * @a_sess_vld: TRUE if the A-device detects that VBUS is above VA_SESS_VLD
 90  * @b_bus_suspend: TRUE when the A-device dete    117  * @b_bus_suspend: TRUE when the A-device detects that the B-device has put
 91  *              the bus into suspend              118  *              the bus into suspend
 92  * @b_bus_resume: TRUE when the A-device detec    119  * @b_bus_resume: TRUE when the A-device detects that the B-device is signaling
 93  *               resume on the bus                120  *               resume on the bus
 94  *                                                121  *
 95  * OTG Output status. Read only for users. Upd    122  * OTG Output status. Read only for users. Updated by OTG FSM helpers defined
 96  * in this file                                   123  * in this file
 97  *                                                124  *
 98  *      Outputs for Both A and B device           125  *      Outputs for Both A and B device
 99  * @drv_vbus:   TRUE when A-device is driving     126  * @drv_vbus:   TRUE when A-device is driving VBUS
100  * @loc_conn:   TRUE when the local device has    127  * @loc_conn:   TRUE when the local device has signaled that it is connected
101  *              to the bus                        128  *              to the bus
102  * @loc_sof:    TRUE when the local device is     129  * @loc_sof:    TRUE when the local device is generating activity on the bus
103  * @adp_prb:    TRUE when the local device is     130  * @adp_prb:    TRUE when the local device is in the process of doing
104  *              ADP probing                       131  *              ADP probing
105  *                                                132  *
106  *      Outputs for B-device state                133  *      Outputs for B-device state
107  * @adp_sns:    TRUE when the B-device is in t    134  * @adp_sns:    TRUE when the B-device is in the process of carrying out
108  *              ADP sensing                       135  *              ADP sensing
109  * @data_pulse: TRUE when the B-device is perf    136  * @data_pulse: TRUE when the B-device is performing data line pulsing
110  *                                                137  *
111  * Internal Variables                             138  * Internal Variables
112  *                                                139  *
113  * a_set_b_hnp_en: TRUE when the A-device has     140  * a_set_b_hnp_en: TRUE when the A-device has successfully set the
114  *              b_hnp_enable bit in the B-devi    141  *              b_hnp_enable bit in the B-device.
115  *                 Unused as OTG fsm uses otg-    142  *                 Unused as OTG fsm uses otg->host->b_hnp_enable instead
116  * b_srp_done:  TRUE when the B-device has com    143  * b_srp_done:  TRUE when the B-device has completed initiating SRP
117  * b_hnp_enable: TRUE when the B-device has ac    144  * b_hnp_enable: TRUE when the B-device has accepted the
118  *              SetFeature(b_hnp_enable) B-dev    145  *              SetFeature(b_hnp_enable) B-device.
119  *              Unused as OTG fsm uses otg->ga    146  *              Unused as OTG fsm uses otg->gadget->b_hnp_enable instead
120  * a_clr_err:   Asserted (by application ?) to    147  * a_clr_err:   Asserted (by application ?) to clear a_vbus_err due to an
121  *              overcurrent condition and caus    148  *              overcurrent condition and causes the A-device to transition
122  *              to a_wait_vfall                   149  *              to a_wait_vfall
123  */                                               150  */
124 struct otg_fsm {                                  151 struct otg_fsm {
125         /* Input */                               152         /* Input */
126         int id;                                   153         int id;
127         int adp_change;                           154         int adp_change;
128         int power_up;                             155         int power_up;
129         int a_srp_det;                            156         int a_srp_det;
130         int a_vbus_vld;                           157         int a_vbus_vld;
131         int b_conn;                               158         int b_conn;
132         int a_bus_resume;                         159         int a_bus_resume;
133         int a_bus_suspend;                        160         int a_bus_suspend;
134         int a_conn;                               161         int a_conn;
135         int b_se0_srp;                            162         int b_se0_srp;
136         int b_ssend_srp;                          163         int b_ssend_srp;
137         int b_sess_vld;                           164         int b_sess_vld;
138         int test_device;                          165         int test_device;
139         int a_bus_drop;                           166         int a_bus_drop;
140         int a_bus_req;                            167         int a_bus_req;
141         int b_bus_req;                            168         int b_bus_req;
142                                                   169 
143         /* Auxiliary inputs */                 !! 170         /* Auxilary inputs */
144         int a_sess_vld;                           171         int a_sess_vld;
145         int b_bus_resume;                         172         int b_bus_resume;
146         int b_bus_suspend;                        173         int b_bus_suspend;
147                                                   174 
148         /* Output */                              175         /* Output */
149         int drv_vbus;                             176         int drv_vbus;
150         int loc_conn;                             177         int loc_conn;
151         int loc_sof;                              178         int loc_sof;
152         int adp_prb;                              179         int adp_prb;
153         int adp_sns;                              180         int adp_sns;
154         int data_pulse;                           181         int data_pulse;
155                                                   182 
156         /* Internal variables */                  183         /* Internal variables */
157         int a_set_b_hnp_en;                       184         int a_set_b_hnp_en;
158         int b_srp_done;                           185         int b_srp_done;
159         int b_hnp_enable;                         186         int b_hnp_enable;
160         int a_clr_err;                            187         int a_clr_err;
161                                                   188 
162         /* Informative variables. All unused a    189         /* Informative variables. All unused as of now */
163         int a_bus_drop_inf;                       190         int a_bus_drop_inf;
164         int a_bus_req_inf;                        191         int a_bus_req_inf;
165         int a_clr_err_inf;                        192         int a_clr_err_inf;
166         int b_bus_req_inf;                        193         int b_bus_req_inf;
167         /* Auxiliary informative variables */  !! 194         /* Auxilary informative variables */
168         int a_suspend_req_inf;                    195         int a_suspend_req_inf;
169                                                   196 
170         /* Timeout indicator for timers */        197         /* Timeout indicator for timers */
171         int a_wait_vrise_tmout;                   198         int a_wait_vrise_tmout;
172         int a_wait_vfall_tmout;                   199         int a_wait_vfall_tmout;
173         int a_wait_bcon_tmout;                    200         int a_wait_bcon_tmout;
174         int a_aidl_bdis_tmout;                    201         int a_aidl_bdis_tmout;
175         int b_ase0_brst_tmout;                    202         int b_ase0_brst_tmout;
176         int a_bidl_adis_tmout;                    203         int a_bidl_adis_tmout;
177                                                   204 
178         struct otg_fsm_ops *ops;                  205         struct otg_fsm_ops *ops;
179         struct usb_otg *otg;                      206         struct usb_otg *otg;
180                                                   207 
181         /* Current usb protocol used: 0:undefi    208         /* Current usb protocol used: 0:undefine; 1:host; 2:client */
182         int protocol;                             209         int protocol;
183         struct mutex lock;                        210         struct mutex lock;
184         u8 *host_req_flag;                        211         u8 *host_req_flag;
185         struct delayed_work hnp_polling_work;     212         struct delayed_work hnp_polling_work;
186         bool hnp_work_inited;                     213         bool hnp_work_inited;
187         bool state_changed;                       214         bool state_changed;
188 };                                                215 };
189                                                   216 
190 struct otg_fsm_ops {                              217 struct otg_fsm_ops {
191         void    (*chrg_vbus)(struct otg_fsm *f    218         void    (*chrg_vbus)(struct otg_fsm *fsm, int on);
192         void    (*drv_vbus)(struct otg_fsm *fs    219         void    (*drv_vbus)(struct otg_fsm *fsm, int on);
193         void    (*loc_conn)(struct otg_fsm *fs    220         void    (*loc_conn)(struct otg_fsm *fsm, int on);
194         void    (*loc_sof)(struct otg_fsm *fsm    221         void    (*loc_sof)(struct otg_fsm *fsm, int on);
195         void    (*start_pulse)(struct otg_fsm     222         void    (*start_pulse)(struct otg_fsm *fsm);
196         void    (*start_adp_prb)(struct otg_fs    223         void    (*start_adp_prb)(struct otg_fsm *fsm);
197         void    (*start_adp_sns)(struct otg_fs    224         void    (*start_adp_sns)(struct otg_fsm *fsm);
198         void    (*add_timer)(struct otg_fsm *f    225         void    (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
199         void    (*del_timer)(struct otg_fsm *f    226         void    (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
200         int     (*start_host)(struct otg_fsm *    227         int     (*start_host)(struct otg_fsm *fsm, int on);
201         int     (*start_gadget)(struct otg_fsm    228         int     (*start_gadget)(struct otg_fsm *fsm, int on);
202 };                                                229 };
203                                                   230 
204                                                   231 
205 static inline int otg_chrg_vbus(struct otg_fsm    232 static inline int otg_chrg_vbus(struct otg_fsm *fsm, int on)
206 {                                                 233 {
207         if (!fsm->ops->chrg_vbus)                 234         if (!fsm->ops->chrg_vbus)
208                 return -EOPNOTSUPP;               235                 return -EOPNOTSUPP;
209         fsm->ops->chrg_vbus(fsm, on);             236         fsm->ops->chrg_vbus(fsm, on);
210         return 0;                                 237         return 0;
211 }                                                 238 }
212                                                   239 
213 static inline int otg_drv_vbus(struct otg_fsm     240 static inline int otg_drv_vbus(struct otg_fsm *fsm, int on)
214 {                                                 241 {
215         if (!fsm->ops->drv_vbus)                  242         if (!fsm->ops->drv_vbus)
216                 return -EOPNOTSUPP;               243                 return -EOPNOTSUPP;
217         if (fsm->drv_vbus != on) {                244         if (fsm->drv_vbus != on) {
218                 fsm->drv_vbus = on;               245                 fsm->drv_vbus = on;
219                 fsm->ops->drv_vbus(fsm, on);      246                 fsm->ops->drv_vbus(fsm, on);
220         }                                         247         }
221         return 0;                                 248         return 0;
222 }                                                 249 }
223                                                   250 
224 static inline int otg_loc_conn(struct otg_fsm     251 static inline int otg_loc_conn(struct otg_fsm *fsm, int on)
225 {                                                 252 {
226         if (!fsm->ops->loc_conn)                  253         if (!fsm->ops->loc_conn)
227                 return -EOPNOTSUPP;               254                 return -EOPNOTSUPP;
228         if (fsm->loc_conn != on) {                255         if (fsm->loc_conn != on) {
229                 fsm->loc_conn = on;               256                 fsm->loc_conn = on;
230                 fsm->ops->loc_conn(fsm, on);      257                 fsm->ops->loc_conn(fsm, on);
231         }                                         258         }
232         return 0;                                 259         return 0;
233 }                                                 260 }
234                                                   261 
235 static inline int otg_loc_sof(struct otg_fsm *    262 static inline int otg_loc_sof(struct otg_fsm *fsm, int on)
236 {                                                 263 {
237         if (!fsm->ops->loc_sof)                   264         if (!fsm->ops->loc_sof)
238                 return -EOPNOTSUPP;               265                 return -EOPNOTSUPP;
239         if (fsm->loc_sof != on) {                 266         if (fsm->loc_sof != on) {
240                 fsm->loc_sof = on;                267                 fsm->loc_sof = on;
241                 fsm->ops->loc_sof(fsm, on);       268                 fsm->ops->loc_sof(fsm, on);
242         }                                         269         }
243         return 0;                                 270         return 0;
244 }                                                 271 }
245                                                   272 
246 static inline int otg_start_pulse(struct otg_f    273 static inline int otg_start_pulse(struct otg_fsm *fsm)
247 {                                                 274 {
248         if (!fsm->ops->start_pulse)               275         if (!fsm->ops->start_pulse)
249                 return -EOPNOTSUPP;               276                 return -EOPNOTSUPP;
250         if (!fsm->data_pulse) {                   277         if (!fsm->data_pulse) {
251                 fsm->data_pulse = 1;              278                 fsm->data_pulse = 1;
252                 fsm->ops->start_pulse(fsm);       279                 fsm->ops->start_pulse(fsm);
253         }                                         280         }
254         return 0;                                 281         return 0;
255 }                                                 282 }
256                                                   283 
257 static inline int otg_start_adp_prb(struct otg    284 static inline int otg_start_adp_prb(struct otg_fsm *fsm)
258 {                                                 285 {
259         if (!fsm->ops->start_adp_prb)             286         if (!fsm->ops->start_adp_prb)
260                 return -EOPNOTSUPP;               287                 return -EOPNOTSUPP;
261         if (!fsm->adp_prb) {                      288         if (!fsm->adp_prb) {
262                 fsm->adp_sns = 0;                 289                 fsm->adp_sns = 0;
263                 fsm->adp_prb = 1;                 290                 fsm->adp_prb = 1;
264                 fsm->ops->start_adp_prb(fsm);     291                 fsm->ops->start_adp_prb(fsm);
265         }                                         292         }
266         return 0;                                 293         return 0;
267 }                                                 294 }
268                                                   295 
269 static inline int otg_start_adp_sns(struct otg    296 static inline int otg_start_adp_sns(struct otg_fsm *fsm)
270 {                                                 297 {
271         if (!fsm->ops->start_adp_sns)             298         if (!fsm->ops->start_adp_sns)
272                 return -EOPNOTSUPP;               299                 return -EOPNOTSUPP;
273         if (!fsm->adp_sns) {                      300         if (!fsm->adp_sns) {
274                 fsm->adp_sns = 1;                 301                 fsm->adp_sns = 1;
275                 fsm->ops->start_adp_sns(fsm);     302                 fsm->ops->start_adp_sns(fsm);
276         }                                         303         }
277         return 0;                                 304         return 0;
278 }                                                 305 }
279                                                   306 
280 static inline int otg_add_timer(struct otg_fsm    307 static inline int otg_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
281 {                                                 308 {
282         if (!fsm->ops->add_timer)                 309         if (!fsm->ops->add_timer)
283                 return -EOPNOTSUPP;               310                 return -EOPNOTSUPP;
284         fsm->ops->add_timer(fsm, timer);          311         fsm->ops->add_timer(fsm, timer);
285         return 0;                                 312         return 0;
286 }                                                 313 }
287                                                   314 
288 static inline int otg_del_timer(struct otg_fsm    315 static inline int otg_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
289 {                                                 316 {
290         if (!fsm->ops->del_timer)                 317         if (!fsm->ops->del_timer)
291                 return -EOPNOTSUPP;               318                 return -EOPNOTSUPP;
292         fsm->ops->del_timer(fsm, timer);          319         fsm->ops->del_timer(fsm, timer);
293         return 0;                                 320         return 0;
294 }                                                 321 }
295                                                   322 
296 static inline int otg_start_host(struct otg_fs    323 static inline int otg_start_host(struct otg_fsm *fsm, int on)
297 {                                                 324 {
298         if (!fsm->ops->start_host)                325         if (!fsm->ops->start_host)
299                 return -EOPNOTSUPP;               326                 return -EOPNOTSUPP;
300         return fsm->ops->start_host(fsm, on);     327         return fsm->ops->start_host(fsm, on);
301 }                                                 328 }
302                                                   329 
303 static inline int otg_start_gadget(struct otg_    330 static inline int otg_start_gadget(struct otg_fsm *fsm, int on)
304 {                                                 331 {
305         if (!fsm->ops->start_gadget)              332         if (!fsm->ops->start_gadget)
306                 return -EOPNOTSUPP;               333                 return -EOPNOTSUPP;
307         return fsm->ops->start_gadget(fsm, on)    334         return fsm->ops->start_gadget(fsm, on);
308 }                                                 335 }
309                                                   336 
310 int otg_statemachine(struct otg_fsm *fsm);        337 int otg_statemachine(struct otg_fsm *fsm);
311                                                   338 
312 #endif /* __LINUX_USB_OTG_FSM_H */                339 #endif /* __LINUX_USB_OTG_FSM_H */
313                                                   340 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php