From patchwork Thu Jul 30 04:01:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11692291 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 2553C14B7 for ; Thu, 30 Jul 2020 04:03:22 +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 F2D9422B42 for ; Thu, 30 Jul 2020 04:03:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lZCWVSKh"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="h1y6cW+6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2D9422B42 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-arm-kernel-bounces+patchwork-linux-arm=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=d/LZpRI82wRWcvAdrERNWLWL6ACrbikz+tv/0d+yK3I=; b=lZCWVSKhTtpneEgOWt89rLsrlB 8ol033DdKa7nP8LIkW51OneE4dwmL0NJj903YQje4rPCBSUMAaKYHZUASjScBPDvOynE6EvuAW3g5 TMDSvsJJpTS4rTwTWl9Ey2pUpj31d1h8oswH6nCIBkL7rV/aTWRzhl6o00JQJgGDFMx4T9li/FvNg oN1ZDMVE8ajMiKERGZwGt3i7Dnm4yBHsBtGFzKROXg/mq8Y1q1M5Z0KmAxX7nJPMJ/sc6frW8j0Ef BzxjsCAFGZGN4BCuesbvjpIWcv1mwEfgFoyj97lZDIEwg4h/SRpUyMGtKgqYrCCQx0mYXIdGjHb2d 9x6XeM3A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0zkt-0008Cu-Aw; Thu, 30 Jul 2020 04:01:19 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0zkq-0008C8-5N for linux-arm-kernel@lists.infradead.org; Thu, 30 Jul 2020 04:01:17 +0000 Received: by mail-pl1-x642.google.com with SMTP id p1so13070194pls.4 for ; Wed, 29 Jul 2020 21:01:15 -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=xsPP2haPHn6gP2Ahy+74zO8OhQ1ajIMIhlDBCTv89iU=; b=h1y6cW+6Z9M3i8Gmgo+exdkCKFBjsJco4+EmU8SXWJjn4RYqJkUIfmBZkebgkvyLjC 90xEmIQysAERID7Tr5dKM9CYAfnfTHChrpKQMsBES1fhl08rGMG3kVGuoHp/uvHIG6l3 bMhhMk7DDLNn8o8VWm5+YoMHFVNIio0Q70Lf4= 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=xsPP2haPHn6gP2Ahy+74zO8OhQ1ajIMIhlDBCTv89iU=; b=aNzwMPDXZVKtVOfXZp/KRDg3WSpWXP4SdmHSdHE4BPlCAh3oV5wfZNxO/VQGaP++mb EyaJI3a0icUJS8zfqF3co8j7HLhZHs41ZUJx2cUjt3v+4Uuwg5nWgT9axNZ+Z/Lo1ILg w0DOZToxPluUCd7o5SkgRneo1mMoaSaSVgwC7Wfr/krulx4LdbZcdcPDXvgrmLDTzFyY CWOhtyPhbgcv4hvR/48iuKL18+OBMGr4NxZ2Fz1JC34GUnAtFWgmZpO6QPa4ii4rCl4V qcFUF2K+1Mq++9+7muFo+J3vQCe8gRVk6b1r3dRfv/O4sAerWxM0cdMdGvGigUS8Gwng 0xvA== X-Gm-Message-State: AOAM5313LOv5Vn+7BHLtxje0RQbnd382+N8f1DeaZlYPS6QzH4z5RvO7 UJ9JbxWuYpKR5X2RJrQ4qEkZtQ== X-Google-Smtp-Source: ABdhPJxkoLXNECTfu4ISeOa4wxsYJN4hZQrVF0BybO4ggF5F738z+52YcT2dpRPFmHvt6Q2fHI6H5Q== X-Received: by 2002:a17:90a:5d87:: with SMTP id t7mr1095548pji.213.1596081673509; Wed, 29 Jul 2020 21:01:13 -0700 (PDT) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:7220:84ff:fe09:41dc]) by smtp.gmail.com with ESMTPSA id c9sm3635209pjr.35.2020.07.29.21.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 21:01:12 -0700 (PDT) From: Nicolas Boichat To: Matthias Brugger Subject: [PATCH] soc: mediatek: Check if power domains can be powered on at boot time Date: Thu, 30 Jul 2020 12:01:08 +0800 Message-Id: <20200730120054.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> X-Mailer: git-send-email 2.28.0.rc0.142.g3c755180ce-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200730_000116_352600_A6D5D783 X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 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:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Nicolas Boichat , Sascha Hauer , linux-kernel@vger.kernel.org, Daniel Kurtz , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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). Fixes: c84e358718a66f7 ("soc: Mediatek: Add SCPSYS power domain driver") Signed-off-by: Nicolas Boichat --- 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 f669d3754627dad..0055a52a49733d5 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 = genpd->power_on(genpd) >= 0; - pm_genpd_init(genpd, NULL, false); + pm_genpd_init(genpd, NULL, !on); } /*