Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2930429pxk; Sun, 4 Oct 2020 18:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNKrmUVkCz16Svc3O3APQCd9kZIZJrcffrv9vBQPloGNJDPao8T+QHp0Tn31nRFpPtR4/4 X-Received: by 2002:a17:906:8248:: with SMTP id f8mr13377561ejx.292.1601860421794; Sun, 04 Oct 2020 18:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601860421; cv=none; d=google.com; s=arc-20160816; b=syAz0z3HVryLHs/aY/yM2nrudlS8f9XDWfp9gc45Al2khALH+m3VPbIXBJfbcTB6vF Fslpl4Z10pE0tNsFbHTGWGOh8iYkmVOQtDwpNfRwo3ay6Ny/gynvJUkVa1GA7TT1H599 htI+bN30E9gm+gKMlS7MTup/g7yRPaaVRP2whDz9v+P1PJAcnr7O0GtrODbpfE7m+T3L 02hCj5CaCEscTekYjUXwk8Ei+p9j0l1wjnzHS4QmldsgECOsDnGvbDiYKth5LDL+X6vV GJantZNxWHQimL0wAgIpjuI6oVpS98o//I2E1jytKmdestI2o4IZ7QHwkJuVw6YZe40p 9yRg== 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=Lzi6k3AqyqG7MfTfpPbp6oQnU/CVHLJ/4VcvpRGjvRc=; b=VebsukAeDYyisqw/bZfiUWRxyPeeuFnEyenNkxAlsL8jiU7OE3NLdY87vg65b9HSwJ RPtFiIoAsuXbK3CL0UpgXmB4EqyWJ9pYxVjuiv2Ld1e+t6M7onwMsMqlSM8jILyRzWWn q8BvpZ2hRbEap+64/OhFvONMKA5FQitEPx1AbIy8is+J6ZP8ZFpdnOjjcnOncKKFNA8k 2eQ2EU239nKfH6YY8HuCwfJY61/r3GNyiCTEby7mhgwXSUbEq/SXuJtsWc7lEAKFjX7y m1OzxrbUE2MmXOd5dQAAG/NbXBzDBnpATzTlsoFuf2B5QsyYr2ay4SzxMBKuu773NWgY UeWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nM0rmVuO; 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 e14si3631647ejj.573.2020.10.04.18.12.44; Sun, 04 Oct 2020 18:13:41 -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=nM0rmVuO; 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 S1725848AbgJEBI2 (ORCPT + 99 others); Sun, 4 Oct 2020 21:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbgJEBI2 (ORCPT ); Sun, 4 Oct 2020 21:08:28 -0400 Received: from mail-ua1-x941.google.com (mail-ua1-x941.google.com [IPv6:2607:f8b0:4864:20::941]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E73EC0613CE for ; Sun, 4 Oct 2020 18:08:28 -0700 (PDT) Received: by mail-ua1-x941.google.com with SMTP id z1so1998061uaa.6 for ; Sun, 04 Oct 2020 18:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Lzi6k3AqyqG7MfTfpPbp6oQnU/CVHLJ/4VcvpRGjvRc=; b=nM0rmVuONuIJa+EEBfrSCP2xTfko8vm5CnOGvyCu8krelT0/1VAozhlhcH53yUCuO0 1HU0fmsWVFjrMW0/1HoPf6feLYpLfSVVE0Z40EK1VFZ6GF4MllxWX3uvhZteLiTFi1oO x4SCN21hIFZOx2Nt7IM04ehakAPmGQA0NTYhY= 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=Lzi6k3AqyqG7MfTfpPbp6oQnU/CVHLJ/4VcvpRGjvRc=; b=WguCm5Eh/vOsUEudZHffY7W6nnkYs0MSE61rSgVejLk3lCDxjC1Y/Hhq6ly80lDLI0 ZV0PXKNHKY8LnNpfxVkF2vy3pUR8EEAnfflS4iSsAWFHGmLPnaW+LW/noWdIOTgn1aSu WYmCRDVqJ90AV2J6r1rLA45MKs8nhMn2cX0Efe7syqeJpNuA2nPtx1UtbBuW/+Zz999J vtpdlidzJKLzTUB3Scoc8RceFgCJBvK8X3QLrQX00osYcmWpzq1iedBj7vsNqYSSSWXT LeLa1/zMlGRXuMtkQSix5pRm8+GX1vSzAaDJIT/LbZF2iNgXPp7tzk1i/wn0e9OCcBX7 uiMA== X-Gm-Message-State: AOAM530hA5uk7dOt8+CEbofPCeAcgJXSmt3J0RSYKhqJlcm2rPROnM5o o/rvZN6IKbvkpKGqHy5Veb4Ctty66yrdEU2+7tyhvg== X-Received: by 2002:ab0:7658:: with SMTP id s24mr439583uaq.48.1601860107092; Sun, 04 Oct 2020 18:08:27 -0700 (PDT) MIME-Version: 1.0 References: <20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> In-Reply-To: From: Nicolas Boichat Date: Mon, 5 Oct 2020 09:08:16 +0800 Message-ID: Subject: Re: [PATCH v2] soc: mediatek: Check if power domains can be powered on at boot time To: Matthias Brugger Cc: Daniel Kurtz , Sascha Hauer , linux-arm Mailing List , lkml , "moderated list:ARM/Mediatek SoC support" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 1, 2020 at 11:03 PM Matthias Brugger wrote: > > > > On 28/09/2020 05:31, Nicolas Boichat wrote: > > 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 > > Applied to v5.10-tmp/soc which will be v5.10-next/soc as soon as v5.10-rc1 gets > published. > > Nicolas can you please make sure that similar logic will be part of the series > Enric is working on? https://patchwork.kernel.org/patch/11811767/ the logic is a bit different, and the whole scpsys driver would fail to probe, but I think that's also reasonable behaviour. Thanks, > > Thanks a lot. > Matthias > > > --- > > > > 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); > > } > > > > /* > >