From patchwork Sat Feb 2 01:05:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Gupta X-Patchwork-Id: 10793913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF77B13BF for ; Sat, 2 Feb 2019 01:05:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D313832F9D for ; Sat, 2 Feb 2019 01:05:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7BCB32FA2; Sat, 2 Feb 2019 01:05:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7CE732F9D for ; Sat, 2 Feb 2019 01:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbfBBBF0 (ORCPT ); Fri, 1 Feb 2019 20:05:26 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37272 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbfBBBFZ (ORCPT ); Fri, 1 Feb 2019 20:05:25 -0500 Received: by mail-pl1-f196.google.com with SMTP id b5so4078418plr.4 for ; Fri, 01 Feb 2019 17:05:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Dw5XvpHxxvWb9lyvFcCghubZUcX0UpsvFTAHbMA8ty8=; b=Q8EmueDkhBUtdLJGtknjWHeCBe56TEUdrO4YnQMKqSzVXVw9UPSQ+JXSgL+x/Dgric FgcETqZQvHiSIk1iauZkLrVBl6uLl/XxOGoA8kHqyTSRnB9IVCFbtRnCOc8osZNSpK2x h6o4Qh9ZLWkeRXrLeeaWvBaebiiAbGznSJjzVmXk0zVoI3tFtEm7WqZKk6VwwZjltEuf UIayNAupALSwTxUFbKromhxP1Mm7MsaaI+aWtUIxwUPsGA13BZ4R/hE2SPwUa4D8DPbN nEU40vm+K7RDQ3lSMUj33VLyjwZOnBG+iVj2jUfUEzQ1o3tToTGvsaXIeqviq26S/f1j MUPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Dw5XvpHxxvWb9lyvFcCghubZUcX0UpsvFTAHbMA8ty8=; b=tOg0dYfojpV6nfWlw7ZupGk8c8I1ZBEMNF9vSwhenNxIFQv2gDt0PrK4aGowVCjzIW 3KVk8GLBHtugmcxOshHkllqDMUz6z+ZD9IzI+KZ6GxlH0RZyn9S3Qk8eY62TuxcMxTzb lOsiQoXRTqFCKelp25K+0KxhEaDptXngBONwPLZUmARvsQIifY3gQN0iXxdKYzc1RONT HZNPqrdjIwvd0nGTSJQMpczDi6PoRXJAcNVSNuhJy3GUUzzwUkPljfhTT+HhcHXFwyqG PEWMbeLS2KUTOgfIDBXSnihYzrLf8HLATwboOWsiNwL8HlXYzHTTj7AtBQkVp1e4DsXF py8A== X-Gm-Message-State: AJcUukfsMeshXdgOimdmrxmekHyTYYwFpAWeprT/jNJ0V3AGjhNtP1B7 WZNEOv0+FrH7XzKwlzDLc919NNcr X-Google-Smtp-Source: ALg8bN66989wmJoRi3/WT0TpPlaEnadbqaXQ4iqcm0IXradbvGU6ehRSNwOFO/AyrC9wQWpUf1Yc2g== X-Received: by 2002:a17:902:2a66:: with SMTP id i93mr41314677plb.113.1549069524176; Fri, 01 Feb 2019 17:05:24 -0800 (PST) Received: from ajayg.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id f6sm13158685pfg.188.2019.02.01.17.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 17:05:23 -0800 (PST) From: Ajay Gupta X-Google-Original-From: Ajay Gupta To: heikki.krogerus@linux.intel.com Cc: linux-usb@vger.kernel.org, Ajay Gupta Subject: [PATCH v3 3/6] usb: typec: ucsi: add port num info Date: Fri, 1 Feb 2019 17:05:07 -0800 Message-Id: <20190202010510.25016-4-ajayg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190202010510.25016-1-ajayg@nvidia.com> References: <20190202010510.25016-1-ajayg@nvidia.com> X-NVConfidentiality: public Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ajay Gupta Read PD port number information and save. It will be required while sending PD_PORT_ENABLE command. Signed-off-by: Ajay Gupta --- 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(+) 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,