From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Agner Date: Tue, 06 Sep 2016 18:23:31 +0000 Subject: Re: [PATCH] video: mxsfb: get supply regulator optionally Message-Id: <4b3a7bda2202a536efaf4a693234c273@agner.ch> List-Id: References: <20160904042627.30182-1-stefan@agner.ch> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tomi Valkeinen Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown On 2016-09-06 01:21, Tomi Valkeinen wrote: > Hi, > > On 04/09/16 07:26, Stefan Agner wrote: >> The lcd-supply is meant to be optional, there are several device- >> trees not specifying it and the code handles error values silently. >> Therefor, avoid creating a dummy regulator (and the associated >> warning) by using devm_regulator_get_optional. >> >> While at it, document that fact also in the device-tree bindings. > > The binding change looks correct, but using > devm_regulator_get_optional() does not sound correct. > > devm_regulator_get_optional() is to be used when the device in question > truly can function without the power supply. But if the supply is there, > it's just not controlled by the SW, devm_regulator_get() is to be used. The framebuffer device can even function without a display, no problem there.. Probably not really useful... devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says: > In order to ease transitions with drivers are boards start using regulators > provide an option to cause all regulator_get() calls to succeed, with a > dummy always on regulator being supplied where one has not been configured. > A warning is printed whenever the dummy regulator is used to aid system > development. I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator. -- Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Agner Subject: Re: [PATCH] video: mxsfb: get supply regulator optionally Date: Tue, 06 Sep 2016 11:23:31 -0700 Message-ID: <4b3a7bda2202a536efaf4a693234c273@agner.ch> References: <20160904042627.30182-1-stefan@agner.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Tomi Valkeinen Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown List-Id: devicetree@vger.kernel.org On 2016-09-06 01:21, Tomi Valkeinen wrote: > Hi, > > On 04/09/16 07:26, Stefan Agner wrote: >> The lcd-supply is meant to be optional, there are several device- >> trees not specifying it and the code handles error values silently. >> Therefor, avoid creating a dummy regulator (and the associated >> warning) by using devm_regulator_get_optional. >> >> While at it, document that fact also in the device-tree bindings. > > The binding change looks correct, but using > devm_regulator_get_optional() does not sound correct. > > devm_regulator_get_optional() is to be used when the device in question > truly can function without the power supply. But if the supply is there, > it's just not controlled by the SW, devm_regulator_get() is to be used. The framebuffer device can even function without a display, no problem there.. Probably not really useful... devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says: > In order to ease transitions with drivers are boards start using regulators > provide an option to cause all regulator_get() calls to succeed, with a > dummy always on regulator being supplied where one has not been configured. > A warning is printed whenever the dummy regulator is used to aid system > development. I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator. -- Stefan -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965141AbcIFS3g (ORCPT ); Tue, 6 Sep 2016 14:29:36 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:33034 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938998AbcIFS3b (ORCPT ); Tue, 6 Sep 2016 14:29:31 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Tue, 06 Sep 2016 11:23:31 -0700 From: Stefan Agner To: Tomi Valkeinen Cc: plagnioj@jcrosoft.com, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown Subject: Re: [PATCH] video: mxsfb: get supply regulator optionally In-Reply-To: References: <20160904042627.30182-1-stefan@agner.ch> Message-ID: <4b3a7bda2202a536efaf4a693234c273@agner.ch> User-Agent: Roundcube Webmail/1.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016-09-06 01:21, Tomi Valkeinen wrote: > Hi, > > On 04/09/16 07:26, Stefan Agner wrote: >> The lcd-supply is meant to be optional, there are several device- >> trees not specifying it and the code handles error values silently. >> Therefor, avoid creating a dummy regulator (and the associated >> warning) by using devm_regulator_get_optional. >> >> While at it, document that fact also in the device-tree bindings. > > The binding change looks correct, but using > devm_regulator_get_optional() does not sound correct. > > devm_regulator_get_optional() is to be used when the device in question > truly can function without the power supply. But if the supply is there, > it's just not controlled by the SW, devm_regulator_get() is to be used. The framebuffer device can even function without a display, no problem there.. Probably not really useful... devm_regulator_get creates a dummy regulator and a warning. Afaik, the dummy regulator was meant to be as an aid during development, but not as a permanent solution. This is what the initial commit of the dummy regulator says: > In order to ease transitions with drivers are boards start using regulators > provide an option to cause all regulator_get() calls to succeed, with a > dummy always on regulator being supplied where one has not been configured. > A warning is printed whenever the dummy regulator is used to aid system > development. I think we should either make the property mandatory and fix the device trees or we should fix the driver to support an optional regulator. The code already supports the reg_lcd being NULL, which is probably mostly pointless right now as devm_regulator_get always returns a dummy regulator. -- Stefan