Received: by 10.213.65.68 with SMTP id h4csp1105738imn; Wed, 14 Mar 2018 09:45:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELspjEulBd4DgKcpZPpeeGeqvAFHezSiKCexgQ1Iu8uQOW85igXvxiWlMexh1geoJh1iKWF9 X-Received: by 10.99.110.11 with SMTP id j11mr4278674pgc.294.1521045913714; Wed, 14 Mar 2018 09:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045913; cv=none; d=google.com; s=arc-20160816; b=TLNEhVgLSv2V9M4g16PS0TDKfcMlw9Liuxzl7HkjtmwBKdlDAjze9P1Sty0r86lsJh 0Dbkfee9ZEPwmuBSu6vVnO/ejex5HWpuDT5Od7hnZ2zi4YWMdgBJ6HFh+Fbv753SPmcJ vZNFZVPkdk+b4rdymWGNywVDDb5n/EeX+sVhMIVR80solCELpI7y3GkSncztqx3mR5YY Uh5rXjwkDICt3QLwnOi/+dLEcZph4T6He4SH+89aBwWsL5fDGhQIPtCT4YnPNoZWLubG 5H8gGbvavLv/bK9Dm61UAeBJN4j2YeoSRfOF6Ozh2zbRu1v9RVPFwo8Y5vov7Bz6/ZUu R5AA== 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=qqwjCldACk5ax3HBRDY2OcETm62DESJjDncBZYDLOuM=; b=aWNGPkTbvZ2Yem+sFxbWsjnv3FgXKbSdzqnIA3LZFSm9GMxyagFxRtL/r8M7Ow+BUz 9rqr2j4VKCy5SgfF03KVWkABIAF7ev/Hs2mksl1Qos+wtAAEK6f4JEDenrODeISDTKpR wOSxRR393k3TzGHkIiRqLYorBbUmj9zWEfsfdu2gEK9BAiQNf4ctcHBdqHsdhk2gYErn uHaBPT2lZMUgAMcLe07qMGwAuzyl6dKUdh1orM1xlzjDXXwLc5ymPpnx8c3gNUTJ0rPY IYCC5HtwzKNyKIu+IDUPXOaLKqHftw4xnKSAykL6LfoCJQ2xUILPu0yiamiDlOI2hR4N nEHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OZ0akp9Q; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j65si2087722pgc.808.2018.03.14.09.44.59; Wed, 14 Mar 2018 09:45:13 -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=@gmail.com header.s=20161025 header.b=OZ0akp9Q; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751964AbeCNQnw (ORCPT + 99 others); Wed, 14 Mar 2018 12:43:52 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:42577 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbeCNQnu (ORCPT ); Wed, 14 Mar 2018 12:43:50 -0400 Received: by mail-pf0-f193.google.com with SMTP id a16so1634862pfn.9; Wed, 14 Mar 2018 09:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qqwjCldACk5ax3HBRDY2OcETm62DESJjDncBZYDLOuM=; b=OZ0akp9QZ6g4ZwyI2ef47ScvmrPBdOFVb4eiEq1Dz81RKfJT/MShEG2vICrQtsinPH hB9YFEXNCS/JVyAV4O+ThNnIOmvagW/iIW+N6khYXd/1YxrFKKQz+uua8KD112tA+4H0 mFcam+++zxCrbpU03n/jmQ4CowUXy9RJG4W3sP4yQkLaUW5s4I/Mbl5bFwArnvyS4ZGS khzZayZ9tCrOVtotjdaf77FST3TW5aJs2vIxD8yXEopITsAWnoc6HX9QYbv46bRTlGvA 8OrMwGxs7F+LWOONV55Vz6/Rbdh4Xy2cSoYEdFA/UjJ0DJCCMzbUfkLH6UcEGK5NTTGL 8R3A== 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=qqwjCldACk5ax3HBRDY2OcETm62DESJjDncBZYDLOuM=; b=VJzzs96eIfjRAXNB8wNM3+QdlwxQR+JGuNyqENlxIfIKiyKsmQpTU7qQWXwt7pZX7a Q1FDXq2zlkeWe1Q+m+tNBPlI/uUXGoAsZ9qr4ajGsyYogQzTTgKIbf+J5DLJl5WJ7wIn oUdTkXmX10uskBYA3ed2yGFANa+oIbc9FPCSOucPEAsPWsKoYf5MgkT0QD/z4+e9aR7c 0ULru6p+3goMhqi4YvuwK9wNWffF9SnvJxtJaGzFva/b92RQpVNbZ5flRqu/mBDuZpbk /zKCsKmMZiE49JwuBEd+6xHUw95bL3niIRwGr3HLPAcn3neXEPraOv2/M4AV525Z0wMR 3ErA== X-Gm-Message-State: AElRT7FmWPeFVfOBJw5s5yh/EaDob6ol4Wn6cnWL6Rz71c0y1hxD2D9c cLF/MZ7E6sWaockW9d8NMw6lLmyj X-Received: by 10.98.73.205 with SMTP id r74mr2016478pfi.111.1521045829125; Wed, 14 Mar 2018 09:43:49 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id r29sm6025314pfj.99.2018.03.14.09.43.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Mar 2018 09:43:48 -0700 (PDT) Date: Wed, 14 Mar 2018 09:43:46 -0700 From: Dmitry Torokhov To: Bjorn Andersson Cc: Tirupathi Reddy , 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: <20180314164346.GA74407@dtor-ws> References: <1520930158-5854-1-git-send-email-tirupath@codeaurora.org> <20180314024048.GA11034@tuxbook-pro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180314024048.GA11034@tuxbook-pro> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 13, 2018 at 07:40:48PM -0700, Bjorn Andersson wrote: > 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. I prefer keeping it as "error" please. > > > + 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 -- Dmitry