From patchwork Wed Oct 15 05:38:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 5083991 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 746A39FB83 for ; Wed, 15 Oct 2014 05:37:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A412D200F3 for ; Wed, 15 Oct 2014 05:37:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B789B20120 for ; Wed, 15 Oct 2014 05:37:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751103AbaJOFhl (ORCPT ); Wed, 15 Oct 2014 01:37:41 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:41866 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751069AbaJOFhi (ORCPT ); Wed, 15 Oct 2014 01:37:38 -0400 Received: by mail-pd0-f176.google.com with SMTP id fp1so617871pdb.7 for ; Tue, 14 Oct 2014 22:37:38 -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=9L5ZtLeZKlHRrF7F6OPIga60vdP0i0Aaw+h3jjXH46Q=; b=ce6OaVMWYe9lvxLsWb2su/A2btqOm49cf3kKJsfqBKawY6Jhp+mJ0a20xOLMofo8VQ wir4Uxir00fT9vdPwvqaQHx7GrzVvmfoMbz7t6tZXN8zO+P/Pka9Th0A8EScqsV1tjZ4 ZLCaiREnaUvdHbsELrQAR9IFmt8GckbyOeCqHj7M/7OeAjP+QakeoR4DmwDon/PFZd6A JJy+lmrolEMnflZAo5eed3CuwlhyeSZ6VCFH0sQv92AuM8gJrLvHZZC2KlKgKt5/fhur /v4nkXaOuHRpR8eunsXB6c/hBGdJDYjw4nIp10Dzk4Js7oJUCeJiIVIlEtqkBVco1EgN whWw== X-Received: by 10.66.228.131 with SMTP id si3mr10527669pac.32.1413351458037; Tue, 14 Oct 2014 22:37:38 -0700 (PDT) Received: from niteshade.hsd1.or.comcast.net ([73.11.13.125]) by mx.google.com with ESMTPSA id rx2sm8434067pbc.50.2014.10.14.22.37.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 22:37:37 -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 v7 3/3] cap11xx: support for irq-active-high option Date: Tue, 14 Oct 2014 22:38:27 -0700 Message-Id: <1413351507-6611-4-git-send-email-mranostay@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413351507-6611-1-git-send-email-mranostay@gmail.com> References: <1413351507-6611-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=unavailable 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 61d20d8..7d0a300 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 91effe5..0ae7d2f 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 @@ -253,6 +254,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 < cap->num_channels; i++) priv->keycodes[i] = KEY_A + i;