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
40 * bits the chip supports.40 * bits the chip supports.
41 */41 */
42 42
43#include <linux/acpi.h>
43#include <linux/module.h>44#include <linux/module.h>
44#include <linux/delay.h>45#include <linux/delay.h>
45#include <linux/string.h>46#include <linux/string.h>
@@ -100,6 +101,15 @@ static const struct i2c_device_id pca955x_id[] = { · 54 unmodified lines
100};101};
101MODULE_DEVICE_TABLE(i2c, pca955x_id);102MODULE_DEVICE_TABLE(i2c, pca955x_id);
102 103
104static const struct acpi_device_id pca955x_acpi_ids[] = {
105 { "PCA9550", pca9550 },
106 { "PCA9551", pca9551 },
107 { "PCA9552", pca9552 },
108 { "PCA9553", pca9553 },
109 { }
110};
111MODULE_DEVICE_TABLE(acpi, pca955x_acpi_ids);
112
103struct pca955x {113struct pca955x {
104 struct mutex lock;114 struct mutex lock;
105 struct pca955x_led *leds;115 struct pca955x_led *leds;
@@ -250,7 +260,16 @@ static int pca955x_probe(struct i2c_client *client, · 144 unmodified lines
250 struct led_platform_data *pdata;260 struct led_platform_data *pdata;
251 int i, err;261 int i, err;
252 262
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 }
254 adapter = to_i2c_adapter(client->dev.parent);273 adapter = to_i2c_adapter(client->dev.parent);
255 pdata = dev_get_platdata(&client->dev);274 pdata = dev_get_platdata(&client->dev);
256 275
@@ -264,7 +283,7 @@ static int pca955x_probe(struct i2c_client *client, · 7 unmodified lines
264 283
265 dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at "284 dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at "
266 "slave address 0x%02x\n",285 "slave address 0x%02x\n",
267 id->name, chip->bits, client->addr);286 client->name, chip->bits, client->addr);
268 287
269 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))288 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
270 return -EIO;289 return -EIO;
@@ -358,6 +377,7 @@ static int pca955x_remove(struct i2c_client *client) · 87 unmodified lines
358static struct i2c_driver pca955x_driver = {377static struct i2c_driver pca955x_driver = {
359 .driver = {378 .driver = {
360 .name = "leds-pca955x",379 .name = "leds-pca955x",
380 .acpi_match_table = ACPI_PTR(pca955x_acpi_ids),
361 },381 },
362 .probe = pca955x_probe,382 .probe = pca955x_probe,
363 .remove = pca955x_remove,383 .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