From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE54C56202 for ; Wed, 18 Nov 2020 00:39:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61BC72151B for ; Wed, 18 Nov 2020 00:39:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K2nX4dPa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="spDKP8Cj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61BC72151B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wp2qj1mGZLCv01Ka6aakRDCwN8LX91teNOOPIebJAvE=; b=K2nX4dPazsr398zY2b3oMW1tI 9La7wEbKifwzb7WkRFGRIaRM8q3nZaR6VS85GL8vpoR45SqDUAEdWVtjaySRrI4LYKXEZgtLuk7/G EC+wyLYUwG94abZ7cgesvXP0ouoEzwwwvYNWVngrzGEQzvdt/m2rXzSJIZoM19sa5pb2pPT2y7Fm8 cGngRdLqovuDcMy8PDeQq1ea47kT+ak4K+iwteOL6GnwFkJkTZPGSG5GptsxG0ozsNENfGWDd0lLD 26NSvuXIcrx5j2Dh+MhA1ndSivsYQNGBqzgH8F2l8bziMnxEmjGUCstj9HyLCIwQPyiYgx/yw5/sz RrgFbOrDw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfBV5-0005Qs-Nq; Wed, 18 Nov 2020 00:39:07 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfBV2-0005QE-81 for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2020 00:39:05 +0000 Received: by mail-lf1-x143.google.com with SMTP id d17so435158lfq.10 for ; Tue, 17 Nov 2020 16:39:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8cUIbkZJylsb5mO6hD/KZYGDtSV3P8FggXBoXgK+a98=; b=spDKP8Cj1EaiX/Lv5t3Qkw8QD0FSRfZa/OQOa/7jvbJs0fpyUfTlaf7QGQ0S+UAdez SX8kQ6hZj+W1hgFZUV8GqSBklPHOJDyy8SxvO5CLmie/8wyXwkaZ2aiGVXYQvvZo3Jzx maRCHS63l7HL59+bKhFIOLi0ptIP47AvkIRf3s298xunQ6JY4lcG2g7gum+M5E+fwg7x Hv7gg6oxYSiXOHpPYj9GIaobsuYesLc+ROcJx/RWeAQ+d6D7x3tcrK1F5C7kT6xjNZY9 JfEuxBxuaK7d0Z1jxSXxhh2jfAPpXPHluITOn2AAhO/KSpNDJqCF2H2QrUiB+beesAia cX8Q== 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=8cUIbkZJylsb5mO6hD/KZYGDtSV3P8FggXBoXgK+a98=; b=gI8LVP52ni+3EdZSc/rKgpt3GR255afatQp9KdWfMTpwqIxhPNsTFCbM9LYsiXQJUG ii5q9kkNIZt2z2GYt4QD7N0nFpuvoegl2D1M9cVBSv83vyH8u6JQzJzZwWu9yG/J4YE0 nfJMe+JtK+6/rS6vxRPdCPpJtzgeYWijP6Ighiy9FO0rvkuKFNdAURDY/h7PGDDPrWaa /iV/mcviRDCGh5zsBDDFaWMA8h6FxJBdqt+Kp9xqs5DTMH9V8OVqEmmahuMpVYOnP0YU OU0vU0UEOO0RAGa2BWoUszQgtfxuoMWgyA6bOPgIKLlJS7JxMweVazbfZKLeGb5o4tkW adLA== X-Gm-Message-State: AOAM531HqypJH6Ppq+M1jSLjMbmY628sTV+r9aHGValPKTqRqgn+VG0k /zLvvd039/OHVmpUc1xkgg5+2F9noLEPN1RMCNNAnQ== X-Google-Smtp-Source: ABdhPJzP/7gUUiG2Hzqfd0CHPMAFi62oLlQ30ZVIBtWrmH4gJQa06oqnka0nRprKaPt7QqMH80d7vCKK79I+HmFZHP8= X-Received: by 2002:a19:546:: with SMTP id 67mr2477974lff.502.1605659941675; Tue, 17 Nov 2020 16:39:01 -0800 (PST) MIME-Version: 1.0 References: <1605201148-4508-1-git-send-email-srinivas.neeli@xilinx.com> <1605201148-4508-8-git-send-email-srinivas.neeli@xilinx.com> In-Reply-To: <1605201148-4508-8-git-send-email-srinivas.neeli@xilinx.com> From: Linus Walleij Date: Wed, 18 Nov 2020 01:38:50 +0100 Message-ID: Subject: Re: [LINUX PATCH V3 7/9] gpio: gpio-xilinx: Add support for suspend and resume To: Srinivas Neeli X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_193904_309901_8BE429D4 X-CRM114-Status: GOOD ( 15.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:GPIO SUBSYSTEM" , sgoud@xilinx.com, Shubhrajyoti Datta , Michal Simek , "linux-kernel@vger.kernel.org" , Robert Hancock , Bartosz Golaszewski , git@xilinx.com, Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Srinivas, On Thu, Nov 12, 2020 at 6:13 PM Srinivas Neeli wrote: > Add support for suspend and resume, pm runtime suspend and resume. > Added free and request calls. > > Signed-off-by: Srinivas Neeli > --- > Changes in V3: > -Created new patch for suspend and resume. (...) I'm following the idea here I think. > @@ -544,6 +618,8 @@ static int xgpio_probe(struct platform_device *pdev) > + pm_runtime_enable(&pdev->dev); > + status = pm_runtime_get_sync(&pdev->dev); > + if (status < 0) > + goto err_unprepare_clk; Now the clock is enabled a second time. Because runtime PM kicks in. Do this instead: pm_runtime_get_noresume() pm_runtime_set_active() pm_runtime_enable() Now runtime PM knows it is active and will not call runtime resume and enable the clock a second time. > + pm_runtime_put(&pdev->dev); > return 0; This is right, now pm runtime will gate the clock until the first GPIO is requested. > +err_pm_put: > + pm_runtime_put_sync(&pdev->dev); > err_unprepare_clk: > + pm_runtime_disable(&pdev->dev); > clk_disable_unprepare(chip->clk); > return status; Use this on the errorpath instead: pm_runtime_put_noidle() pm_runtime_disable() clk_disable_unprepare(); Now the code will not call runtime suspend to gate the clock a second time. Double-check the references to the clock and check in debugfs that the clock really gets disabled if you're not using any GPIOs. Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel