Received: by 10.213.65.68 with SMTP id h4csp715568imn; Tue, 13 Mar 2018 19:42:02 -0700 (PDT) X-Google-Smtp-Source: AG47ELv5zw0VX5QwjdfrDBpzJZeWysWQpej4OuYm5c4zE3gv3gAyMuOf0l3j6L5qgIgabUiIqN/u X-Received: by 10.99.105.70 with SMTP id e67mr2297220pgc.342.1520995322397; Tue, 13 Mar 2018 19:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520995322; cv=none; d=google.com; s=arc-20160816; b=Q/yJ8Ys61Fs4R+4FM/HolkUPZ7CK8ur5/kQVe0Ewyiu/H+CgCdD3/zPDqpeu7OYr67 clpTGJuddXq3MW2bL2GC2UqfJ8kXfktpEjbuyLN9+DOk7SepxJcjSWOn+9RYgXMNRPSw O+ZpjYMYVJRKGNDjr5ghq6MTbPsUvwyVPyyIVfY8nSCEXoy+b+Nf/hEwJmuKubj1FBy8 neSueKdePCXsAlF7imQM8bUqk2FLgd3/tfm1zi3dWEYK1uhZSicYxxDkpvXEriivUr0h ppF8L81jIfqiPsteW1BoJCKzyM32M/ahu9uudYU+Sl5EMwNdCSzMIfRi3UxyZkUfq1YU GM7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=z6En/xR7aeMF/+pGzIPH5Ah1dDOwvZnHXSzyiFZ9bMk=; b=LS+BIK5Jmtpttc7iDyUb4+wJaNjgpbdTACZKMwtZd+8x7JyOKlQR4SMj1PaebWUylR x6AWx1kHxIy924xeWPMoAvP7uucD4AR7yJqGnE5RQrBmPr4FvOcEuh9XHLfT+4rA/F8V 24gOGB0eyg1dT1E2YLiUjPiRlkjnpIH1pGXEd73CsSwT1WyslcjIWNIfJmo13eturt8n XqHpvaRsKDnGpQAuK7kNDN9zexNYdQApAtR+l20LYz4fT6gXIF9Z18j9OpBkY2ATjDns CcE79bSUCB3YTgXmuAvAEAcONxbSmIPWNupeFP6EDO72KVt3l8kLECz+uvLW4vUQKqOJ 2x+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OlIu5n19; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3-v6si1173828plm.240.2018.03.13.19.41.48; Tue, 13 Mar 2018 19:42:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OlIu5n19; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933114AbeCNCkx (ORCPT + 99 others); Tue, 13 Mar 2018 22:40:53 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39666 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932842AbeCNCkv (ORCPT ); Tue, 13 Mar 2018 22:40:51 -0400 Received: by mail-pl0-f67.google.com with SMTP id k22-v6so120943pls.6 for ; Tue, 13 Mar 2018 19:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=z6En/xR7aeMF/+pGzIPH5Ah1dDOwvZnHXSzyiFZ9bMk=; b=OlIu5n19HXJGH3UV9QAZiSsko4YdFH1U98CeniEaYBPsJzkb+ztSIcfW2K7j3dZWsL b3F/MZK1TIBPijgoqPTTXMgwy8QW5oYXicastdRm48ep37zHwnqwR1oajP0tWPG+NXPp RYq+TStkcPhjvAqCXeByI9MAVNM3/g7Bjghz4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=z6En/xR7aeMF/+pGzIPH5Ah1dDOwvZnHXSzyiFZ9bMk=; b=l/sLiXWiwPGVXr/+9pa7B1yiyDZEw9CrxcoJ6IXn4V0bZQABQNgaBhMKl/zIQq2tsb B4ndKk8xMD0SlNzxkNlfuLkVXlywmdv1r7ZQemNDa4jUeb8pg0TwwFRhfK/t/N+Uoxp+ 5mMypjYP8xkiQzOF+RnO5+HsbE96GojavrIcTfNKc/UxG+EGzMJcbz2c9NFwest/oPMQ cFII80iaMSG696EM6sMm91kF/Mjjn2Q4fAzV/f+a9YWuiEzIF42reBYr9K+VCNic3LsI xNaqadsA14qqsjO05kneW0b7DZry3BHdnr0ABZWfNsT0zXlmieNj/+mLecBytOAma3tj oBPA== X-Gm-Message-State: AElRT7F7aN9hWAEB59BbkZOyfWUZLHCuYWVNziIwJLmIcF6GmVolnbBC jqeY3EJE/chbiiGDg7+7tY35HQ== X-Received: by 2002:a17:902:b40c:: with SMTP id x12-v6mr2538082plr.94.1520995250372; Tue, 13 Mar 2018 19:40:50 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id p9sm2237456pff.173.2018.03.13.19.40.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 19:40:49 -0700 (PDT) Date: Tue, 13 Mar 2018 19:40:48 -0700 From: Bjorn Andersson To: Tirupathi Reddy Cc: dmitry.torokhov@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-input@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] Input: pm8941-pwrkey: add resin key capabilities Message-ID: <20180314024048.GA11034@tuxbook-pro> References: <1520930158-5854-1-git-send-email-tirupath@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520930158-5854-1-git-send-email-tirupath@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 13 Mar 01:35 PDT 2018, Tirupathi Reddy wrote: > Add resin key support to handle different types of key events > defined in different platforms. > > Signed-off-by: Tirupathi Reddy > --- > .../bindings/input/qcom,pm8941-pwrkey.txt | 20 ++++++- > drivers/input/misc/pm8941-pwrkey.c | 65 +++++++++++++++++++++- > 2 files changed, 83 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt > index 07bf55f..f499cf8 100644 > --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt > +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt > @@ -20,6 +20,14 @@ PROPERTIES > defined by the binding document describing the node's > interrupt parent. > > +- interrupt-names: > + Usage: required > + Value type: > + Definition: Interrupt names. This list must match up 1-to-1 with the > + interrupts specified in the 'interrupts' property. "kpdpwr" > + must be specified and should be the first entry of the list. > + "resin" may be specified for some platforms. > + > - debounce: > Usage: optional > Value type: > @@ -32,12 +40,22 @@ PROPERTIES > Definition: presence of this property indicates that the KPDPWR_N pin > should be configured for pull up. > > +- linux,code: > + Usage: required for "resin" key > + Value type: > + Definition: The input key-code associated with the resin key. > + Use the linux event codes defined in > + include/dt-bindings/input/linux-event-codes.h For completeness sake I think this should list both the key code for the power key and for the RESIN key. > + > EXAMPLE > > pwrkey@800 { > compatible = "qcom,pm8941-pwrkey"; > reg = <0x800>; > - interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>; > + interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>; > + interrupt-names = "kpdpwr", "resin"; > debounce = <15625>; > bias-pull-up; Do we need to support defining the bias for the resin as well? Perhaps it makes more sense to describe the RESIN key with a separate compatible and define that in a node of its own (we can still implement this in the same driver - if there's any chance of reuse...). > + linux,code = ; > }; > diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c > index 18ad956..2fffc7c 100644 > --- a/drivers/input/misc/pm8941-pwrkey.c > +++ b/drivers/input/misc/pm8941-pwrkey.c > @@ -28,6 +28,7 @@ > > #define PON_RT_STS 0x10 > #define PON_KPDPWR_N_SET BIT(0) > +#define PON_RESIN_N_SET BIT(1) > > #define PON_PS_HOLD_RST_CTL 0x5a > #define PON_PS_HOLD_RST_CTL2 0x5b > @@ -46,6 +47,7 @@ > struct pm8941_pwrkey { > struct device *dev; > int irq; > + u32 resin_key_code; > u32 baseaddr; > struct regmap *regmap; > struct input_dev *input; > @@ -130,6 +132,24 @@ static irqreturn_t pm8941_pwrkey_irq(int irq, void *_data) > return IRQ_HANDLED; > } > > +static irqreturn_t pm8941_resinkey_irq(int irq, void *_data) > +{ > + struct pm8941_pwrkey *pwrkey = _data; > + unsigned int sts; > + int error; > + > + error = regmap_read(pwrkey->regmap, > + pwrkey->baseaddr + PON_RT_STS, &sts); This needs to be broken because the line is 81 chars long, if you use a shorter name for the return value (e.g. "ret") you don't need to do this. > + if (error) > + return IRQ_HANDLED; > + > + input_report_key(pwrkey->input, pwrkey->resin_key_code, > + !!(sts & PON_RESIN_N_SET)); Put pwrkey->resin_key_code in a local variable named "key" (or even key_code) and you don't need to line wrap this one. > + input_sync(pwrkey->input); > + > + return IRQ_HANDLED; > +} > + Regards, Bjorn