lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 7 Dec 2011 15:16:06 +0100
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	Linus Walleij <linus.walleij@...ricsson.com>,
	Richard Purdie <rpurdie@...ys.net>,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Shreshtha Kumar Sahu <shreshthakumar.sahu@...ricsson.com>
Subject: Re: [PATCH] leds: driver for ab5500 high voltage leds

On Sat, Dec 3, 2011 at 10:49 PM, Mark Brown
<broonie@...nsource.wolfsonmicro.com> wrote:

> On Fri, Dec 02, 2011 at 02:56:22PM +0100, Linus Walleij wrote:
>
>> +What:                /sys/class/leds/<led>/led_current
>> +Date:                December 2011
>> +KernelVersion:       3.3
>> +Contact:     Shreshtha Kumar SAHU <shreshthakumar.sahu@...ricsson.com>
>> +Description:
>> +             Read and set the current limit for the LED. Value in
>> +             milliampere.
>
> This sounds like a platform data thing - normally if you get a current
> limit wrong you're heading for magic smoke so it's not something you
> want to be playing with at runtime from userspace.

There is a platform thing, it sets the upper limit for the
current:

+/**
+ * struct ab5500_led
+ * @id: hvled index
+ * @max_current: max current permitted for hvled instance
+ * @brt_val: brightness value set for hvled
+ * @fade_hi: fadeout time high bits
+ * @fade_lo: fadeout time low bits
+ * @led_on: led is on
+ * @led_cdev: hvled class device
+ * @led_work: work to set the brightness of hvled
+ */
+struct ab5500_led {
+       u8 id;
+       u8 max_current;
+       u16 brt_val;
+       u16 fade_hi;
+       u16 fade_lo;
+       bool led_on;
+       struct led_classdev led_cdev;
+       struct work_struct led_work;
+};

Here max_current is the max current allowed by the platform.

Then in the sysfs interface:

+       if (led_curr > led->max_current)
+               led_curr = led->max_current;

You are only allowed to set a lower value than the max value.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ