From patchwork Fri Jul 24 05:05:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dudley Du X-Patchwork-Id: 6857271 Return-Path: X-Original-To: patchwork-linux-input@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 E1EED9F1D4 for ; Fri, 24 Jul 2015 05:15:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F174C20523 for ; Fri, 24 Jul 2015 05:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1A4620525 for ; Fri, 24 Jul 2015 05:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753463AbbGXFPy (ORCPT ); Fri, 24 Jul 2015 01:15:54 -0400 Received: from smtp1.cypress.com ([157.95.67.100]:44704 "EHLO smtp1.cypress.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbbGXFPu (ORCPT ); Fri, 24 Jul 2015 01:15:50 -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 t6O56g4A027858; Thu, 23 Jul 2015 22:06:42 -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 t6O56grp015749; Thu, 23 Jul 2015 22:06:42 -0700 Received: from localhost ([172.23.6.229]) by mailhost.mis.cypress.com (8.12.11/8.12.11) with ESMTP id t6O56fY4016129; Thu, 23 Jul 2015 22:06:41 -0700 (PDT) From: Dudley Du To: dmitry.torokhov@gmail.com, mark.rutland@arm.com, robh+dt@kernel.org 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 2/3] input: cyapa: add of match device support and description document Date: Fri, 24 Jul 2015 13:05:58 +0800 Message-Id: <1437714359-2484-3-git-send-email-dudl@cypress.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437714359-2484-1-git-send-email-dudl@cypress.com> References: <1437714359-2484-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: t6O56g4A027858 X-Cypress-MailScanner-From: dudl@cypress.com X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add of_match_device mechanism support for Cypress trackpad device, and add the sample description document on how to adding the trackpad device node in the device tree. 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 d444757..57c0f5f 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -54,6 +54,7 @@ cortina Cortina Systems, Inc. cosmic Cosmic Circuits crystalfontz Crystalfontz America, Inc. cubietech Cubietech, Ltd. +cypress Cypress Semiconductor Corporation dallas Maxim Integrated Products (formerly Dallas Semiconductor) davicom DAVICOM Semiconductor, Inc. delta Delta Electronics, Inc. diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 2159c5e..3431510 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "cyapa.h" @@ -1486,11 +1487,20 @@ 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", .pm = &cyapa_pm_ops, .acpi_match_table = ACPI_PTR(cyapa_acpi_id), + .of_match_table = of_match_ptr(cyapa_of_match), }, .probe = cyapa_probe,