Commit edc837da authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'leds_for_4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds

Pull LED updates from Jacek Anaszewski:
 "In this merge window we'd like to announce a change on the list of LED
  subsystem maintainers - Bryan Wu decided to step back and handed over
  the maintainership to me (Jacek Anaszewski), which entailed an update
  of LED subsystem git tree URL.

  Besides the changes in MAINTAINERS we have:

   - optimizations and improvements to existing LED class drivers

   - improvements to the common LEDs DT documentation

   - modifications of kirkwood-* dts files, to be in sync with patches
     for leds-ns2 driver, that move LEDs mode mapping outside of the
     driver"

* tag 'leds_for_4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
  leds: Export OF module alias information in missing drivers
  leds:lp55xx: use the private data instead of updating I2C device platform data
  leds: syscon: Correct check for syscon_node_to_regmap() errors
  leds: leds-fsg: Use devm_led_classdev_register
  MAINTAINERS: Change LED subsystem git tree URL
  leds/led-class: Add missing put_device()
  ARM: Kirkwood: add modes-map property to ns2-leds nodes
  leds: tlc591xx: Remove redundant I2C_FUNC_SMBUS_BYTE_DATA functionality check
  leds: leds-ns2: depends on MACH_ARMADA_370
  leds: leds-ns2: handle can_sleep GPIOs
  leds: leds-ns2: move LED modes mapping outside of the driver
  leds: lp8860: Constify reg_default tables
  leds: Drop owner assignment from i2c_driver
  leds: Allow compile test of LEDS_AAT1290 and LEDS_KTD2692 if !GPIOLIB
  leds: Allow compile test of GPIO consumers if !GPIOLIB
  DT: leds: Improve description of flash LEDs related properties
parents e5aeced6 4d59ed85
......@@ -29,14 +29,23 @@ Optional properties for child nodes:
"ide-disk" - LED indicates disk activity
"timer" - LED flashes at a fixed, configurable rate
- max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- flash-max-microamp : maximum intensity in microamperes of the
flash LED; it is mandatory if the LED should
support the flash mode
- flash-timeout-us : timeout in microseconds after which the flash
LED is turned off
- led-max-microamp : Maximum LED supply current in microamperes. This property
can be made mandatory for the board configurations
introducing a risk of hardware damage in case an excessive
current is set.
For flash LED controllers with configurable current this
property is mandatory for the LEDs in the non-flash modes
(e.g. torch or indicator).
Required properties for flash LED child nodes:
- flash-max-microamp : Maximum flash LED supply current in microamperes.
- flash-max-timeout-us : Maximum timeout in microseconds after which the flash
LED is turned off.
For controllers that have no configurable current the flash-max-microamp
property can be omitted.
For controllers that have no configurable timeout the flash-max-timeout-us
property can be omitted.
Examples:
......@@ -49,7 +58,7 @@ system-status {
camera-flash {
label = "Flash";
led-sources = <0>, <1>;
max-microamp = <50000>;
led-max-microamp = <50000>;
flash-max-microamp = <320000>;
flash-timeout-us = <500000>;
flash-max-timeout-us = <500000>;
};
......@@ -8,6 +8,9 @@ Each LED is represented as a sub-node of the ns2-leds device.
Required sub-node properties:
- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
- modes-map: A mapping between LED modes (off, on or SATA activity blinking) and
the corresponding cmd-gpio/slow-gpio values. All the GPIO values combinations
should be given in order to avoid having an unknown mode at driver probe time.
Optional sub-node properties:
- label: Name for this LED. If omitted, the label is taken from the node name.
......@@ -15,6 +18,8 @@ Optional sub-node properties:
Example:
#include <dt-bindings/leds/leds-ns2.h>
ns2-leds {
compatible = "lacie,ns2-leds";
......@@ -22,5 +27,9 @@ ns2-leds {
label = "ns2:blue:sata";
slow-gpio = <&gpio0 29 0>;
cmd-gpio = <&gpio0 30 0>;
modes-map = <NS_V2_LED_OFF 0 1
NS_V2_LED_ON 1 0
NS_V2_LED_ON 0 0
NS_V2_LED_SATA 1 1>;
};
};
......@@ -6042,11 +6042,10 @@ F: Documentation/scsi/53c700.txt
F: drivers/scsi/53c700*
LED SUBSYSTEM
M: Bryan Wu <cooloney@gmail.com>
M: Richard Purdie <rpurdie@rpsys.net>
M: Jacek Anaszewski <j.anaszewski@samsung.com>
L: linux-leds@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git
T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
S: Maintained
F: drivers/leds/
F: include/linux/leds.h
......
......@@ -10,6 +10,7 @@
/dts-v1/;
#include <dt-bindings/leds/leds-ns2.h>
#include "kirkwood-netxbig.dtsi"
/ {
......@@ -28,6 +29,10 @@
label = "d2net_v2:blue:sata";
slow-gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
cmd-gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
modes-map = <NS_V2_LED_OFF 1 0
NS_V2_LED_ON 0 1
NS_V2_LED_ON 1 1
NS_V2_LED_SATA 0 0>;
};
};
......
/dts-v1/;
#include <dt-bindings/leds/leds-ns2.h>
#include "kirkwood-ns2-common.dtsi"
/ {
......@@ -27,6 +28,10 @@
label = "ns2:blue:sata";
slow-gpio = <&gpio0 29 0>;
cmd-gpio = <&gpio0 30 0>;
modes-map = <NS_V2_LED_OFF 1 0
NS_V2_LED_ON 0 1
NS_V2_LED_ON 1 1
NS_V2_LED_SATA 0 0>;
};
};
};
......
/dts-v1/;
#include <dt-bindings/leds/leds-ns2.h>
#include "kirkwood-ns2-common.dtsi"
/ {
......@@ -27,6 +28,10 @@
label = "ns2:blue:sata";
slow-gpio = <&gpio0 29 0>;
cmd-gpio = <&gpio0 30 0>;
modes-map = <NS_V2_LED_OFF 1 0
NS_V2_LED_ON 0 1
NS_V2_LED_ON 1 1
NS_V2_LED_SATA 0 0>;
};
};
};
......
/dts-v1/;
#include <dt-bindings/leds/leds-ns2.h>
#include "kirkwood-ns2-common.dtsi"
/ {
......@@ -46,6 +47,10 @@
label = "ns2:blue:sata";
slow-gpio = <&gpio0 29 0>;
cmd-gpio = <&gpio0 30 0>;
modes-map = <NS_V2_LED_OFF 1 0
NS_V2_LED_ON 0 1
NS_V2_LED_ON 1 1
NS_V2_LED_SATA 0 0>;
};
};
};
......
/dts-v1/;
#include <dt-bindings/leds/leds-ns2.h>
#include "kirkwood-ns2-common.dtsi"
/ {
......@@ -47,6 +48,10 @@
label = "ns2:blue:sata";
slow-gpio = <&gpio0 29 0>;
cmd-gpio = <&gpio0 30 0>;
modes-map = <NS_V2_LED_OFF 1 0
NS_V2_LED_ON 0 1
NS_V2_LED_ON 1 1
NS_V2_LED_SATA 0 0>;
};
};
};
......
......@@ -43,7 +43,7 @@ config LEDS_AAT1290
tristate "LED support for the AAT1290"
depends on LEDS_CLASS_FLASH
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
depends on GPIOLIB
depends on GPIOLIB || COMPILE_TEST
depends on OF
depends on PINCTRL
help
......@@ -419,7 +419,7 @@ config LEDS_INTEL_SS4200
config LEDS_LT3593
tristate "LED driver for LT3593 controllers"
depends on LEDS_CLASS
depends on GPIOLIB
depends on GPIOLIB || COMPILE_TEST
help
This option enables support for LEDs driven by a Linear Technology
LT3593 controller. This controller uses a special one-wire pulse
......@@ -455,12 +455,16 @@ config LEDS_MC13783
config LEDS_NS2
tristate "LED support for Network Space v2 GPIO LEDs"
depends on LEDS_CLASS
depends on MACH_KIRKWOOD
depends on MACH_KIRKWOOD || MACH_ARMADA_370
default y
help
This option enable support for the dual-GPIO LED found on the
Network Space v2 board (and parents). This include Internet Space v2,
Network Space (Max) v2 and d2 Network v2 boards.
This option enables support for the dual-GPIO LEDs found on the
following LaCie/Seagate boards:
Network Space v2 (and parents: Max, Mini)
Internet Space v2
d2 Network v2
n090401 (Seagate NAS 4-Bay)
config LEDS_NETXBIG
tristate "LED support for Big Network series LEDs"
......@@ -543,7 +547,8 @@ config LEDS_MENF21BMC
config LEDS_KTD2692
tristate "LED support for KTD2692 flash LED controller"
depends on LEDS_CLASS_FLASH && GPIOLIB && OF
depends on LEDS_CLASS_FLASH && OF
depends on GPIOLIB || COMPILE_TEST
help
This option enables support for KTD2692 LED flash connected
through ExpressWire interface.
......
......@@ -228,12 +228,15 @@ static int led_classdev_next_name(const char *init_name, char *name,
{
unsigned int i = 0;
int ret = 0;
struct device *dev;
strlcpy(name, init_name, len);
while (class_find_device(leds_class, NULL, name, match_name) &&
(ret < len))
while ((ret < len) &&
(dev = class_find_device(leds_class, NULL, name, match_name))) {
put_device(dev);
ret = snprintf(name, len, "%s_%u", init_name, ++i);
}
if (ret >= len)
return -ENOMEM;
......
......@@ -156,63 +156,35 @@ static int fsg_led_probe(struct platform_device *pdev)
latch_value = 0xffff;
*latch_address = latch_value;
ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_wlan_led);
if (ret < 0)
goto failwlan;
return ret;
ret = led_classdev_register(&pdev->dev, &fsg_wan_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_wan_led);
if (ret < 0)
goto failwan;
return ret;
ret = led_classdev_register(&pdev->dev, &fsg_sata_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_sata_led);
if (ret < 0)
goto failsata;
return ret;
ret = led_classdev_register(&pdev->dev, &fsg_usb_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_usb_led);
if (ret < 0)
goto failusb;
return ret;
ret = led_classdev_register(&pdev->dev, &fsg_sync_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_sync_led);
if (ret < 0)
goto failsync;
return ret;
ret = led_classdev_register(&pdev->dev, &fsg_ring_led);
ret = devm_led_classdev_register(&pdev->dev, &fsg_ring_led);
if (ret < 0)
goto failring;
return ret;
failring:
led_classdev_unregister(&fsg_sync_led);
failsync:
led_classdev_unregister(&fsg_usb_led);
failusb:
led_classdev_unregister(&fsg_sata_led);
failsata:
led_classdev_unregister(&fsg_wan_led);
failwan:
led_classdev_unregister(&fsg_wlan_led);
failwlan:
return ret;
return ret;
}
static int fsg_led_remove(struct platform_device *pdev)
{
led_classdev_unregister(&fsg_wlan_led);
led_classdev_unregister(&fsg_wan_led);
led_classdev_unregister(&fsg_sata_led);
led_classdev_unregister(&fsg_usb_led);
led_classdev_unregister(&fsg_sync_led);
led_classdev_unregister(&fsg_ring_led);
return 0;
}
static struct platform_driver fsg_led_driver = {
.probe = fsg_led_probe,
.remove = fsg_led_remove,
.driver = {
.name = "fsg-led",
},
......
......@@ -492,7 +492,6 @@ static struct i2c_driver lm3530_i2c_driver = {
.id_table = lm3530_id,
.driver = {
.name = LM3530_NAME,
.owner = THIS_MODULE,
},
};
......
......@@ -555,7 +555,6 @@ MODULE_DEVICE_TABLE(i2c, lm355x_id);
static struct i2c_driver lm355x_i2c_driver = {
.driver = {
.name = LM355x_NAME,
.owner = THIS_MODULE,
.pm = NULL,
},
.probe = lm355x_probe,
......
......@@ -446,7 +446,6 @@ MODULE_DEVICE_TABLE(i2c, lm3642_id);
static struct i2c_driver lm3642_i2c_driver = {
.driver = {
.name = LM3642_NAME,
.owner = THIS_MODULE,
.pm = NULL,
},
.probe = lm3642_probe,
......
......@@ -514,20 +514,19 @@ static int lp5521_probe(struct i2c_client *client,
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata;
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
struct device_node *np = client->dev.of_node;
if (!dev_get_platdata(&client->dev)) {
if (!pdata) {
if (np) {
ret = lp55xx_of_populate_pdata(&client->dev, np);
if (ret < 0)
return ret;
pdata = lp55xx_of_populate_pdata(&client->dev, np);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
} else {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}
}
pdata = dev_get_platdata(&client->dev);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
......
......@@ -880,20 +880,19 @@ static int lp5523_probe(struct i2c_client *client,
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata;
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
struct device_node *np = client->dev.of_node;
if (!dev_get_platdata(&client->dev)) {
if (!pdata) {
if (np) {
ret = lp55xx_of_populate_pdata(&client->dev, np);
if (ret < 0)
return ret;
pdata = lp55xx_of_populate_pdata(&client->dev, np);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
} else {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}
}
pdata = dev_get_platdata(&client->dev);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
......
......@@ -515,20 +515,19 @@ static int lp5562_probe(struct i2c_client *client,
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata;
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
struct device_node *np = client->dev.of_node;
if (!dev_get_platdata(&client->dev)) {
if (!pdata) {
if (np) {
ret = lp55xx_of_populate_pdata(&client->dev, np);
if (ret < 0)
return ret;
pdata = lp55xx_of_populate_pdata(&client->dev, np);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
} else {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}
}
pdata = dev_get_platdata(&client->dev);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
......
......@@ -543,7 +543,8 @@ void lp55xx_unregister_sysfs(struct lp55xx_chip *chip)
}
EXPORT_SYMBOL_GPL(lp55xx_unregister_sysfs);
int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
struct device_node *np)
{
struct device_node *child;
struct lp55xx_platform_data *pdata;
......@@ -553,17 +554,17 @@ int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
return ERR_PTR(-ENOMEM);
num_channels = of_get_child_count(np);
if (num_channels == 0) {
dev_err(dev, "no LED channels\n");
return -EINVAL;
return ERR_PTR(-EINVAL);
}
cfg = devm_kzalloc(dev, sizeof(*cfg) * num_channels, GFP_KERNEL);
if (!cfg)
return -ENOMEM;
return ERR_PTR(-ENOMEM);
pdata->led_config = &cfg[0];
pdata->num_channels = num_channels;
......@@ -588,9 +589,7 @@ int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
/* LP8501 specific */
of_property_read_u8(np, "pwr-sel", (u8 *)&pdata->pwr_sel);
dev->platform_data = pdata;
return 0;
return pdata;
}
EXPORT_SYMBOL_GPL(lp55xx_of_populate_pdata);
......
......@@ -202,7 +202,7 @@ extern int lp55xx_register_sysfs(struct lp55xx_chip *chip);
extern void lp55xx_unregister_sysfs(struct lp55xx_chip *chip);
/* common device tree population function */
extern int lp55xx_of_populate_pdata(struct device *dev,
struct device_node *np);
extern struct lp55xx_platform_data
*lp55xx_of_populate_pdata(struct device *dev, struct device_node *np);
#endif /* _LEDS_LP55XX_COMMON_H */
......@@ -308,20 +308,19 @@ static int lp8501_probe(struct i2c_client *client,
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata;
struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
struct device_node *np = client->dev.of_node;
if (!dev_get_platdata(&client->dev)) {
if (!pdata) {
if (np) {
ret = lp55xx_of_populate_pdata(&client->dev, np);
if (ret < 0)
return ret;
pdata = lp55xx_of_populate_pdata(&client->dev, np);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
} else {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}
}
pdata = dev_get_platdata(&client->dev);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment