From patchwork Fri Jun 12 06:56:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dudley Du X-Patchwork-Id: 483402 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D0E25140280 for ; Fri, 12 Jun 2015 17:20:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754816AbbFLHTt (ORCPT ); Fri, 12 Jun 2015 03:19:49 -0400 Received: from smtp1.cypress.com ([157.95.67.100]:57981 "EHLO smtp1.cypress.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932214AbbFLHSG (ORCPT ); Fri, 12 Jun 2015 03:18:06 -0400 Received: from corpmail1.cypress.com (corpmail1.mis.cypress.com [172.16.5.228]) by smtp1.cypress.com (8.13.8/8.13.8) with ESMTP id t5C6vWWn016742; Thu, 11 Jun 2015 23:57:32 -0700 Received: from mailhost.mis.cypress.com (mailhost [172.16.2.5]) by corpmail1.cypress.com (8.14.4/8.14.4) with ESMTP id t5C6vWcd011137; Thu, 11 Jun 2015 23:57:32 -0700 Received: from localhost ([172.23.6.229]) by mailhost.mis.cypress.com (8.12.11/8.12.11) with ESMTP id t5C6vUuj005780; Thu, 11 Jun 2015 23:57:31 -0700 (PDT) From: Dudley Du To: dmitry.torokhov@gmail.com, mark.rutland@arm.com, robh+dt@kernel.org, rydberg@euromail.se Cc: Dudley Du , bleung@google.com, jmmahler@gmail.com, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] input: cyapa: add of match device support and description document Date: Fri, 12 Jun 2015 14:56:37 +0800 Message-Id: <1434092198-13018-7-git-send-email-dudl@cypress.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434092198-13018-1-git-send-email-dudl@cypress.com> References: <1434092198-13018-1-git-send-email-dudl@cypress.com> MIME-Version: 1.0 X-Cypress-MailScanner-Information: Please contact the ISP for more information X-Cypress-MailScanner-ID: t5C6vWWn016742 X-Cypress-MailScanner-From: dudl@cypress.com X-Spam-Status: No Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add of_match_device machanism support for Cypress trackpad device, and add the sample description document of adding the trackpad device node in DT. TEST=test on Chromebook. Signed-off-by: Dudley Du --- .../devicetree/bindings/input/cypress,cyapa.txt | 44 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/input/mouse/cyapa.c | 10 +++++ 3 files changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress,cyapa.txt diff --git a/Documentation/devicetree/bindings/input/cypress,cyapa.txt b/Documentation/devicetree/bindings/input/cypress,cyapa.txt new file mode 100644 index 0000000..9be2b44 --- /dev/null +++ b/Documentation/devicetree/bindings/input/cypress,cyapa.txt @@ -0,0 +1,44 @@ +Cypress I2C Touchpad + +Required properties: +- compatible: must be "cypress,cyapa". +- reg: I2C address of the chip. +- interrupt-parent: a phandle for the interrupt controller (see interrupt + binding[0]). +- interrupts: interrupt to which the chip is connected (see interrupt + binding[0]). + +Optional properties: +- wakeup-source: touchpad can be used as a wakeup source. +- pinctrl-names: should be "default" (see pinctrl binding [1]). +- pinctrl-0: a phandle pointing to the pin settings for the device (see + pinctrl binding [1]). +- vcc-supply: a phandle for the regulator supplying 3.3V power. + +[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +[1]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt + +Example: + &i2c0 { + /* ... */ + + /* Cypress Gen3 touchpad */ + touchpad@67 { + compatible = "cypress,cyapa"; + reg = <0x24>; + interrupt-parent = <&gpio>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ + wakeup-source; + }; + + /* Cypress Gen5 and later touchpad */ + touchpad@24 { + compatible = "cypress,cyapa"; + reg = <0x24>; + interrupt-parent = <&gpio>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ + wakeup-source; + }; + + /* ... */ + }; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 728cd0e..4813437 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -48,6 +48,7 @@ cnxt Conexant Systems, Inc. cortina Cortina Systems, Inc. cosmic Cosmic Circuits crystalfontz Crystalfontz America, Inc. +cypress Cypress Semiconductor Corporation dallas Maxim Integrated Products (formerly Dallas Semiconductor) davicom DAVICOM Semiconductor, Inc. denx Denx Software Engineering diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 86f2263..7e7613f 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "cyapa.h" @@ -1562,12 +1563,21 @@ static const struct acpi_device_id cyapa_acpi_id[] = { MODULE_DEVICE_TABLE(acpi, cyapa_acpi_id); #endif +#ifdef CONFIG_OF +static const struct of_device_id cyapa_of_match[] = { + { .compatible = "cypress,cyapa" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, cyapa_of_match); +#endif + static struct i2c_driver cyapa_driver = { .driver = { .name = "cyapa", .owner = THIS_MODULE, .pm = &cyapa_pm_ops, .acpi_match_table = ACPI_PTR(cyapa_acpi_id), + .of_match_table = of_match_ptr(cyapa_of_match), }, .probe = cyapa_probe,