Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp700179ybe; Thu, 5 Sep 2019 04:42:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhYnjFRXF1yLfD+E8HABmN3Uml8LaHpwYOFQUs9hnQ+tn/w6gt5yZfXSqzyKwLKN0yz30J X-Received: by 2002:a65:654d:: with SMTP id a13mr2708468pgw.196.1567683751183; Thu, 05 Sep 2019 04:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567683751; cv=none; d=google.com; s=arc-20160816; b=IJs14LRGl58dCBTcsVSCm67xPaUz13882xSxsDULTghWo1djyHgaHAvf6WC2hRfu6B JZRYSzOP0HbDgKFxnFEzFDmRAJiWPP5QBJPQSlgKNfl2DzIjAyXOFudW5Atnr0ANMmSg o0SeR7Y0BqZhdkl8acOHH0xSWL1SEQ92MDQSN2LXk9EKbXM8rGEgFITk323cKdbqDW+U JvkgFWw22bVOZnd71GiFNR22sQGk3HrtQuPyKJjFXnkEQ86tRmMdP0aw0M5EIMQNDj/e xTqQh8TTOl2IT86K7Xf0q/0PVHQRz2p2H0jEfr/JpAjRAfOzNi2Ohsriyn8NUgI0tQit +SaA== 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=gChxX3svbMR+tYTmW/+zo+EnAYytUrTeuejmCgDTVGc=; b=EMw64xFBZ/QGBvDxeOQp9Cfe3eMHT4Y3WJ+p7Wwh/CFMAEihuYZQ57nhARkGbi+zHr CFzOYZwvKd4ayaW7tKb9SJ0IacUOt1rjTdhcZIfLIaNXYaruJwqu6OYbZaAD6lTZ0Fal 3uTJUg1h+kdFz87wAe0PxeghZ4DeIGM0rXoJKYtK7hgmNCgfQUU1J2G+ATqW7gMTeXbx lmZ/HzjrRfC4A51Tb2MF+iI9kUC18lVDwNYKJIv5/cApd0AQFMpN3eVIY5wQf6rVYZRO ci3rtc1tZgdkILWsorSkCdoe0PoGCn62RSWcZ66XaxbTfNsc6v87fjnhUo7t/f3UEx4K /C8A== 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 m12si1889053pfa.186.2019.09.05.04.42.15; Thu, 05 Sep 2019 04:42:31 -0700 (PDT) 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 S2387524AbfIEJh5 (ORCPT + 99 others); Thu, 5 Sep 2019 05:37:57 -0400 Received: from foss.arm.com ([217.140.110.172]:40444 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730872AbfIEJh5 (ORCPT ); Thu, 5 Sep 2019 05:37:57 -0400 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 883721576; Thu, 5 Sep 2019 02:37:56 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B9AB33F67D; Thu, 5 Sep 2019 02:37:55 -0700 (PDT) Subject: Re: [PATCH] drm/panfrost: Fix regulator_get_optional() misuse To: Rob Herring , Mark Brown Cc: David Airlie , dri-devel , Tomeu Vizoso , "linux-kernel@vger.kernel.org" References: <20190904123032.23263-1-broonie@kernel.org> From: Steven Price Message-ID: Date: Thu, 5 Sep 2019 10:37:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09/2019 09:21, Rob Herring wrote: > +Steven > > On Wed, Sep 4, 2019 at 1:30 PM Mark Brown wrote: >> >> The panfrost driver requests a supply using regulator_get_optional() >> but both the name of the supply and the usage pattern suggest that it is >> being used for the main power for the device and is not at all optional >> for the device for function, there is no meaningful handling for absent >> supplies. Such regulators should use the vanilla regulator_get() >> interface, it will ensure that even if a supply is not described in the >> system integration one will be provided in software. > > I guess commits e21dd290881b ("drm/panfrost: Enable devfreq to work > without regulator") and c90f30812a79 ("drm/panfrost: Add missing check > for pfdev->regulator") > in -next should be reverted or partially reverted? Ah, I didn't realise that regulator_get() will return a dummy regulator if none is provided in the DT. In theory that seems like a nicer solution to my two commits. However there's still a problem - the dummy regulator returned from regulator_get() reports errors when regulator_set_voltage() is called. So I get errors like this: [ 299.861165] panfrost e82c0000.mali: Cannot set voltage 1100000 uV [ 299.867294] devfreq devfreq0: dvfs failed with (-22) error (And therefore the frequency isn't being changed) Ideally we want a dummy regulator that will silently ignore any regulator_set_voltage() calls. Steve