From patchwork Mon Sep 28 03:31:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11802765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 873F06CA for ; Mon, 28 Sep 2020 03:31:49 +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 DC5B6239A1 for ; Mon, 28 Sep 2020 03:31:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zNL9St4A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TPnACvqk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC5B6239A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.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:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=oq+RC9t6aKhLglAvsUx6EBc4Fv5mkinvTqVbfw6UKRE=; b=zNL9St4A118lg9rnRkXffniwyc mzRFsTT8im0CqdyQ5lQe2EXgNaifZoDr/hmXHcbgQjyGBVAhoUropl+NERmSZuPe5kWCW94tKWjOP GLNN7IWUcstyCwLz2/ezg0CNlE1CsOdae80KI/Rr9Bg55Z+3XWWYCS+15UeeoAkOyfnwjrTY7XNj3 udrrrRAwU87qW718i4WQLHGSkHjGmJDaH1oRMyTwIxSh5xswM3lObACWdOHKhsmLECz/H1/hmLb/b 57LNldK0w9qrBn2pq7o+g8J3Gtz+WkT61PRlSoW8K6hRh+TzoXYuZtxXhiNqRsp8J30bLi8MmAgkc 4hT2R9HA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMjtC-0005x3-WF; Mon, 28 Sep 2020 03:31:47 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMjtB-0005wN-B8 for linux-mediatek@lists.infradead.org; Mon, 28 Sep 2020 03:31:46 +0000 Received: by mail-pg1-x541.google.com with SMTP id d13so7083084pgl.6 for ; Sun, 27 Sep 2020 20:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N/EpoZQfstu+PtLpJpKosc5sDI8cNsjHAqKjuh09dpU=; b=TPnACvqkAuZKzWjdeh9nwNFuQlDeml7iNwfm7yiuUMD+fLPKDKiPV0d3OUxkF/4nwv YOJkoUckvY6C5DCSyiXEGg3vqREv67TrjRFIQE1BZBezidWKQ63ALmygtJhiX5bbMOeX IUrlHOhAv38J+fNOK5OpVSZth44dtAChBiCSU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N/EpoZQfstu+PtLpJpKosc5sDI8cNsjHAqKjuh09dpU=; b=U0cHk0IpXdMyN/omZACD4okR3ltIsytpy/TyxY3CS0QFreTegl2OVkBiFnom07Cdnu 2JFtSpFQGP1VDlfhBT7ae5D9uu/HGvD5W4dlHeZplREpIQ2CP4UhNlXepCdKibQWZ2sZ L8KnjODhLNQGL1UKnnc1B4W3cwrjyOk7ktinI6Bz4GrbqPiUa7mby5SHGfgCJM2DcjCu ZCo8RMNwpnPlqtmCliC3f4t8u/ht4pBCMmSoAXTngI9xOs01zo+ej8BG4wFU8bLVl/HJ 9FE895FwuPT7yOkbCq0Cpgya2UrUztCumK63tGIDv0tCkcs/AhkeLSDEtTFzTSnfVaZn XonA== X-Gm-Message-State: AOAM5320A6Lds5W8LRbJVjhFfBPk/v4S29+TCLoMcbTVzQR3bpnER+yq wwAyxmW+gMwI1jnz4OkIYxP7Mg== X-Google-Smtp-Source: ABdhPJzTJGzCeQ9lvnJeSH23CAuBjJ+xu7mtkCHRt4CPpwRzS5FlrwfY9s2qHfFca9qJY+TDrd/WXA== X-Received: by 2002:aa7:8249:0:b029:142:2501:34db with SMTP id e9-20020aa782490000b0290142250134dbmr9395510pfn.52.1601263900127; Sun, 27 Sep 2020 20:31:40 -0700 (PDT) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:7220:84ff:fe09:41dc]) by smtp.gmail.com with ESMTPSA id z8sm8201440pgr.70.2020.09.27.20.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2020 20:31:39 -0700 (PDT) From: Nicolas Boichat To: Matthias Brugger Subject: [PATCH v2] soc: mediatek: Check if power domains can be powered on at boot time Date: Mon, 28 Sep 2020 11:31:35 +0800 Message-Id: <20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200927_233145_466292_DA8609D3 X-CRM114-Status: GOOD ( 14.59 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.6 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Boichat , Sascha Hauer , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org In the error case, where a power domain cannot be powered on successfully at boot time (in mtk_register_power_domains), pm_genpd_init would still be called with is_off=false, and the system would later try to disable the power domain again, triggering warnings as disabled clocks are disabled again (and other potential issues). Also print a warning splat in that case, as this should never happen. Fixes: c84e358718a66f7 ("soc: Mediatek: Add SCPSYS power domain driver") Signed-off-by: Nicolas Boichat --- Changes in v2: - Add WARN_ON if the domain can't be powered on, to make it more obvious that this should not happen (there is already an error message). drivers/soc/mediatek/mtk-scpsys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index f669d3754627..ca75b14931ec 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -524,6 +524,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, for (i = 0; i < num; i++) { struct scp_domain *scpd = &scp->domains[i]; struct generic_pm_domain *genpd = &scpd->genpd; + bool on; /* * Initially turn on all domains to make the domains usable @@ -531,9 +532,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, * software. The unused domains will be switched off during * late_init time. */ - genpd->power_on(genpd); + on = !WARN_ON(genpd->power_on(genpd) < 0); - pm_genpd_init(genpd, NULL, false); + pm_genpd_init(genpd, NULL, !on); } /*