summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/debugfs.c
diff options
context:
space:
mode:
authorJohn Youn <John.Youn@synopsys.com>2017-01-23 14:58:52 -0800
committerFelipe Balbi <felipe.balbi@linux.intel.com>2017-01-24 16:19:08 +0200
commit2124f9e673124b72fdbd2d534526ab76f0771766 (patch)
tree3f78fa485de4b589adef63348febb047b4fcb05e /drivers/usb/dwc2/debugfs.c
parent5dc6422564b3f6ab8f87611ca1ade3adb369770b (diff)
downloadlinux-2124f9e673124b72fdbd2d534526ab76f0771766.tar.bz2
usb: dwc2: Show dr_mode via debugfs
Show the value of dr_mode via a debufs file. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2/debugfs.c')
-rw-r--r--drivers/usb/dwc2/debugfs.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c
index 57747b0df595..794b959a7c8c 100644
--- a/drivers/usb/dwc2/debugfs.c
+++ b/drivers/usb/dwc2/debugfs.c
@@ -839,6 +839,29 @@ static const struct file_operations hw_params_fops = {
.release = single_release,
};
+static int dr_mode_show(struct seq_file *seq, void *v)
+{
+ struct dwc2_hsotg *hsotg = seq->private;
+ const char *dr_mode = "";
+
+ device_property_read_string(hsotg->dev, "dr_mode", &dr_mode);
+ seq_printf(seq, "%s\n", dr_mode);
+ return 0;
+}
+
+static int dr_mode_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, dr_mode_show, inode->i_private);
+}
+
+static const struct file_operations dr_mode_fops = {
+ .owner = THIS_MODULE,
+ .open = dr_mode_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
{
int ret;
@@ -863,6 +886,12 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
dev_err(hsotg->dev, "%s: failed to create hw_params\n",
__func__);
+ file = debugfs_create_file("dr_mode", 0444,
+ hsotg->debug_root,
+ hsotg, &dr_mode_fops);
+ if (IS_ERR(file))
+ dev_err(hsotg->dev, "%s: failed to create dr_mode\n", __func__);
+
/* Add gadget debugfs nodes */
dwc2_hsotg_create_debug(hsotg);