From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Ajay Gupta <ajayg@nvidia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Hsu <mhsu@nvidia.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: [4/5] usb: typec: ucsi: Preliminary support for alternate modes
Date: Wed, 6 Feb 2019 10:30:00 +0200 [thread overview]
Message-ID: <20190206083000.GC27830@kuha.fi.intel.com> (raw)
Hi Ajay,
On Tue, Feb 05, 2019 at 12:59:27AM +0000, Ajay Gupta wrote:
> > +static int ucsi_register_altmode(struct ucsi_connector *con,
> > + struct typec_altmode_desc *desc,
> > + u8 recipient)
> > +{
> > + struct typec_altmode *alt;
> > + int ret;
> > + int i;
> > +
> > + switch (recipient) {
> > + case UCSI_RECIPIENT_CON:
> > + i = ucsi_next_altmode(con->port_altmode);
> > + if (i < 0) {
> > + ret = i;
> > + goto err;
> > + }
> > +
> > + desc->mode = ucsi_altmode_next_mode(con->port_altmode,
> > + desc->svid);
> > +
> > + alt = typec_port_register_altmode(con->port, desc);
> > + if (IS_ERR(alt)) {
> > + ret = PTR_ERR(alt);
> > + goto err;
> > + }
> > +
> > + con->port_altmode[i] = alt;
> > + break;
> > + case UCSI_RECIPIENT_SOP:
> > + i = ucsi_next_altmode(con->partner_altmode);
> We are seeing duplicate partner altmode devices getting created when we set
> "active" file from 1->0->1 Please add a check here to see if altmode device
> already exists.
>
> [...]
> case UCSI_RECIPIENT_SOP:
> /* check to see if partner altmode already exists */
> if (ucsi_altmode_found(con->partner_altmode, desc))
> break;
>
> i = ucsi_next_altmode(con->partner_altmode);
> if (i < 0) {
> [...]
>
>
> static bool ucsi_altmode_found(struct typec_altmode **alt,
> struct typec_altmode_desc *desc)
> {
> int i;
>
> for (i = 0; i < UCSI_MAX_ALTMODES; i++) {
> if (!alt[i])
> return false;
> if (alt[i]->svid == desc->svid && alt[i]->vdo == desc->vdo)
> return true;
> }
>
> return false;
> }
OK. I'll prepare new version later this week.
thanks,
next reply other threads:[~2019-02-06 8:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 8:30 Heikki Krogerus [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-02-18 14:11 [4/5] usb: typec: ucsi: Preliminary support for alternate modes Heikki Krogerus
2019-02-16 1:36 Michael Hsu
2019-02-12 15:22 Heikki Krogerus
2019-02-11 23:43 Michael Hsu
2019-02-08 13:48 Heikki Krogerus
2019-02-07 22:01 Michael Hsu
2019-02-07 13:15 Heikki Krogerus
2019-02-06 22:36 Michael Hsu
2019-02-06 9:06 Heikki Krogerus
2019-02-05 15:24 Heikki Krogerus
2019-02-05 2:20 Michael Hsu
2019-02-05 0:59 Ajay Gupta
2019-02-04 12:09 Heikki Krogerus
2019-02-01 22:02 Michael Hsu
2019-02-01 10:47 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=20190206083000.GC27830@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=ajayg@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mhsu@nvidia.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).