Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp686481pxf; Thu, 8 Apr 2021 10:43:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW5Q59xM/tb1m1f2mnZUnnpyazS4LLNEIJItmbBa56gAQ5eQuwWBA/g3Wj0cA5ed13v6dN X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr11732578ejc.403.1617903794398; Thu, 08 Apr 2021 10:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617903794; cv=none; d=google.com; s=arc-20160816; b=K9HW6rBy+20g4kvk0s98Q5KK5TpnMGaY2vigk3dk0tx691wju4UU9FEjvIuW0Z5Vi5 D+i8o/fmR1PorAYDXW+dRXNUbZos2htc2C62GF5Xbqqz2Dkua/hqWUNc90r2rlohTyJK yjLgi8RaW0ZBgN+SGW/KVEgQsrSWtFlRNWmH41fBzZdQ/tlx2N1w9aXCaWSbM8xO7JqK obeoo/fBPkRUJEk/a3gsZ7th18V2ZPlwIH/D15uRdxAi+1M4BT0o5cXXPdV0twFCT+HC PGZ/k2vFqzkKy7FyILClkDKQQL0fPxqWp1hqH96FAWXLX9iXixtNkFjee2k+OuJalZkD X5TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=MxPv9rGDLS4kNaUwF1zjTD50xd/6Z8XGBbW4dmhPKD8=; b=NmM74ZzrMQ2I/VNLH/G9SVHWf1RDvmektNm0DmiBqP6KKnT6j/TzvuKJig8dCSt4Dh XHaYZT6Qm1wxgPAjz21yLjKAwg3MS5ebqk5S80CPkqTlsp5qHNcf6lngNhXR2cAlf9sL JSFh3VeQVbs8ulBOalenf/XiM3H6GAqYWzK0L96h/9Kq+snXHbUEScOhIaUkzyLKBae4 PpoQiJv58iV71L3pUYJ1MaVCL6AVHcsDsdnMZwbQBNc/MryxZIHqkD7x0zen8au+JxY8 rOWgkIoVJwHo+vZhh7Hdz9/NcR4r0ih0o/5KBl3cVYVKFrFuimlQbeM4vKm7O0OW4fF8 tg5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id wn19si7257531ejb.372.2021.04.08.10.42.50; Thu, 08 Apr 2021 10:43:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232507AbhDHRlh (ORCPT + 99 others); Thu, 8 Apr 2021 13:41:37 -0400 Received: from mail-oi1-f181.google.com ([209.85.167.181]:38693 "EHLO mail-oi1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232267AbhDHRld (ORCPT ); Thu, 8 Apr 2021 13:41:33 -0400 Received: by mail-oi1-f181.google.com with SMTP id 25so1533671oiy.5; Thu, 08 Apr 2021 10:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MxPv9rGDLS4kNaUwF1zjTD50xd/6Z8XGBbW4dmhPKD8=; b=A2lp3oM0ItWq0xqfVnnJ3qVaiuOO3KsJ94X+E1AqzUrxBH2KeRrfGIxLILWRiuXIJv ZjNkaAtXAnZ31OcKco2QcSOMQ57i87H0SlKSeVPyMRKdvkGfyQ9Av/vc57KHDHfIUvaZ sKh0tG7XXhSdtAe5CEl3fj/jkgyOTz5XaX1QuOaWljBtXt/TDCH8gSDW6zVkiNOHY52a cvW/Jg4xTcREQcda3OuZlTzOekZTMk3n7LLJnVEzIlJNSRE1dAdMYPn/w4syyK3DrtZ/ t+M218Ihp4d6s/pnuU/UuXJLtUhsK2dpD3Smv65BYbTmSXTUk4Pf6p+SW6CtZcmqkML+ qU6g== X-Gm-Message-State: AOAM5313SyItVaHcVZmvPqqnJoNik09lQ95dqpaVLoTurNQCm0Drw/Pg pU6RHC/mwiNFTdFYm1FrfhEaDQYjpWt3wRdbvhs= X-Received: by 2002:aca:5fc3:: with SMTP id t186mr6817482oib.69.1617903681158; Thu, 08 Apr 2021 10:41:21 -0700 (PDT) MIME-Version: 1.0 References: <1617874514-12282-1-git-send-email-chunfeng.yun@mediatek.com> In-Reply-To: <1617874514-12282-1-git-send-email-chunfeng.yun@mediatek.com> From: "Rafael J. Wysocki" Date: Thu, 8 Apr 2021 19:41:10 +0200 Message-ID: Subject: Re: [PATCH 1/6] PM: runtime: enable wake irq after runtime_suspend hook called To: Chunfeng Yun Cc: Rob Herring , Mathias Nyman , Greg Kroah-Hartman , Matthias Brugger , "Rafael J. Wysocki" , Len Brown , Pavel Machek , "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" , Linux ARM , "moderated list:ARM/Mediatek SoC..." , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux PM , Tony Lindgren , Tianping Fang , Eddie Hung , Ikjoon Jang , Nicolas Boichat Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 8, 2021 at 11:35 AM Chunfeng Yun wrote: > > When the dedicated wake irq is level trigger, enable it before > calling runtime_suspend, will trigger an interrupt. > > e.g. > for a low level trigger type, it's low level at running time (0), > and becomes high level when enters suspend (runtime_suspend (1) is > called), a wakeup signal at (2) make it become low level, wake irq > will be triggered. > > ------------------ > | ^ ^| > ---------------- | | -------------- > |<---(0)--->|<--(1)--| (3) (2) (4) > > if we enable the wake irq before calling runtime_suspend during (0), > an interrupt will arise, it causes resume immediately; But that's necessary to avoid missing a wakeup interrupt, isn't it? > enable wake irq after calling runtime_suspend, e.g. at (3) or (4), > will works. > > This patch seems no side effect on edge trigger wake irq. > > Signed-off-by: Chunfeng Yun > --- > drivers/base/power/runtime.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > index a46a7e30881b..796739a015a5 100644 > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -619,12 +619,12 @@ static int rpm_suspend(struct device *dev, int rpmflags) > __update_runtime_status(dev, RPM_SUSPENDING); > > callback = RPM_GET_CALLBACK(dev, runtime_suspend); > - > - dev_pm_enable_wake_irq_check(dev, true); > retval = rpm_callback(callback, dev); > if (retval) > goto fail; > > + dev_pm_enable_wake_irq_check(dev, true); > + > no_callback: > __update_runtime_status(dev, RPM_SUSPENDED); > pm_runtime_deactivate_timer(dev); > @@ -659,7 +659,6 @@ static int rpm_suspend(struct device *dev, int rpmflags) > return retval; > > fail: > - dev_pm_disable_wake_irq_check(dev); > __update_runtime_status(dev, RPM_ACTIVE); > dev->power.deferred_resume = false; > wake_up_all(&dev->power.wait_queue); > -- > 2.18.0 >