Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3454578ybv; Sun, 9 Feb 2020 23:51:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyoUgNgKEf92U7phHPoPfchZSSohrqY0PPWPdukteX+l0EQ5ilq7cKxl9IMzWB0pE4IkrJE X-Received: by 2002:a05:6830:18f5:: with SMTP id d21mr149861otf.225.1581321077069; Sun, 09 Feb 2020 23:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581321077; cv=none; d=google.com; s=arc-20160816; b=K+8cGbbdTI6D+o9hjTJLGy4q7CNs7r06I0/x00NE19p8BPhOrXx+jP0eM0jJHuBnu8 2GRdt+5RY6rmF4EjJC81Bl6Efc1tMeNty2Vss8hcNxMfqrij7JDWjabh7y7YE6tVIol0 6ClHu/l0AztZQjMf1gVUHScE/ZDtU/muh2paKhyUteNxkikGirGt+M3JKw2tQjPFFllX o/vx6E0T9iqJ0DCcryOpYwqbBSitoenTBzBg2g9G6LVCpfxtB9Dw8l/uwkJH0+dpsg6v frM86k53ItkFPMU5VK6lT+RpJBcPVYhwMYGslEK5g7qYiQsrUMZ+Gxi6eGnZmOdsN6Bs 2XMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=u3O+szgfwEJKuo4yzEkWiTVNHGumVBlqNQZE9NfjV7I=; b=ZUXXTeYOm7Mj7SO/mGRa9vcLmqOGQ4hb97jTUulkQ5A4LIa8N7ayfWowWzGVba7Aho 5McPyT9qcp4KVa7LBynLDnJx61mFei3NoUzXU3CWUFhSFf8XP+gV5Rro8lP30mneG5Hf epRHvshefWhfP9Tg7Qkl2GYoliRLP3L15ovmatvu/jsEIY/DLDxx9QvuQI71TkHrwArL YdROUyJwp35yk0vjtveBZileJpV1xgrwVaI+8MTwFN2qAimp8/CnCW8XqNj4e90alvCW 51clndNIzA6rzLwD/IL8JNnJjWtO12z64CsXSTlkssXJQpnIW5CO552mpVw9XMghl/TB nyXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QsC4PDi5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id i6si4256375oth.182.2020.02.09.23.51.05; Sun, 09 Feb 2020 23:51:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QsC4PDi5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727051AbgBJHvC (ORCPT + 99 others); Mon, 10 Feb 2020 02:51:02 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:46318 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbgBJHvC (ORCPT ); Mon, 10 Feb 2020 02:51:02 -0500 Received: by mail-vs1-f68.google.com with SMTP id t12so3469018vso.13 for ; Sun, 09 Feb 2020 23:51:01 -0800 (PST) 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=u3O+szgfwEJKuo4yzEkWiTVNHGumVBlqNQZE9NfjV7I=; b=QsC4PDi5ZlYbAjfw6pBUa0KPphhE/VVoGj6kVK1MAL7QZqo9wjmEBLb9Ikbb7Fp770 o5u/R5ApawhiT5Waee9rnPrac69HShLMufZLupjUjI/CMI3snfnPnH5LdDWGPL7q39dr Evp1CxZoX8gCVNOonqGfUiXeiuwNtbZ+WegCEVukUffQd+2gilW7icSVWUk6sIYv749b slMXTUuMoGaFUwlQwE/ldzraKsne3DiELel3X/Jp70Dz80496OwgjZdM776TADILQLuO yAjl54QHAMbG0F+Y6cIXjrS11+kCEVl5NN47dW7kpuL4QC9qVts5HHxcSN5tLZgx3jY5 Purg== 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=u3O+szgfwEJKuo4yzEkWiTVNHGumVBlqNQZE9NfjV7I=; b=Q+gTPsl1Nm6vIQAPCyNIBQ+DgnKaaVZYY/ouyB4mShz7U353ZZM7CTURGMm17nl3P5 2uu7c3iuxJTYc4VsL/sne9Vi0CSPmDdPNg5Lhql8+yQhENxmJhbW8AOBgVqZcWp++BTh n67dC+bjEIS8DqLblUry0YxR0uSRPhUgZhBHt4Bf0oQRayONZOKnlSDXn5YBEmACfBDP 1sILb8w3UGlGoI4haROLz2+P3PsVIAhbFCKjsWwzaz0LuNGT4HHQmdE7SHDAxBgatcfe fzQd6kYLcGf4ddbMnUHO31U14/krSwlcEMHQSD6N06FXzgcMMJ0L4te/hZg/O1bLmm1I q88w== X-Gm-Message-State: APjAAAUm2OG60eHNAkfIaasScb5HRXPb4szEn4M4Zx8CJnyDBNhAaoM/ 2cgI1Mwh3nmUYx+zj7jOBSIcNOURw8s0MpSoiCaN4g== X-Received: by 2002:a67:ee02:: with SMTP id f2mr5601456vsp.165.1581321061313; Sun, 09 Feb 2020 23:51:01 -0800 (PST) MIME-Version: 1.0 References: <20200207052627.130118-1-drinkcat@chromium.org> <20200207052627.130118-6-drinkcat@chromium.org> In-Reply-To: From: Ulf Hansson Date: Mon, 10 Feb 2020 08:50:25 +0100 Message-ID: Subject: Re: [PATCH v4 5/7] drm/panfrost: Add support for multiple power domains To: Nicolas Boichat Cc: Rob Herring , David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel , DTML , Linux Kernel Mailing List , Linux ARM , "moderated list:ARM/Mediatek SoC support" , Hsin-Yi Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 9 Feb 2020 at 13:50, Nicolas Boichat wrote: > > On Fri, Feb 7, 2020 at 10:26 PM Ulf Hansson wrote: > > > > On Fri, 7 Feb 2020 at 06:27, Nicolas Boichat wrote: > > > > > > When there is a single power domain per device, the core will > > > ensure the power domain is switched on (so it is technically > > > equivalent to having not power domain specified at all). > > > > > > However, when there are multiple domains, as in MT8183 Bifrost > > > GPU, we need to handle them in driver code. > > > > > > Signed-off-by: Nicolas Boichat > > > > Besides a minor nitpick, feel free to add: > > > > Reviewed-by: Ulf Hansson > > > > Kind regards > > Uffe > > > > [snip] > > > +static int panfrost_pm_domain_init(struct panfrost_device *pfdev) > > > +{ > > > + int err; > > > + int i, num_domains; > > > + > > > + num_domains = of_count_phandle_with_args(pfdev->dev->of_node, > > > + "power-domains", > > > + "#power-domain-cells"); > > > + > > > + /* > > > + * Single domain is handled by the core, and, if only a single power > > > + * the power domain is requested, the property is optional. > > > + */ > > > + if (num_domains < 2 && pfdev->comp->num_pm_domains < 2) > > > + return 0; > > > + > > > + if (num_domains != pfdev->comp->num_pm_domains) { > > > + dev_err(pfdev->dev, > > > + "Incorrect number of power domains: %d provided, %d needed\n", > > > + num_domains, pfdev->comp->num_pm_domains); > > > + return -EINVAL; > > > + } > > > + > > > + if (WARN(num_domains > ARRAY_SIZE(pfdev->pm_domain_devs), > > > + "Too many supplies in compatible structure.\n")) > > > > Nitpick: > > Not sure this deserves a WARN. Perhaps a regular dev_err() is sufficient. > > Ah well I had a BUG_ON before so presumably this is already a little better ,-) > > You can only reach there if you set pfdev->comp->num_pm_domains > > MAX_PM_DOMAINS in the currently matched struct panfrost_compatible > (pfdev->comp->num_pm_domains == num_domains, and see below too), so > the kernel code would actually be actually broken (not the device > tree, nor anything that could be probed). So I'm wondering if the > loudness of a WARN is better in this case? Arguable ,-) I see. It's not a big a deal, so feel free to keep as is. [...] Kind regards Uffe