All of lore.kernel.org
 help / color / mirror / Atom feed
* Creating sysfs brightness for every led channels
@ 2016-09-05 18:32 ` Raul Piper
  0 siblings, 0 replies; 9+ messages in thread
From: Raul Piper @ 2016-09-05 18:32 UTC (permalink / raw)
  To: linux-leds, kernelnewbies

Hi,
I am trying to send the brightness value ( for 5 channels) by
 echo "val1val2val3val4val5" > brightness ,
But seems like even if I change the brightness type to enum or int in
my driver ,I will never be able to send the brightness string because
led class defines the brightness value as enum.

extern void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness);

Only possible way I am finding is to create attributes for each
channel like brightness,default trigger,max_brightness and any user
defined attributes, but i am not getting how to do this.
Can some on please comment or post the link to the example driver.
Do i have to call led_class_register for every channel and I have to
define every channel in the device tree?
Thanks in advance !
Regards,
Rp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
@ 2016-09-05 18:32 ` Raul Piper
  0 siblings, 0 replies; 9+ messages in thread
From: Raul Piper @ 2016-09-05 18:32 UTC (permalink / raw)
  To: kernelnewbies

Hi,
I am trying to send the brightness value ( for 5 channels) by
 echo "val1val2val3val4val5" > brightness ,
But seems like even if I change the brightness type to enum or int in
my driver ,I will never be able to send the brightness string because
led class defines the brightness value as enum.

extern void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness);

Only possible way I am finding is to create attributes for each
channel like brightness,default trigger,max_brightness and any user
defined attributes, but i am not getting how to do this.
Can some on please comment or post the link to the example driver.
Do i have to call led_class_register for every channel and I have to
define every channel in the device tree?
Thanks in advance !
Regards,
Rp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating sysfs brightness for every led channels
  2016-09-05 18:32 ` Raul Piper
@ 2016-09-07 20:27   ` Jacek Anaszewski
  -1 siblings, 0 replies; 9+ messages in thread
From: Jacek Anaszewski @ 2016-09-07 20:27 UTC (permalink / raw)
  To: Raul Piper, linux-leds, kernelnewbies

Hi Raul,

On 09/05/2016 08:32 PM, Raul Piper wrote:
> Hi,
> I am trying to send the brightness value ( for 5 channels) by
>  echo "val1val2val3val4val5" > brightness ,

How did you infer this format?

Please get acquainted with Documentation/leds/leds-class.txt
and Documentation/ABI/testing/sysfs-class-led.

> But seems like even if I change the brightness type to enum or int in
> my driver ,I will never be able to send the brightness string because
> led class defines the brightness value as enum.

One LED class device can control one channel.

>
> extern void led_set_brightness(struct led_classdev *led_cdev,
> enum led_brightness brightness);
>
> Only possible way I am finding is to create attributes for each
> channel like brightness,default trigger,max_brightness and any user
> defined attributes, but i am not getting how to do this.
> Can some on please comment or post the link to the example driver.
> Do i have to call led_class_register for every channel and I have to
> define every channel in the device tree?

Just grep through drivers/leds and Documentation/devicetree/bindings/leds/.

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
@ 2016-09-07 20:27   ` Jacek Anaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Jacek Anaszewski @ 2016-09-07 20:27 UTC (permalink / raw)
  To: kernelnewbies

Hi Raul,

On 09/05/2016 08:32 PM, Raul Piper wrote:
> Hi,
> I am trying to send the brightness value ( for 5 channels) by
>  echo "val1val2val3val4val5" > brightness ,

How did you infer this format?

Please get acquainted with Documentation/leds/leds-class.txt
and Documentation/ABI/testing/sysfs-class-led.

> But seems like even if I change the brightness type to enum or int in
> my driver ,I will never be able to send the brightness string because
> led class defines the brightness value as enum.

One LED class device can control one channel.

>
> extern void led_set_brightness(struct led_classdev *led_cdev,
> enum led_brightness brightness);
>
> Only possible way I am finding is to create attributes for each
> channel like brightness,default trigger,max_brightness and any user
> defined attributes, but i am not getting how to do this.
> Can some on please comment or post the link to the example driver.
> Do i have to call led_class_register for every channel and I have to
> define every channel in the device tree?

Just grep through drivers/leds and Documentation/devicetree/bindings/leds/.

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
  2016-09-07 20:27   ` Jacek Anaszewski
  (?)
@ 2016-09-08 10:56   ` Raul Piper
  2016-09-08 19:17       ` Jacek Anaszewski
  -1 siblings, 1 reply; 9+ messages in thread
From: Raul Piper @ 2016-09-08 10:56 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Sep 8, 2016 at 1:57 AM, Jacek Anaszewski
<jacek.anaszewski@gmail.com> wrote:
> Hi Raul,
>
> On 09/05/2016 08:32 PM, Raul Piper wrote:
>>
>> Hi,
>> I am trying to send the brightness value ( for 5 channels) by
>>  echo "val1val2val3val4val5" > brightness ,
>
>
> How did you infer this format?
 Val1 is for channel #1 brightness, Val2 is for channel #2 .I un-parse
it in the _set_brightness_ method , but as written I think I have to
create a separate brightness sysfs for each channel. Thankyou for the
example documentation.

But what if I want to change the brightness of all the channels
simultaneously?Is it supported?
Is the Brightness sysfs implementation guaranteed to change the
brightness of the leds as soon as it is written by some user space
script.Can we not just store the values every time a channel is
written with the brightness value and then sync all the brightness by
some other sysfs(custom) with all those values.- In case of
simultaneous brightness change?

> Please get acquainted with Documentation/leds/leds-class.txt
> and Documentation/ABI/testing/sysfs-class-led.
>
>> But seems like even if I change the brightness type to enum or int in
>> my driver ,I will never be able to send the brightness string because
>> led class defines the brightness value as enum.
>
>
> One LED class device can control one channel.
>
>>
>> extern void led_set_brightness(struct led_classdev *led_cdev,
>> enum led_brightness brightness);
>>
>> Only possible way I am finding is to create attributes for each
>> channel like brightness,default trigger,max_brightness and any user
>> defined attributes, but i am not getting how to do this.
>> Can some on please comment or post the link to the example driver.
>> Do i have to call led_class_register for every channel and I have to
>> define every channel in the device tree?
>
>
> Just grep through drivers/leds and Documentation/devicetree/bindings/leds/.
Thank-you for this.
> --
> Best regards,
> Jacek Anaszewski

Thanks and Regards,
Rp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating sysfs brightness for every led channels
  2016-09-08 10:56   ` Raul Piper
@ 2016-09-08 19:17       ` Jacek Anaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Jacek Anaszewski @ 2016-09-08 19:17 UTC (permalink / raw)
  To: Raul Piper; +Cc: kernelnewbies, Linux LED Subsystem

On 09/08/2016 12:56 PM, Raul Piper wrote:
> On Thu, Sep 8, 2016 at 1:57 AM, Jacek Anaszewski
> <jacek.anaszewski@gmail.com> wrote:
>> Hi Raul,
>>
>> On 09/05/2016 08:32 PM, Raul Piper wrote:
>>>
>>> Hi,
>>> I am trying to send the brightness value ( for 5 channels) by
>>>  echo "val1val2val3val4val5" > brightness ,
>>
>>
>> How did you infer this format?
>  Val1 is for channel #1 brightness, Val2 is for channel #2 .I un-parse
> it in the _set_brightness_ method , but as written I think I have to
> create a separate brightness sysfs for each channel. Thankyou for the
> example documentation.
>
> But what if I want to change the brightness of all the channels
> simultaneously?Is it supported?
> Is the Brightness sysfs implementation guaranteed to change the
> brightness of the leds as soon as it is written by some user space
> script.Can we not just store the values every time a channel is
> written with the brightness value and then sync all the brightness by
> some other sysfs(custom) with all those values.- In case of
> simultaneous brightness change?

This is the problem that emerges from time to time. We've had few
discussions about it. The last one took place few months ago,
when we were trying to merge generic support for RGB LEDs:

http://www.spinics.net/lists/linux-leds/msg05938.html

We've even managed to agree on possible solution to the problem
but nobody was eager to take the chance and implement it. Maybe you
will be the one ? :)

>> Please get acquainted with Documentation/leds/leds-class.txt
>> and Documentation/ABI/testing/sysfs-class-led.
>>
>>> But seems like even if I change the brightness type to enum or int in
>>> my driver ,I will never be able to send the brightness string because
>>> led class defines the brightness value as enum.
>>
>>
>> One LED class device can control one channel.
>>
>>>
>>> extern void led_set_brightness(struct led_classdev *led_cdev,
>>> enum led_brightness brightness);
>>>
>>> Only possible way I am finding is to create attributes for each
>>> channel like brightness,default trigger,max_brightness and any user
>>> defined attributes, but i am not getting how to do this.
>>> Can some on please comment or post the link to the example driver.
>>> Do i have to call led_class_register for every channel and I have to
>>> define every channel in the device tree?
>>
>>
>> Just grep through drivers/leds and Documentation/devicetree/bindings/leds/.
> Thank-you for this.
>> --
>> Best regards,
>> Jacek Anaszewski
>
> Thanks and Regards,
> Rp
>

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
@ 2016-09-08 19:17       ` Jacek Anaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Jacek Anaszewski @ 2016-09-08 19:17 UTC (permalink / raw)
  To: kernelnewbies

On 09/08/2016 12:56 PM, Raul Piper wrote:
> On Thu, Sep 8, 2016 at 1:57 AM, Jacek Anaszewski
> <jacek.anaszewski@gmail.com> wrote:
>> Hi Raul,
>>
>> On 09/05/2016 08:32 PM, Raul Piper wrote:
>>>
>>> Hi,
>>> I am trying to send the brightness value ( for 5 channels) by
>>>  echo "val1val2val3val4val5" > brightness ,
>>
>>
>> How did you infer this format?
>  Val1 is for channel #1 brightness, Val2 is for channel #2 .I un-parse
> it in the _set_brightness_ method , but as written I think I have to
> create a separate brightness sysfs for each channel. Thankyou for the
> example documentation.
>
> But what if I want to change the brightness of all the channels
> simultaneously?Is it supported?
> Is the Brightness sysfs implementation guaranteed to change the
> brightness of the leds as soon as it is written by some user space
> script.Can we not just store the values every time a channel is
> written with the brightness value and then sync all the brightness by
> some other sysfs(custom) with all those values.- In case of
> simultaneous brightness change?

This is the problem that emerges from time to time. We've had few
discussions about it. The last one took place few months ago,
when we were trying to merge generic support for RGB LEDs:

http://www.spinics.net/lists/linux-leds/msg05938.html

We've even managed to agree on possible solution to the problem
but nobody was eager to take the chance and implement it. Maybe you
will be the one ? :)

>> Please get acquainted with Documentation/leds/leds-class.txt
>> and Documentation/ABI/testing/sysfs-class-led.
>>
>>> But seems like even if I change the brightness type to enum or int in
>>> my driver ,I will never be able to send the brightness string because
>>> led class defines the brightness value as enum.
>>
>>
>> One LED class device can control one channel.
>>
>>>
>>> extern void led_set_brightness(struct led_classdev *led_cdev,
>>> enum led_brightness brightness);
>>>
>>> Only possible way I am finding is to create attributes for each
>>> channel like brightness,default trigger,max_brightness and any user
>>> defined attributes, but i am not getting how to do this.
>>> Can some on please comment or post the link to the example driver.
>>> Do i have to call led_class_register for every channel and I have to
>>> define every channel in the device tree?
>>
>>
>> Just grep through drivers/leds and Documentation/devicetree/bindings/leds/.
> Thank-you for this.
>> --
>> Best regards,
>> Jacek Anaszewski
>
> Thanks and Regards,
> Rp
>

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
@ 2016-09-05 18:27 ` Raul Piper
  0 siblings, 0 replies; 9+ messages in thread
From: Raul Piper @ 2016-09-05 18:27 UTC (permalink / raw)
  To: linux-leds, kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 796 bytes --]

Hi,
I am trying to send the brightness value ( for 5 channels) by
 echo "val1val2val3val4val5" > brightness ,
But seems like even if I change the brightness type to enum or int in my
driver ,I will never be able to send the brightness string because led
class defines the brightness value as enum.

*extern void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness);*

Only possible way I am finding is to create attributes for each channel
like brightness,default trigger,max_brightness and any user defined
attributes, but i am not getting how to do this.
Can some on please comment or post the link to the example driver.
Do i have to call led_class_register for every channel and I have to
 define every channel in the device tree?
Thanks in advance !
Regards,
Rp

[-- Attachment #1.2: Type: text/html, Size: 1152 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Creating sysfs brightness for every led channels
@ 2016-09-05 18:27 ` Raul Piper
  0 siblings, 0 replies; 9+ messages in thread
From: Raul Piper @ 2016-09-05 18:27 UTC (permalink / raw)
  To: kernelnewbies

Hi,
I am trying to send the brightness value ( for 5 channels) by
 echo "val1val2val3val4val5" > brightness ,
But seems like even if I change the brightness type to enum or int in my
driver ,I will never be able to send the brightness string because led
class defines the brightness value as enum.

*extern void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness);*

Only possible way I am finding is to create attributes for each channel
like brightness,default trigger,max_brightness and any user defined
attributes, but i am not getting how to do this.
Can some on please comment or post the link to the example driver.
Do i have to call led_class_register for every channel and I have to
 define every channel in the device tree?
Thanks in advance !
Regards,
Rp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160905/dcd60127/attachment-0001.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-08 19:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-05 18:32 Creating sysfs brightness for every led channels Raul Piper
2016-09-05 18:32 ` Raul Piper
2016-09-07 20:27 ` Jacek Anaszewski
2016-09-07 20:27   ` Jacek Anaszewski
2016-09-08 10:56   ` Raul Piper
2016-09-08 19:17     ` Jacek Anaszewski
2016-09-08 19:17       ` Jacek Anaszewski
  -- strict thread matches above, loose matches on Subject: below --
2016-09-05 18:27 Raul Piper
2016-09-05 18:27 ` Raul Piper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.