From patchwork Fri Oct 10 04:23:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 5063511 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B89CDC11AD for ; Fri, 10 Oct 2014 04:22:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFA382022A for ; Fri, 10 Oct 2014 04:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F07692022D for ; Fri, 10 Oct 2014 04:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbaJJEWv (ORCPT ); Fri, 10 Oct 2014 00:22:51 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:42651 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbaJJEWu (ORCPT ); Fri, 10 Oct 2014 00:22:50 -0400 Received: by mail-pd0-f181.google.com with SMTP id z10so889612pdj.26 for ; Thu, 09 Oct 2014 21:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uEzvz1Al/zOiXEA7ZmT2T59D+gt0LyK36akxviKPpLI=; b=RKRl2Gd8pZ5aYl5EfC3Yb3gZrynx8+jVyog7zTlq2mJKLf7gczCoJq9zHD3I2oDlna 6qTtgZ2kmSMQjISyUIN7yjmiJlPJY36V1k55WWoykp3jx6TxMZ4dcGNK6hGQKL1jw93R yLr4a9Z0qWTCsm09ZDpDhSoNIaCGmxx/4LKwjHIa0FmPoVrudWTAigvFoLAsn4meEQMp kx4At5D7adI9dmuNVqNdd0JtpMLAndXSDgtL8dzwvqVGYWRWw090SamhuS81e+OL9zYe ZIkTnxAGu7V3UuNWZ6nZHQ9Cv1bNBZ45f42iFODWgONDbcUoPba7Q8rtZZ8do3HZWxR9 PqTA== X-Received: by 10.68.245.135 with SMTP id xo7mr50790pbc.161.1412914970233; Thu, 09 Oct 2014 21:22:50 -0700 (PDT) Received: from niteshade.hsd1.or.comcast.net (c-50-186-57-65.hsd1.or.comcast.net. [50.186.57.65]) by mx.google.com with ESMTPSA id iu10sm1983560pbd.57.2014.10.09.21.22.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Oct 2014 21:22:49 -0700 (PDT) From: Matt Ranostay To: dmitry.torokhov@gmail.com, galak@codeaurora.org, zonque@gmail.com Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, Matt Ranostay Subject: [PATCH v5 3/3] cap11xx: support for irq-active-high option Date: Thu, 9 Oct 2014 21:23:03 -0700 Message-Id: <1412914983-3742-4-git-send-email-mranostay@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412914983-3742-1-git-send-email-mranostay@gmail.com> References: <1412914983-3742-1-git-send-email-mranostay@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Some applications need to use the irq-active-high push-pull option. This allows it be enabled in the device tree child node. Signed-off-by: Matt Ranostay --- Documentation/devicetree/bindings/input/cap11xx.txt | 4 ++++ drivers/input/keyboard/cap11xx.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt index 8031aa5..57407be 100644 --- a/Documentation/devicetree/bindings/input/cap11xx.txt +++ b/Documentation/devicetree/bindings/input/cap11xx.txt @@ -28,6 +28,10 @@ Optional properties: Valid values are 1, 2, 4, and 8. By default, a gain of 1 is set. + microchip,irq-active-high: By default the interrupt pin is active low + open drain. This property allows using the active + high push-pull output. + linux,keycodes: Specifies an array of numeric keycode values to be used for the channels. If this property is omitted, KEY_A, KEY_B, etc are used as diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index b605134..a75b8fc 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -45,6 +45,7 @@ #define CAP11XX_REG_STANDBY_SENSITIVITY 0x42 #define CAP11XX_REG_STANDBY_THRESH 0x43 #define CAP11XX_REG_CONFIG2 0x44 +#define CAP11XX_REG_CONFIG2_ALT_POL BIT(6) #define CAP11XX_REG_SENSOR_BASE_CNT(X) (0x50 + (X)) #define CAP11XX_REG_SENSOR_CALIB (0xb1 + (X)) #define CAP11XX_REG_SENSOR_CALIB_LSB1 0xb9 @@ -255,6 +256,13 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client, dev_err(dev, "Invalid sensor-gain value %d\n", gain32); } + if (of_property_read_bool(node, "microchip,irq-active-high")) { + error = regmap_update_bits(priv->regmap, CAP11XX_REG_CONFIG2, + CAP11XX_REG_CONFIG2_ALT_POL, 0); + if (error) + return error; + } + /* Provide some useful defaults */ for (i = 0; i < priv->num_channels; i++) priv->keycodes[i] = KEY_A + i;