diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 04:02:51 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 04:02:51 +0300 |
commit | 8b35ad6232c462b02e397e87ce702bcddd4ba543 (patch) | |
tree | 921cd619336b1ff7f0dde7bdbf9f898ffe4cedae /drivers/leds/leds-pca955x.c | |
parent | f678d6da749983791850876e3421e7c48a0a7127 (diff) | |
parent | 0db37915d912e8dc6588f25da76d3ed36718d92f (diff) | |
download | linux-8b35ad6232c462b02e397e87ce702bcddd4ba543.tar.xz |
Merge tag 'leds-for-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED updates from Jacek Anaszewski:
"LED core fixes and improvements:
- avoid races with workqueue
- Kconfig: pedantic cleanup
- small fixes for Flash class description
leds-lt3593:
- remove unneeded assignment in lt3593_led_probe
- drop pdata handling code
leds-blinkm:
- clean up double assignment to data->i2c_addr
leds-pca955x, leds-pca963x:
- revert ACPI support, as it turned out that there is no evidence
of officially registered ACPI IDs for these devices.
- make use of device property API
leds-as3645a:
- switch to fwnode property API
LED related addition to ACPI documentation:
- document how to refer to LEDs from remote nodes
LED related fix to ALSA line6/toneport driver:
- avoid polluting led_* namespace
And lm3532 driver relocation from MFD to LED subsystem, accompanied by
various improvements and optimizations; it entails also a change in
omap4-droid4-xt894.dts:
- leds: lm3532: Introduce the lm3532 LED driver
- mfd: ti-lmu: Remove LM3532 backlight driver references
- ARM: dts: omap4-droid4: Update backlight dt properties
- dt: lm3532: Add lm3532 dt doc and update ti_lmu doc"
* tag 'leds-for-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
leds: avoid races with workqueue
ALSA: line6: Avoid polluting led_* namespace
leds: lm3532: Introduce the lm3532 LED driver
mfd: ti-lmu: Remove LM3532 backlight driver references
ARM: dts: omap4-droid4: Update backlight dt properties
dt: lm3532: Add lm3532 dt doc and update ti_lmu doc
leds: Small fixes for Flash class description
leds: blinkm: clean up double assignment to data->i2c_addr
leds: pca963x: Make use of device property API
leds: pca955x: Make use of device property API
leds: lt3593: Remove unneeded assignment in lt3593_led_probe
leds: lt3593: drop pdata handling code
leds: pca955x: Revert "Add ACPI support"
leds: pca963x: Revert "Add ACPI support"
drivers: leds: Kconfig: pedantic cleanups
ACPI: Document how to refer to LEDs from remote nodes
leds: as3645a: Switch to fwnode property API
Diffstat (limited to 'drivers/leds/leds-pca955x.c')
-rw-r--r-- | drivers/leds/leds-pca955x.c | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index f51b356d4426..a9f5dad55956 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -40,7 +40,6 @@ * bits the chip supports. */ -#include <linux/acpi.h> #include <linux/ctype.h> #include <linux/delay.h> #include <linux/err.h> @@ -48,8 +47,8 @@ #include <linux/i2c.h> #include <linux/leds.h> #include <linux/module.h> -#include <linux/of_device.h> #include <linux/of.h> +#include <linux/property.h> #include <linux/slab.h> #include <linux/string.h> @@ -110,15 +109,6 @@ static const struct i2c_device_id pca955x_id[] = { }; MODULE_DEVICE_TABLE(i2c, pca955x_id); -static const struct acpi_device_id pca955x_acpi_ids[] = { - { "PCA9550", pca9550 }, - { "PCA9551", pca9551 }, - { "PCA9552", pca9552 }, - { "PCA9553", pca9553 }, - { } -}; -MODULE_DEVICE_TABLE(acpi, pca955x_acpi_ids); - struct pca955x { struct mutex lock; struct pca955x_led *leds; @@ -373,16 +363,14 @@ static int pca955x_gpio_direction_output(struct gpio_chip *gc, } #endif /* CONFIG_LEDS_PCA955X_GPIO */ -#if IS_ENABLED(CONFIG_OF) static struct pca955x_platform_data * -pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip) +pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip) { - struct device_node *np = client->dev.of_node; - struct device_node *child; struct pca955x_platform_data *pdata; + struct fwnode_handle *child; int count; - count = of_get_child_count(np); + count = device_get_child_node_count(&client->dev); if (!count || count > chip->bits) return ERR_PTR(-ENODEV); @@ -396,24 +384,25 @@ pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip) if (!pdata->leds) return ERR_PTR(-ENOMEM); - for_each_child_of_node(np, child) { + device_for_each_child_node(&client->dev, child) { const char *name; u32 reg; int res; - res = of_property_read_u32(child, "reg", ®); + res = fwnode_property_read_u32(child, "reg", ®); if ((res != 0) || (reg >= chip->bits)) continue; - if (of_property_read_string(child, "label", &name)) - name = child->name; + res = fwnode_property_read_string(child, "label", &name); + if ((res != 0) && is_of_node(child)) + name = to_of_node(child)->name; snprintf(pdata->leds[reg].name, sizeof(pdata->leds[reg].name), "%s", name); pdata->leds[reg].type = PCA955X_TYPE_LED; - of_property_read_u32(child, "type", &pdata->leds[reg].type); - of_property_read_string(child, "linux,default-trigger", + fwnode_property_read_u32(child, "type", &pdata->leds[reg].type); + fwnode_property_read_string(child, "linux,default-trigger", &pdata->leds[reg].default_trigger); } @@ -429,15 +418,7 @@ static const struct of_device_id of_pca955x_match[] = { { .compatible = "nxp,pca9553", .data = (void *)pca9553 }, {}, }; - MODULE_DEVICE_TABLE(of, of_pca955x_match); -#else -static struct pca955x_platform_data * -pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip) -{ - return ERR_PTR(-ENODEV); -} -#endif static int pca955x_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -450,20 +431,11 @@ static int pca955x_probe(struct i2c_client *client, struct pca955x_platform_data *pdata; int ngpios = 0; - if (id) { - chip = &pca955x_chipdefs[id->driver_data]; - } else { - const struct acpi_device_id *acpi_id; - - acpi_id = acpi_match_device(pca955x_acpi_ids, &client->dev); - if (!acpi_id) - return -ENODEV; - chip = &pca955x_chipdefs[acpi_id->driver_data]; - } + chip = &pca955x_chipdefs[id->driver_data]; adapter = to_i2c_adapter(client->dev.parent); pdata = dev_get_platdata(&client->dev); if (!pdata) { - pdata = pca955x_pdata_of_init(client, chip); + pdata = pca955x_get_pdata(client, chip); if (IS_ERR(pdata)) return PTR_ERR(pdata); } @@ -602,8 +574,7 @@ static int pca955x_probe(struct i2c_client *client, static struct i2c_driver pca955x_driver = { .driver = { .name = "leds-pca955x", - .acpi_match_table = ACPI_PTR(pca955x_acpi_ids), - .of_match_table = of_match_ptr(of_pca955x_match), + .of_match_table = of_pca955x_match, }, .probe = pca955x_probe, .id_table = pca955x_id, |