Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1631610ybg; Wed, 29 Jul 2020 21:04:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdvznRnX3jquRGyA8KXzEuEhvnnQfcBnG+eYbS1IKcGvHhOOV8k6bIP4MmfN9mPFWo7JdT X-Received: by 2002:a17:906:5c52:: with SMTP id c18mr771879ejr.168.1596081869814; Wed, 29 Jul 2020 21:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596081869; cv=none; d=google.com; s=arc-20160816; b=NzTfF7HBJoNMuhsIrgZsL+NEuGk3Uh58+8716iggcUsW8CxKF6TFwEJPGXUCCdKPHp 1Uxp5uqzzt02GJAAy5py8h/p+cDy2feHg4uE//QoJ/XUm3URFK4eiX3/Lhu+SF0sCnld e+rJr7TDCtQUvMcXoiyaTRuLMzplmQ186HakNjO+tJEowTCE1/eZExHXyR475pBiR3vm vWcfDAX4vqB1P+kTbzlp4SKwyYsmT4XvDzj+ZqpNEX/hLUEPQraVDC5LYmedWwEuGZLn drZVDylRgtwPEHzsJprHhggX/z3yBCVQguZxDgJXNf0wEEkQJj/NoSUY6q3pHX4Jl2NB ipTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xsPP2haPHn6gP2Ahy+74zO8OhQ1ajIMIhlDBCTv89iU=; b=YoCbVnWJLjIpjoKbFMGCuiJ5dDwmSHXJkvgwQyxXNSu1yiUxsyd8fIaiuk+NengeG3 1OsWYU9CNkKifKWDn1n/LLCoyYTs2zaGulLB15J/2QXqcBFClZKxWN+JpceYRNyXu+dl 1HO6ZE5rr3uyKl0V0LvesMosuRQAshI4fBjDZkvnCLR5oJHc8L2i5MJChhdOpWS+Lxx6 AswWQAyqYGhA7PodifLxqi73c7IOdBoXVZlll7YO1l9oJFGArVUtPi1H5Wul6TKRhWcC 7A9feQid0Sy1FxNCWRJObbDIYflE4ZkVJUr4s0q4aHaCGI2NQatyP8L5RkyRMfgjxzBq 8fbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h1y6cW+6; 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 g20si2533292edq.447.2020.07.29.21.04.06; Wed, 29 Jul 2020 21:04:29 -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=h1y6cW+6; 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 S1726519AbgG3EBO (ORCPT + 99 others); Thu, 30 Jul 2020 00:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725765AbgG3EBO (ORCPT ); Thu, 30 Jul 2020 00:01:14 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21B3CC061794 for ; Wed, 29 Jul 2020 21:01:14 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id k13so5256041plk.13 for ; Wed, 29 Jul 2020 21:01:14 -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=UQ6AlnH61vwBK3PvgPvgGFprcCqDCaa9kM6L+DKcrH8cHp2GNDtyZ3si0kAtTJFFNl p7+n4wiuFT4LM1P4kcomDA/o+umBRSH9jyP4pdwDAHC1e/lAr+cB06xAv4mhm37HzONA ASaKDvyLdzCrfaEQRcUwz9g62WYq5q5sIGob/MSsyEVvQWI/8M3PTrz5TDNy2ZXYTcXk ti9Xc6DbuwsUEw18kHyfVXCP65C9S77j9OgKP/5aAyZLHK7/seRnFGHu0NuWfLnxlCoF QzhWO3cyWmZkopIQli/OjSJKMl7budkNX9jdOF3oBEXfiADbrYaJIxEEZAimeNEzYw8F pbDQ== X-Gm-Message-State: AOAM533gcLvWGQGDdefVO5z7znvu7rFi+Kox7zTtZY1XI6bptRjZ5zRf M5Mj0CEEMH4kuncYSSPL1gVwmRv5pi/Pww== 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 Cc: Nicolas Boichat , Daniel Kurtz , Sascha Hauer , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); } /* -- 2.28.0.rc0.142.g3c755180ce-goog