From patchwork Mon Jan 22 13:01:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 125416 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1143638ljf; Mon, 22 Jan 2018 05:02:31 -0800 (PST) X-Google-Smtp-Source: AH8x227k/d8lSuuRVvBcjukUopp0yjgMwPL3oF4OBD9tT94IyMHgq1eIWssviEsMo2Dnmk/XUgPW X-Received: by 2002:a17:902:7046:: with SMTP id h6-v6mr2332815plt.157.1516626151060; Mon, 22 Jan 2018 05:02:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516626151; cv=none; d=google.com; s=arc-20160816; b=vHe8LtUeTaOKop6A3bLmjbm47PNuG85E4DGxNbr6BXpMMHvqO6GYjZJy6zi8S3jtWz rd1RvlFS+rE3V2ToQKFw15qSRTzfpAYPARSAGHNrqYS/p7rbKhSDSNwuOt20wYoFIPAX DVn+pvbcL+8uPgsdqGgoyzDe3rpWbz6ECQsQ8yaEKu1u5NFg9+IBGnLY/Xz7IZRGS/X6 46dfMLW1nnAVrM+AA7BogK/erMiyW5lZVcM8w6jHCs8SLpiCy3sqjv0S/vVLnuOmOBKl PZmeqO6JTQafRg9p+r4kDhTrAFq8ow40sJpfRvN6NQPZ3mnq791wSi+Vqsxc35/jdL2f 9xJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0nymR4iMXTUWXAiRxbPES1ndlSGDjQEuO6TA81p3r/U=; b=Ug2lJUpLRMLC3J1jvO0EmfDsxXVRMiOa9XBCHl29tNG/hLtOURlUzE/8E72oDx8AkL ptvZH6ykM2QEl1ez83j4PhSShLCiTVSlvqJShzw8lxtshpNA2n9WkSFEjYFaKX8FhHpk rPTPK4sj1bOhPTcaP6L/xr2fgJbBgEUvpMcDlF+icOk2MNTTcH1NKP3IpOou49rfhwMY YN3ddhWsknUsj2BxxQaDJ/qjUYrn5uNFL9Ba6KlfsW+HQrphMVnkq6Ua2Jj+aia3JDMv jM4hNtM6EUftwWR55xwS+NzbU15gKB3S5zJjkBwXAWxHKeKLb6bLoDZAhGydTnwRsKvA F6KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t7Q5Nr9T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1-v6si2231548plb.466.2018.01.22.05.02.30; Mon, 22 Jan 2018 05:02:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t7Q5Nr9T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751335AbeAVNC2 (ORCPT + 28 others); Mon, 22 Jan 2018 08:02:28 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:24539 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbeAVNBz (ORCPT ); Mon, 22 Jan 2018 08:01:55 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w0MD1rBS006714; Mon, 22 Jan 2018 07:01:53 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1516626113; bh=AIpv58iUotZBxK5oxMuljqfglkqI8nayxCrcf4Noft0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=t7Q5Nr9TZq06au/7aMWTPfnZKa/00WQbaPxqR0Dq0kRwjItWkq3VkSdkwCDhRpoq+ BL1r6JrmFkgVM5Ak67rAyjjXVx2tW2qqRS/ipNRz81al3nRjW6lUNiTJKoZbF4vfOD RqN+cpLRa8GEuozVS0MqaPgA7BzFv0iQpriFfKBU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MD1rVN005179; Mon, 22 Jan 2018 07:01:53 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 22 Jan 2018 07:01:53 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 22 Jan 2018 07:01:53 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MD1rjp010737; Mon, 22 Jan 2018 07:01:53 -0600 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.235.94]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MD1oWZ029287; Mon, 22 Jan 2018 07:01:52 -0600 From: Roger Quadros To: CC: , , Roger Quadros Subject: [PATCH 1/2] usb: dwc3: omap: don't miss events during suspend/resume Date: Mon, 22 Jan 2018 15:01:42 +0200 Message-ID: <1516626103-1969-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516626103-1969-1-git-send-email-rogerq@ti.com> References: <1516626103-1969-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The USB cable state can change during suspend/resume so be sure to check and update the extcon state. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/dwc3-omap.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index a4719e8..ed8b865 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -582,9 +582,25 @@ static int dwc3_omap_resume(struct device *dev) return 0; } +static void dwc3_omap_complete(struct device *dev) +{ + struct dwc3_omap *omap = dev_get_drvdata(dev); + + if (extcon_get_state(omap->edev, EXTCON_USB)) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); + else + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); + + if (extcon_get_state(omap->edev, EXTCON_USB_HOST)) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); + else + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT); +} + static const struct dev_pm_ops dwc3_omap_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(dwc3_omap_suspend, dwc3_omap_resume) + .complete = dwc3_omap_complete, }; #define DEV_PM_OPS (&dwc3_omap_dev_pm_ops)