From: Romain Gantois <romain.gantois@bootlin.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: mux: Add support for the TUSB1046 crosspoint switch
Date: Fri, 25 Oct 2024 09:09:11 +0200 [thread overview]
Message-ID: <1945710.vURJNgTSzn@fw-rgant> (raw)
In-Reply-To: <bgqmq4kehejgud2eymcwusbu6ks4jnaeasr6ad735czxxazyht@ppzrbmce5mog>
Hello Dmitry,
On vendredi 25 octobre 2024 08:39:54 UTC+2 Dmitry Baryshkov wrote:
> On Thu, Oct 24, 2024 at 10:54:17AM +0200, Romain Gantois wrote:
...
> > +
> > +static int tusb1046_mux_set(struct typec_mux_dev *mux,
> > + struct typec_mux_state *state)
> > +{
> > + struct tusb1046_priv *priv = typec_mux_get_drvdata(mux);
> > + struct i2c_client *client = priv->client;
> > + struct device *dev = &client->dev;
> > + int mode, val, ret = 0;
> > +
> > + if (state->mode >= TYPEC_STATE_MODAL &&
> > + state->alt->svid != USB_TYPEC_DP_SID)
> > + return -EINVAL;
> > +
> > + dev_dbg(dev, "mux mode requested: %lu\n", state->mode);
> > +
> > + mutex_lock(&priv->general_reg_lock);
> > +
> > + val = i2c_smbus_read_byte_data(client, TUSB1046_REG_GENERAL);
> > + if (val < 0) {
> > + dev_err(dev, "failed to read ctlsel status, err %d\n", val);
> > + ret = val;
> > + goto out_unlock;
> > + }
> > +
> > + switch (state->mode) {
> > + case TYPEC_STATE_USB:
> > + mode = TUSB1046_CTLSEL_USB3;
> > + break;
>
> > + case TYPEC_DP_STATE_C:
> These are only valid if you have checked that altmode SVID is a
> DisplayPort SVID.
I did check it near the beginning of the function didn't I?
> > + if (state->mode >= TYPEC_STATE_MODAL &&
> > + state->alt->svid != USB_TYPEC_DP_SID)
> > + return -EINVAL;
Or is there something I'm missing?
Thanks for the review,
--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-10-25 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 8:54 [PATCH v2 0/2] Add support for the TUSB1046-DCI Type-C crosspoint switch Romain Gantois
2024-10-24 8:54 ` [PATCH v2 1/2] dt-bindings: usb: Describe TUSB1046 " Romain Gantois
2024-10-24 8:54 ` [PATCH v2 2/2] usb: typec: mux: Add support for the " Romain Gantois
2024-10-25 6:39 ` Dmitry Baryshkov
2024-10-25 7:09 ` Romain Gantois [this message]
2024-10-25 10:29 ` Dmitry Baryshkov
2024-10-29 11:51 ` 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=1945710.vURJNgTSzn@fw-rgant \
--to=romain.gantois@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.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