Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1531889 > unrolled thread

[PATCH V1] leds: pca963x: Add ACPI support

Started byTin Huynh <tnhuynh@apm.com>
First post2016-11-29 05:20 +0100
Last post2016-11-29 11:10 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V1] leds: pca963x: Add ACPI support Tin Huynh <tnhuynh@apm.com> - 2016-11-29 05:20 +0100
    Re: [PATCH V1] leds: pca963x: Add ACPI support Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-29 10:20 +0100
      Re: [PATCH V1] leds: pca963x: Add ACPI support Tin Huynh <tnhuynh@apm.com> - 2016-11-29 11:10 +0100
        Re: [PATCH V1] leds: pca963x: Add ACPI support Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-11-29 11:30 +0100
      Re: [PATCH V1] leds: pca963x: Add ACPI support Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-11-29 11:10 +0100

#1531889 — [PATCH V1] leds: pca963x: Add ACPI support

FromTin Huynh <tnhuynh@apm.com>
Date2016-11-29 05:20 +0100
Subject[PATCH V1] leds: pca963x: Add ACPI support
Message-ID<sII3D-3lf-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1532016

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2016-11-29 10:20 +0100
Message-ID<sIMJX-6yn-13@gated-at.bofh.it>
In reply to#1531889
On Tue, Nov 29, 2016 at 11:18:20AM +0700, Tin Huynh wrote:
> This patch enables ACPI support for leds-pca963x driver.
> 
> Signed-off-by: Tin Huynh <tnhuynh@apm.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

[toc] | [prev] | [next] | [standalone]


#1532077

FromTin Huynh <tnhuynh@apm.com>
Date2016-11-29 11:10 +0100
Message-ID<sINwm-75C-23@gated-at.bofh.it>
In reply to#1532016
Hi
I got a small bug when compiling without CONFIG_ACPI
I will send out the patch to fix the problem later.

On Tue, Nov 29, 2016 at 5:04 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> Hi Tin,
>
> Thanks for the update.
>
> On 11/29/2016 10:15 AM, Mika Westerberg wrote:
>>
>> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>
>
> Mika, thanks for the review.
>
> Patch applied to the for-next branch of linux-leds.git.
>
> --
> Best regards,
> Jacek Anaszewski



-- 
Sr SW Eng

[toc] | [prev] | [next] | [standalone]


#1532106

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2016-11-29 11:30 +0100
Message-ID<sINPH-7eO-7@gated-at.bofh.it>
In reply to#1532077
On 11/29/2016 11:09 AM, Tin Huynh wrote:
> Hi
> I got a small bug when compiling without CONFIG_ACPI
> I will send out the patch to fix the problem later.

Dropping the patch then.
Could you share the details?

Thanks,
Jacek Anaszewski

> On Tue, Nov 29, 2016 at 5:04 PM, Jacek Anaszewski
> <j.anaszewski@samsung.com> wrote:
>> Hi Tin,
>>
>> Thanks for the update.
>>
>> On 11/29/2016 10:15 AM, Mika Westerberg wrote:
>>>
>>> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>>
>>
>> Mika, thanks for the review.
>>
>> Patch applied to the for-next branch of linux-leds.git.
>>
>> --
>> Best regards,
>> Jacek Anaszewski
>
>
>

[toc] | [prev] | [next] | [standalone]


#1532078

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2016-11-29 11:10 +0100
Message-ID<sINwm-75C-27@gated-at.bofh.it>
In reply to#1532016
Hi Tin,

Thanks for the update.

On 11/29/2016 10:15 AM, Mika Westerberg wrote:
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Mika, thanks for the review.

Patch applied to the for-next branch of linux-leds.git.

-- 
Best regards,
Jacek Anaszewski

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web