Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4098840ybg; Fri, 25 Oct 2019 13:18:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwFvKj3WMIF7Py49wHILCyV+TvwPLfoRaIOuK5xB2pVYEKFXHm6rfjNMMEgPSalIivLNJE X-Received: by 2002:a17:906:3615:: with SMTP id q21mr3768278ejb.90.1572034694717; Fri, 25 Oct 2019 13:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572034694; cv=none; d=google.com; s=arc-20160816; b=haSWPpONvsYwUgbs0l0zg6rLT5l/Jc0JUPKQ58S7YyDI3I7p1u99ucB2SCbFZgHj4j 1eUR1JIT4sKM3coUl+MoBMRIHddjShXNVr6ekxQrxoRva3pW5nx0rGegyDOOOT4fBRx3 qt6kThrqg7uxGCHfAh1Ji2FOKOvu/If1RCYZhe24jbxVHGSHt4LORLaN/zTVGg9HvqVD tbx8k0EilNUPzE1VnA6SJHMssb2kxG+D4+xMI7a8oL2u1tv6HzBBfGk8mC0Tg8noQhse qquagik/FlpOLnCmhqFNIat5+0kGgMh/AmBA8q7ZBG8Vswa2f4nGaRY8uPX/VZfV5pMv 3T3w== 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=mWAKcl8j7ZnGOrbpPiW78OchysSg/HKo2c9XWvB5EtU=; b=0WQBAiUZ074EILRQ8XL8rVetV9hfuSPtwDhO4lxpZgqY+iNFyexfMFgTz04JzCCJyA kKSE+McoT0kjLC1qnverO7usL2V54eitPcDz7HFSyJ2xkVH3WihQj1OcNOjZJsRULtFW waDD0jJUFFXyvkervmnqSZuRdkdWYnk4BhPax0goVdC3fovXY25o1uui8tjefCFhcoYW Ijw33F5OeVh6CkVuXcpB4IKr1MTFoJw0RbmfTrUnixW5XNv5J0scfpcPOVMhtZjgKEMH 2u9jdKunRVKXUOtCpZ/6Dml66dAHtpHB6HxtQi9qQqHv6TO3wrRfKbvjA8GwX9pvL3yq ykXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YMIPgc49; 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 q45si2024606eda.202.2019.10.25.13.17.51; Fri, 25 Oct 2019 13:18:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=YMIPgc49; 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 S2394608AbfJYNYV (ORCPT + 99 others); Fri, 25 Oct 2019 09:24:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:35230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394578AbfJYNYU (ORCPT ); Fri, 25 Oct 2019 09:24:20 -0400 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 E46BF222BD; Fri, 25 Oct 2019 13:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572009859; bh=mWAKcl8j7ZnGOrbpPiW78OchysSg/HKo2c9XWvB5EtU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YMIPgc49yX3gYacnLbiWqvug4Q8RWRPmKnZshdGxr5phXajKJn5DxRTt5aAzO5eTo hipdnVdMLXV/m1+knse4yLsfK/7ZwgQ7hcwalL44+1/yxnE3P+wtrYeV0/fBz+SJ5X ur7b35aj4UvNL7XVjvOu0PG1Fps0K9FG56PNWUdc= Received: by mail-qk1-f170.google.com with SMTP id u184so1718269qkd.4; Fri, 25 Oct 2019 06:24:18 -0700 (PDT) X-Gm-Message-State: APjAAAV+s4BO2zlbGNDJjc119otuYLo0FcQDc9IrPSvCELAHWY41MXtB X7JCjr+eDod8p/eJHTN6OrwpbHFYFBXe9JTVkQ== X-Received: by 2002:a05:620a:344:: with SMTP id t4mr2680325qkm.393.1572009857854; Fri, 25 Oct 2019 06:24:17 -0700 (PDT) MIME-Version: 1.0 References: <4570db9c-7bc8-f131-269a-248b87e25e38@gmail.com> <201df0f7319b94eb581a040a2b1b07dbfed12e94.camel@fi.rohmeurope.com> <8974a3974377d0623ed968563b035e701191440e.camel@fi.rohmeurope.com> <06b3909a-b3ff-2c0e-d1df-a475a69951ed@gmail.com> In-Reply-To: From: Rob Herring Date: Fri, 25 Oct 2019 08:24:06 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 11/13] led: bd71828: Support LED outputs on ROHM BD71828 PMIC To: "Vaittinen, Matti" Cc: "mazziesaccount@gmail.com" , "dmurphy@ti.com" , "jacek.anaszewski@gmail.com" , "linux-leds@vger.kernel.org" , "linux-rtc@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "alexandre.belloni@bootlin.com" , "mturquette@baylibre.com" , "lgirdwood@gmail.com" , "devicetree@vger.kernel.org" , "linus.walleij@linaro.org" , "a.zummo@towertech.it" , "mark.rutland@arm.com" , "bgolaszewski@baylibre.com" , "linux-clk@vger.kernel.org" , "lee.jones@linaro.org" , "pavel@ucw.cz" , "broonie@kernel.org" , "sboyd@kernel.org" 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 Fri, Oct 25, 2019 at 2:07 AM Vaittinen, Matti wrote: > > Hi Again Jacek, > > This has been a nice conversation. I guess I have learned something > from this all but I think this is no longer going forward too much :) > I'll cook up second version - where I add LEDs to DT (even if I don't > see the value for it now). I won't add own compatible for the LED (for > now) - as it is part of MFD - and I'll add the LEDs also to binding > docs. I think that will get the attention from Lee/Rob better than the > LED driver discussion. We can continue discussion there. I hope this is > Ok to you. (And then just few compulsory notes about my view on your > replies - after all, I can't let you to have the final say xD - you can > ignore them or respond just as you like) > > On Fri, 2019-10-25 at 00:04 +0200, Jacek Anaszewski wrote: > > Hi Matti, > > > > On 10/24/19 10:15 AM, Vaittinen, Matti wrote: > > > Hello Jacek, > > > > > > On Wed, 2019-10-23 at 23:59 +0200, Jacek Anaszewski wrote: > > > > On 10/23/19 10:37 AM, Vaittinen, Matti wrote: > > > > > On Tue, 2019-10-22 at 19:40 +0200, Jacek Anaszewski wrote: > > > > > > On 10/22/19 2:40 PM, Vaittinen, Matti wrote: > > > > > > > On Mon, 2019-10-21 at 21:09 +0200, Jacek Anaszewski wrote: > > > > > > > > On 10/21/19 10:00 AM, Vaittinen, Matti wrote: > > > > > > > > > Hello Dan, > > > > > > > > > > > > > > > > > > Thanks for taking the time to check my driver :) I > > > > > > > > > truly > > > > > > > > > appreciate > > > > > > > > > all > > > > > > > > > the help! > > > > > > > > > > > > > > > > > > A "fundamental question" regarding these review > > > > > > > > > comments is > > > > > > > > > whether > > > > > > > > > I > > > > > > > > > should add DT entries for these LEDs or not. I thought > > > > > > > > > I > > > > > > > > > shouldn't > > > > > > > > > but > > > > > > > > > I would like to get a comment from Rob regarding it. > > > > > > > > > > > > > > > > If the LED controller is a part of MFD device probed from > > > > > > > > DT > > > > > > > > then > > > > > > > > there is no doubt it should have corresponding DT sub- > > > > > > > > node. Agreed. [...] > > > Right. Or at first it might be enough (and simplest) to assume that > > > if > > > LEDs are used via this driver, then colour for both LEDs is set > > > explicitly by user-space. I wouldn't try guessing if sibling LED > > > state > > > changes to OFF when one LED is turned ON - or if LED states change > > > to > > > ON if both are turned OFF. This would require exporting interfaces > > > from > > > power-supply driver - and it would still be racy. The thing is that > > > when both LEDs are on board they are both either under HW or SW > > > control. So it makes no sense to control only one LED in such case. > > > Thus I think it is Ok if this LED driver is registering both class > > > devices at one probe. No need to instantiate own platform devices > > > for > > > both of the LEDs. > > > > We always register all LEDs originating from the same device in one > > probe. > > > > Then I see little benefit from of_compatible or leds subnode for MFD > devices with many LEDs. The driver or core must in any ways parse the > DT in order to find the sub nodes with information for individual LEDs. > I don't think that would be much different from just using the MFD node > as controller node and walking through the MFD child nodes to locate > LED sub nodes (at least for MFDs with simple LED controller). The cases for not having child nodes are when you have child nodes with nothing more than a compatible and possibly provider properties (e.g. #gpio-cells for gpio providers). If you have other resource dependencies (e.g. clocks) or data to define (e.g. voltages for regulators), then child nodes absolutely make sense. Once we have child nodes, then generally it is easier for every function to be a child node and not mix the two. I'm sure I have told people incorrectly to not do child nodes because they define incomplete bindings. I would group the led nodes under an led-controller node (with a compatible). The simple reason is each level only has one number/address space and you can't mix different ones. You're not numbering the leds here, but could you (with numbers that correspond to something in the h/w, not just 0..N)? The other reason is modern LED bindings define a controller node for the controller and led nodes for the actual led on the board. While the MFD node could be the controller node, that gets into mixing. Rob