Lines Matching +full:s +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
13 #include <linux/usb/otg-fsm.h>
24 static int ci_device_show(struct seq_file *s, void *data) in ci_device_show() argument
26 struct ci_hdrc *ci = s->private; in ci_device_show()
27 struct usb_gadget *gadget = &ci->gadget; in ci_device_show()
29 seq_printf(s, "speed = %d\n", gadget->speed); in ci_device_show()
30 seq_printf(s, "max_speed = %d\n", gadget->max_speed); in ci_device_show()
31 seq_printf(s, "is_otg = %d\n", gadget->is_otg); in ci_device_show()
32 seq_printf(s, "is_a_peripheral = %d\n", gadget->is_a_peripheral); in ci_device_show()
33 seq_printf(s, "b_hnp_enable = %d\n", gadget->b_hnp_enable); in ci_device_show()
34 seq_printf(s, "a_hnp_support = %d\n", gadget->a_hnp_support); in ci_device_show()
35 seq_printf(s, "a_alt_hnp_support = %d\n", gadget->a_alt_hnp_support); in ci_device_show()
36 seq_printf(s, "name = %s\n", in ci_device_show()
37 (gadget->name ? gadget->name : "")); in ci_device_show()
39 if (!ci->driver) in ci_device_show()
42 seq_printf(s, "gadget function = %s\n", in ci_device_show()
43 (ci->driver->function ? ci->driver->function : "")); in ci_device_show()
44 seq_printf(s, "gadget max speed = %d\n", ci->driver->max_speed); in ci_device_show()
51 * ci_port_test_show: reads port test mode
53 static int ci_port_test_show(struct seq_file *s, void *data) in ci_port_test_show() argument
55 struct ci_hdrc *ci = s->private; in ci_port_test_show()
57 unsigned mode; in ci_port_test_show() local
59 pm_runtime_get_sync(ci->dev); in ci_port_test_show()
60 spin_lock_irqsave(&ci->lock, flags); in ci_port_test_show()
61 mode = hw_port_test_get(ci); in ci_port_test_show()
62 spin_unlock_irqrestore(&ci->lock, flags); in ci_port_test_show()
63 pm_runtime_put_sync(ci->dev); in ci_port_test_show()
65 seq_printf(s, "mode = %u\n", mode); in ci_port_test_show()
71 * ci_port_test_write: writes port test mode
76 struct seq_file *s = file->private_data; in ci_port_test_write() local
77 struct ci_hdrc *ci = s->private; in ci_port_test_write()
79 unsigned mode; in ci_port_test_write() local
83 count = min_t(size_t, sizeof(buf) - 1, count); in ci_port_test_write()
85 return -EFAULT; in ci_port_test_write()
90 if (sscanf(buf, "%u", &mode) != 1) in ci_port_test_write()
91 return -EINVAL; in ci_port_test_write()
93 if (mode > 255) in ci_port_test_write()
94 return -EBADRQC; in ci_port_test_write()
96 pm_runtime_get_sync(ci->dev); in ci_port_test_write()
97 spin_lock_irqsave(&ci->lock, flags); in ci_port_test_write()
98 ret = hw_port_test_set(ci, mode); in ci_port_test_write()
99 spin_unlock_irqrestore(&ci->lock, flags); in ci_port_test_write()
100 pm_runtime_put_sync(ci->dev); in ci_port_test_write()
107 return single_open(file, ci_port_test_show, inode->i_private); in ci_port_test_open()
121 static int ci_qheads_show(struct seq_file *s, void *data) in ci_qheads_show() argument
123 struct ci_hdrc *ci = s->private; in ci_qheads_show()
127 if (ci->role != CI_ROLE_GADGET) { in ci_qheads_show()
128 seq_printf(s, "not in gadget mode\n"); in ci_qheads_show()
132 spin_lock_irqsave(&ci->lock, flags); in ci_qheads_show()
133 for (i = 0; i < ci->hw_ep_max/2; i++) { in ci_qheads_show()
134 struct ci_hw_ep *hweprx = &ci->ci_hw_ep[i]; in ci_qheads_show()
136 &ci->ci_hw_ep[i + ci->hw_ep_max/2]; in ci_qheads_show()
137 seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n", in ci_qheads_show()
138 i, (u32)hweprx->qh.dma, (u32)hweptx->qh.dma); in ci_qheads_show()
140 seq_printf(s, " %04X: %08X %08X\n", j, in ci_qheads_show()
141 *((u32 *)hweprx->qh.ptr + j), in ci_qheads_show()
142 *((u32 *)hweptx->qh.ptr + j)); in ci_qheads_show()
144 spin_unlock_irqrestore(&ci->lock, flags); in ci_qheads_show()
153 static int ci_requests_show(struct seq_file *s, void *data) in ci_requests_show() argument
155 struct ci_hdrc *ci = s->private; in ci_requests_show()
161 if (ci->role != CI_ROLE_GADGET) { in ci_requests_show()
162 seq_printf(s, "not in gadget mode\n"); in ci_requests_show()
166 spin_lock_irqsave(&ci->lock, flags); in ci_requests_show()
167 for (i = 0; i < ci->hw_ep_max; i++) in ci_requests_show()
168 list_for_each_entry(req, &ci->ci_hw_ep[i].qh.queue, queue) { in ci_requests_show()
169 list_for_each_entry_safe(node, tmpnode, &req->tds, td) { in ci_requests_show()
170 seq_printf(s, "EP=%02i: TD=%08X %s\n", in ci_requests_show()
171 i % (ci->hw_ep_max / 2), in ci_requests_show()
172 (u32)node->dma, in ci_requests_show()
173 ((i < ci->hw_ep_max/2) ? in ci_requests_show()
177 seq_printf(s, " %04X: %08X\n", j, in ci_requests_show()
178 *((u32 *)node->ptr + j)); in ci_requests_show()
181 spin_unlock_irqrestore(&ci->lock, flags); in ci_requests_show()
187 static int ci_otg_show(struct seq_file *s, void *unused) in ci_otg_show() argument
189 struct ci_hdrc *ci = s->private; in ci_otg_show()
195 fsm = &ci->fsm; in ci_otg_show()
197 /* ------ State ----- */ in ci_otg_show()
198 seq_printf(s, "OTG state: %s\n\n", in ci_otg_show()
199 usb_otg_state_string(ci->otg.state)); in ci_otg_show()
201 /* ------ State Machine Variables ----- */ in ci_otg_show()
202 seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); in ci_otg_show()
204 seq_printf(s, "a_bus_req: %d\n", fsm->a_bus_req); in ci_otg_show()
206 seq_printf(s, "a_srp_det: %d\n", fsm->a_srp_det); in ci_otg_show()
208 seq_printf(s, "a_vbus_vld: %d\n", fsm->a_vbus_vld); in ci_otg_show()
210 seq_printf(s, "b_conn: %d\n", fsm->b_conn); in ci_otg_show()
212 seq_printf(s, "adp_change: %d\n", fsm->adp_change); in ci_otg_show()
214 seq_printf(s, "power_up: %d\n", fsm->power_up); in ci_otg_show()
216 seq_printf(s, "a_bus_resume: %d\n", fsm->a_bus_resume); in ci_otg_show()
218 seq_printf(s, "a_bus_suspend: %d\n", fsm->a_bus_suspend); in ci_otg_show()
220 seq_printf(s, "a_conn: %d\n", fsm->a_conn); in ci_otg_show()
222 seq_printf(s, "b_bus_req: %d\n", fsm->b_bus_req); in ci_otg_show()
224 seq_printf(s, "b_bus_suspend: %d\n", fsm->b_bus_suspend); in ci_otg_show()
226 seq_printf(s, "b_se0_srp: %d\n", fsm->b_se0_srp); in ci_otg_show()
228 seq_printf(s, "b_ssend_srp: %d\n", fsm->b_ssend_srp); in ci_otg_show()
230 seq_printf(s, "b_sess_vld: %d\n", fsm->b_sess_vld); in ci_otg_show()
232 seq_printf(s, "b_srp_done: %d\n", fsm->b_srp_done); in ci_otg_show()
234 seq_printf(s, "drv_vbus: %d\n", fsm->drv_vbus); in ci_otg_show()
236 seq_printf(s, "loc_conn: %d\n", fsm->loc_conn); in ci_otg_show()
238 seq_printf(s, "loc_sof: %d\n", fsm->loc_sof); in ci_otg_show()
240 seq_printf(s, "adp_prb: %d\n", fsm->adp_prb); in ci_otg_show()
242 seq_printf(s, "id: %d\n", fsm->id); in ci_otg_show()
244 seq_printf(s, "protocol: %d\n", fsm->protocol); in ci_otg_show()
250 static int ci_registers_show(struct seq_file *s, void *unused) in ci_registers_show() argument
252 struct ci_hdrc *ci = s->private; in ci_registers_show()
255 if (!ci || ci->in_lpm) in ci_registers_show()
256 return -EPERM; in ci_registers_show()
258 /* ------ Registers ----- */ in ci_registers_show()
260 seq_printf(s, "USBINTR reg: %08x\n", tmp_reg); in ci_registers_show()
263 seq_printf(s, "USBSTS reg: %08x\n", tmp_reg); in ci_registers_show()
266 seq_printf(s, "USBMODE reg: %08x\n", tmp_reg); in ci_registers_show()
269 seq_printf(s, "USBCMD reg: %08x\n", tmp_reg); in ci_registers_show()
272 seq_printf(s, "PORTSC reg: %08x\n", tmp_reg); in ci_registers_show()
274 if (ci->is_otg) { in ci_registers_show()
276 seq_printf(s, "OTGSC reg: %08x\n", tmp_reg); in ci_registers_show()
293 dir = debugfs_create_dir(dev_name(ci->dev), usb_debug_root); in dbg_create_files()
312 debugfs_lookup_and_remove(dev_name(ci->dev), usb_debug_root); in dbg_remove_files()