Commit Graph

9 Commits

Author SHA1 Message Date
Dan Murphy 6d4faf3b6b leds: lm3532: Fix optional led-max-microamp prop error handling
Fix the error handling for the led-max-microamp property.
Need to check if the property is present and then if it is
retrieve the setting and its max boundary

Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-12 20:45:52 +02:00
Krzysztof Wilczynski 536129cc9a leds: lm3532: Move static keyword to the front of declarations
Move the static keyword to the front of declarations ramp_table,
als_avrg_table and als_imp_table, and resolve the following
compiler warnings that can be seen when building with warnings
enabled (W=1):

drivers/leds/leds-lm3532.c:209:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:266:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:281:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-03 20:34:39 +02:00
Tony Lindgren 070a0eed75 leds: lm3532: Avoid potentially unpaired regulator calls
We may currently get unpaired regulator calls when configuring the LED
brightness via sysfs in case of regulator calls producing errors. Let's
fix this by maintaining local state for enabled.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-09-01 13:33:27 +02:00
Dan Murphy 517ea49a7b leds: lm3532: Add full scale current configuration
Allow the full scale current to be configured at init.
Valid rangles are 5mA->29.8mA.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26 20:03:58 +02:00
Dan Murphy 6559ac3299 leds: lm3532: Fixes for the driver for stability
Fixed misspelled words, added error check during probe
on the init of the registers, and fixed ALS/I2C control
mode.

Fixes: bc1b8492c7 ("leds: lm3532: Introduce the lm3532 LED driver")
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26 20:03:50 +02:00
Dan Murphy 4c9054506c leds: lm3532: Change the define for the fs current register
Change the define name of the full scale current registers.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26 20:03:49 +02:00
Dan Murphy 1312394023 leds: lm3532: Fix brightness control for i2c mode
Fix the brightness control for I2C mode.  Instead of
changing the full scale current register update the ALS target
register for the appropriate banks.

In addition clean up some code errors and random misspellings found
during coding.

Tested on Droid4 as well as LM3532 EVM connected to a BeagleBoneBlack

Fixes: bc1b8492c7 ("leds: lm3532: Introduce the lm3532 LED driver")
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-08-26 20:03:26 +02:00
Andy Shevchenko cc93c86370 leds: lm3532: Switch to use fwnode_property_count_uXX()
Use fwnode_property_count_uXX() directly, that makes code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-07-25 20:08:02 +02:00
Dan Murphy bc1b8492c7 leds: lm3532: Introduce the lm3532 LED driver
Introduce the Texas Instruments LM3532 White LED driver.
The driver supports ALS configurability or manual brightness
control.

The driver also supports associating LED strings with specific
control banks in a group or as individually controlled strings.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-04-07 20:45:49 +02:00