devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Rob Herring <robh@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>, Sakari Ailus <sakari.ailus@iki.fi>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-leds@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Dan Murphy <dmurphy@ti.com>
Subject: Re: [RESEND PATCH v2 4/6] dt: bindings: as3645a: Improve label documentation, DT example
Date: Sat, 18 Nov 2017 14:38:07 +0100	[thread overview]
Message-ID: <add4f657-be92-39c9-cbdf-a33ddb01262c@gmail.com> (raw)
In-Reply-To: <4e69932a-18af-416a-b280-16236fc4c2b3@gmail.com>

Hi Rob,

Any thoughts on my analysis? Do you think that LED function naming
standardization would really make sense having the abundance
of LED functions categories present in the mainline dts files?

The list of standard LED function names would have to be
continuously extended as people would be adding new boards.
Limiting users to only existing set of LED functions wouldn't
be practical IMHO.

I'd propose only to modify 'label' property description in LED common
bindings, so that it would explicitly state that it should contain only
"colour:functon" segments. It would be driver's responsibility to add
"devicename:" prefix to the label and use the whole string for a LED
class device name. Some drivers do that already. All DT bindings, dts
files and LED class drivers that don't adhere to this rule would have
to be updated accordingly.

Regarding colour - the "devicename:colour:function" LED device naming
convention defined in Documentation/leds/leds-class.txt is around for
a long time. Since LED colour can vary from board two board and is
independent of a driver, we have to have a means for defining it in
DT. Would you see providing separate 'colour' DT property as a solution?

Best regards,
Jacek Anaszewski

On 09/23/2017 11:12 PM, Jacek Anaszewski wrote:
> On 09/22/2017 11:07 PM, Jacek Anaszewski wrote:
>> On 09/20/2017 10:53 PM, Rob Herring wrote:
>>> On Tue, Sep 19, 2017 at 11:01:02PM +0200, Jacek Anaszewski wrote:
>>>> Hi Pavel,
>>>>
>>>> On 09/18/2017 10:54 PM, Pavel Machek wrote:
>>>>> On Mon 2017-09-18 17:49:23, Sakari Ailus wrote:
>>>>>> Hi Pavel,
>>>>>>
>>>>>> On Mon, Sep 18, 2017 at 12:56:55PM +0200, Pavel Machek wrote:
>>>>>>> Hi!
>>>>>>>
>>>>>>>> Specify the exact label used if the label property is omitted in DT, as
>>>>>>>> well as use label in the example that conforms to LED device naming.
>>>>>>>>
>>>>>>>> @@ -69,11 +73,11 @@ Example
>>>>>>>>  			flash-max-microamp = <320000>;
>>>>>>>>  			led-max-microamp = <60000>;
>>>>>>>>  			ams,input-max-microamp = <1750000>;
>>>>>>>> -			label = "as3645a:flash";
>>>>>>>> +			label = "as3645a:white:flash";
>>>>>>>>  		};
>>>>>>>>  		indicator@1 {
>>>>>>>>  			reg = <0x1>;
>>>>>>>>  			led-max-microamp = <10000>;
>>>>>>>> -			label = "as3645a:indicator";
>>>>>>>> +			label = "as3645a:red:indicator";
>>>>>>>>  		};
>>>>>>>>  	};
>>>>>>>
>>>>>>> Ok, but userspace still has no chance to determine if this is flash
>>>>>>> from main camera or flash for front camera; todays smartphones have
>>>>>>> flashes on both cameras.
>>>>>>>
>>>>>>> So.. Can I suggset as3645a:white:main_camera_flash or main_flash or
>>>>>>> ....?
>>>>>>
>>>>>> If there's just a single one in the device, could you use that?
>>>>>>
>>>>>> Even if we name this so for N9 (and N900), the application still would only
>>>>>> work with the two devices.
>>>>>
>>>>> Well, I'd plan to name it on other devices, too.
>>>>>
>>>>>> My suggestion would be to look for a flash LED, and perhaps the maximum
>>>>>> current as well. That should generally work better than assumptions on the
>>>>>> label.
>>>>>
>>>>> If you just look for flash LED, you don't know if it is front one or
>>>>> back one. Its true that if you have just one flash it is usually on
>>>>> the back camera, but you can't know if maybe driver is not available
>>>>> for the main flash.
>>>>>
>>>>> Lets get this right, please "main_camera_flash" is 12 bytes more than
>>>>> "flash", and it saves application logic.. more than 12 bytes, I'm sure. 
>>>>
>>>> What you are trying to introduce is yet another level of LED class
>>>> device naming standard, one level below devicename:colour:function.
>>>> It seems you want also to come up with the set of standarized LED
>>>> function names. This would certainly have to be covered for consistency.
>>>
>>> I really dislike how this naming convention is used for label. label is 
>>> supposed to be the phyically identifiable name. Having the devicename 
>>> defeats that. Perhaps color, too. We'd be better off with a color 
>>> property. It seems we're overloading the naming with too many things. 
>>> Now we're adding device association.
>>
>> Regarding devicename - there is indeed inconsistency in the way how LED
>> DT bindings use label, as some of them use it for defining full LED
>> class device name, and the rest fill only colour and function, leaving
>> addition of a devicename to the driver.
>>
>> The problem is also in current definition of label in LED common
>> bindings documentation, which says:
>>
>> "It has to uniquely identify a device, i.e. no other LED class device
>> can be assigned the same label."
>>
>> In view of your above words this is not true, and we probably should
>> remove this sentence (it doesn't have DT maintainer ack btw).
>>
>>> I do want to see standard names though. On 96boards for example, there 
>>> are defined LEDs and locations. The function on some are defined (e.g. 
>>> WiFi/BT) and somewhat undefined on others (user{1-4}). I'd like to see 
>>> the same label across all boards.
>>
>> Currently we have following LED functions (obtained with
>> grep label Documentation/devicetree/bindings/leds/* | sed
>> s'/^.*label/label/g' | awk -F"=" '{print $2}' | sed '/^$/d' | sed
>> s'/.*:\(.*\)";/\1/' | sed '/^\s\{1,\}/d' | sort -u)
>>
>> 0
>> 1
>> 2
>> 2g
>> 3
>> 4
>> 5
>> 6
>> 7
>> adsl
>> alarm
>> alive
>> aux
>> broadband
>> chrg
>> dsl
>> flash
>> green
>> indicator
>> inet
>> keypad
>> phone
>> power
>> red
>> sata
>> sata0
>> sata1
>> tel
>> tv
>> upgrading
>> usb
>> usr0
>> usr1
>> usr35
>> wan
>> white
>> wireless
>> wps
>> yellow
>>
>> By extracting numerical pattern names and replacing numbers with N
>> we're getting something like this:
>>
>> N
>> Ng
>> colour
>> adsl
>> alarm
>> alive
>> aux
>> broadband
>> chrg
>> dsl
>> flash
>> indicator
>> inet
>> keypad
>> phone
>> power
>> sataN
>> tel
>> tv
>> upgrading
>> usb
>> usrN
>> wan
>> wireless
>> wps
>>
>> Is this list something you'd like to see as a base of standard LED
>> functions? It seems that this list would have to be continuously
>> supplemented with new positions.
>>
> 
> Even better option is to grep through all *.dts* files in the arch
> directory. A slightly modified command chain. which removes numerical
> postfixes (there are some not covered corner cases though)
> 
> find arch -name "*.dts*" | xargs grep label | sed s'/^.*label/label/g' |
> awk -F"=" '{print $2}' | sed s'/.*:\(.*\)";/\1/' | sed '/^\s\{1,\}/d' |
> sed s'/\([^0-9]*\)\([0-9]*\)/\1/' | sed '/^$/d' | sort -u
> 
> gives following 135 positions (~5 colours percolated due
> to some non-covered corner cases), and some of them don't belong
> to LED DT nodes unfortunately, as e.g. gpio-keys use also ":" as
> a delimiter in their labels, but the whole set gives reasonable
> overview I think:
> 
> active
> activity_led
> adsl
> alarm
> alive
> all
> amber
> app
> aux
> backup
> backup_led
> bl
> blue
> bluetooth
> boot
> bottom
> brick-status
> bt
> CEL
> chrg
> COM
> copy
> core_module
> cpu
> D
> debug
> DIA
> disk
> disk_led
> down
> dsl
> enocean
> enter
> err
> error
> esata
> ethernet-status
> fail
> fault
> front
> func
> function
> g
> ghz
> ghz-1
> ghz-2
> gpio
> green
> gsm
> HD
> hdd
> hdderr
> health
> health_led
> heart
> heartbeat
> home
> inet
> info
> internet
> keypad
> L
> lan
> led
> ledb
> left
> l_hdd
> live
> logo
> microSD
> misc
> mmc
> nand
> network
> on
> orange
> os
> panel
> pmu_stat
> power
> power_led
> programming
> proximitysensor
> pulse
> pwr
> qss
> rebuild_led
> red
> r_hdd
> right
> router
> rs
> rx
> sata
> sata-l
> sata-r
> sd
> SD
> sleep
> standby
> stat
> state
> status
> Status
> sw
> sys
> system
> system-status
> tel
> top
> tv
> tx
> up
> usb
> USB
> usb_1
> usb_2
> usb_copy
> usb-port1
> usb-port2
> user
> USER
> usr
> wan
> white
> wifi
> wifi_ap
> wifi-status
> wireless
> wlan
> wlan_g
> wmode
> wps
> WPS
> yellow
> 

  reply	other threads:[~2017-11-18 13:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 10:23 [RESEND PATCH v2 0/6] AS3645A fixes Sakari Ailus
2017-09-18 10:23 ` [RESEND PATCH v2 1/6] as3645a: Use ams,input-max-microamp as documented in DT bindings Sakari Ailus
2017-09-18 10:23 ` [RESEND PATCH v2 2/6] dt: bindings: as3645a: Use LED number to refer to LEDs Sakari Ailus
2017-09-18 10:23 ` [RESEND PATCH v2 3/6] as3645a: Use integer numbers for parsing LEDs Sakari Ailus
     [not found] ` <20170918102349.8935-1-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-18 10:23   ` [RESEND PATCH v2 4/6] dt: bindings: as3645a: Improve label documentation, DT example Sakari Ailus
2017-09-18 10:56     ` Pavel Machek
2017-09-18 14:49       ` Sakari Ailus
2017-09-18 20:54         ` Pavel Machek
2017-09-19 21:01           ` Jacek Anaszewski
2017-09-20 20:53             ` Rob Herring
2017-09-22 21:07               ` Jacek Anaszewski
2017-09-23 21:12                 ` Jacek Anaszewski
2017-11-18 13:38                   ` Jacek Anaszewski [this message]
2017-09-25  3:52                 ` Rob Herring
2017-09-18 10:23 ` [RESEND PATCH v2 5/6] as3645a: Add colour to LED name Sakari Ailus
2017-09-18 10:23 ` [RESEND PATCH v2 6/6] as3645a: Unregister indicator LED on device unbind Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=add4f657-be92-39c9-cbdf-a33ddb01262c@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).