devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: [PATCH 11/11] usb: mtu3: add a function to switch mailbox state to string
Date: Wed, 6 Mar 2019 19:46:23 +0800	[thread overview]
Message-ID: <1551872783-13707-12-git-send-email-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <1551872783-13707-1-git-send-email-chunfeng.yun@mediatek.com>

By introducing mailbox_state_string(), allow to make debug
log more readable

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_dr.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
index 82913120622b..5fcb71af875a 100644
--- a/drivers/usb/mtu3/mtu3_dr.c
+++ b/drivers/usb/mtu3/mtu3_dr.c
@@ -21,6 +21,22 @@ enum mtu3_vbus_id_state {
 	MTU3_VBUS_VALID,
 };
 
+static char *mailbox_state_string(enum mtu3_vbus_id_state state)
+{
+	switch (state) {
+	case MTU3_ID_FLOAT:
+		return "ID_FLOAT";
+	case MTU3_ID_GROUND:
+		return "ID_GROUND";
+	case MTU3_VBUS_OFF:
+		return "VBUS_OFF";
+	case MTU3_VBUS_VALID:
+		return "VBUS_VALID";
+	default:
+		return "UNKNOWN";
+	}
+}
+
 static void toggle_opstate(struct ssusb_mtk *ssusb)
 {
 	if (!ssusb->otg_switch.is_u3_drd) {
@@ -140,8 +156,8 @@ static void ssusb_set_mailbox(struct otg_switch_mtk *otg_sx,
 		container_of(otg_sx, struct ssusb_mtk, otg_switch);
 	struct mtu3 *mtu = ssusb->u3d;
 
-	dev_dbg(ssusb->dev, "mailbox state(%d)\n", status);
-	mtu3_dbg_trace(ssusb->dev, "mailbox %d", status);
+	dev_dbg(ssusb->dev, "mailbox %s\n", mailbox_state_string(status));
+	mtu3_dbg_trace(ssusb->dev, "mailbox %s", mailbox_state_string(status));
 
 	switch (status) {
 	case MTU3_ID_GROUND:
-- 
2.20.1

      parent reply	other threads:[~2019-03-06 11:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 11:46 [PATCH 00/11] add debugfs consumers, tracepoints and rebuild QMU Chunfeng Yun
2019-03-06 11:46 ` [PATCH 01/11] usb: mtu3: check return value of devm_extcon_register_notifier() Chunfeng Yun
2019-03-06 11:46 ` [PATCH 02/11] usb: mtu3: print useful information also for device and host modes Chunfeng Yun
2019-03-06 11:46 ` [PATCH 03/11] usb: mtu3: remove unnecessary local variable @req Chunfeng Yun
2019-03-06 11:46 ` [PATCH 04/11] usb: mtu3: rebuild the code of getting vbus regulator Chunfeng Yun
2019-03-06 11:46 ` [PATCH 05/11] usb: mtu3: fix transfer error of USB3 Gen2 isoc Chunfeng Yun
2019-03-06 11:46 ` [PATCH 06/11] usb: mtu3: rebuild qmu_gpd struct to prepare to support new QMU format Chunfeng Yun
2019-03-06 11:46 ` [PATCH 07/11] usb: mtu3: supports " Chunfeng Yun
2019-03-06 11:46 ` [PATCH 08/11] usb: mtu3: add debugfs interface files Chunfeng Yun
2019-03-06 11:46 ` [PATCH 09/11] usb: mtu3: move vbus and mode debugfs interfaces into mtu3_debugfs.c Chunfeng Yun
2019-03-06 11:46 ` [PATCH 10/11] usb: mtu3: add tracepoints to help debug Chunfeng Yun
2019-03-06 11:46 ` Chunfeng Yun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1551872783-13707-12-git-send-email-chunfeng.yun@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).