Patchwork [v3,3/6] usb: typec: ucsi: add port num info

login
register
mail settings
Submitter Ajay Gupta
Date Feb. 2, 2019, 1:05 a.m.
Message ID <20190202010510.25016-4-ajayg@nvidia.com>
Download mbox | patch
Permalink /patch/716393/
State New
Headers show

Comments

Ajay Gupta - Feb. 2, 2019, 1:05 a.m.
From: Ajay Gupta <ajayg@nvidia.com>

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 v2 to v3
	- Fixed comments from Heikki on removing SHIFT

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

Patch

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 58b697d1ef8b..63b07b7d17f2 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -117,6 +117,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)
@@ -464,6 +465,11 @@  static int ucsi_ccg_probe(struct i2c_client *client,
 		return status;
 	}
 
+	uc->port_num = 1;
+
+	if (uc->info.mode & CCG_DEVINFO_PDPORTS_MASK)
+		uc->port_num++;
+
 	status = devm_request_threaded_irq(dev, client->irq, NULL,
 					   ccg_irq_handler,
 					   IRQF_ONESHOT | IRQF_TRIGGER_HIGH,