From: Tin Huynh <tnhuynh@apm.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Richard Purdie <rpurdie@rpsys.net>,
Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, Loc Ho <lho@apm.com>,
Thang Nguyen <tqnguyen@apm.com>, Phong Vo <pvo@apm.com>,
patches@apm.com, Tin Huynh <tnhuynh@apm.com>
Subject: [PATCH V1] leds: pca963x: Add ACPI support
Date: Tue, 29 Nov 2016 11:18:20 +0700 [thread overview]
Message-ID: <1480393100-1397-1-git-send-email-tnhuynh@apm.com> (raw)
This patch enables ACPI support for leds-pca963x driver.
Signed-off-by: Tin Huynh <tnhuynh@apm.com>
---
drivers/leds/leds-pca963x.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index 407eba1..be51a12 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -25,6 +25,7 @@
* or by adding the 'nxp,hw-blink' property to the DTS.
*/
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/string.h>
@@ -95,6 +96,15 @@ struct pca963x_chipdef {
};
MODULE_DEVICE_TABLE(i2c, pca963x_id);
+static const struct acpi_device_id pca963x_acpi_ids[] = {
+ { "PCA9632", pca9633 },
+ { "PCA9633", pca9633 },
+ { "PCA9634", pca9634 },
+ { "PCA9635", pca9635 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, pca963x_acpi_ids);
+
struct pca963x_led;
struct pca963x {
@@ -322,7 +332,16 @@ static int pca963x_probe(struct i2c_client *client,
struct pca963x_chipdef *chip;
int i, err;
- chip = &pca963x_chipdefs[id->driver_data];
+ if (id) {
+ chip = &pca963x_chipdefs[id->driver_data];
+ } else {
+ const struct acpi_device_id *acpi_id;
+
+ acpi_id = acpi_match_device(pca963x_acpi_ids, &client->dev);
+ if (!acpi_id)
+ return -ENODEV;
+ chip = &pca963x_chipdefs[acpi_id->driver_data];
+ }
pdata = dev_get_platdata(&client->dev);
if (!pdata) {
@@ -426,6 +445,7 @@ static int pca963x_remove(struct i2c_client *client)
.driver = {
.name = "leds-pca963x",
.of_match_table = of_match_ptr(of_pca963x_match),
+ .acpi_match_table = ACPI_PTR(pca963x_acpi_ids),
},
.probe = pca963x_probe,
.remove = pca963x_remove,
--
1.7.1
next reply other threads:[~2016-11-29 4:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 4:18 Tin Huynh [this message]
2016-11-29 9:15 ` Mika Westerberg
2016-11-29 10:04 ` Jacek Anaszewski
2016-11-29 10:09 ` Tin Huynh
2016-11-29 10:24 ` Jacek Anaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480393100-1397-1-git-send-email-tnhuynh@apm.com \
--to=tnhuynh@apm.com \
--cc=j.anaszewski@samsung.com \
--cc=lho@apm.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=patches@apm.com \
--cc=pvo@apm.com \
--cc=rjw@rjwysocki.net \
--cc=rpurdie@rpsys.net \
--cc=tqnguyen@apm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®