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: 995782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6LGDhQU017857 for ; Thu, 21 Jul 2011 16:13:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753054Ab1GUQNm (ORCPT ); Thu, 21 Jul 2011 12:13:42 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:59549 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752901Ab1GUQNl (ORCPT ); Thu, 21 Jul 2011 12:13:41 -0400 Received: by iyb12 with SMTP id 12so981790iyb.19 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 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 21 Jul 2011 16:13:43 +0000 (UTC) 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),