Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1804858ioo; Fri, 27 May 2022 18:25:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvXe3Yz0AqTjFSp/ERJbtwfjLjihIrG161cQnmhWx3gJEQcXSIPeOvEQIoLN1IvfEwNQGN X-Received: by 2002:a05:6402:3508:b0:42b:6ec7:1674 with SMTP id b8-20020a056402350800b0042b6ec71674mr27441973edd.176.1653701124530; Fri, 27 May 2022 18:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653701124; cv=none; d=google.com; s=arc-20160816; b=LNs/hsomtYzKrbi73wBM9dUrISNW5k335SKnsPdEThHbAzGsjKEhbqhyAke9YtrzeR gxDvmDLC+ECGRcr4eHvg5AUitwXAU1dcWhqHZtjOFWbe9ajIsDDgK2rrkYkE6lS4z3Kf sWgIhn4d2E0MrSRGO6yQrwoE2dRggcFAMZcZxDE/5CtZNkEGWVFEzjEWb9oxBHPn+91E CAoIIvp2yyDChEq2uM6G0gwIZsDe0hVFO/sPSL3YCvtjQHKVbQ30DIEcavzSXev9n5Da nrRsJ5MO7etG8ettoOy9XUbLSjJXr0wnnfAzWlrIO8aKLEXW8MYQvBfAY0ZUqQgjYMqo fatQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Cz0az1bh7WDnZV2yku+ue+sCkR00jjhrmoI17Su6PQ4=; b=VadwRqJ6b9t2DsJuXYokFa7wcra6VrhESKk2pMwogsfxPxnWURFlwvApqylqk7kf/6 LHoHVWkm+Nsi2ahPQMzmOebidvuIHUXpCGdfrOeieUMe5NxCZc0TbPg2Yb/ztLjzJIMN 4gL4gwI8HTqa3OrfubQ2RC0UqYTO+O5Kjbmj+pJCjtiMNWd/ahhPJvxOBrnapi+Y57jU FJY0dwfW69PUjNYJyAGTMRipGjq5dTQR/gh2xYqmDJrLCS9FSDWytepvbeSWdDH9sGFB nCNcqX3pP8EHK4Wx0NLBsijbLrU1FZD17xXyBhtnqGTGbWL5q03zjlRacY4HWMzdumub wZxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=I6SA6TdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a170906794b00b006f4213f2b43si5902242ejo.533.2022.05.27.18.24.58; Fri, 27 May 2022 18:25:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=I6SA6TdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350487AbiE0JD6 (ORCPT + 99 others); Fri, 27 May 2022 05:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350852AbiE0JAq (ORCPT ); Fri, 27 May 2022 05:00:46 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D00D108AAD; Fri, 27 May 2022 01:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653641837; x=1685177837; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Cz0az1bh7WDnZV2yku+ue+sCkR00jjhrmoI17Su6PQ4=; b=I6SA6TdD/TDx9TN8xWS73h69+5XWUTNWdGGDj2cBAnE9/qEDWFju6YFO ycrLYH2v+YpbwVZjoYe2nUt3he8PQXwQzyCkg3+TkHnoHJD/bYrfRFpRh 1lSJTVOyQsPt1IcUuNsP2UGWqRlU3CmiFYQo9hXwthATjnAQ7aTKCoUDC M=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 27 May 2022 01:57:17 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2022 01:57:01 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 27 May 2022 01:56:40 -0700 Received: from hu-pkondeti-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 27 May 2022 01:56:38 -0700 Date: Fri, 27 May 2022 14:26:33 +0530 From: Pavan Kondeti To: Prashanth K CC: Matthias Brugger , Greg Kroah-Hartman , Pavankumar Kondeti , Pratham Pratap , , Subject: Re: [PATCH] usb: common: usb-conn-gpio: Allow wakeup from system suspend Message-ID: <20220527085633.GB17518@hu-pkondeti-hyd.qualcomm.com> References: <1653634146-12215-1-git-send-email-quic_prashk@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1653634146-12215-1-git-send-email-quic_prashk@quicinc.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 27, 2022 at 12:19:06PM +0530, Prashanth K wrote: > Currently the VBUS/ID detection interrupts are disabled during system > suspend. So the USB cable connect/disconnect event can't wakeup the > system from low power mode. To allow this, we keep these interrupts > enabled and configure them as wakeup capable. This behavior can be > controlled through device wakeup source policy by the user space. > > Signed-off-by: Prashanth K > --- > drivers/usb/common/usb-conn-gpio.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c > index 395f9bb..b39c9f1c 100644 > --- a/drivers/usb/common/usb-conn-gpio.c > +++ b/drivers/usb/common/usb-conn-gpio.c > @@ -257,6 +257,7 @@ static int usb_conn_probe(struct platform_device *pdev) > } > > platform_set_drvdata(pdev, info); > + device_set_wakeup_capable(&pdev->dev, true); > > /* Perform initial detection */ > usb_conn_queue_dwork(info, 0); > @@ -286,6 +287,14 @@ static int __maybe_unused usb_conn_suspend(struct device *dev) > { > struct usb_conn_info *info = dev_get_drvdata(dev); > > + if (device_may_wakeup(dev)) { > + if (info->id_gpiod) > + enable_irq_wake(info->id_irq); > + if (info->vbus_gpiod) > + enable_irq_wake(info->vbus_irq); > + return 0; > + } > + > if (info->id_gpiod) > disable_irq(info->id_irq); > if (info->vbus_gpiod) > @@ -300,6 +309,14 @@ static int __maybe_unused usb_conn_resume(struct device *dev) > { > struct usb_conn_info *info = dev_get_drvdata(dev); > > + if (device_may_wakeup(dev)) { > + if (info->id_gpiod) > + disable_irq_wake(info->id_irq); > + if (info->vbus_gpiod) > + disable_irq_wake(info->vbus_irq); > + return 0; > + } > + > pinctrl_pm_select_default_state(dev); > > if (info->id_gpiod) Looks good to me. Thanks, Pavan