Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1355704pxb; Fri, 1 Oct 2021 08:56:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZFMSMZDZP3SoeB5noWsfgk/bVya1KAPFW2xec57KmeJX+fMaB2VajufQx3RS6rxBvZCOM X-Received: by 2002:a17:906:b14d:: with SMTP id bt13mr6921459ejb.39.1633103813015; Fri, 01 Oct 2021 08:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633103813; cv=none; d=google.com; s=arc-20160816; b=jDYqp60P1pToFQIPKMhbzpzizmOCEIj1wdm/nY7wyknLENQcQeRvWvI/EaQeaOQZzi xnSvzLzkpK+IDJdnFe1QkBgdPZJOKp7YX/eUi00G0MZa1HIbyTJlEun+Gq1ifsozfP51 wGPLjINSdcvG0+nH582vOFroG2KeVYljU3UV4pvQCMeGDkHXmwf2gODIYe3j2Pj65f/s 73YdHot2FjLm8PnHiuAkNmDpFXqaa83CT7o1dhhaKdDKZQS5OHcD+C+La8a5axs67BK9 WF5RuBGxIy/BQn89061dWwMjD24aKBO1kVh52flDnmGGC3L/0WP8WB58Kvzgk0MYQ6Tw WzcQ== 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=TmYkpMVtb1uSKsqX5euv7WOyLfzbmtOSlOndqVN+8j0=; b=oRyyfEtjW9rZxozeHID38vosAXrm7vNy4zswrGkNsmuLKUaBnFdpmTxS5vORdr6Zzx P2sFh/Oaiwrbu652xujcl9aIO6YgjpeWL9+J8qgxPgWvLKVHmfQVD//L3QyHZPH6Adz8 K7eDiMOPBZ7AL7lPkJSrYHzcD4xVgTn3dBg2YX/0ZhptzNmZOsiERYeKt75zaOTxh+QB QU+gSBoKQs9AAcpCIppSspiIWqsb4dDLGQ3/J5CCsUw9bFy5tEEFWVvKC3dRiuq0rM87 765ZHXdDrVVsZa7n3DudnDzcIHD3W9AmVWXt2BottV3nbjcodHI1iOB+sqwPuJB4ydJk WKZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=duQY39xT; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si7532122ejj.636.2021.10.01.08.56.27; Fri, 01 Oct 2021 08:56:52 -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=@linaro.org header.s=google header.b=duQY39xT; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354373AbhJAOVW (ORCPT + 99 others); Fri, 1 Oct 2021 10:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354368AbhJAOVV (ORCPT ); Fri, 1 Oct 2021 10:21:21 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26B5DC06177E for ; Fri, 1 Oct 2021 07:19:37 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id m3so38942254lfu.2 for ; Fri, 01 Oct 2021 07:19:37 -0700 (PDT) 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=TmYkpMVtb1uSKsqX5euv7WOyLfzbmtOSlOndqVN+8j0=; b=duQY39xT4Fb3Hr1PnbXTs56tkaQqjpQAgYJH7QSZorCPxuVu1w1xjBo4K+zxv2eT/i Gv8vFaPicQua766hZYd2Z4sFxKAhudSPsUf76DMai8U3Fw5bbvcx7fO5WW1P2A848bGM ZQq9OG2u50UNu3Jjx5+mQA6VDCrE6ml8Fh35xGIGRw6EE6eRYolYKa9p+8rWD2ZvBilp uWVK4oDlCgf7DxNBdPej6J24qlMnSVWJnHXL2sfU57hu2pnNnIEFwtPnFm56+42awhNu cSD+lRwaEeSCzPyePp37ympdEiAHaEdnn7LGs+wYp5tVdUW4CxRCTuk1HbDpdUV4ipuJ BGrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TmYkpMVtb1uSKsqX5euv7WOyLfzbmtOSlOndqVN+8j0=; b=EMw196avon90bY1vpXMGlcu5oW5wCQs90WKEokI6VVEqIKxuXhkmAkeTXOcQqnMf9R zJbvh1QRdFfVcxAcc9w/9dBu98z+FPJm2hWsrJA84jStuSPDGviSq8PVQ8cplHZLlGMT 1PoHSkovyAC1a+kObyyKP95H0DN1uZXkDX8t/TxmSz3j7hazb9ItefDyrUWxNgQjzaOF vFFu1Xst37QbkmhtWy3IHaFx3GxXML9ftIo71F8L/WpjMjuPVvgAiaclmMEtTxTjgggC anPHSxeHK0xPKD8CzVirzNK4+cC86KU/8WdLw1oR1/g1zEokQtd53EN7EGgvL/EDEOZP UaLw== X-Gm-Message-State: AOAM533p+F69N98zqQ5cP18WpMki/5ucPkI/Ep/t0ELaljoRy5NzKTX5 ZXYMDzv6UZyTAV8TWnbSGZT2H/0V3Msg6aIIhRQ00w== X-Received: by 2002:a05:6512:2397:: with SMTP id c23mr5560648lfv.358.1633097975362; Fri, 01 Oct 2021 07:19:35 -0700 (PDT) MIME-Version: 1.0 References: <20210926224058.1252-1-digetx@gmail.com> <20210926224058.1252-18-digetx@gmail.com> In-Reply-To: <20210926224058.1252-18-digetx@gmail.com> From: Ulf Hansson Date: Fri, 1 Oct 2021 16:18:59 +0200 Message-ID: Subject: Re: [PATCH v13 17/35] bus: tegra-gmi: Add runtime PM and OPP support To: Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Lee Jones , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Nishanth Menon , Adrian Hunter , Michael Turquette , Linux Kernel Mailing List , linux-tegra , Linux PM , Linux USB List , linux-staging@lists.linux.dev, linux-pwm@vger.kernel.org, linux-mmc , dri-devel , DTML , linux-clk , Mark Brown , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Mauro Carvalho Chehab , David Heidelberg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Sept 2021 at 00:42, Dmitry Osipenko wrote: > > The GMI bus on Tegra belongs to the core power domain and we're going to > enable GENPD support for the core domain. Now GMI must be resumed using > runtime PM API in order to initialize the GMI power state. Add runtime PM > and OPP support to the GMI driver. > > Signed-off-by: Dmitry Osipenko > --- > drivers/bus/tegra-gmi.c | 52 ++++++++++++++++++++++++++++++++++++----- > 1 file changed, 46 insertions(+), 6 deletions(-) > > diff --git a/drivers/bus/tegra-gmi.c b/drivers/bus/tegra-gmi.c > index a6570789f7af..72ef8a8c236b 100644 > --- a/drivers/bus/tegra-gmi.c > +++ b/drivers/bus/tegra-gmi.c > @@ -13,8 +13,11 @@ > #include > #include > #include > +#include > #include > > +#include > + > #define TEGRA_GMI_CONFIG 0x00 > #define TEGRA_GMI_CONFIG_GO BIT(31) > #define TEGRA_GMI_BUS_WIDTH_32BIT BIT(30) > @@ -54,9 +57,9 @@ static int tegra_gmi_enable(struct tegra_gmi *gmi) > { > int err; > > - err = clk_prepare_enable(gmi->clk); > - if (err < 0) { > - dev_err(gmi->dev, "failed to enable clock: %d\n", err); > + err = pm_runtime_resume_and_get(gmi->dev); > + if (err) { > + pm_runtime_disable(gmi->dev); > return err; > } > > @@ -83,7 +86,8 @@ static void tegra_gmi_disable(struct tegra_gmi *gmi) > writel(config, gmi->base + TEGRA_GMI_CONFIG); > > reset_control_assert(gmi->rst); > - clk_disable_unprepare(gmi->clk); > + > + pm_runtime_put(gmi->dev); > } > > static int tegra_gmi_parse_dt(struct tegra_gmi *gmi) > @@ -213,6 +217,7 @@ static int tegra_gmi_probe(struct platform_device *pdev) > if (!gmi) > return -ENOMEM; > > + platform_set_drvdata(pdev, gmi); > gmi->dev = dev; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > @@ -232,6 +237,14 @@ static int tegra_gmi_probe(struct platform_device *pdev) > return PTR_ERR(gmi->rst); > } > > + err = devm_pm_runtime_enable(gmi->dev); > + if (err) > + return err; > + > + err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); > + if (err) > + return err; > + > err = tegra_gmi_parse_dt(gmi); > if (err) > return err; > @@ -247,8 +260,6 @@ static int tegra_gmi_probe(struct platform_device *pdev) > return err; > } > > - platform_set_drvdata(pdev, gmi); > - > return 0; > } > > @@ -262,6 +273,34 @@ static int tegra_gmi_remove(struct platform_device *pdev) Similar comment as for patch13, for the ->remove() callback. This problem, which sometimes also exists in the error path in ->probe() (according to my comments in patch13), seems to be a common issue in the series. I will therefore not continue to repeat my comment on this for the remaining patches in the series, I think I have made my point. :-) Kind regards Uffe