From patchwork Tue Nov 29 04:18:20 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: 9450901 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 C218D6074E for ; Tue, 29 Nov 2016 04:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD73527E63 for ; Tue, 29 Nov 2016 04:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B060E27F95; Tue, 29 Nov 2016 04:18:34 +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 4905527E63 for ; Tue, 29 Nov 2016 04:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932178AbcK2ESd (ORCPT ); Mon, 28 Nov 2016 23:18:33 -0500 Received: from mail-pg0-f54.google.com ([74.125.83.54]:36190 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbcK2ESc (ORCPT ); Mon, 28 Nov 2016 23:18:32 -0500 Received: by mail-pg0-f54.google.com with SMTP id f188so64356463pgc.3 for ; Mon, 28 Nov 2016 20:18:32 -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=+CNiDpzVekAqCyxEPYFA+g1W1iAvRwkZ6XnRFps4oOo=; b=SyciNBhFlHnZb4jjj2SzeKS4a6u9GsIg20zzm8l+xpGNEGHeQaEeJHHnQRIA1QFkOn Lah31vVf3ra7+LeAEzW4G2mlOot4TNT4p9Bsgw9K6mBKu2P1qojCazUDHQ4wYMZjMxoc GabVM9vDKmKW7JXsG7LYhNq64h7hVRYpO8Hhg= 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=+CNiDpzVekAqCyxEPYFA+g1W1iAvRwkZ6XnRFps4oOo=; b=iSq9Ljom50gk8yA2+DnJlYnd4rZ3BH8iwF5gwFCzXWsArPKLHnWNXpkYKUhTwi0oVF LPBEwOrjcw/7al2mpTKUwwjTTRrnj4DeVxP8PVSub4dVsn0TIoheejzt2CsR/kTD2Tqa RPED3IKE9t45lgSDyNXutvxSqYgNEMY/2Qli87/9IlVqP2KpPny74oYl3PhsH9NQg8mC +ORaAB1zvwqSrippe4erzHI7mUILq6mHli4g23Grd7T9Y1JMNwzqAvVFlufF5/2f0ClX Bx0YQ3BZPat81svtktvPYVNDxGM/smbErRX63/W3OYLjfNbNQu68pY61ZshvQeAjz3fz nQQQ== X-Gm-Message-State: AKaTC01T0HHTG/h5mav0c6D9Ih3DyWqppMGHgruBdiNCQXl3nhw9fiipumUQYzCOOcM8sBOU X-Received: by 10.99.153.26 with SMTP id d26mr47059683pge.44.1480393111656; Mon, 28 Nov 2016 20:18:31 -0800 (PST) Received: from localhost.localdomain ([118.69.219.197]) by smtp.gmail.com with ESMTPSA id c128sm90639259pfc.39.2016.11.28.20.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 20:18:30 -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 V1] leds: pca963x: Add ACPI support Date: Tue, 29 Nov 2016 11:18:20 +0700 Message-Id: <1480393100-1397-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 | 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 #include #include #include @@ -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,