From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF567C32771 for ; Mon, 27 Jan 2020 07:41:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B9BC20842 for ; Mon, 27 Jan 2020 07:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726054AbgA0Hl3 (ORCPT ); Mon, 27 Jan 2020 02:41:29 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:41369 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgA0Hl3 (ORCPT ); Mon, 27 Jan 2020 02:41:29 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ivz1O-0006lk-Dr; Mon, 27 Jan 2020 08:41:22 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1ivz1N-0002Se-EY; Mon, 27 Jan 2020 08:41:21 +0100 Date: Mon, 27 Jan 2020 08:41:21 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Jeff LaBundy Cc: Jacek Anaszewski , Pavel Machek , Dan Murphy , Thierry Reding , "linux-leds@vger.kernel.org" , "linux-pwm@vger.kernel.org" Subject: Re: [PATCH 3/3] leds: pwm: don't set the brightness during .probe Message-ID: <20200127074121.n2qawknactfjqvkr@pengutronix.de> References: <20200124165409.12422-1-uwe@kleine-koenig.org> <20200124165409.12422-4-uwe@kleine-koenig.org> <20200126194236.GC2569@labundy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200126194236.GC2569@labundy.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-leds@vger.kernel.org Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Hello Jeff, On Sun, Jan 26, 2020 at 07:42:39PM +0000, Jeff LaBundy wrote: > My only concern here is whether or not there happen to be some hardware > out in the world whose PWM-related registers power on to a random state > and unknowingly depended on brightness being forced to zero. This might happen, and is (AFAIK) the same for other LED drivers. > The other folks on the thread probably have some better view into this, > but I wonder if the safest option would be to adopt the "default-state" > property from leds/common.txt, and only forgo the call to led_pwm_set() > if the property is set to "keep". I think it would be sane to add support for parsing the default-state property to the LED core. I was surprised to learn that this for now is only implemented in a few LED drivers. > I did test this and can confirm that the LED's state prior to the driver > being loaded is preserved. However as you've warned, the brightness read > back from user space is zero and does not match the actual brightness of > the LED. That is something that the core should handle, too. If there is no .get_brightness callback and 0 is assumed, calling .set_brightness to 0 to ensure a right assumption sounds like the right thing to me. > Understanding that it's more work, I wonder if this patch is not safe if > we don't also add a brightness_get callback in case there were any cases > where user space makes some decisions based on brightness == 0? > > At any rate this patch does what is advertised, and so: > > Tested-by: Jeff LaBundy Thanks for your feedback. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |