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,1/7] usb: typec: Generalize mux mode names
Date: Wed, 2 May 2018 00:21:07 +0200 [thread overview]
Message-ID: <1525213273-6103-2-git-send-email-mats.dev.list@gmail.com> (raw)
The current naming used for tcpc_mux_mode constants makes
too much assumptioms about the usage of the signals.
This patch replaces the names with generic names more closely
tied to the Type-C specifications and also adds some new ones.
At the same time TCPC_MUX_* defines are removed as they do not
fit the new concept and currently have no in-tree users.
Signed-off-by: Mats Karrman <mats.dev.list@gmail.com>
---
drivers/usb/typec/mux/pi3usb30532.c | 7 ++++---
drivers/usb/typec/tcpm.c | 2 +-
include/linux/usb/tcpm.h | 21 ++++++++++-----------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/typec/mux/pi3usb30532.c b/drivers/usb/typec/mux/pi3usb30532.c
index b0e88db..279f3c3 100644
--- a/drivers/usb/typec/mux/pi3usb30532.c
+++ b/drivers/usb/typec/mux/pi3usb30532.c
@@ -83,18 +83,19 @@ static int pi3usb30532_mux_set(struct typec_mux *mux, int state)
new_conf = pi->conf;
switch (state) {
+ default:
case TYPEC_MUX_NONE:
new_conf = PI3USB30532_CONF_OPEN;
break;
- case TYPEC_MUX_USB:
+ case TYPEC_MUX_2CH_USBSS:
new_conf = (new_conf & PI3USB30532_CONF_SWAP) |
PI3USB30532_CONF_USB3;
break;
- case TYPEC_MUX_DP:
+ case TYPEC_MUX_4CH_AM:
new_conf = (new_conf & PI3USB30532_CONF_SWAP) |
PI3USB30532_CONF_4LANE_DP;
break;
- case TYPEC_MUX_DOCK:
+ case TYPEC_MUX_2CH_USBSS_2CH_AM:
new_conf = (new_conf & PI3USB30532_CONF_SWAP) |
PI3USB30532_CONF_USB3_AND_2LANE_DP;
break;
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 7ee417a..0451ea0 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -790,7 +790,7 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached,
else
usb_role = USB_ROLE_DEVICE;
- ret = tcpm_mux_set(port, TYPEC_MUX_USB, usb_role, orientation);
+ ret = tcpm_mux_set(port, TYPEC_MUX_2CH_USBSS, usb_role, orientation);
if (ret < 0)
return ret;
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index b231b93..3518965 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -93,20 +93,19 @@ struct tcpc_config {
const struct typec_altmode_desc *alt_modes;
};
-/* Mux state attributes */
-#define TCPC_MUX_USB_ENABLED BIT(0) /* USB enabled */
-#define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */
-#define TCPC_MUX_POLARITY_INVERTED BIT(2) /* Polarity inverted */
-
-/* Mux modes, decoded to attributes */
+/* Mux modes */
enum tcpc_mux_mode {
- TYPEC_MUX_NONE = 0, /* Open switch */
- TYPEC_MUX_USB = TCPC_MUX_USB_ENABLED, /* USB only */
- TYPEC_MUX_DP = TCPC_MUX_DP_ENABLED, /* DP only */
- TYPEC_MUX_DOCK = TCPC_MUX_USB_ENABLED | /* Both USB and DP */
- TCPC_MUX_DP_ENABLED,
+ 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
* @config: Pointer to port configuration
next reply other threads:[~2018-05-01 22:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-01 22:21 Mats Karrman [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-05-02 8:23 [RFC,1/7] usb: typec: Generalize mux mode names Heikki Krogerus
2018-05-02 8:25 Heikki Krogerus
2018-05-02 13:13 Mats Karrman
2018-05-04 14:56 Heikki Krogerus
2018-05-04 16:57 Mats Karrman
2018-05-07 13:39 Heikki Krogerus
2018-05-07 21:19 Mats Karrman
2018-05-08 14:25 Heikki Krogerus
2018-05-08 19:10 Mats Karrman
2018-05-09 12:49 Heikki Krogerus
2018-05-11 19:28 Mats Karrman
2018-05-15 7:30 Heikki Krogerus
2018-05-15 21:24 Mats Karrman
2018-05-16 11:43 Heikki Krogerus
2018-05-16 21:11 Mats Karrman
2018-05-17 11:50 Heikki Krogerus
2018-05-18 5:26 Mats Karrman
2018-05-21 13:04 Heikki Krogerus
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-2-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).