From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
To: Jacek Anaszewski <j.anaszewski81@gmail.com>
Cc: stewart@linux.vnet.ibm.com, cooloney@gmail.com,
rpurdie@rpsys.net, linuxppc-dev@lists.ozlabs.org,
linux-leds@vger.kernel.org, khandual@linux.vnet.ibm.com
Subject: Re: [PATCH v2 2/2] leds/powernv: Add driver for PowerNV platform
Date: Thu, 23 Apr 2015 10:55:40 +0530 [thread overview]
Message-ID: <55388254.4000606@linux.vnet.ibm.com> (raw)
In-Reply-To: <20150422234509.626d9dc7@ja.home>
On 04/23/2015 03:15 AM, Jacek Anaszewski wrote:
> Hi Vasant,
>
Hi Jacek,
.../...
>>
>>>
>>> From what I can see from the driver code the LEDs are set with:
>>>
>>> opal_leds_set_ind(token, loc_code, led_mask, led_value,
>>> &max_led_type);
>>>
>>> and their state can be read with:
>>>
>>> opal_leds_get_ind(loc_code, &led_mask, &led_value, &max_led_type)
>>>
>>> From the kernel point of view these are very simple operations.
>>>
>>> All the logic you described should be handled by user space.
>>> If you need to be able to specify the LED mode you want to set/read,
>>> then additional 'mode' sysfs attribute should be added by the driver.
>>> There would have to be also additional sysfs attribute
>>> 'available_modes" provided. The ABI documentation should inform how
>>> the mode identifiers map to the modes. I already explained how to
>>> add it, when we were discussing about retaining led state on remove.
>>
>> Sorry..My fault.. I should have elaborated mode operation...
>
> What I was thinking about here was actually LED type, not mode in terms
> of Guiding Light/Light Path. However, please look at the newest
> approach in the end of this message.
>
No problem.
>> I forgot to mention that LED mode is static... meaning platform
>> provides this information, but we cannot change during runtime..
>>
>> Presently we have this information in Device Tree. Since this is
>> static one (and also LED Mode is system wide.. nothing to do
>> individual LED), I didn't add it in LED driver code.. .Do you think
>> we should add that property ?
>
> The property shouldn't be documented at all if it isn't to be used.
Ok . I will remove this.
>
>>>
>>>
>>> I'd see following use cases.
>>>
>>> (let's assume that modes are defined as follows:
>>> 0: ident, 1: attn, 2: fault)
>>
>> Modes are : Guiding Light / Light Path ... which is static and
>> platform provides this information.
>>
>> LED types : IDENT, FAULT and ATTN .... which can be get/set/reset by
>> OS (kernel/userspace)
>>
>> Also only 1 LED can be ATTN ...
>>
>>> #cat available_modes
>>> #0 1 2
>>> #echo 0 > mode //set ident mode
>>> #echo 1 > brightness //set ident state
>>> #echo 2 > mode //set fault mode
>>> #cat brightness //read fault state
>>> #0
>>> #echo 1 > attn //set attn mode
>>> #echo 1 > brightness
>>>
>>> This would set the LED in blinking mode, so I am wondering if we
>>> shouldn't employ timer trigger for this to keep the LED API
>>> consistent.
>>>
>>> Can a single LED support other mode than 'attention'? I'd like to
>>> know if a LED in attention mode (blinking), can be set to some solid
>>> mode?
>>
>> No.. Its always single attention LED/system ... which can be Set
>> (Solid) / reset state.
>
> I confused it with ident.
No problem. We have many hardware specific jargon's which is enough to confuse
anyone :-)
>
>>>
>>> Please let me know if such an approach would still not fit for your
>>> requirements.
>>>
>>
>> Given above conditions, I think current approach (my v3 patchset) is
>> simple and works better. What you say?
>
> Yes, but we still have naming and blinking issues to solve.
>
> Please look at this draft design of device tree node:
>
> opal-leds {
> compatible = "ibm,opal-v3-led";
>
> U78C9.001.RST0027-P1-C1:attn {
> };
>
> U78C9.001.RST0027-P2-C1:identify:fault
> };
>
> U78C9.001.RST0027-P3-C2:identify:fault {
> };
> };
> };
>
> The LED nodes could be empty as the name would convey all the
> required information. The implications would be as follows:
>
These device tree comes from out firmware ... which is immutable .
We can use LED node name + led-type property for naming...which is what I do
currently (v4.. which I haven't posted)
> 1. Each LED would have one corresponding LED class device.
>
> 2. Operations on attn and fault LED types:
> turn on:
> echo 255 > brightness
> turn off:
> echo 0 > brightness
> get status
> cat brightness
>
> 3. Operations on identify LED:
> turn on:
> echo "timer" > trigger
> (blink_set op would have to be implemented in the
> driver)
> turn off:
> echo 0 > brightness
> get status:
> support for this would have to be added to the LED
> subsystem core
I see few issues here.
- Overloading same LED device with multiple opeartion complicates things .. as
these operations can be done independently (say user is allowed to enable both
identify and fault simultaneously)
- point 3: IIUC after duration value expires identify indicator reverts.. we
don't want to revert until user asks .
- point 3: if I use brightness for both identify/fault, how to disable these
LEDs independently?
- Also how to use trigger property for each LED (if at all we want to use them
later)?
>
> 4. Since 'identify' is the platform specific name it could be preserved
>
Ok sure.
>
> Does it work for you?
>
Thanks
Vasant
next prev parent reply other threads:[~2015-04-23 5:26 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 21:45 [PATCH v2 2/2] leds/powernv: Add driver for PowerNV platform Jacek Anaszewski
2015-04-23 5:25 ` Vasant Hegde [this message]
2015-04-23 14:13 ` Jacek Anaszewski
2015-04-24 4:18 ` Stewart Smith
2015-04-24 10:16 ` Jacek Anaszewski
2015-04-28 6:59 ` Stewart Smith
2015-04-28 9:10 ` Jacek Anaszewski
2015-04-24 5:30 ` Vasant Hegde
2015-04-24 10:15 ` Jacek Anaszewski
2015-04-26 22:08 ` Benjamin Herrenschmidt
2015-04-27 11:15 ` Jacek Anaszewski
2015-04-26 22:07 ` Benjamin Herrenschmidt
2015-04-27 7:24 ` Jacek Anaszewski
2015-04-27 9:53 ` Benjamin Herrenschmidt
2015-04-27 11:15 ` Jacek Anaszewski
2015-04-27 13:47 ` Vasant Hegde
2015-04-28 11:06 ` Vasant Hegde
-- strict thread matches above, loose matches on Subject: below --
2015-03-20 11:02 [PATCH v2 0/2] LED interface " Vasant Hegde
2015-03-20 11:04 ` [PATCH v2 2/2] leds/powernv: Add driver " Vasant Hegde
2015-03-25 5:21 ` Benjamin Herrenschmidt
2015-04-14 5:40 ` Vasant Hegde
2015-04-14 15:20 ` Jacek Anaszewski
2015-04-15 6:26 ` Vasant Hegde
[not found] ` <552E2480.9060102@samsung.com>
2015-04-15 10:15 ` Vasant Hegde
[not found] ` <552E63D2.4070209@samsung.com>
2015-04-16 6:52 ` Vasant Hegde
2015-04-16 8:51 ` Jacek Anaszewski
2015-04-16 10:26 ` Vasant Hegde
2015-04-16 11:34 ` Jacek Anaszewski
2015-04-20 7:29 ` Jacek Anaszewski
2015-04-20 11:45 ` Jacek Anaszewski
2015-04-20 12:34 ` Vasant Hegde
2015-04-20 15:20 ` Jacek Anaszewski
2015-04-20 15:53 ` Vasant Hegde
2015-04-15 18:50 ` Stewart Smith
2015-04-16 5:07 ` Vasant Hegde
2015-04-21 23:03 ` Stewart Smith
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=55388254.4000606@linux.vnet.ibm.com \
--to=hegdevasant@linux.vnet.ibm.com \
--cc=cooloney@gmail.com \
--cc=j.anaszewski81@gmail.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-leds@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=rpurdie@rpsys.net \
--cc=stewart@linux.vnet.ibm.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).