From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Guenter Roeck <linux@roeck-us.net>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] usb: typec: Support the WUSB3801 port controller
Date: Tue, 1 Feb 2022 11:29:51 +0100 [thread overview]
Message-ID: <YfkLn4UTjAea22wL@kroah.com> (raw)
In-Reply-To: <20220201032440.5196-4-samuel@sholland.org>
On Mon, Jan 31, 2022 at 09:24:40PM -0600, Samuel Holland wrote:
> +static enum typec_role wusb3801_get_default_role(struct wusb3801 *wusb3801)
> +{
> + switch (wusb3801->port_type) {
> + case TYPEC_PORT_SRC:
> + return TYPEC_SOURCE;
> + case TYPEC_PORT_SNK:
> + return TYPEC_SINK;
> + case TYPEC_PORT_DRP:
> + default:
> + if (wusb3801->cap.prefer_role == TYPEC_SOURCE)
> + return TYPEC_SOURCE;
> + return TYPEC_SINK;
> + }
> +}
> +
> +static int wusb3801_map_port_type(enum typec_port_type type)
> +{
> + switch (type) {
> + case TYPEC_PORT_SRC:
> + return WUSB3801_CTRL0_ROLE_SRC;
> + case TYPEC_PORT_SNK:
> + return WUSB3801_CTRL0_ROLE_SNK;
> + case TYPEC_PORT_DRP:
> + default:
> + return WUSB3801_CTRL0_ROLE_DRP;
> + }
> +}
> +
> +static int wusb3801_map_pwr_opmode(enum typec_pwr_opmode mode)
> +{
> + switch (mode) {
> + case TYPEC_PWR_MODE_USB:
> + default:
> + return WUSB3801_CTRL0_CURRENT_DEFAULT;
> + case TYPEC_PWR_MODE_1_5A:
> + return WUSB3801_CTRL0_CURRENT_1_5A;
> + case TYPEC_PWR_MODE_3_0A:
> + return WUSB3801_CTRL0_CURRENT_3_0A;
> + }
> +}
> +
> +static unsigned int wusb3801_map_try_role(int role)
> +{
> + switch (role) {
> + case TYPEC_NO_PREFERRED_ROLE:
> + default:
> + return WUSB3801_CTRL0_TRY_NONE;
> + case TYPEC_SINK:
> + return WUSB3801_CTRL0_TRY_SNK;
> + case TYPEC_SOURCE:
> + return WUSB3801_CTRL0_TRY_SRC;
> + }
> +}
> +
> +static enum typec_orientation wusb3801_unmap_orientation(unsigned int status)
> +{
> + switch (status & WUSB3801_STAT_ORIENTATION) {
> + case WUSB3801_STAT_ORIENTATION_NONE:
> + case WUSB3801_STAT_ORIENTATION_BOTH:
> + return TYPEC_ORIENTATION_NONE;
> + case WUSB3801_STAT_ORIENTATION_CC1:
> + return TYPEC_ORIENTATION_NORMAL;
> + case WUSB3801_STAT_ORIENTATION_CC2:
> + return TYPEC_ORIENTATION_REVERSE;
> + }
> +
> + unreachable();
Some of these functions use use unreachable() and others you do not.
Pick one style and stick with it please.
thanks,
greg k-h
next prev parent reply other threads:[~2022-02-01 10:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 3:24 [PATCH 1/4] dt-bindings: vendor-prefixes: Add willsemi Samuel Holland
2022-02-01 3:24 ` [PATCH 2/4] dt-bindings: usb: Add WUSB3801 Type-C Port Controller Samuel Holland
2022-02-01 3:24 ` [PATCH 3/4] usb: typec: Factor out non-PD fwnode properties Samuel Holland
2022-02-02 6:22 ` kernel test robot
2022-02-02 19:53 ` Guenter Roeck
2022-02-01 3:24 ` [PATCH 4/4] usb: typec: Support the WUSB3801 port controller Samuel Holland
2022-02-01 10:28 ` Greg Kroah-Hartman
2022-02-01 10:29 ` Greg Kroah-Hartman [this message]
2022-02-01 15:24 ` Guenter Roeck
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=YfkLn4UTjAea22wL@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devicetree@vger.kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=samuel@sholland.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).