Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4284664imu; Fri, 30 Nov 2018 14:20:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/WDIG1FFmMHAqnTnym0ywL7r2UP/AAaZFe7SRnnVgOqjgTfaT47V6AaCfcwQ30J9HNH+0mg X-Received: by 2002:a65:4784:: with SMTP id e4mr6099389pgs.12.1543616452883; Fri, 30 Nov 2018 14:20:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543616452; cv=none; d=google.com; s=arc-20160816; b=zymWuAnFlJc6sLnn8N4SktCvD6pTlcYDsOKLfR9fVUH18jMed6y8vBsq+EwRl9cZaT ulsp+45zfLFUrJYms41hGmfnQrJeQ0zeZSazRiSvSvDIGfzTi74JFF4O4xrgU3urQsNE oDosV0VSzjKuVcwag6iD0mY+5/JjMAehkmcxnCSoUNRbsSKHMWgJotsI75iIA89TWe71 VeWKkWtnA9pVnBHbzs5aggbNOBRWwC3ZGY9wZKPn2P7Madwfpv+RhlU9+7g1IQ9Ddrzv kSkYHR4ecwPp/Ldj+THFHsqN7VaoaxH0k6RlEwGhRguQAoxDAEMmWV4WzR2IL4/6OWSB 1foQ== 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=8gbL4OjIbn4gfskhjDIxeiJtPyjduLyRyLDusin/fMo=; b=kLt9JuwR+ojaPaQhwUHNOP0EPD/xftUAedjuCCyuI7rRMisrHz+vpDswppKfYhvg0c E0+jlU2sbzpobEOF4NFJ4FFP4+Cd9IW+po/4tIFULYMiQGTjrxWlpgCZVelLiD074bx3 w3YDqCG5T2CCMz/WqfoSsZY1JWb0Yx1ftFVsJIu1/aiA8klNKpOG+sjM7Fy68SZ6vMOt rUJlWCswiKM3At+BAcjNMcBu6NkNyUJZEt+WEqAzEiVLj3XUn9DX+IU21MAGxdexxdOz mh0WWdCqSHkstUvcYCpkVmf1YfFzLJMM/heOz/6vrgLNWCwK2hOS1PuhQ0Knc/e/Q6tZ hL+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ph2rZ+Jb; 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 x23si5750773pgj.247.2018.11.30.14.20.38; Fri, 30 Nov 2018 14:20:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ph2rZ+Jb; 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 S1727018AbeLAJaS (ORCPT + 99 others); Sat, 1 Dec 2018 04:30:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbeLAJaS (ORCPT ); Sat, 1 Dec 2018 04:30:18 -0500 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (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 69FBF21479; Fri, 30 Nov 2018 22:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543616371; bh=LA/PfnhDfVkeFfga7qgRNkvrRtFx+kj5fkxfWxfssvs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ph2rZ+JbuYCfr8BIST2w3dwI394pHunTuvYQBUVnGXWNZNONfzSlNPjcmBKCLdBf+ XECL5VDObcnWtpcik11R98AAbwy1IjzvJNMrm2b5kkFZRiUg7WD8f/BOktcuWwA4y/ nXS1+0RVu1oclnkJfw95Y2BEgEr0ZxX+yZRZ2ib0= Received: by mail-qt1-f172.google.com with SMTP id p17so7676869qtl.5; Fri, 30 Nov 2018 14:19:31 -0800 (PST) X-Gm-Message-State: AA+aEWZOMK6Xa9wVQmsI8dRln9zip4Di+UL8ZGBHUFU9K4iJkSnnIzcS GUIbUH8BAGehP/MXtfwcZE2q7Me4yGXiJRXjoA== X-Received: by 2002:a0c:c389:: with SMTP id o9mr7320505qvi.90.1543616370592; Fri, 30 Nov 2018 14:19:30 -0800 (PST) MIME-Version: 1.0 References: <1541542052-10081-1-git-send-email-jacek.anaszewski@gmail.com> <1541542052-10081-5-git-send-email-jacek.anaszewski@gmail.com> <5bea0eb8.1c69fb81.6b921.80e6@mx.google.com> <0a0b176c-4eb4-4b0e-6c3c-b3c6c8f5fff5@gmail.com> <20181130210814.GA5756@amd> In-Reply-To: <20181130210814.GA5756@amd> From: Rob Herring Date: Fri, 30 Nov 2018 16:19:18 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 04/24] dt-bindings: leds: Add function and color properties To: Pavel Machek Cc: Jacek Anaszewski , Linux LED Subsystem , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Baolin Wang , Daniel Mack , Dan Murphy , Linus Walleij , Oleh Kravchenko , Sakari Ailus , Simon Shields 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, Nov 30, 2018 at 3:08 PM Pavel Machek wrote: > > Hi! > > > > Pavel gave following examples: > > > > > > eth0:green:link > > > adsl0:green:link > > > adsl0:red:error > > > > > > So we would have e.g.: > > > > > > associated-vl42-device = <&camera1>; > > > associated-network-device = <&phy1>; > > > associated-block-device = <&phy1>; > > > > Variable property names are kind of a pain to parse. > > Ok, would it be enough to have associated-device = <&whatever>? Yeah, but I though you needed the device type name in there. > > Perhaps when LEDs are associated with a device, we shouldn't care > > within the context of the LED subsystem what the name is. The > > association is more important and if you have that exposed, then you > > don't really need to care what the name is. You still have to deal > > with a device with more than 1 LED, but that becomes a problem local > > to that device. > > > > What I'm getting at is following a more standard binding pattern of > > providers and consumers like we have for gpios, clocks, etc. So we'd > > have something like this: > > > > ethernet { > > ... > > leds = <&green_led>, <&red_led>; > > led-names = "link", "err"; > > }; > > Basically every single device could have a LED associated with it > ("activity"). Would doing it like this mean we'd have to modify every > single driver to parse leds / led-names properties? Normally, that's how properties like this would work. A driver is also what knows how the leds should function. A driver can retrieve the led and associate it with the 'foo-bar' function. The 'foo-bar' function then doesn't have to be defined in DT nor exposed to userspace. It wouldn't even have to be driver specific. The driver's subsystem could handle it all if the led functions are standardized. Though then you'd be back to needing standard names for 'led-names', but that's no worse that trigger names. This model would also allow getting rid of 'linux,default-trigger' properties in a lot of cases which wouldn't be a bad thing. However, having drivers handle this is not required. You can iterate thru the tree for nodes with 'leds' and find the node which has a phandle to the led node you care about. Sure, it's not that efficient, but it does work and it's only done once. Basically, as long as the linkage is there, we can make it work. I think using 'associated-device' might work better for the current implementation of Linux LED support, but leds/led-names would be more inline with other DT bindings. The current Linux implementation shouldn't dictate the binding design. Rob