linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mats Karrman <mats.dev.list@gmail.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>, linux-usb@vger.kernel.org
Subject: [RFC,2/7] usb: typec: Move mux mode type definition to limit dependency
Date: Wed,  2 May 2018 00:21:08 +0200	[thread overview]
Message-ID: <1525213273-6103-3-git-send-email-mats.dev.list@gmail.com> (raw)

To avoid unnecessary dependencies on tcpm.h and to pave the way
for comming patches, move the tcpc_mux_mode enum from tcpm.h to
typec.h and change its name to typec_mux_mode (the enum constants
already follow this naming).

Signed-off-by: Mats Karrman <mats.dev.list@gmail.com>
---
 drivers/usb/typec/mux/pi3usb30532.c |  6 +++---
 drivers/usb/typec/tcpm.c            |  2 +-
 include/linux/usb/tcpm.h            | 12 ------------
 include/linux/usb/typec.h           | 11 +++++++++++
 include/linux/usb/typec_mux.h       |  4 ++--
 5 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/typec/mux/pi3usb30532.c b/drivers/usb/typec/mux/pi3usb30532.c
index 279f3c3..d995883 100644
--- a/drivers/usb/typec/mux/pi3usb30532.c
+++ b/drivers/usb/typec/mux/pi3usb30532.c
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
-#include <linux/usb/tcpm.h>
+#include <linux/usb/typec.h>
 #include <linux/usb/typec_mux.h>
 
 #define PI3USB30532_CONF			0x00
@@ -73,7 +73,7 @@ static int pi3usb30532_sw_set(struct typec_switch *sw,
 	return ret;
 }
 
-static int pi3usb30532_mux_set(struct typec_mux *mux, int state)
+static int pi3usb30532_mux_set(struct typec_mux *mux, enum typec_mux_mode mode)
 {
 	struct pi3usb30532 *pi = container_of(mux, struct pi3usb30532, mux);
 	u8 new_conf;
@@ -82,7 +82,7 @@ static int pi3usb30532_mux_set(struct typec_mux *mux, int state)
 	mutex_lock(&pi->lock);
 	new_conf = pi->conf;
 
-	switch (state) {
+	switch (mode) {
 	default:
 	case TYPEC_MUX_NONE:
 		new_conf = PI3USB30532_CONF_OPEN;
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 0451ea0..aaf6d57 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -644,7 +644,7 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port,
 }
 EXPORT_SYMBOL_GPL(tcpm_pd_transmit_complete);
 
-static int tcpm_mux_set(struct tcpm_port *port, enum tcpc_mux_mode mode,
+static int tcpm_mux_set(struct tcpm_port *port, enum typec_mux_mode mode,
 			enum usb_role usb_role,
 			enum typec_orientation orientation)
 {
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 3518965..e641e21 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -93,18 +93,6 @@ struct tcpc_config {
 	const struct typec_altmode_desc *alt_modes;
 };
 
-/* Mux modes */
-enum tcpc_mux_mode {
-	TYPEC_MUX_NONE,				/* Open switch */
-	TYPEC_MUX_2CH_USBSS,			/* 2ch USB SS */
-	TYPEC_MUX_4CH_AM,			/* 4ch Alt Mode */
-	TYPEC_MUX_2CH_USBSS_2CH_AM,		/* 2ch USB SS + 2ch Alt Mode */
-
-	// Example of additional modes that may be needed in future:
-	TYPEC_MUX_4CH_USBSS,			/* 4ch USB SS */
-	TYPEC_MUX_2CH_USBSS_2CH_AM_B,		/* 2ch USB SS + 2ch Alt Mode (e.g. DP GPU2) */
-};
-
 
 /**
  * struct tcpc_dev - Port configuration and callback functions
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
index 672b39b..d356577 100644
--- a/include/linux/usb/typec.h
+++ b/include/linux/usb/typec.h
@@ -72,6 +72,17 @@ enum typec_orientation {
 	TYPEC_ORIENTATION_REVERSE,
 };
 
+enum typec_mux_mode {
+	TYPEC_MUX_NONE,				/* Open switch */
+	TYPEC_MUX_2CH_USBSS,			/* 2ch USB SS */
+	TYPEC_MUX_4CH_AM,			/* 4ch Alt Mode */
+	TYPEC_MUX_2CH_USBSS_2CH_AM,		/* 2ch USB SS + 2ch Alt Mode */
+
+	// Example of additional modes that may be needed in future:
+	TYPEC_MUX_4CH_USBSS,			/* 4ch USB SS */
+	TYPEC_MUX_2CH_USBSS_2CH_AM_B,		/* 2ch USB SS + 2ch Alt Mode (e.g. DP GPU2) */
+};
+
 /*
  * struct usb_pd_identity - USB Power Delivery identity data
  * @id_header: ID Header VDO
diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h
index 12c1b05..e44137d 100644
--- a/include/linux/usb/typec_mux.h
+++ b/include/linux/usb/typec_mux.h
@@ -29,7 +29,7 @@ struct typec_switch {
  * struct typec_switch - USB Type-C connector pin mux
  * @dev: Mux device
  * @entry: List entry
- * @set: Callback to the driver for setting the state of the mux
+ * @set: Callback to the driver for setting the mode of the mux
  *
  * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to
  * different components depending on the requested mode of operation. Used with
@@ -39,7 +39,7 @@ struct typec_mux {
 	struct device *dev;
 	struct list_head entry;
 
-	int (*set)(struct typec_mux *mux, int state);
+	int (*set)(struct typec_mux *mux, enum typec_mux_mode mode);
 };
 
 struct typec_switch *typec_switch_get(struct device *dev);

                 reply	other threads:[~2018-05-01 22:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1525213273-6103-3-git-send-email-mats.dev.list@gmail.com \
    --to=mats.dev.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    /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).