From patchwork Tue Nov 29 10:21:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tnhuynh@apm.com X-Patchwork-Id: 9451413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0619F60235 for ; Tue, 29 Nov 2016 10:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F350227FE4 for ; Tue, 29 Nov 2016 10:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80FE28138; Tue, 29 Nov 2016 10:22:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE43F27FE4 for ; Tue, 29 Nov 2016 10:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412AbcK2KWD (ORCPT ); Tue, 29 Nov 2016 05:22:03 -0500 Received: from mail-pg0-f49.google.com ([74.125.83.49]:34301 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755120AbcK2KWC (ORCPT ); Tue, 29 Nov 2016 05:22:02 -0500 Received: by mail-pg0-f49.google.com with SMTP id x23so68239038pgx.1 for ; Tue, 29 Nov 2016 02:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=FWFUTEEv1Imvl4fVjI0xpS0/i7oSXkSM/qykwZRjyJo=; b=mcPat9iRRKEdmVvpX2F/stpOWSribZkNUSYC/17I/QDsNeMIdnhCPGEwiNhgW905k2 d3rS7wDC5aiqsh/nCNH0zxlJy+cusBFy1HD3+FMBNJEssq+D+58aarth2GsWl8Q71EXM h36W2Dx4MpBoI6vEJ70ZnISzvtztlJ57/oD+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FWFUTEEv1Imvl4fVjI0xpS0/i7oSXkSM/qykwZRjyJo=; b=ZymC2UkS1L4CfqCFzZbQ8QkwTtQKlihZwwSCtEH14CxgFzCPKE93ietB82zx6X4yo4 oeAWdVXZvHAn3KdwnIEPQU9bPyUq78qNuzr0mWokJ4Ate16Tr2oXuSJ56rFdowxPvvXv AflZbI+YiOJdFTDWw39bDzjZFCJbtTHCMJigCi+QEit4j6It2OJLPncnCQIIIMBpNDUU AotigsyhjPQxpYnVKlmexPWl/Tn2a+i3rkO9ud/O0YRBEXIgRqnZhvFQ7Ai8Ztv9aCZV sEixi/wc3TTjFArRm99/PHulQMA4hsCzPNec38nmGFrfDNyj5qVy/IoWV/w6grkK9iop l4VA== X-Gm-Message-State: AKaTC01qVaLJ7/KBDX5ZcI2Jof8tzcMAZ5UBLnxZsTgjIIBtZ4HGwt6NhvKiWI5Hz11lVYEI X-Received: by 10.84.164.162 with SMTP id w31mr60293820pla.9.1480414921296; Tue, 29 Nov 2016 02:22:01 -0800 (PST) Received: from localhost.localdomain ([118.69.219.197]) by smtp.gmail.com with ESMTPSA id o29sm57649921pgn.28.2016.11.29.02.21.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 02:22:00 -0800 (PST) From: Tin Huynh To: Mika Westerberg , "Rafael J. Wysocki" , Richard Purdie , Jacek Anaszewski Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Loc Ho , Thang Nguyen , Phong Vo , patches@apm.com, Tin Huynh Subject: [PATCH V2] leds: pca963x: Add ACPI support Date: Tue, 29 Nov 2016 17:21:50 +0700 Message-Id: <1480414910-16691-1-git-send-email-tnhuynh@apm.com> X-Mailer: git-send-email 1.7.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables ACPI support for leds-pca963x driver. Signed-off-by: Tin Huynh Acked-by: Mika Westerberg --- drivers/leds/leds-pca963x.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) Change from V1: -Add CONFIG_ACPI. diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 407eba1..57f11e3 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 #include #include #include @@ -95,6 +96,17 @@ struct pca963x_chipdef { }; MODULE_DEVICE_TABLE(i2c, pca963x_id); +#ifdef CONFIG_ACPI +static const struct acpi_device_id pca963x_acpi_ids[] = { + { "PCA9632", pca9633 }, + { "PCA9633", pca9633 }, + { "PCA9634", pca9634 }, + { "PCA9635", pca9635 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, pca963x_acpi_ids); +#endif + struct pca963x_led; struct pca963x { @@ -322,7 +334,17 @@ 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(ACPI_PTR(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 +448,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,