aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Jun <b47624@freescale.com>2014-04-23 03:56:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-24 15:56:35 -0400
commit88bdffc89d84cdb11b6f3373a11ff612c097834e (patch)
tree40e4b9c00e6ec3cad4e63f32120e2ad92c24e9e7
parent15f75defacd3da412d4c9823d4a9c9f410923766 (diff)
usb: chipidea: debug: add debug file for OTG variables
This patch adds a debug file for OTG vairables show. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <b47624@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/chipidea/debug.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index 5b890c1e69e0..7cccab6ff308 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -7,6 +7,9 @@
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <linux/usb/ch9.h> 8#include <linux/usb/ch9.h>
9#include <linux/usb/gadget.h> 9#include <linux/usb/gadget.h>
10#include <linux/usb/phy.h>
11#include <linux/usb/otg.h>
12#include <linux/usb/otg-fsm.h>
10 13
11#include "ci.h" 14#include "ci.h"
12#include "udc.h" 15#include "udc.h"
@@ -205,6 +208,80 @@ static const struct file_operations ci_requests_fops = {
205 .release = single_release, 208 .release = single_release,
206}; 209};
207 210
211int ci_otg_show(struct seq_file *s, void *unused)
212{
213 struct ci_hdrc *ci = s->private;
214 struct otg_fsm *fsm;
215
216 if (!ci || !ci_otg_is_fsm_mode(ci))
217 return 0;
218
219 fsm = &ci->fsm;
220
221 /* ------ State ----- */
222 seq_printf(s, "OTG state: %s\n\n",
223 usb_otg_state_string(ci->transceiver->state));
224
225 /* ------ State Machine Variables ----- */
226 seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop);
227
228 seq_printf(s, "a_bus_req: %d\n", fsm->a_bus_req);
229
230 seq_printf(s, "a_srp_det: %d\n", fsm->a_srp_det);
231
232 seq_printf(s, "a_vbus_vld: %d\n", fsm->a_vbus_vld);
233
234 seq_printf(s, "b_conn: %d\n", fsm->b_conn);
235
236 seq_printf(s, "adp_change: %d\n", fsm->adp_change);
237
238 seq_printf(s, "power_up: %d\n", fsm->power_up);
239
240 seq_printf(s, "a_bus_resume: %d\n", fsm->a_bus_resume);
241
242 seq_printf(s, "a_bus_suspend: %d\n", fsm->a_bus_suspend);
243
244 seq_printf(s, "a_conn: %d\n", fsm->a_conn);
245
246 seq_printf(s, "b_bus_req: %d\n", fsm->b_bus_req);
247
248 seq_printf(s, "b_bus_suspend: %d\n", fsm->b_bus_suspend);
249
250 seq_printf(s, "b_se0_srp: %d\n", fsm->b_se0_srp);
251
252 seq_printf(s, "b_ssend_srp: %d\n", fsm->b_ssend_srp);
253
254 seq_printf(s, "b_sess_vld: %d\n", fsm->b_sess_vld);
255
256 seq_printf(s, "b_srp_done: %d\n", fsm->b_srp_done);
257
258 seq_printf(s, "drv_vbus: %d\n", fsm->drv_vbus);
259
260 seq_printf(s, "loc_conn: %d\n", fsm->loc_conn);
261
262 seq_printf(s, "loc_sof: %d\n", fsm->loc_sof);
263
264 seq_printf(s, "adp_prb: %d\n", fsm->adp_prb);
265
266 seq_printf(s, "id: %d\n", fsm->id);
267
268 seq_printf(s, "protocol: %d\n", fsm->protocol);
269
270 return 0;
271}
272
273static int ci_otg_open(struct inode *inode, struct file *file)
274{
275 return single_open(file, ci_otg_show, inode->i_private);
276}
277
278static const struct file_operations ci_otg_fops = {
279 .open = ci_otg_open,
280 .read = seq_read,
281 .llseek = seq_lseek,
282 .release = single_release,
283};
284
208static int ci_role_show(struct seq_file *s, void *data) 285static int ci_role_show(struct seq_file *s, void *data)
209{ 286{
210 struct ci_hdrc *ci = s->private; 287 struct ci_hdrc *ci = s->private;
@@ -332,6 +409,13 @@ int dbg_create_files(struct ci_hdrc *ci)
332 if (!dent) 409 if (!dent)
333 goto err; 410 goto err;
334 411
412 if (ci_otg_is_fsm_mode(ci)) {
413 dent = debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci,
414 &ci_otg_fops);
415 if (!dent)
416 goto err;
417 }
418
335 dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci, 419 dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
336 &ci_role_fops); 420 &ci_role_fops);
337 if (!dent) 421 if (!dent)