History

leds: pca955x: Add ACPI support

This patch enables ACPI support for leds-pca955x driver.

Tin Huynh committed 9 years ago

Commit 44b3e311 parent 825fe381 file · +22 −2Browse files

Unified · Split

drivers/leds/leds-pca955x.c+22−2
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 * bits the chip supports.
4141 */
4242
43+#include <linux/acpi.h>
4344 #include <linux/module.h>
4445 #include <linux/delay.h>
4546 #include <linux/string.h>
@@ -100,6 +101,15 @@ static const struct i2c_device_id pca955x_id[] = { · 54 unmodified lines
100101 };
101102 MODULE_DEVICE_TABLE(i2c, pca955x_id);
102103
104+static const struct acpi_device_id pca955x_acpi_ids[] = {
105+ { "PCA9550", pca9550 },
106+ { "PCA9551", pca9551 },
107+ { "PCA9552", pca9552 },
108+ { "PCA9553", pca9553 },
109+ { }
110+};
111+MODULE_DEVICE_TABLE(acpi, pca955x_acpi_ids);
112+
103113 struct pca955x {
104114 struct mutex lock;
105115 struct pca955x_led *leds;
@@ -250,7 +260,16 @@ static int pca955x_probe(struct i2c_client *client, · 144 unmodified lines
250260 struct led_platform_data *pdata;
251261 int i, err;
252262
253− chip = &pca955x_chipdefs[id->driver_data];
263+ if (id) {
264+ chip = &pca955x_chipdefs[id->driver_data];
265+ } else {
266+ const struct acpi_device_id *acpi_id;
267+
268+ acpi_id = acpi_match_device(pca955x_acpi_ids, &client->dev);
269+ if (!acpi_id)
270+ return -ENODEV;
271+ chip = &pca955x_chipdefs[acpi_id->driver_data];
272+ }
254273 adapter = to_i2c_adapter(client->dev.parent);
255274 pdata = dev_get_platdata(&client->dev);
256275
@@ -264,7 +283,7 @@ static int pca955x_probe(struct i2c_client *client, · 7 unmodified lines
264283
265284 dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at "
266285 "slave address 0x%02x\n",
267− id->name, chip->bits, client->addr);
286+ client->name, chip->bits, client->addr);
268287
269288 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
270289 return -EIO;
@@ -358,6 +377,7 @@ static int pca955x_remove(struct i2c_client *client) · 87 unmodified lines
358377 static struct i2c_driver pca955x_driver = {
359378 .driver = {
360379 .name = "leds-pca955x",
380+ .acpi_match_table = ACPI_PTR(pca955x_acpi_ids),
361381 },
362382 .probe = pca955x_probe,
363383 .remove = pca955x_remove,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t