linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ajay Gupta <ajaykuee@gmail.com>
To: heikki.krogerus@linux.intel.com
Cc: linux-usb@vger.kernel.org, Ajay Gupta <ajayg@nvidia.com>
Subject: [v2,3/6] usb: typec: ucsi: add port num info
Date: Mon, 28 Jan 2019 12:37:28 -0800	[thread overview]
Message-ID: <20190128203731.12681-4-ajayg@nvidia.com> (raw)

Read PD port number information and save. It will be
required while sending PD_PORT_ENABLE command.

Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
---
Changes from v1:
	- Updated commit message
	- Used mask and shift instead of bitfield

 drivers/usb/typec/ucsi/ucsi_ccg.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 3155ee6be357..f71387a21693 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -172,6 +172,7 @@ struct ucsi_ccg {
 #define DEV_CMD_PENDING	1
 	struct ccg_resp dev_resp;
 	u8 cmd_resp;
+	int port_num;
 };
 
 static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len)
@@ -526,6 +527,12 @@ static int ucsi_ccg_probe(struct i2c_client *client,
 		return status;
 	}
 
+	if ((uc->info.mode & CCG_DEVINFO_PDPORTS_MASK) >>
+			CCG_DEVINFO_PDPORTS_SHIFT)
+		uc->port_num = 2;
+	else
+		uc->port_num = 1;
+
 	status = devm_request_threaded_irq(dev, client->irq, NULL,
 					   ccg_irq_handler,
 					   IRQF_ONESHOT | IRQF_TRIGGER_HIGH,

             reply	other threads:[~2019-01-28 20:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 20:37 Ajay Gupta [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-01-30 14:47 [v2,3/6] usb: typec: ucsi: add port num info Heikki Krogerus
2019-01-31  1:07 Ajay Gupta

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=20190128203731.12681-4-ajayg@nvidia.com \
    --to=ajaykuee@gmail.com \
    --cc=ajayg@nvidia.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.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).