From patchwork Wed Jul 3 16:48:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5442F13B1 for ; Wed, 3 Jul 2019 16:50:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42B0B1FE84 for ; Wed, 3 Jul 2019 16:50:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36A4028998; Wed, 3 Jul 2019 16:50:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 642571FE84 for ; Wed, 3 Jul 2019 16:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfGCQtm (ORCPT ); Wed, 3 Jul 2019 12:49:42 -0400 Received: from mout.gmx.net ([212.227.15.18]:60141 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbfGCQtl (ORCPT ); Wed, 3 Jul 2019 12:49:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172512; bh=0w7nyu9wSyUNFugecpftxoveFd04MwndiFhERzCcH4U=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PYCf/wvNcQPJqzK+6TrPDe4U1s3nWPkcTSLDXO7gGiKpTIDfc7nv5PJV3SbxXc7Xw LeRsR1//wn5WyWNxELldcMXnjAt1fNkanjNfcJEqmb3szfmhO4k6naSQFo58U5pvew 8jpdomMfHcgQrEMVZu4sW6iJ4sPXLyv8kVwZWCXM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M1Ygz-1hhKrD2Xhj-0032k6; Wed, 03 Jul 2019 18:48:32 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 1/7] docs: dt-bindings: add poweroff Date: Wed, 3 Jul 2019 18:48:16 +0200 Message-Id: <20190703164822.17924-2-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:RaJfCMIYAXb0FRWR7atb1Wt8tqSDqFVstf8i87J53HmZBA/WEAg 8LprSsryrnuZeOepH5JTe1QAJSgeVotvVYsGLs6vhRAbo862eWgtojUHsuKT0EBbNS2dWBO R2U9uzKnD1fziJD6yy+RdFdfe+Y+MnXjt3uOOKFlS3d3DJT8Pxz92w9+sjvWeX5O/0dxnWB hHc3AvQQ7ORjbRBCJsiZg== X-UI-Out-Filterresults: notjunk:1;V03:K0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y8 dr6wRWdiqKoEp7nV0v+UBliPBigRdTjSwnipfxpSr0CpBGuV1IPOG/Z/9jISlQP4O6PpxdqyU sxej10Kq0vp0m0= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl add documentation for pmic, rtc and power/reset devicetree bindings Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- .../devicetree/bindings/mfd/mt6397.txt | 10 ++++++- .../bindings/power/reset/mt6323-poweroff.txt | 20 +++++++++++++ .../devicetree/bindings/rtc/rtc-mt6397.txt | 29 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt -- 2.17.1 diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt index 0ebd08af777d..44acb9827716 100644 --- a/Documentation/devicetree/bindings/mfd/mt6397.txt +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt @@ -8,6 +8,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules: - Clock - LED - Keys +- Power controller It is interfaced to host controller using SPI interface by a proprietary hardware called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap. @@ -22,8 +23,10 @@ compatible: "mediatek,mt6397" or "mediatek,mt6323" Optional subnodes: - rtc - Required properties: + Required properties: Should be one of follows + - compatible: "mediatek,mt6323-rtc" - compatible: "mediatek,mt6397-rtc" + For details, see Documentation/devicetree/bindings/rtc/rtc-mt6397.txt - regulators Required properties: - compatible: "mediatek,mt6397-regulator" @@ -46,6 +49,11 @@ Optional subnodes: - compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" see Documentation/devicetree/bindings/input/mtk-pmic-keys.txt +- power-controller + Required properties: + - compatible: "mediatek,mt6323-pwrc" + For details, see Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt + Example: pwrap: pwrap@1000f000 { compatible = "mediatek,mt8135-pwrap"; diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt new file mode 100644 index 000000000000..933f0c48e887 --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt @@ -0,0 +1,20 @@ +Device Tree Bindings for Power Controller on MediaTek PMIC + +The power controller which could be found on PMIC is responsible for externally +powering off or on the remote MediaTek SoC through the circuit BBPU. + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-pwrc": for MT6323 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + } diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt new file mode 100644 index 000000000000..ebd1cf80dcc8 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt @@ -0,0 +1,29 @@ +Device-Tree bindings for MediaTek PMIC based RTC + +MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works +as a type of multi-function device (MFD). The RTC can be configured and set up +with PMIC wrapper bus which is a common resource shared with the other +functions found on the same PMIC. + +For MediaTek PMIC MFD bindings, see: +Documentation/devicetree/bindings/mfd/mt6397.txt + +For MediaTek PMIC wrapper bus bindings, see: +Documentation/devicetree/bindings/soc/mediatek/pwrap.txt + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-rtc": for MT6323 PMIC + "mediatek,mt6397-rtc": for MT6397 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; + }; From patchwork Wed Jul 3 16:48:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA456138B for ; Wed, 3 Jul 2019 16:49:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98D711FE84 for ; Wed, 3 Jul 2019 16:49:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B31A28998; Wed, 3 Jul 2019 16:49:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 098C81FE84 for ; Wed, 3 Jul 2019 16:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727168AbfGCQtn (ORCPT ); Wed, 3 Jul 2019 12:49:43 -0400 Received: from mout.gmx.net ([212.227.15.15]:48097 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727117AbfGCQtl (ORCPT ); Wed, 3 Jul 2019 12:49:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172514; bh=/9xBDfa8MmyCEGy9lts4eV0fUCDWP2vWjFBrUMAHZIw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=NJL6u9vCVUAcj0aiV9JL+ahQq/Z3X+rRu6afSaN6dMYm+Evbul46DCtz365/Naq2f RSTEGdTVeueXpiveIakMux/69G0mtdqLpPiDN3f+KIueDJAgt0jB0lZ8ej6mdwiwDD 9bB2mbSEgwKIQ4a0M/fu/pfntvqwrENfhrz9JTj4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M42jK-1hiiQr3zXc-0001fV; Wed, 03 Jul 2019 18:48:34 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 2/7] rtc: mt6397: move some common definitions into rtc.h Date: Wed, 3 Jul 2019 18:48:17 +0200 Message-Id: <20190703164822.17924-3-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:eNTAGak/khtebF18hP1o00uJHTFlKw0xrt738upulxWk1z31acU PoB2U9jBsL3a67ozQdB+gG5Tq5CJQPDRj0dNh3mKEH1ReCjxe96SLWjYx9mEeCzDeIYs1eE BYo7WMGYd5CUSfhSLvOqR02xzohVYND0/oRHlhR7xCxaVLxuHJxze47sRzK2taMUN5K6QHZ IPFfX9BTpN8nR4lpP3t7A== X-UI-Out-Filterresults: notjunk:1;V03:K0:hrXaNRx2yJU=:n8xY8hWfUEOQNncyM2MDfb hgyC4lTVSopY06MROwkDrLATI7KOf4BREy8UbjkvevcUbP4bo5sS3X0ccBpwv+LSxbLvv2bT6 ttpL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-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/rtc/rtc-mt6397.c | 55 +------------------------- include/linux/mfd/mt6397/rtc.h | 71 ++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 54 deletions(-) create mode 100644 include/linux/mfd/mt6397/rtc.h -- 2.17.1 diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index b46ed4dc7015..c08ee5edf865 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -9,60 +9,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include - -#define RTC_BBPU 0x0000 -#define RTC_BBPU_CBUSY BIT(6) - -#define RTC_WRTGR 0x003c - -#define RTC_IRQ_STA 0x0002 -#define RTC_IRQ_STA_AL BIT(0) -#define RTC_IRQ_STA_LP BIT(3) - -#define RTC_IRQ_EN 0x0004 -#define RTC_IRQ_EN_AL BIT(0) -#define RTC_IRQ_EN_ONESHOT BIT(2) -#define RTC_IRQ_EN_LP BIT(3) -#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) - -#define RTC_AL_MASK 0x0008 -#define RTC_AL_MASK_DOW BIT(4) - -#define RTC_TC_SEC 0x000a -/* Min, Hour, Dom... register offset to RTC_TC_SEC */ -#define RTC_OFFSET_SEC 0 -#define RTC_OFFSET_MIN 1 -#define RTC_OFFSET_HOUR 2 -#define RTC_OFFSET_DOM 3 -#define RTC_OFFSET_DOW 4 -#define RTC_OFFSET_MTH 5 -#define RTC_OFFSET_YEAR 6 -#define RTC_OFFSET_COUNT 7 - -#define RTC_AL_SEC 0x0018 - -#define RTC_PDN2 0x002e -#define RTC_PDN2_PWRON_ALARM BIT(4) - -#define RTC_MIN_YEAR 1968 -#define RTC_BASE_YEAR 1900 -#define RTC_NUM_YEARS 128 -#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) - -struct mt6397_rtc { - struct device *dev; - struct rtc_device *rtc_dev; - struct mutex lock; - struct regmap *regmap; - int irq; - u32 addr_base; -}; +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h new file mode 100644 index 000000000000..b702c29e8c74 --- /dev/null +++ b/include/linux/mfd/mt6397/rtc.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2014-2018 MediaTek Inc. + * + * Author: Tianping.Fang + * Sean Wang + */ + +#ifndef _LINUX_MFD_MT6397_RTC_H_ +#define _LINUX_MFD_MT6397_RTC_H_ + +#include +#include +#include +#include + +#define RTC_BBPU 0x0000 +#define RTC_BBPU_CBUSY BIT(6) +#define RTC_BBPU_KEY (0x43 << 8) + +#define RTC_WRTGR 0x003c + +#define RTC_IRQ_STA 0x0002 +#define RTC_IRQ_STA_AL BIT(0) +#define RTC_IRQ_STA_LP BIT(3) + +#define RTC_IRQ_EN 0x0004 +#define RTC_IRQ_EN_AL BIT(0) +#define RTC_IRQ_EN_ONESHOT BIT(2) +#define RTC_IRQ_EN_LP BIT(3) +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) + +#define RTC_AL_MASK 0x0008 +#define RTC_AL_MASK_DOW BIT(4) + +#define RTC_TC_SEC 0x000a +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ +#define RTC_OFFSET_SEC 0 +#define RTC_OFFSET_MIN 1 +#define RTC_OFFSET_HOUR 2 +#define RTC_OFFSET_DOM 3 +#define RTC_OFFSET_DOW 4 +#define RTC_OFFSET_MTH 5 +#define RTC_OFFSET_YEAR 6 +#define RTC_OFFSET_COUNT 7 + +#define RTC_AL_SEC 0x0018 + +#define RTC_PDN2 0x002e +#define RTC_PDN2_PWRON_ALARM BIT(4) + +#define RTC_MIN_YEAR 1968 +#define RTC_BASE_YEAR 1900 +#define RTC_NUM_YEARS 128 +#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) + +#define MTK_RTC_POLL_DELAY_US 10 +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) + +struct mt6397_rtc { + struct device *dev; + struct rtc_device *rtc_dev; + + /* Protect register access from multiple tasks */ + struct mutex lock; + struct regmap *regmap; + int irq; + u32 addr_base; +}; + +#endif /* _LINUX_MFD_MT6397_RTC_H_ */ From patchwork Wed Jul 3 16:48:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E8FB1890 for ; Wed, 3 Jul 2019 16:49:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA621FE84 for ; Wed, 3 Jul 2019 16:49:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40A55289C6; Wed, 3 Jul 2019 16:49:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ADFA1FE84 for ; Wed, 3 Jul 2019 16:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbfGCQtj (ORCPT ); Wed, 3 Jul 2019 12:49:39 -0400 Received: from mout.gmx.net ([212.227.15.15]:48639 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726430AbfGCQtj (ORCPT ); Wed, 3 Jul 2019 12:49:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172515; bh=Q4SNzBfUgmUaXEsp2/EkbHDrGPVnZzLCOAAZMoTbLHU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=dUAq2zu8k0rxZvBIT5mcoE2t0sC3jCT+ju9g6JRkYtSp4RB6PavjpCfVuJ3uQRRag PtBvoecXZuNbglZNIfhDtks5YMtnk0+OSSOMgQzm+6QDyPXudrub7GdWqXzZqIxp28 vaAJLRKY6+Bm2vyaA7kTXQhbVzwli2iBr3QLmayg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbirE-1iF1363taI-00dD2d; Wed, 03 Jul 2019 18:48:35 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 3/7] rtc: mt6397: improvements of rtc driver Date: Wed, 3 Jul 2019 18:48:18 +0200 Message-Id: <20190703164822.17924-4-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:Doz5m2szHD54xebFCDZtFG1jkMhZkLcvMGXvCyriCBWcdSKa3Po 9pNHVGegXnLoqrAeDO7HXgCEhNeUReGWchhh3UVvXcsL6dD65KFzYJ1tAzs8YKkI2gMYAJW LC9Evz9eFQO1eF3akk3EL0bT7PfbiTi5oaw4VaP8f9vPXewf09C2JHPqAcdg9iEdYErjHpu 1VcNABzfFOtmGkWQ3WBeA== X-UI-Out-Filterresults: notjunk:1;V03:K0:XzjbtNDDVBI=:6fPDOhc3ib1mIDPeODXkCM sGi1yA24Th45Cti4r6Y/VVlK7UWP/BLhd4poItsbr+IxQhAowvs6NNYsbHW3GH455oJZvioNF Iz9au5ndpJA27wKgIKRuGvhb+0p59VDjdfiVFTfduF+yiu4c+G+S7rrqVatiaGL1nAucT4yel 1JiS4o0cD/oOP58flHAPTxmJkMw0e93hr94qBZRn9BCNdG69zTFZkd7xpHZsp5uNOq7L3uKIU yHj60ZWItxffMb4qH/X7ERxbLhEQwIY02T+NQtnZg4v2259rR5do7Upvh1RRUcolMeM7vGTYH mgCAy2IOu53hldt6Q3fRSXGaI3OqMbu3WeoBN/RK1DPRzEDEdIYwAYr9BOdAr5VoUSQhzOjvj qSjwMlr4ryLFhTrnOEqtJ6X0Xop8NoGrWRlf1jnVB9CTiqe3716CRqhlsNdaEVhghXX3dQjol CGpdKc6iw9xvxM0zJz9l6x7g7GxkistvOnle7SMPISNaZwZER8Rza8QR9K1ZEfCGrSgVwihbE e9Czk22vy05sRHcKC5Ke8nYPvGyskoGRZREhurmrTgSJBvVVymfKkSVH+FRux18hLEN25W0zA 47AKfruN7OYXdawFTDu43VqZgGSe9KllIEO3TbTgAS3Idocr9sBaBWxDj7Hh9ALIi0qpMnjIR o48+7naGWINRsknUz/s/qsc7S3ZEObFHqWKMKE8PHSCCOWLskDGq9tnr111598PVD7bldVS4F mAAuPrrA+wagXuvlmZ5ZlYv13TTbALqZkA7i6sn+Pd1AMWo+FJfdpIUs9LUWBhnn9Lhp0uDI9 zodNRadZvE4BtssJmsUzNk3dfiD9vJssjxxPSrRx9P3DYOxchAu6Q1MbvuSSuFRES+fw2bgrn 7wzeLS0IVG4/PofxgGy6FXVLzjjhnWUXj32h+vCPDiLKKMz/xZKW8CpWawz/b61VF+RAmqcRg MsZPvcSJ4LR/1YfWdlAh7cX9Gwv6OzpVyFO3ZpiPobgO76SIKO4GKVKkiqEywfTOsnfZ+TOhc ICjiGClrvXeiYyaHpfKONdnWyaH04Bbd0pCM/LW68c68SC8JSKo/kekPE6uBRNiLMkzjrYJyS sfAoazhD4roxRs= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl - use regmap_read_poll_timeout to drop while-loop - use devm-api to drop remove-callback - add new compatible for mt6323 Signed-off-by: Frank Wunderlich --- drivers/rtc/rtc-mt6397.c | 55 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 33 deletions(-) -- 2.17.1 diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index c08ee5edf865..e5ddf0d0b6f1 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -4,16 +4,19 @@ * Author: Tianping.Fang */ -#include -#include +#include +#include +#include #include +#include +#include #include #include #include +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { - unsigned long timeout = jiffies + HZ; int ret; u32 data; @@ -21,19 +24,13 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) if (ret < 0) return ret; - while (1) { - ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, - &data); - if (ret < 0) - break; - if (!(data & RTC_BBPU_CBUSY)) - break; - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - break; - } - cpu_relax(); - } + ret = regmap_read_poll_timeout(rtc->regmap, + rtc->addr_base + RTC_BBPU, data, + !(data & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret < 0) + dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret); return ret; } @@ -271,14 +268,11 @@ static int mtk_rtc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rtc); - rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev); - if (IS_ERR(rtc->rtc_dev)) - return PTR_ERR(rtc->rtc_dev); + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, + mtk_rtc_irq_handler_thread, + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, + "mt6397-rtc", rtc); - ret = request_threaded_irq(rtc->irq, NULL, - mtk_rtc_irq_handler_thread, - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, - "mt6397-rtc", rtc); if (ret) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", rtc->irq, ret); @@ -287,6 +281,10 @@ static int mtk_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(rtc->rtc_dev)) + return PTR_ERR(rtc->rtc_dev); + rtc->rtc_dev->ops = &mtk_rtc_ops; ret = rtc_register_device(rtc->rtc_dev); @@ -302,15 +300,6 @@ static int mtk_rtc_probe(struct platform_device *pdev) return ret; } -static int mtk_rtc_remove(struct platform_device *pdev) -{ - struct mt6397_rtc *rtc = platform_get_drvdata(pdev); - - free_irq(rtc->irq, rtc); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int mt6397_rtc_suspend(struct device *dev) { @@ -337,6 +326,7 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, mt6397_rtc_resume); static const struct of_device_id mt6397_rtc_of_match[] = { + { .compatible = "mediatek,mt6323-rtc", }, { .compatible = "mediatek,mt6397-rtc", }, { } }; @@ -349,7 +339,6 @@ static struct platform_driver mtk_rtc_driver = { .pm = &mt6397_pm_ops, }, .probe = mtk_rtc_probe, - .remove = mtk_rtc_remove, }; module_platform_driver(mtk_rtc_driver); From patchwork Wed Jul 3 16:48:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8855138B for ; Wed, 3 Jul 2019 16:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C75961FE84 for ; Wed, 3 Jul 2019 16:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB546289C2; Wed, 3 Jul 2019 16:50:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41CDC1FE84 for ; Wed, 3 Jul 2019 16:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbfGCQtn (ORCPT ); Wed, 3 Jul 2019 12:49:43 -0400 Received: from mout.gmx.net ([212.227.15.19]:57979 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbfGCQtl (ORCPT ); Wed, 3 Jul 2019 12:49:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172516; bh=M6PWi+AqvzIHnI2kv34DphxxV8F7xx3ycFGzciNTHis=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=bTC6pznWnKuM2Q7ikYhEDEtVB6XrMQF7C4D3fmIQN5OPnhNjXYqhISarRoFWzzyJr nEO4RH6SMtjdWb90eSUniAUT6Qeagsf/SPn8grFddGBfDgaXgriQOZrTPjf9Hw4bno SHQ16P83037cSeXYO0ANMgqtI/zfdFvKIAs3c42I= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N9MpS-1iccR545rg-015Lm9; Wed, 03 Jul 2019 18:48:36 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 4/7] mfd: mt6323: some improvements of mt6397-core Date: Wed, 3 Jul 2019 18:48:19 +0200 Message-Id: <20190703164822.17924-5-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:kuKrBJnTtq4b2/NjZPE2sfV/tuwmiaGxoDx1uz7jDmUZFdXJVqu E4J9a9ArB0XhOnjqVPn9Cu6pWThn9Rc4Ycy9O/xTrDtTUbdjiP6n3jveMUnYXxd/LZoUaHC icVc9k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unu89tc2oPm0mjwCzrkxVOO9oGheruWFJr7 O5t3EaJR1WwF/+PMPtjIaMsHcx9TdjcE58OcRxGrnv+jRwmroHSI1cME9wDv/kweyIseNK8v3 XXhSPUus/34aUQRfIqnyrsUERQdU9Mm3g8ttDbgeJSdm20NHgT0FzXuZ6Qi5sPqikl0L6hVga FEsTdQsGIxFBs0= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl - simplyfications (resource definitions my DEFINE_RES_* macros) - add mt6323 rtc+pwrc Signed-off-by: Frank Wunderlich --- drivers/mfd/mt6397-core.c | 40 ++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 337bcccdb914..a4abce00f156 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -1,10 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014 MediaTek Inc. + * Copyright (c) 2014-2018 MediaTek Inc. * Author: Flora Fu, MediaTek */ #include +#include #include #include #include @@ -15,24 +16,27 @@ #include #include +#define MT6323_RTC_BASE 0x8000 +#define MT6323_RTC_SIZE 0x40 + #define MT6397_RTC_BASE 0xe000 #define MT6397_RTC_SIZE 0x3e +#define MT6323_PWRC_BASE 0x8000 +#define MT6323_PWRC_SIZE 0x40 + #define MT6323_CID_CODE 0x23 #define MT6391_CID_CODE 0x91 #define MT6397_CID_CODE 0x97 +static const struct resource mt6323_rtc_resources[] = { + DEFINE_RES_MEM(MT6323_RTC_BASE, MT6323_RTC_SIZE), + DEFINE_RES_IRQ(MT6323_IRQ_STATUS_RTC), +}; + static const struct resource mt6397_rtc_resources[] = { - { - .start = MT6397_RTC_BASE, - .end = MT6397_RTC_BASE + MT6397_RTC_SIZE, - .flags = IORESOURCE_MEM, - }, - { - .start = MT6397_IRQ_RTC, - .end = MT6397_IRQ_RTC, - .flags = IORESOURCE_IRQ, - }, + DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE), + DEFINE_RES_IRQ(MT6397_IRQ_RTC), }; static const struct resource mt6323_keys_resources[] = { @@ -45,8 +49,17 @@ static const struct resource mt6397_keys_resources[] = { DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY), }; +static const struct resource mt6323_pwrc_resources[] = { + DEFINE_RES_MEM(MT6323_PWRC_BASE, MT6323_PWRC_SIZE), +}; + static const struct mfd_cell mt6323_devs[] = { { + .name = "mt6323-rtc", + .num_resources = ARRAY_SIZE(mt6323_rtc_resources), + .resources = mt6323_rtc_resources, + .of_compatible = "mediatek,mt6323-rtc", + }, { .name = "mt6323-regulator", .of_compatible = "mediatek,mt6323-regulator" }, { @@ -57,6 +70,11 @@ static const struct mfd_cell mt6323_devs[] = { .num_resources = ARRAY_SIZE(mt6323_keys_resources), .resources = mt6323_keys_resources, .of_compatible = "mediatek,mt6323-keys" + }, { + .name = "mt6323-pwrc", + .num_resources = ARRAY_SIZE(mt6323_pwrc_resources), + .resources = mt6323_pwrc_resources, + .of_compatible = "mediatek,mt6323-pwrc" }, }; From patchwork Wed Jul 3 16:48:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6823513B1 for ; Wed, 3 Jul 2019 16:50:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 531A228678 for ; Wed, 3 Jul 2019 16:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 405DE1FE84; Wed, 3 Jul 2019 16:50:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A42CC1FE84 for ; Wed, 3 Jul 2019 16:50:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbfGCQt5 (ORCPT ); Wed, 3 Jul 2019 12:49:57 -0400 Received: from mout.gmx.net ([212.227.15.15]:34623 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbfGCQtr (ORCPT ); Wed, 3 Jul 2019 12:49:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172517; bh=FYPoJLHu+kLCtWhSyoQqK0wSUyhdckRPerDAqwIXB5c=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=G0q81dSU2nsJt4KWWwdvJ6iuq4nItbX9Ao6DXDU4JL8k+46BUF3R64i4Zt9wsLoaG yIpw0I19Q+aqWIkWRAY/NXRoOcGNge72o11jAvKApMT5minRHDoU0nfpEvMVvFm9ZM DkkzexOvoZZwaQn74hfFkqAuX/MDtpAGTvJywUYU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbAcs-1iFZHQ3reS-00bYLZ; Wed, 03 Jul 2019 18:48:37 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 5/7] power: reset: add driver for mt6323 poweroff Date: Wed, 3 Jul 2019 18:48:20 +0200 Message-Id: <20190703164822.17924-6-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:gdDgvKlW8Sm9gNmKtGMkuW55LkelpJPP0Pu8TtsWrmVdWT+06b9 ODLkHjuVpbcK6QkjMouhOSatVh9X9w6QshI7F5VYBtF47336ITJHAgFaIeucSUHktwZZKKk 7sRvhuVIUY224YacBdCOrHXPx2Zt+qJquchaohcZWqqBHXucVKlFFk8pX/ks2GwwZYHg7Gx zFLzyBEAcqT/cjCjVnnRQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:hc+szzbz1YQ=:5qEd8DXbexZP8hpZ2owlA0 e804rvNLdJZQNN5LOZxCaTFYroAXeDlijhgszblJlxaZxOSWMnvvUOkAkWOyg8h0ylmC0rrqw nLikIkNTGOyizTavLtnkjPKdl9HBe+8zz7YDe98s0oqJzluUmBOYahj4ck6rczWbrzxR9dm/G T88JbvkYZzubE4cyHnEx1I3OmAg+8a08MMJTyYiOlTLY5Zi0jaMfrkngdFj2m14VUJnSl3LF3 W33aZCAWfJPflaP+MJeZgBjXMohvRAYViM4iO4ObdKwz9+JmCDERIkdCRO8SS+4W/Mg5Sr6QI 4LM7ug6v4Hb/QKHg1mipCLSu2XsjaKNx91jVR7OL0+xtrfJI6JfaUEynHQPCdNGeRhg7kkp1w JB4dRTPd9eJELcX25Of2/vootDeXmxlJbZFeE7zSHZ3U70GZxZIPt9CbRMCim/P52C5bzSX0x zZ/W1SJxPUVRlK+47vQwv5hAU3BZLpO4FLpoBTcXuZ35BC49/FNN4r+GMEdNfP9ZFGKPhhrPS CitKx9IiBWBL4m2UMt1wQTx4zwLg8sKoTpgR7LPFyKZaiRNxJTR9jMM+wqpbf8siaulITxNfJ Wrxiw/8kQOhmMrG6RsNS2J7LO3GL2eonqB8yLkww75yIF4FychaUWMR7gvlp/l6Ivtv2uWOhF PDHFwrsNWFyJiAc5Lo7I9ey8sEJM6MFXFuj1cfq8o+NQoI3ngzB5KDtB4hHCXaHVXdqJYAY1I VQCK27aUau373AgKJ8rIVE5wn39nG8llq0b47Nk0RpgNyZy94Opp5ZmtjgWFd296Wa3j1IIaz Eg2lAXr1TPuQMeHKxjd2VfaE66sCiz0AkYdXIQuBXdm0Aux/C+BHlNvI5S5KE3aioZY/Hc4aH nXR0YBHMfFbKzqRrSMaPxJFwvi5vBUEKgDQoWNpukZJbftx9hp2QIQXBV0BX6p/u5WbAdRuLY XsIjjSPXGfcHLtJ+wBskFws2q6nwE31keunV1/iClZL2HaZxJnz38Qz9jWyCR/uJbxDuyfgRy maUUzL71yMrvwIqbqeTwKrU2q1MB8aSqbz8Hk+CZaY4iVrF9tYFsgn6Yd6enlaQpHQr5NYiwm mdKsQqhVLCLcB4= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- drivers/power/reset/Kconfig | 10 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 +++++++++++++++++++++++++++ include/linux/mfd/mt6397/core.h | 2 + 4 files changed, 110 insertions(+) create mode 100644 drivers/power/reset/mt6323-poweroff.c -- 2.17.1 diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index 980951dff834..492678e22088 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -140,6 +140,16 @@ config POWER_RESET_LTC2952 This driver supports an external powerdown trigger and board power down via the LTC2952. Bindings are made in the device tree. +config POWER_RESET_MT6323 + bool "MediaTek MT6323 power-off driver" + depends on MFD_MT6397 + help + The power-off driver is responsible for externally shutdown down + the power of a remote MediaTek SoC MT6323 is connected to through + controlling a tiny circuit BBPU inside MT6323 RTC. + + Say Y if you have a board where MT6323 could be found. + config POWER_RESET_QNAP bool "QNAP power-off driver" depends on OF_GPIO && PLAT_ORION diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 0aebee954ac1..94eaceb01d66 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o +obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c new file mode 100644 index 000000000000..1caf43d9e46d --- /dev/null +++ b/drivers/power/reset/mt6323-poweroff.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Power off through MediaTek PMIC + * + * Copyright (C) 2018 MediaTek Inc. + * + * Author: Sean Wang + * + */ + +#include +#include +#include +#include +#include +#include + +struct mt6323_pwrc { + struct device *dev; + struct regmap *regmap; + u32 base; +}; + +static struct mt6323_pwrc *mt_pwrc; + +static void mt6323_do_pwroff(void) +{ + struct mt6323_pwrc *pwrc = mt_pwrc; + unsigned int val; + int ret; + + regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY); + regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1); + + ret = regmap_read_poll_timeout(pwrc->regmap, + pwrc->base + RTC_BBPU, val, + !(val & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret) + dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret); + + /* Wait some time until system down, otherwise, notice with a warn */ + mdelay(1000); + + WARN_ONCE(1, "Unable to power off system\n"); +} + +static int mt6323_pwrc_probe(struct platform_device *pdev) +{ + struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent); + struct mt6323_pwrc *pwrc; + struct resource *res; + + pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + if (!pwrc) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pwrc->base = res->start; + pwrc->regmap = mt6397_chip->regmap; + pwrc->dev = &pdev->dev; + mt_pwrc = pwrc; + + pm_power_off = &mt6323_do_pwroff; + + return 0; +} + +static int mt6323_pwrc_remove(struct platform_device *pdev) +{ + if (pm_power_off == &mt6323_do_pwroff) + pm_power_off = NULL; + + return 0; +} + +static const struct of_device_id mt6323_pwrc_dt_match[] = { + { .compatible = "mediatek,mt6323-pwrc" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match); + +static struct platform_driver mt6323_pwrc_driver = { + .probe = mt6323_pwrc_probe, + .remove = mt6323_pwrc_remove, + .driver = { + .name = "mt6323-pwrc", + .of_match_table = mt6323_pwrc_dt_match, + }, +}; + +module_platform_driver(mt6323_pwrc_driver); + +MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC"); +MODULE_AUTHOR("Sean Wang "); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h index 25a95e72179b..652da61e3711 100644 --- a/include/linux/mfd/mt6397/core.h +++ b/include/linux/mfd/mt6397/core.h @@ -7,6 +7,8 @@ #ifndef __MFD_MT6397_CORE_H__ #define __MFD_MT6397_CORE_H__ +#include + enum mt6397_irq_numbers { MT6397_IRQ_SPKL_AB = 0, MT6397_IRQ_SPKR_AB, From patchwork Wed Jul 3 16:48:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2826138B for ; Wed, 3 Jul 2019 16:49:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E31281FE84 for ; Wed, 3 Jul 2019 16:49:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D670C28678; Wed, 3 Jul 2019 16:49:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F05A289C2 for ; Wed, 3 Jul 2019 16:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfGCQtn (ORCPT ); Wed, 3 Jul 2019 12:49:43 -0400 Received: from mout.gmx.net ([212.227.15.18]:55005 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727113AbfGCQtl (ORCPT ); Wed, 3 Jul 2019 12:49:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172518; bh=mlVtn+Ho9nIUbfGR8C2oGgrsdZ7rqHETi2ijdwOPmY8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=D9XJFLABs755rRVSJSHjeQOPFBEi/QylsfND1jDl+D71/FShQ8GmFYCDto0sDl5KM Q/03aI//Mz1BUAdEakHPxyu/3DI36ek3Fi8gYz7YdSzSZEdazh9Kud8CfzYneTQ1FY tnl5hH75JarH/URPtt50e9KcXTk+d1teJroTlLJA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MmULr-1iQt0O3f4T-00iTAm; Wed, 03 Jul 2019 18:48:37 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 6/7] MAINTAINERS: add Mediatek shutdown drivers Date: Wed, 3 Jul 2019 18:48:21 +0200 Message-Id: <20190703164822.17924-7-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:euDHaiPM7bK1qAj7PUZGcpgw9FdWaWQgXoeWf9V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v/2+ocb5sDrpp/wZXPDucO742895fkSXk0swGlCqocYhIKSDFWe+ /0uHog17t1XWB7RuVn+oryAPAXMR2eZy9h2pGwG9wDpFEdLAWuOfSUYp7Ml7qMm4qFBtN0DQv Fwa/aBNwp91+zuqBWzNu7FC6iEQFrMBQJYVbYz+5fU7nZUHTnr3r1u2fSxmwo7v378fIj4hCN wxC/UZg4+hEWH1llQsG8gGwZvjJh/IJW2YePtFK6pGVllkwKo8NX69ydxdyXxyAsIBcryQm87 gZmuT6VWEm9tGw= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl Signed-off-by: Frank Wunderlich --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/MAINTAINERS b/MAINTAINERS index 01a52fc964da..31c1e882b7d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9920,6 +9920,13 @@ S: Maintained F: drivers/net/dsa/mt7530.* F: net/dsa/tag_mtk.c +MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS +M: Sean Wang +L: linux-pm@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt +F: drivers/power/reset/mt6323-poweroff.c + MEDIATEK JPEG DRIVER M: Rick Chang M: Bin Liu From patchwork Wed Jul 3 16:48:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11029937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A3D5138B for ; Wed, 3 Jul 2019 16:50:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F4B1FE84 for ; Wed, 3 Jul 2019 16:50:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D4FA28998; Wed, 3 Jul 2019 16:50:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CEDD1FE84 for ; Wed, 3 Jul 2019 16:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbfGCQtj (ORCPT ); Wed, 3 Jul 2019 12:49:39 -0400 Received: from mout.gmx.net ([212.227.15.15]:40339 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbfGCQti (ORCPT ); Wed, 3 Jul 2019 12:49:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562172519; bh=f9CkfFAhLTyBC2mK1XCTgP+oK3gUWu6kajz4IzQ916o=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ccmsewjWRWHoMNLF2s7g//LMWfgSyp06z3ShFt9/me5/llbudtpyDqAZ7RnoOn4Tt CvC4e0v/3nmjUv0dhgQJy2sigeitMow5Sn9OcqLdqbvdjoj8dmxW0wXY/m+G+VQrOo i3uwlTJ4K0nJ56PsJ7LtFjxsv6hWsHCF3gnGztF4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([217.61.158.204]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MTRMs-1i5laU3QXU-00Tp6b; Wed, 03 Jul 2019 18:48:38 +0200 From: Frank Wunderlich To: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" Cc: Josef Friedl , Frank Wunderlich Subject: [PATCH v2 7/7] arm: dts: mt6323: add keys, power-controller, rtc and codec Date: Wed, 3 Jul 2019 18:48:22 +0200 Message-Id: <20190703164822.17924-8-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703164822.17924-1-frank-w@public-files.de> References: <20190703164822.17924-1-frank-w@public-files.de> X-Provags-ID: V03:K1:J5PTVldGZ2BtOOxdvMcmlO+wL7EiSfxjE9VHSxBCKJhbkcDQlEx Esz8v7fVJsxih/JVqdN1Xz4ToCcEotkG8nETqKCtpTZjnCWCEYhdAhXiwdENZNq5B9ALaPs YoBaBKrCd1vtz098oBC24Shrtkt4F4GsB4V19dGupv+0Vcm0eG0R/w64S1CugmqG8uGDnnG ZXLtwX8ZJAaVOUvXxwkPw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ykV+fAiJ0bE=:bYAiQp4RTDSPBbgVDfvdSU XzhISACTumkRFqupBxuQKLduJKimCuNWZglVJIt37DLMLw3+n8YOjkzy+31rLeZQOUYZvtRaF Sqjto3crgtUqjxK0YrdEGwu70YNCdvrTwsfAuTDG+PXrRXLjRM/5s2fayeOnczlpkM1w0VOV7 eNCLq2Qy72II90gVKsvL3jvVcpdTZWQguisuYqiT0vCy3GqFzJ3pIyCa914/rvwh/L1hj16pV 91xEZ4csMdVhHCahybIFDx6qGbs28J6i32giKzVjyGfILSk9kDfjD0Wl3fuInAA0HOP+JGv9W XpjUH3RuiMldhEpbL8JbDMQxP/na3Ai1+cF8t39qAH9NUd0vtExElGOt035Z05eGbA38TTlxt kl0hRtPLSRbNnSrakMC9oBAbwTxjZVpBRrMfwPdkmdGlK9XMF2rmUcgwBJZgI1Xu4vfP3iKnp qgw/fiZcX54mg3PAxHR3lPDDseNTVWNmyMN5i6dEgSKLX0ibn1v1m471NiMGejISsmhRz/rje 4RlmsfErlTp1GwalRw+nSLlWtw0grTJl8L/6NCGkQXeb5IYECjeSJhcwrZJKFH+KaMKCUU3MO zlXHhbWWL4nQ8y3c2W2Va0kuimBZCOa7fNndZpjm/z1F17l9bzaxMorz9kzx7C5aaOfhGI7Fp 9fhhaZ1wzuiLUJAYswpw+4MpTC2AlrToXrRrjfd/nKHjE3fj+1mZqIXUPhwcQatiBXz6gIYus eqLYR+bdFy0mMuMx48q5RYwktraBnxph4eSoAltr6xQGslFCQDQcVQ7iCppVOc5MetAZ2VVfb UZrNFiCmM3+YVxojnQbNfPEhmomgngQwRf7pKvZO9j9M5HDMFb24NmsUho4+9n2icrM5xipIL YrnY515cISAYSiRQKC6XiU61Ff7PwW38TgBB7oP/sdAw86snuoB7JNWC+DzwIf1lfvw7IpTjk Q8RbRz1YOaLomovB9VHabs4hdYACWf4KZ6E3r0iNHwLzJ/85jux3C2jPM6nuBqrwBqfLs9jk2 bsBGd61Hv/hEAHxPGsvJmt2wcMpHB/x9pSBqMYJWuRx26h+7WRPhmYSw3gdWgpZbHJsHG3KmK 91ATsTSyIjDuDg= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Friedl support poweroff and power-related keys on bpi-r2 Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- arch/arm/boot/dts/mt6323.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.17.1 diff --git a/arch/arm/boot/dts/mt6323.dtsi b/arch/arm/boot/dts/mt6323.dtsi index ba397407c1dd..7fda40ab5fe8 100644 --- a/arch/arm/boot/dts/mt6323.dtsi +++ b/arch/arm/boot/dts/mt6323.dtsi @@ -238,5 +238,32 @@ regulator-enable-ramp-delay = <216>; }; }; + + mt6323keys: mt6323keys { + compatible = "mediatek,mt6323-keys"; + mediatek,long-press-mode = <1>; + power-off-time-sec = <0>; + + power { + linux,keycodes = <116>; + wakeup-source; + }; + + home { + linux,keycodes = <114>; + }; + }; + + codec: mt6397codec { + compatible = "mediatek,mt6397-codec"; + }; + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; }; };