From patchwork Thu Jul 21 16:25:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3025 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2A22023F4D for ; Thu, 21 Jul 2011 16:13:43 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id ECB85A1802C for ; Thu, 21 Jul 2011 16:13:42 +0000 (UTC) Received: by mail-qy0-f180.google.com with SMTP id 30so995796qyk.11 for ; Thu, 21 Jul 2011 09:13:42 -0700 (PDT) Received: by 10.229.44.19 with SMTP id y19mr409104qce.190.1311264822657; Thu, 21 Jul 2011 09:13:42 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs144658qcb; Thu, 21 Jul 2011 09:13:42 -0700 (PDT) Received: by 10.150.47.26 with SMTP id u26mr854213ybu.226.1311264822015; Thu, 21 Jul 2011 09:13:42 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id b10si1793774ibd.134.2011.07.21.09.13.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jul 2011 09:13:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by iyb26 with SMTP id 26so1148341iyb.37 for ; Thu, 21 Jul 2011 09:13:41 -0700 (PDT) Received: by 10.142.61.20 with SMTP id j20mr196851wfa.242.1311264821245; Thu, 21 Jul 2011 09:13:41 -0700 (PDT) Received: from localhost.localdomain ([121.228.79.244]) by mx.google.com with ESMTPS id r12sm728795wfe.13.2011.07.21.09.13.34 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jul 2011 09:13:40 -0700 (PDT) From: Shawn Guo To: linux-input@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org, patches@linaro.org, Shawn Guo , Grant Likely , Sammy He , Eric Miao , Dmitry Torokhov Subject: [PATCH] Input: mma8450: add device tree probe support Date: Fri, 22 Jul 2011 00:25:51 +0800 Message-Id: <1311265551-23233-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 It adds device tree probe support for mma8450 driver. Signed-off-by: Shawn Guo Cc: Grant Likely Cc: Sammy He Cc: Eric Miao Cc: Dmitry Torokhov Acked-by: Grant Likely --- .../devicetree/bindings/input/fsl-mma8450.txt | 11 +++++++++++ drivers/input/misc/mma8450.c | 8 ++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/fsl-mma8450.txt diff --git a/Documentation/devicetree/bindings/input/fsl-mma8450.txt b/Documentation/devicetree/bindings/input/fsl-mma8450.txt new file mode 100644 index 0000000..a00c94c --- /dev/null +++ b/Documentation/devicetree/bindings/input/fsl-mma8450.txt @@ -0,0 +1,11 @@ +* Freescale MMA8450 3-Axis Accelerometer + +Required properties: +- compatible : "fsl,mma8450". + +Example: + +accelerometer: mma8450@1c { + compatible = "fsl,mma8450"; + reg = <0x1c>; +}; diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c index 20f8f92..6c76cf7 100644 --- a/drivers/input/misc/mma8450.c +++ b/drivers/input/misc/mma8450.c @@ -24,6 +24,7 @@ #include #include #include +#include #define MMA8450_DRV_NAME "mma8450" @@ -229,10 +230,17 @@ static const struct i2c_device_id mma8450_id[] = { }; MODULE_DEVICE_TABLE(i2c, mma8450_id); +static const struct of_device_id mma8450_dt_ids[] = { + { .compatible = "fsl,mma8450", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(i2c, mma8450_dt_ids); + static struct i2c_driver mma8450_driver = { .driver = { .name = MMA8450_DRV_NAME, .owner = THIS_MODULE, + .of_match_table = mma8450_dt_ids, }, .probe = mma8450_probe, .remove = __devexit_p(mma8450_remove),