From patchwork Tue Sep 23 04:04:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 392219 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 6D2CA1400BE for ; Tue, 23 Sep 2014 14:03:58 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990AbaIWEDn (ORCPT ); Tue, 23 Sep 2014 00:03:43 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:60255 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbaIWEDj (ORCPT ); Tue, 23 Sep 2014 00:03:39 -0400 Received: by mail-pa0-f54.google.com with SMTP id fb1so5847051pad.27 for ; Mon, 22 Sep 2014 21:03: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=Q8gVNrZk1g8x6OjEABsNd8g2S0WZa2sjiZ19AhupOc4=; b=dIYx727VAsFxidqwsAEebWefQAGT5y8y3NOHPSSIlfUf7wM26Im6gHmwzWb3/QGgdw rM9wtdtv/WpVIp2wXil2gsICmT2YIKGbE0Y/4eXmyc4CW1Dg6sPx+R+La8YCEyj8Z5c8 N1rRs+fKE/4DLPO2z5ex1gwhg+2Gv0a9TozFDJCR7ZTgaxzo/8Uc7ogMwRDh3HK7LXQe 41lSCX6F0BrmaNB2No73gCFINpn86unF5c1L+L4nKidGyuU1N2uWFgU6bEqVw23w2zfe M8+Vivbyb6w6kHhj0QvbmafUol1s1EKX8HWP3XTlMKmM8C1eesTMORe0GXOdHML9ekTw oF3A== X-Received: by 10.67.15.71 with SMTP id fm7mr30641710pad.45.1411445018642; Mon, 22 Sep 2014 21:03:38 -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 uf6sm10786495pac.16.2014.09.22.21.03.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Sep 2014 21:03:38 -0700 (PDT) From: Matt Ranostay To: galak@codeaurora.org, dmitry.torokhov@gmail.com, zonque@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org Cc: devicetree@vger.kernel.org, Matt Ranostay Subject: [PATCH v2 2/2] cap1106: support for irq-active-high option Date: Mon, 22 Sep 2014 21:04:17 -0700 Message-Id: <1411445057-30048-3-git-send-email-mranostay@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411445057-30048-1-git-send-email-mranostay@gmail.com> References: <1411445057-30048-1-git-send-email-mranostay@gmail.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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/cap1106.txt | 4 ++++ drivers/input/keyboard/cap1106.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/input/cap1106.txt b/Documentation/devicetree/bindings/input/cap1106.txt index 4b46390..6f5a143 100644 --- a/Documentation/devicetree/bindings/input/cap1106.txt +++ b/Documentation/devicetree/bindings/input/cap1106.txt @@ -26,6 +26,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/cap1106.c b/drivers/input/keyboard/cap1106.c index 07f9e88..d5ce060 100644 --- a/drivers/input/keyboard/cap1106.c +++ b/drivers/input/keyboard/cap1106.c @@ -47,6 +47,7 @@ #define CAP1106_REG_STANDBY_SENSITIVITY 0x42 #define CAP1106_REG_STANDBY_THRESH 0x43 #define CAP1106_REG_CONFIG2 0x44 +#define CAP1106_REG_CONFIG2_ALT_POL BIT(6) #define CAP1106_REG_SENSOR_BASE_CNT(X) (0x50 + (X)) #define CAP1106_REG_SENSOR_CALIB (0xb1 + (X)) #define CAP1106_REG_SENSOR_CALIB_LSB1 0xb9 @@ -260,6 +261,13 @@ static int cap1106_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, CAP1106_REG_CONFIG2, + CAP1106_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;