From patchwork Thu May 18 00:49:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9732191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C7DF600CC for ; Thu, 18 May 2017 00:50:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B53E92873D for ; Thu, 18 May 2017 00:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9553287B7; Thu, 18 May 2017 00:50:19 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EBCCF2873D for ; Thu, 18 May 2017 00:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0Gx9JMxQbHwzp8t1dwaJOfDAKK0B9Jh3ZUNsEZwMXMA=; b=A63KOe9PnZMfqx vsKchipU+EpxEHjK5I79+sZS3woB15En1H80XmwnmlQ3r30MBWiUARlxlEaLL70QaFfOizoI1+TdS Zy3QAM5osC4hxxl/BqXhPnS2k0oexFT21iXDggHUX0VrVIMLEEbjAfP3PF6+dkTAjD0+u65NoPg3m kKs+GHDrNJY8heBJHLiMQWxFfrKduwJYKDBSaQQ+JaUOpUl5ST/rtbI9HljpbCnV7RYKIJl9FSqay SJhocpyBGPJQdErs7NWzraEc7pxHOvrLBJwO29SKxER1+iENFjWhtg9oX5D7+/TDHoCEVfpTt8Xm6 Te5z3wDqKd9IkgTDc6Hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dB9dx-0002gX-JG; Thu, 18 May 2017 00:50:17 +0000 Received: from mail-by2nam03on0078.outbound.protection.outlook.com ([104.47.42.78] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dB9ds-0001FH-8e for linux-arm-kernel@lists.infradead.org; Thu, 18 May 2017 00:50:15 +0000 Received: from DM5PR03CA0041.namprd03.prod.outlook.com (10.174.189.158) by BN6PR03MB2787.namprd03.prod.outlook.com (10.173.144.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Thu, 18 May 2017 00:49:49 +0000 Received: from BY2FFO11FD001.protection.gbl (2a01:111:f400:7c0c::147) by DM5PR03CA0041.outlook.office365.com (2603:10b6:4:3b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Thu, 18 May 2017 00:49:49 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD001.mail.protection.outlook.com (10.1.14.123) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Thu, 18 May 2017 00:49:48 +0000 Received: from b29397-desktop.ap.freescale.net (b29397-desktop.ap.freescale.net [10.192.242.114]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v4I0n18T023387; Wed, 17 May 2017 17:49:40 -0700 From: Peter Chen To: , , , , , , , , Subject: [PATCH v14 4/7] usb: core: add power sequence handling for USB devices Date: Thu, 18 May 2017 08:49:00 +0800 Message-ID: <1495068543-6938-5-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495068543-6938-1-git-send-email-peter.chen@nxp.com> References: <1495068543-6938-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131395421889937205; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(39450400003)(39840400002)(39410400002)(39400400002)(39850400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(47776003)(81166006)(189998001)(8676002)(50226002)(77096006)(2950100002)(8936002)(7416002)(6666003)(50986999)(76176999)(53936002)(356003)(39060400002)(5003940100001)(4326008)(7406005)(2906002)(50466002)(85426001)(104016004)(48376002)(54906002)(5660300001)(106466001)(36756003)(8656002)(33646002)(305945005)(2201001)(86362001)(498600001)(105606002)(38730400002)(2171002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2787; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD001; 1:OU77N+l2r+WHAJGf8AIWbngLSJoNHf2063CqJ6dZTqyi16pvthSzn+UL5IBTyBVL7XQN5EdDFNa8+ap4u9R8TWOicfVUJUK1EAFvdJLq6eQJXHiMCp/qD3PC4rw5QtkiTMstXCGenmxwsY7CtJmrKuiM6JxyeRKaA5HRbwWpIWoy7CGAbVpDo5BeMCSldSQsDlYKaGIx21eHoHd9AOIRjxuCturPN00v0vlqkXI0MEBWPAi91lMOFN8yDL5YLhkRMOGO/dCLlgQx8NMRel8ymC1EmFBtjVLd8DLDA4NIAPcfbhHfyRGMGPzrgCCob6tN1G60OQ2Sq6Su7xKW/PbW7L5DUi2EcS/EfsDz3B6sIHoA29dFWNAmaNpn30xRscmY8Q7cdGKKzjrXWB1zZ/hkNRdkewj/rk/wjCDASN24Wf5AbjLfcEiper+1CG0acZw6Jknq87RGqvohgUBPdzNESiOHXuCjSLhxG90kbiINKoZz9f4zMMFDJliHgvfpZxe1swYhr+HhtAGob+QCBdd68mI66egQ7/3wtFaSskQOTsRNetqh6zA7awPSUBF7AaS0F44czP9bibV6a0LTTWQft56ia2XMWvphK6tjHGjucdRZO9du1GBsxtX/Gun5RkhGURl9d8laLiAZRvaoYXphWFDAG5V0gLxF1uWZLPbvmNfoG+H2svCBfFBOMRLkDumdYSSLu/fS4j85OfpneBf4vnOkhtECC6pL26bHIa4Z5igvj+29lVjntcZKzGizrXAV4rUPeKpkvz5ewQHZ9cxZhQ== MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR03MB2787: X-MS-Office365-Filtering-Correlation-Id: 9a82246d-1ebd-4b39-bf35-08d49d87c953 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BN6PR03MB2787; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2787; 3:9spZZeCdb3qMB3BlJMjhPU3ot1GI/kFTtzSBWpjIm0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6hovv5Mu/R+QRxJKM3dFaHnH/iFRzkdQPKYRUd3pKdybCCygMpV1F8EOGpJS5fGYF4rma14vuzvc0pbt8iEEASQV9e2xCMtF1yTk4daShCbySJzUXk1nNgrLsiuoMIAHg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13024025)(13023025)(8121501046)(13018025)(5005006)(13015025)(13017025)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123563025)(20161123561025)(20161123556025); SRVR:BN6PR03MB2787; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2787; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2787; 4:SyL+EYxkxYwHL0kscWwQLdfIkPZQHcvbUAeZT3/us8?= =?us-ascii?Q?C6+nJJD8Ofw4Ju/VVKHhrBzNk/EfUmEqRUfn65MAUKsD0WhEIP3j496Ck8VD?= =?us-ascii?Q?4Cc3fXE9ej9tG4W9K8gSAsNGiCMjjfxKBjOlnX1lQr6XeVvTzWj5zz4opSJ7?= =?us-ascii?Q?4QRWEwf16vLkQz+jxnTgKXWGolB6B7bXj9LD9yxSW9CHOMAkDF+8Isn6G9/2?= =?us-ascii?Q?roo928gfAzDlNpm2M/Pef/SDV7UUjJZqG4kYTVpDF1E+1ke2JXwVuVwNPO66?= =?us-ascii?Q?Bl/4X6n502zZrAuWSRBRkx7T9iPWnLaEu2u7SrYreXMAvPVDatVKPB3f68pj?= =?us-ascii?Q?5T3m2K9D/vf5VI4Dr6MaICOvzlXReEGE5ZEFbtJwZ3befNyG31/DZl8dVv8O?= =?us-ascii?Q?jwZGEZ5dQWBt257IXI2qxCJR+i9YHg4cGqIdvxEh0Rw6LIMMnWtNS5VLolK3?= =?us-ascii?Q?VGGmTXp4tJslMnozK1Qx+/xDekc0t18N2mD90FRIrX+yjswGlHU0M9qX8WLv?= =?us-ascii?Q?gGEhar+Kzn8jV9XTvvBIKCRv66t46EBsqjttFSxASkRdgIxMctKYT423z5iA?= =?us-ascii?Q?XiUbtyZq3NUseb0zirz79QIIFpjdqmzumajw/gUX135YlIkRuqwA/d4XDX9F?= =?us-ascii?Q?9FwtfgHh9m3iNRPBmFX3bFzlTQ8CQQtKLE9As/KfOEFYRxfVFibAYJOB2AuN?= =?us-ascii?Q?5XKrlJAHLKl5VMWsHndvhcyB8UrilB+LauTq9zRm7eURiCjcUrcztB+wPt0m?= =?us-ascii?Q?3Fm6umjPA9QEj82f3jckIRMBvyx2wZhplHrgEXRr0klQmO0vuws1EkWUkaNv?= =?us-ascii?Q?6JIoT/Ke+U89RF4fjDpA9EFGv7lQl1ltcC1OUnkfnR8bpXcsObg8DAn+EEbL?= =?us-ascii?Q?2lJaiEbLm3weORMvAIPv5vq4ecsmbsZ7DNnYDh2uMSiYqXtFUqQvPYMurpZv?= =?us-ascii?Q?cqWOg98luEKdYJcxxVMTogPWmxzWuXin8CvmN9Ig=3D=3D?= X-Forefront-PRVS: 0311124FA9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2787; 23:MUjlubCOO6LwvG4Rn+ozH0v6zqYrh6nUxAbDH4tbg?= =?us-ascii?Q?suPV5HNBzCU2g9xPwAU9JB5dtDTwWsXHTIIOUb+rEA+JntA8Zq/yGEqkT66m?= =?us-ascii?Q?LS2/BSJ4oa2qEtqQ+OW9ICBxhY8qU4e057uLTyML9ZkLKzqPZATPa9vg197r?= =?us-ascii?Q?hVxopm0pGhF5kR6cvyN0KfgiXdcM4wbFLkrGAPlbXeXVjR9QrC6P5dd/PQrZ?= =?us-ascii?Q?ZWP9dnyy3lAAJ4uLsXWUQ2qwQ+JE+dh1Gm+pA2FTK7qaisyUorQC4T6X4/hI?= =?us-ascii?Q?cKsQ0dz8YvGQm8chNXLU1F/WnnVPy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=?us-ascii?Q?9v0KeY1RInmfVHboUwKrBewLFK3CoyV9EBR+jKhM7/Hr1hGgEVN1XPzc1UfA?= =?us-ascii?Q?0rrDYR0I+DMjMH9JohUFgr6mCKaJaCE4ARhMNDv90WZObMuA+qThDZjcdkVx?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2787; 6:JnEqm6jeHTmGqrgm7aTeRc4l9+XE65oTo9TZphDD+6yHTl2IaL0LI7Oxam0S+JN009fy2BLevh8RF8LonH1KqC8OvDqua++faJJfpjmMOll9A8EwpeTgf2Dg2GGSsPbD4rhzbGmj+SumcXng4oDFoqlwzPz8b9cGgsIVojk2pf1tr+IG2K139yAuulmpcWNvw/MaKVeZMGjohEdjbBdqvxNnNoMTr9L8spQElaXSify/xKq605zYxguejEIq2OBRLE5vjZU/90cWDcNfl4ncWewethkAN0yrzV8NFB9qOLqKffj99D19Z3vUIBf2ySlSqosPmYc//ofEIaLrc19L38KjWYHLHthuKcGQWAq0wZptqS97Nw0KccnCFp9hbNDpYSh2hOa2MFVLLnXx4GWXA2ExMyPCI4QtXUZFjWCNW6RbINk3oGWNFpMrBX/6RUZCE+owud4sYc7I7s9n72bL6JwxqmIRf9LQOd8tcuDDNL5tFHKEtkKiO/ON50ogwejtv4VHoYfQSh9d9HGgfZ8XxA==; 5:2r499hdNhr6q7Lggs1ddwFJ/2hcgJHTUA4OqmYeE03KuGxOiSPxVxeDbJ/LQtTU5G7JhabmGItB37ZygEnDewNmThLQ8HzyCGd4LLSpebqbqtvMqxITnOdaYJitO369MkeGy2idS0l7O3S+0XMf27z0SsDESH4eVkwt413ljW9sOksYyqWFHSmrRGCweXFsw; 24:Fy+FgvTdG0xSrXOINDk5gNZ82HcviQvABHu1Pz5g49JW8QKBAKF5QcYqZVvPgoYDvU1dYjmiWEaGpPhCbFv85l5U2QbXRn0TL2hPDi5qezk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2787; 7:99CJM0TKP0IdiY7yePW26GUkWZf9dtl8AFTmOlHt3FP9rJbxMwUcbHfjfa8xXvjAAIbBKeCR1dOi6QPcfbR4jRlRw9+gPLsU3fJxdznGACxYUPQBOqJKaf5IVQMevp/BjN0immuOFEDOinD/02Kv+wBRUm8aRRBn37unIEGnUrPPq2/gSxmgU0XGPjWUMzGPAvisxWLFQ7Kz91sBftVPoZqxLckQXCO7YrWgg5SddZI7v06mlCvcMbY0CYDT28+yPpcCCnV8Nuh3noEqL+Hs9b/Bq6R5MHTQZg+she+0YkcAfU1wJ83ub9dvXMOMtaV/s0+c2oAHLRXdfV0HIg0gGg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2017 00:49:48.7753 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2787 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170517_175012_449423_9FED4C75 X-CRM114-Status: GOOD ( 17.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Peter Chen , heiko@sntech.de, stephen.boyd@linaro.org, frank.li@nxp.com, gary.bisson@boundarydevices.com, festevam@gmail.com, stillcompiling@gmail.com, arnd@arndb.de, vaibhav.hiremath@linaro.org, krzk@kernel.org, mka@chromium.org, devicetree@vger.kernel.org, mail@maciej.szmigiero.name, pawel.moll@arm.com, linux-pm@vger.kernel.org, s.hauer@pengutronix.de, troy.kisky@boundarydevices.com, linux-arm-kernel@lists.infradead.org, hverkuil@xs4all.nl, oscar@naiandei.net, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, jun.li@nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some hard-wired USB devices need to do power sequence to let the device work normally, the typical power sequence like: enable USB PHY clock, toggle reset pin, etc. But current Linux USB driver lacks of such code to do it, it may cause some hard-wired USB devices works abnormal or can't be recognized by controller at all. In this patch, it calls power sequence library APIs to finish the power sequence events. It will do power on sequence at hub's probe for all devices under this hub (includes root hub). At hub_disconnect, it will do power off sequence which is at powered on list. Signed-off-by: Peter Chen Tested-by Joshua Clayton Tested-by: Maciej S. Szmigiero Reviewed-by: Vaibhav Hiremath Acked-by: Alan Stern --- drivers/usb/Kconfig | 1 + drivers/usb/core/hub.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- drivers/usb/core/hub.h | 1 + 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 939a63b..b6f626e 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -39,6 +39,7 @@ config USB tristate "Support for Host-side USB" depends on USB_ARCH_HAS_HCD select USB_COMMON + select POWER_SEQUENCE select NLS # for UTF-8 strings ---help--- Universal Serial Bus (USB) is a specification for a serial bus diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9dca59e..7a67296 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1619,6 +1620,7 @@ static void hub_disconnect(struct usb_interface *intf) hub->error = 0; hub_quiesce(hub, HUB_DISCONNECT); + of_pwrseq_off_list(&hub->pwrseq_on_list); mutex_lock(&usb_port_peer_mutex); /* Avoid races with recursively_mark_NOTATTACHED() */ @@ -1646,12 +1648,42 @@ static void hub_disconnect(struct usb_interface *intf) kref_put(&hub->kref, hub_release); } +#ifdef CONFIG_OF +static int hub_of_pwrseq_on(struct usb_hub *hub) +{ + struct device *parent; + struct usb_device *hdev = hub->hdev; + struct device_node *np; + int ret; + + if (hdev->parent) + parent = &hdev->dev; + else + parent = bus_to_hcd(hdev->bus)->self.sysdev; + + for_each_child_of_node(parent->of_node, np) { + ret = of_pwrseq_on_list(np, &hub->pwrseq_on_list); + /* Maybe no power sequence library is chosen */ + if (ret && ret != -ENOENT) + return ret; + } + + return 0; +} +#else +static int hub_of_pwrseq_on(struct usb_hub *hub) +{ + return 0; +} +#endif + static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_host_interface *desc; struct usb_endpoint_descriptor *endpoint; struct usb_device *hdev; struct usb_hub *hub; + int ret = -ENODEV; desc = intf->cur_altsetting; hdev = interface_to_usbdev(intf); @@ -1756,6 +1788,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) INIT_DELAYED_WORK(&hub->leds, led_work); INIT_DELAYED_WORK(&hub->init_work, NULL); INIT_WORK(&hub->events, hub_event); + INIT_LIST_HEAD(&hub->pwrseq_on_list); usb_get_intf(intf); usb_get_dev(hdev); @@ -1769,11 +1802,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND) hub->quirk_check_port_auto_suspend = 1; - if (hub_configure(hub, endpoint) >= 0) - return 0; + if (hub_configure(hub, endpoint) >= 0) { + ret = hub_of_pwrseq_on(hub); + if (!ret) + return 0; + } hub_disconnect(intf); - return -ENODEV; + return ret; } static int @@ -3593,14 +3629,19 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) /* stop hub_wq and related activity */ hub_quiesce(hub, HUB_SUSPEND); - return 0; + return pwrseq_suspend_list(&hub->pwrseq_on_list); } static int hub_resume(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); + int ret; dev_dbg(&intf->dev, "%s\n", __func__); + ret = pwrseq_resume_list(&hub->pwrseq_on_list); + if (ret) + return ret; + hub_activate(hub, HUB_RESUME); return 0; } diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 34c1a7e..cd86f91 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -78,6 +78,7 @@ struct usb_hub { struct delayed_work init_work; struct work_struct events; struct usb_port **ports; + struct list_head pwrseq_on_list; /* powered pwrseq node list */ }; /**