Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1081802pxf; Thu, 8 Apr 2021 22:35:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxllOK7PvCMd6WAQPU52qhlaYnD33se/Uv8uAgTO4XnkDGZV6+jHc/fmXKE6qvIXFsU6nb8 X-Received: by 2002:a17:906:9605:: with SMTP id s5mr14757680ejx.287.1617946524031; Thu, 08 Apr 2021 22:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617946524; cv=none; d=google.com; s=arc-20160816; b=XRBJnk+j0kBCWisSc0D/nQycm3eN3YnksCsdZT7UIbB8QVT/WRReOM3m8UzErqkFro bT2w7YMjtJPAECfH6pyG9JWOC1OVgd1iLMsNIcZKQte5JadLnftcxRQtJotL0wsG9mR9 jD/luDxML8ON57Ys/Gtk38jvo8s+Y2peh/qjqMy0lqKo8NTLJdy72cG3o7IviXC29Sc3 TuIFb7YKJQXgZUoYhTjbPstRwYobIcLFyzy74iwCYNyqQGpByraFhAT783kggC6xoaK5 Nop08XWzIh9kcK97lkBYYPaUaDDRabovKE9urdHxeHVomJEMlvgc6SfpAoaCcpswgO67 3/nQ== 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:dkim-signature; bh=F9hM9nVGMcr2Nn1IqoOQ93AahNtfT8Yn/VYqHGfn/7I=; b=dAX3etDR4XIV/7TDClEapBohtnuGbm8wFd4IASWQq5kw9i1XvHHSUgFjuYV7BeEXIG /0SgjLvAcWpyxjw+is7Xj+XIC2mWp7LZtFv3zhoYJvlRMy52y86/OcMILRhEbooI7hBm AdNWfnwpx+mk8qgZKooiMzs3XFJQ2nBZLBkIR0grmwS7ESThnioXy2WznM5OpyQOrrUI cyFFsXSfWPZZtj6psG3k9g4buviDqo66WLZIg74PeVWRauTs2qFdU7SFDgYUV2Ey40iN ORZ7En1tIJmILP4SeAJQRIaQ3oY54RhwPU2432lT2qithmocXkorEipO4KgxFk6QUXjZ FFHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MlT+CXpV; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si1124583ejr.361.2021.04.08.22.35.00; Thu, 08 Apr 2021 22:35:24 -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; dkim=pass header.i=@chromium.org header.s=google header.b=MlT+CXpV; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbhDIFc2 (ORCPT + 99 others); Fri, 9 Apr 2021 01:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbhDIFc2 (ORCPT ); Fri, 9 Apr 2021 01:32:28 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF18C061760 for ; Thu, 8 Apr 2021 22:32:15 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id mj7-20020a17090b3687b029014d162a65b6so4400195pjb.2 for ; Thu, 08 Apr 2021 22:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F9hM9nVGMcr2Nn1IqoOQ93AahNtfT8Yn/VYqHGfn/7I=; b=MlT+CXpVe+YEXKYqQu+W958NQrZdgi88YdwzAZb96qmte++WWwYbcPdfBo8w4W3bF5 JIaOtfDEIqS8acjBkZCExhGijH3MWedQIyH4PXz3ifDaeWUiS1qCyBAowfUb27mx9Rpu 3f9lWtKfDlW4KBt36XMD4DabDKOX6pOSbHuKg= 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=F9hM9nVGMcr2Nn1IqoOQ93AahNtfT8Yn/VYqHGfn/7I=; b=HtT53bgTbJ/9MFlKJAI72TSP2vnmETnILODVoS2GpyiQE0e6/ozVeSNFdyV//ei3pl 7RDgDinboOtbXxVSqaeBbS/KzVk+0Ei3kTNNMkYlwLm1clQe44ZZOfE9vWwbEBTYKMoo Jiot1Pt7DqZjnxCVAdEGVqTKr8W3/TpmJvUWeA2cwB4RxWujIEVVoJaCLZmTTgwAZ1RL 3AugS+oJX3MAv4Mm+nAlI1TP0t/QvSToJLvIynXT40CnbhTWxf9zMla1uPRuZNx1Nkar bPZxnO6nEnIwOJocP6JesfHU/ssTTVWIKcuA3k3kPnPL5PRcRzxg6hcQ6bPUjvyP/2th wkVg== X-Gm-Message-State: AOAM532Mly+vfn+JXFUsGP7O1yVuEebtoH0W2PY6LNoKywWCgguIw4yQ 9kjPRd5J1MjUmh4RQ+x9KJ/V4ERYIWwkicKpZhPrjjGozag= X-Received: by 2002:a17:90a:d3c8:: with SMTP id d8mr11825381pjw.144.1617946335435; Thu, 08 Apr 2021 22:32:15 -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: Ikjoon Jang Date: Fri, 9 Apr 2021 13:32:04 +0800 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 , linux-usb@vger.kernel.org, "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , linux-pm@vger.kernel.org, Tony Lindgren , Tianping Fang , Eddie Hung , Nicolas Boichat Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chunfeng, On Thu, Apr 8, 2021 at 5:35 PM 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) > Can't we just use a falling edge type for this irq line? > if we enable the wake irq before calling runtime_suspend during (0), > an interrupt will arise, it causes resume immediately; > 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 >