Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1165203ybl; Wed, 8 Jan 2020 12:10:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzB+jdKpvL9mUA72KSBrhjeUwDrp3um/Kmiq8sQsZwxao/hLoty7dVw6CT6KLEgHGu+yi+C X-Received: by 2002:aca:5f87:: with SMTP id t129mr324207oib.36.1578514245033; Wed, 08 Jan 2020 12:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578514245; cv=none; d=google.com; s=arc-20160816; b=fseGL5aNKHV5JFSU++4ffe2hRKPeRnXAcV4JGTyUiCw14+NbeWb3ro2u86fkBLnni8 FpWjknrNhOJpVh/cY2ssO3pRbPJSJcDGul/b5iLQEJI9wq2lI4qHVeYzqpwFahmhQEN4 ssqV+x9II/GG2hfkut0uqjBRQHmo2sXnpZHkuDTknX17tXNXAPz39UUpKMGtxJUouniQ 8wae5HAg2I0wMC+ud2yOwm5YK9EucWu6lwbBdZzNG9lnR48yi+JOFNPltQBtXxMiRkQL FDLmGAuysJ1a9mY9C+opah0Ct8y80UVCe5Rg3m3EOYC/U91hIdzOp8UbizlSi0HSayXB c6lg== 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=6D1wg6P5OQfAGe4s1yug0zy7UYd4z81YRl80RO+/TYA=; b=A3tIxRVfO7Ho218C8QOU4oHRuStW/50jhhByK6/3FeIrQcYf9j8rm0UtF88yGUybWu 6QHzXBFPGWGMBdZdpalVMsmOe4xwP0woamDKXlmjoNMhz7VtGsAAvJgN4sC9LHcvQXhh 8WYAs6asSwK8JjA2/m5O44QQYmbXos/tqaA4Ylq0GB44USTMiM5wiyQwD88jYTNQDCUB WIsXjh70WPvHrSAneOqiKpMzVWBFJHKSjQ5V4j5KDGo7wxZtYjZKdey0wx3iOCDPUCYl ZiNxMhS6dh0mLheXgeAC+C0QMMtYzK06FSnYqGC+bogHsEYjSYoSIrAENqDJelQEP9aa t0nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lbfmSdy+; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si2451844otg.309.2020.01.08.12.10.32; Wed, 08 Jan 2020 12:10:45 -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=@kernel.org header.s=default header.b=lbfmSdy+; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726179AbgAHUJu (ORCPT + 99 others); Wed, 8 Jan 2020 15:09:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:37484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgAHUJt (ORCPT ); Wed, 8 Jan 2020 15:09:49 -0500 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEDAA2072A; Wed, 8 Jan 2020 20:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578514189; bh=HMpUUI05u881FivDVXx8p23Q4WPCIib06475xNf1c9I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lbfmSdy+Wrg1cKLMM72tdGc41LpdFrJUC2MTXQSvs+CnZr9rnij5xj4uZvm0y+nXr uzzUOtubqbF077jeXhjPh2tR+aoy7gSUi3nr+OAOKX0TZIp0AvFQiRu6NJmMm8pThE 5hrTN+D0LmCaARPP6yREK0FbcXzEPtNzLzbmSfgc= Received: by mail-qk1-f177.google.com with SMTP id t129so3824148qke.10; Wed, 08 Jan 2020 12:09:48 -0800 (PST) X-Gm-Message-State: APjAAAWCcEiPGevYZqCXDNSyAuP5ztv1p9omMdzvEmaN6He/qoG2p+dL LTyIcP8wEVTSah3o9U0HaBK673KfL8KKy0+rEQ== X-Received: by 2002:a37:85c4:: with SMTP id h187mr6192361qkd.223.1578514187969; Wed, 08 Jan 2020 12:09:47 -0800 (PST) MIME-Version: 1.0 References: <20200108052337.65916-1-drinkcat@chromium.org> <20200108052337.65916-8-drinkcat@chromium.org> In-Reply-To: <20200108052337.65916-8-drinkcat@chromium.org> From: Rob Herring Date: Wed, 8 Jan 2020 14:09:36 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 7/7, RFC]: drm/panfrost: devfreq: Add support for 2 regulators To: Nicolas Boichat Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "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 Tue, Jan 7, 2020 at 11:24 PM Nicolas Boichat wrote: > > The Bifrost GPU on MT8183 uses 2 regulators (core and SRAM) for > devfreq, and provides OPP table with 2 sets of voltages. > > TODO: This is incomplete as we'll need add support for setting > a pair of voltages as well. > > Signed-off-by: Nicolas Boichat > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 18 ++++++++++++++++++ > drivers/gpu/drm/panfrost/panfrost_device.h | 2 ++ > 2 files changed, 20 insertions(+) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 413987038fbfccb..5eb0effded7eb09 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -79,6 +79,22 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > struct devfreq *devfreq; > struct thermal_cooling_device *cooling; > > + /* If we have 2 regulator, we need an OPP table with 2 voltages. */ > + if (pfdev->regulator_sram) { > + const char * const reg_names[] = { "mali", "sram" }; > + > + pfdev->devfreq.dev_opp_table = > + dev_pm_opp_set_regulators(dev, > + reg_names, ARRAY_SIZE(reg_names)); > + if (IS_ERR(pfdev->devfreq.dev_opp_table)) { > + ret = PTR_ERR(pfdev->devfreq.dev_opp_table); > + pfdev->devfreq.dev_opp_table = NULL; > + dev_err(dev, > + "Failed to init devfreq opp table: %d\n", ret); > + return ret; > + } > + } > + > ret = dev_pm_opp_of_add_table(dev); > if (ret == -ENODEV) /* Optional, continue without devfreq */ > return 0; > @@ -119,6 +135,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) > if (pfdev->devfreq.cooling) > devfreq_cooling_unregister(pfdev->devfreq.cooling); > dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > + if (pfdev->devfreq.dev_opp_table) > + dev_pm_opp_put_regulators(pfdev->devfreq.dev_opp_table); > } > > void panfrost_devfreq_resume(struct panfrost_device *pfdev) > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 92d471676fc7823..581da3fe5df8b17 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -91,10 +91,12 @@ struct panfrost_device { > struct { > struct devfreq *devfreq; > struct thermal_cooling_device *cooling; > + struct opp_table *dev_opp_table; > ktime_t busy_time; > ktime_t idle_time; > ktime_t time_last_update; > atomic_t busy_count; > + struct panfrost_devfreq_slot slot[NUM_JOB_SLOTS]; ?? Left over from some rebase? Rob