From patchwork Tue Sep 22 10:10:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 7237821 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A72D9F380 for ; Tue, 22 Sep 2015 10:11:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D612205F1 for ; Tue, 22 Sep 2015 10:11:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C4CC205F2 for ; Tue, 22 Sep 2015 10:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757846AbbIVKLB (ORCPT ); Tue, 22 Sep 2015 06:11:01 -0400 Received: from mga02.intel.com ([134.134.136.20]:60329 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757841AbbIVKK7 (ORCPT ); Tue, 22 Sep 2015 06:10:59 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 22 Sep 2015 03:10:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,572,1437462000"; d="scan'208";a="810310988" Received: from black.fi.intel.com ([10.237.72.93]) by orsmga002.jf.intel.com with ESMTP; 22 Sep 2015 03:10:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 042A63C5; Tue, 22 Sep 2015 13:10:20 +0300 (EEST) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, Lee Jones , Wolfram Sang , Linus Walleij , "Rafael J. Wysocki" , Mika Westerberg , "Puustinen, Ismo" , "Pandruvada, Srinivas" , linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Thierry Reding Subject: [PATCH v1 8/8] pwm-pca9685: enable ACPI device found on Galileo Gen2 Date: Tue, 22 Sep 2015 13:10:19 +0300 Message-Id: <1442916619-140607-9-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1442916619-140607-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1442916619-140607-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a chip connected to i2c bus on Intel Galileo Gen2 board. Enable it via ACPI ID INT3492. Cc: Thierry Reding Signed-off-by: Andy Shevchenko --- drivers/pwm/Kconfig | 2 +- drivers/pwm/pwm-pca9685.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 062630a..bb114ef 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -242,7 +242,7 @@ config PWM_MXS config PWM_PCA9685 tristate "NXP PCA9685 PWM driver" - depends on OF && I2C + depends on I2C select REGMAP_I2C help Generic PWM framework driver for NXP PCA9685 LED controller. diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c index 70448a6..38ea28b 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include /* * Because the PCA9685 has only one prescaler per chip, changing the period of @@ -297,7 +299,6 @@ static const struct regmap_config pca9685_regmap_i2c_config = { static int pca9685_pwm_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct device_node *np = client->dev.of_node; struct pca9685 *pca; int ret; int mode2; @@ -320,12 +321,12 @@ static int pca9685_pwm_probe(struct i2c_client *client, regmap_read(pca->regmap, PCA9685_MODE2, &mode2); - if (of_property_read_bool(np, "invert")) + if (device_property_read_bool(&client->dev, "invert")) mode2 |= MODE2_INVRT; else mode2 &= ~MODE2_INVRT; - if (of_property_read_bool(np, "open-drain")) + if (device_property_read_bool(&client->dev, "open-drain")) mode2 &= ~MODE2_OUTDRV; else mode2 |= MODE2_OUTDRV; @@ -363,6 +364,12 @@ static const struct i2c_device_id pca9685_id[] = { }; MODULE_DEVICE_TABLE(i2c, pca9685_id); +static const struct acpi_device_id pca9685_acpi_ids[] = { + { "INT3492", 0 }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(acpi, pca9685_acpi_ids); + static const struct of_device_id pca9685_dt_ids[] = { { .compatible = "nxp,pca9685-pwm", }, { /* sentinel */ } @@ -372,6 +379,7 @@ MODULE_DEVICE_TABLE(of, pca9685_dt_ids); static struct i2c_driver pca9685_i2c_driver = { .driver = { .name = "pca9685-pwm", + .acpi_match_table = ACPI_PTR(pca9685_acpi_ids), .of_match_table = pca9685_dt_ids, }, .probe = pca9685_pwm_probe,