Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4180669ybl; Mon, 13 Jan 2020 09:11:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxWYhTDkPfKdw/UaoFdZ3CBMjzRVzUuj/zgEdk+Guqz+8hoxLUcVzUEUT5jWxQ1nnAPRrNE X-Received: by 2002:a9d:708f:: with SMTP id l15mr14490257otj.229.1578935493598; Mon, 13 Jan 2020 09:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578935493; cv=none; d=google.com; s=arc-20160816; b=Dzm8g6CXt2RJpBVxV77SLG5ARviGlWPpWJj7EGiQtvmrS+HjLoWHtyLJYOrhSxBTWu KiSiOEPhDEQCF21NUown/EBIFMR12QRQNXtZFeaHxbzLWG3ogYRSg8pQfwCrsnu8zk0V kzxbndaAqR89O6OHn+lrmLKnV2q8rYsfyH5pAGNEWbfGV94cTSFipGxDVF9WeYUqjOJ5 toRCNCb4cTF0T4s8jKM6E1Qa29XvyFypjfDPjXww5t+2ng+57IGkelC1eWYiwgQX1s3+ kfM2+8P4k59myz+yWWTsuN6k3YCJHNIWHJWhKIznPu7NwRi9s9lsH/YkAWQyojxtb0ZK cp2A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=9OYaVzYrlwBZrTeBJBb7gBKG6aLGM5CXBSw/9uHli3Y=; b=TbF/4cYHSRRGDxZ2BqI193Sn7KwmEQYhddFTgtFI82ebl8i4VH0e96gtOSisd1R1x5 fAfEUxnKfJsj44yqdHf/DMgfc3XR5MxP4Ab6ClxwyFf3h1bUwX0aLSdLOtEmcR8cQjv6 eYjR77sVlOXI+g+vwb7aQrGjxxU/sCcOnxXfG1JSddusFYj96dzHOJ+50GYDG014mHVC mahYv/uWKlrOHk3ev5gfhHa2SMGqIWJF6bA9oz7Dc1TyjzME/oIJZCHRn9whiAeal6Tk +seBWimreSFObDlo4oA8O/evnXi4d16omkt+bp8mVfnXicNYbgGIyhK0akD3jfymyMsw 97eg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si5695252oiy.28.2020.01.13.09.11.21; Mon, 13 Jan 2020 09:11:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728862AbgAMRK0 (ORCPT + 99 others); Mon, 13 Jan 2020 12:10:26 -0500 Received: from foss.arm.com ([217.140.110.172]:42064 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728712AbgAMRK0 (ORCPT ); Mon, 13 Jan 2020 12:10:26 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 98A4C11B3; Mon, 13 Jan 2020 09:10:25 -0800 (PST) Received: from [10.1.194.52] (e112269-lin.cambridge.arm.com [10.1.194.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 48CE13F534; Mon, 13 Jan 2020 09:10:24 -0800 (PST) Subject: Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again To: Martin Blumenstingl Cc: tomeu.vizoso@collabora.com, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-amlogic@lists.infradead.org, robin.murphy@arm.com, alyssa@rosenzweig.io References: <20200107230626.885451-1-martin.blumenstingl@googlemail.com> <20200107230626.885451-4-martin.blumenstingl@googlemail.com> <2ceffe46-57a8-79a8-2c41-d04b227d3792@arm.com> From: Steven Price Message-ID: <21d0730b-8299-8bfd-4321-746ccb3772d0@arm.com> Date: Mon, 13 Jan 2020 17:10:23 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01/2020 17:27, Martin Blumenstingl wrote: > On Thu, Jan 9, 2020 at 12:31 PM Steven Price wrote: >> >> On 07/01/2020 23:06, Martin Blumenstingl wrote: >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be >>> updated when updating the GPU frequency. The name of the regulator has >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() >>> will update the GPU regulator when updating the frequency (just like >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). >> >> This patch causes a warning from debugfs on my firefly (RK3288) board: >> >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already >> present! >> >> So it looks like the regulator is being added twice - but I haven't >> investigated further. > I *think* it's because the regulator is already fetched by the > panfrost driver itself to enable it > (the devfreq code currently does not support enabling the regulator, > it can only control the voltage) > > I'm not sure what to do about this though Having a little play around with this, I think you can simply remove the panfrost_regulator_init() call. This at least works for me - the call to dev_pm_opp_set_regulators() seems to set everything up. However I suspect you need to do this unconditionally even if there are no operating points defined. > [...] >>> ret = dev_pm_opp_of_add_table(dev); >>> - if (ret) >>> + if (ret) { >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); >> >> If we don't have a regulator then regulators_opp_table will be NULL and >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The >> same applies to the two below calls obviously. > good catch, thank you! > are you happy with the general approach here or do you think that > dev_pm_opp_set_regulators is the wrong way to go (for whatever > reason)? To be honest this is an area I still don't fully understand. There's a lot of magic helper functions and very little in the way of helpful documentation to work out which are the right ones to call. It seems reasonable to me, hopefully someone more in the know will chime in it there's something fundamentally wrong! Thanks, Steve