Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752775AbdHBNwG (ORCPT ); Wed, 2 Aug 2017 09:52:06 -0400 Received: from mailgw01.mediatek.com ([218.249.47.110]:49061 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752513AbdHBNwC (ORCPT ); Wed, 2 Aug 2017 09:52:02 -0400 Message-ID: <1501681602.28466.2.camel@mhfsdcap03> Subject: Re: [PATCH 3/4] input: Add MediaTek PMIC keys support From: Chen Zhong To: Matthias Brugger CC: Dmitry Torokhov , Rob Herring , Mark Rutland , Lee Jones , , , , , Date: Wed, 2 Aug 2017 21:46:42 +0800 In-Reply-To: References: <1501643840-21485-1-git-send-email-chen.zhong@mediatek.com> <1501643840-21485-4-git-send-email-chen.zhong@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3405 Lines: 105 On Wed, 2017-08-02 at 12:33 +0200, Matthias Brugger wrote: > > On 08/02/2017 05:17 AM, Chen Zhong wrote: > > This patch add support to handle MediaTek PMIC MT6397/MT6323 key > > interrupts including pwrkey and homekey, also add setting for > > long press key shutdown behavior. > > > > Signed-off-by: Chen Zhong > > --- > > drivers/input/keyboard/mtk-pmic-keys.c | 320 ++++++++++++++++++++++++++++++++ > > 1 file changed, 320 insertions(+) > > create mode 100644 drivers/input/keyboard/mtk-pmic-keys.c > > > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > > new file mode 100644 > > index 0000000..0ea7d17 > > --- /dev/null > > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > > @@ -0,0 +1,320 @@ > > +/* > > + * Copyright (C) 2017 MediaTek, Inc. > > + * > > + * Author: Chen Zhong > > + * > > + * This software is licensed under the terms of the GNU General Public > > + * License version 2, as published by the Free Software Foundation, and > > + * may be copied, distributed, and modified under those terms. > > + * > > + * This program is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define PWRKEY_RST_EN_MASK 0x1 > > +#define PWRKEY_RST_EN_SHIFT 6 > > +#define HOMEKEY_RST_EN_MASK 0x1 > > +#define HOMEKEY_RST_EN_SHIFT 5 > > +#define RST_DU_MASK 0x3 > > +#define RST_DU_SHIFT 8 > > + > > +struct pmic_keys_regs { > > + u32 deb_reg; > > + u32 deb_mask; > > + u32 intsel_reg; > > + u32 intsel_mask; > > +}; > > + > > +#define PMIC_KEYS_REGS(_deb_reg, _deb_mask, _intsel_reg, _intsel_mask) \ > > +{ \ > > + .deb_reg = _deb_reg, \ > > + .deb_mask = _deb_mask, \ > > + .intsel_reg = _intsel_reg, \ > > + .intsel_mask = _intsel_mask, \ > > +} > > + > > +struct pmic_regs { > > + const struct pmic_keys_regs pwrkey_regs; > > + const struct pmic_keys_regs homekey_regs; > > + u32 pmic_rst_reg; > > +}; > > + > > +static const struct pmic_regs mt6397_regs = { > > + .pwrkey_regs = PMIC_KEYS_REGS(MT6397_CHRSTATUS, > > + 0x8, MT6397_INT_RSV, 0x10), > > + .homekey_regs = PMIC_KEYS_REGS(MT6397_OCSTATUS2, > > + 0x10, MT6397_INT_RSV, 0x8), > > + .pmic_rst_reg = MT6397_TOP_RST_MISC, > > +}; > > + > > +static const struct pmic_regs mt6323_regs = { > > + .pwrkey_regs = PMIC_KEYS_REGS(MT6323_CHRSTATUS, > > + 0x2, MT6323_INT_MISC_CON, 0x10), > > + .homekey_regs = PMIC_KEYS_REGS(MT6323_CHRSTATUS, > > + 0x4, MT6323_INT_MISC_CON, 0x8), > > + .pmic_rst_reg = MT6323_TOP_RST_MISC, > > +}; > > Where are this MTxxxx_CHRSTATUS defined? Hi Matthias, They are defined in "linux/mfd/mt63xx/registers.h". > > Regards, > Matthias