From patchwork Thu May 16 08:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bi1IdW5nIFd1ICjlt6vpp7/lro8p?= X-Patchwork-Id: 10945869 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 8B4236C5 for ; Thu, 16 May 2019 08:11:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D48F28A9D for ; Thu, 16 May 2019 08:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7139928AA7; Thu, 16 May 2019 08:11:34 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B10528AA0 for ; Thu, 16 May 2019 08:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zQZGI9dP7N2J9z/jnJT6Kmk036ixWQe4uHI6Y55NG+s=; b=L0rp7cTW7k5ZZA 3XsB3VOhm5vWz4b+Hau0hQR6N02uMC3ZJpi8+N34scnOvDZnAoQKO1H/u043efHxhzuupny0Ubi39 avtTVkA8Q0bshGR5Edud8scq7ULnSkZLw0DuFAKb0bZO/leZoeP2VjPSyZ81CysTYYVJaBMu3a48n NKWUQ7wi6lO9nNJwz+RB4013slgD6NnJ9H8nOocex2FpBskQ1CsjKvtwPAT6D17J7d6NwlZDpIjZU TcNj/1iWoplygnSzDm5q6vvNmzD4MU+eDXAn6cZe2UTbeNT7FHbszZq1sQx1jmAnPzD4Yle5Xca+7 N4jHs9o4Clwt76SMGQSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBUC-0007yW-Nh; Thu, 16 May 2019 08:11:32 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBU3-0007pB-Qm; Thu, 16 May 2019 08:11:25 +0000 X-UUID: af9647e26818468eabb2c2b047028198-20190516 X-UUID: af9647e26818468eabb2c2b047028198-20190516 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 128995026; Thu, 16 May 2019 00:11:17 -0800 Received: from mtkmbs03n2.mediatek.inc (172.21.101.182) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 01:11:15 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 16:11:13 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 16 May 2019 16:11:13 +0800 From: Chun-Hung Wu To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , Matthias Brugger Subject: [PATCH 1/4] dt-bindings: iio: adc: mediatek: Add document for mt6765 Date: Thu, 16 May 2019 16:10:44 +0800 Message-ID: <1557994247-16739-2-git-send-email-chun-hung.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> References: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: D6E72B9E9052B5A9BAB7288A78883C10455BFD332060B2A0CA13030F9FCD0CDD2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190516_011123_869410_A4AAC23B X-CRM114-Status: UNSURE ( 9.09 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-iio@vger.kernel.org, Chun-Hung Wu , kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, jg_poxu@mediatek.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add compatible node for mt6765 auxadc Signed-off-by: Chun-Hung Wu --- Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt index 0df9bef..ab7efab 100644 --- a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt +++ b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt @@ -15,6 +15,7 @@ Required properties: - "mediatek,mt2712-auxadc": For MT2712 family of SoCs - "mediatek,mt7622-auxadc": For MT7622 family of SoCs - "mediatek,mt8173-auxadc": For MT8173 family of SoCs + - "mediatek,mt6765-auxadc": For MT6765 family of SoCs - reg: Address range of the AUXADC unit. - clocks: Should contain a clock specifier for each entry in clock-names - clock-names: Should contain "main". From patchwork Thu May 16 08:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bi1IdW5nIFd1ICjlt6vpp7/lro8p?= X-Patchwork-Id: 10945889 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 7411D6C5 for ; Thu, 16 May 2019 08:12:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6540E28A9D for ; Thu, 16 May 2019 08:12:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5939C28AA1; Thu, 16 May 2019 08:12:21 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F5B628A9D for ; Thu, 16 May 2019 08:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4q2VFPnUZaN8mmiIUjieXo2OyVeaXbSORHRvPDHWQqU=; b=us4ZO2DEVaBzMV aUqROzNRBKQgkF2ptK8EXeOxo5mH5B7MkZTSZ+vT+4GuFLYEU19lu4L1Tze7v107SnGTuVAmng/ow rii5rDwI9fHvKioYZ1meun2RE8QiEcDNk5qD9pazxdhT3KBs1Jz0hAkt9hT07qFdzbvQzXgRwyjq6 Z3fTzYd3eI5WsqFKNsqw16FGGq3/IKO2SroKVUOO0MRmSXgb3J7xBqnFNiGufmEOsND0u4sIUCgSw WeUH5yv+05biYbtpDTrSp6t+Loe+a4n8z66pEnEm60uegvOS9jsFTt3FYIWDehENVo3SGn+lTdumD ighqW2yhYhK/XE/TmfVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBUx-0000X9-2t; Thu, 16 May 2019 08:12:19 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBU6-0007p9-9s; Thu, 16 May 2019 08:11:27 +0000 X-UUID: 9073a198b92846bdbebad5e208b4fe93-20190516 X-UUID: 9073a198b92846bdbebad5e208b4fe93-20190516 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 725296121; Thu, 16 May 2019 00:11:16 -0800 Received: from mtkmbs03n1.mediatek.inc (172.21.101.181) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 01:11:15 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 16:11:13 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 16 May 2019 16:11:13 +0800 From: Chun-Hung Wu To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , Matthias Brugger Subject: [PATCH 2/4] iio: adc: mediatek: mt6765 upstream driver Date: Thu, 16 May 2019 16:10:45 +0800 Message-ID: <1557994247-16739-3-git-send-email-chun-hung.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> References: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190516_011126_362107_8D79EF24 X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-iio@vger.kernel.org, Chun-Hung Wu , kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, jg_poxu@mediatek.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 1. Add calibrated sample data support 2. Use of_match_table to decide each platform's feature set Signed-off-by: Chun-Hung Wu --- drivers/iio/adc/mt6577_auxadc.c | 54 +++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index 95d76ab..e1bdcc0 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -42,10 +42,26 @@ #define MT6577_AUXADC_POWER_READY_MS 1 #define MT6577_AUXADC_SAMPLE_READY_US 25 +struct mtk_auxadc_compatible { + bool sample_data_cali; + bool check_global_idle; +}; + struct mt6577_auxadc_device { void __iomem *reg_base; struct clk *adc_clk; struct mutex lock; + const struct mtk_auxadc_compatible *dev_comp; +}; + +static const struct mtk_auxadc_compatible mt8173_compat = { + .sample_data_cali = false, + .check_global_idle = true, +}; + +static const struct mtk_auxadc_compatible mt6765_compat = { + .sample_data_cali = true, + .check_global_idle = false, }; #define MT6577_AUXADC_CHANNEL(idx) { \ @@ -74,6 +90,11 @@ struct mt6577_auxadc_device { MT6577_AUXADC_CHANNEL(15), }; +static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) +{ + return rawdata; +} + static inline void mt6577_auxadc_mod_reg(void __iomem *reg, u32 or_mask, u32 and_mask) { @@ -120,15 +141,17 @@ static int mt6577_auxadc_read(struct iio_dev *indio_dev, /* we must delay here for hardware sample channel data */ udelay(MT6577_AUXADC_SAMPLE_READY_US); - /* check MTK_AUXADC_CON2 if auxadc is idle */ - ret = readl_poll_timeout(adc_dev->reg_base + MT6577_AUXADC_CON2, val, - ((val & MT6577_AUXADC_STA) == 0), - MT6577_AUXADC_SLEEP_US, - MT6577_AUXADC_TIMEOUT_US); - if (ret < 0) { - dev_err(indio_dev->dev.parent, - "wait for auxadc idle time out\n"); - goto err_timeout; + if (adc_dev->dev_comp->check_global_idle) { + /* check MTK_AUXADC_CON2 if auxadc is idle */ + ret = readl_poll_timeout(adc_dev->reg_base + MT6577_AUXADC_CON2, + val, ((val & MT6577_AUXADC_STA) == 0), + MT6577_AUXADC_SLEEP_US, + MT6577_AUXADC_TIMEOUT_US); + if (ret < 0) { + dev_err(indio_dev->dev.parent, + "wait for auxadc idle time out\n"); + goto err_timeout; + } } /* read channel and make sure ready bit == 1 */ @@ -163,6 +186,8 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, int *val2, long info) { + struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev); + switch (info) { case IIO_CHAN_INFO_PROCESSED: *val = mt6577_auxadc_read(indio_dev, chan); @@ -172,6 +197,8 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, chan->channel); return *val; } + if (adc_dev->dev_comp->sample_data_cali) + *val = mt_auxadc_get_cali_data(*val, true); return IIO_VAL_INT; default: @@ -304,10 +331,11 @@ static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops, mt6577_auxadc_resume); static const struct of_device_id mt6577_auxadc_of_match[] = { - { .compatible = "mediatek,mt2701-auxadc", }, - { .compatible = "mediatek,mt2712-auxadc", }, - { .compatible = "mediatek,mt7622-auxadc", }, - { .compatible = "mediatek,mt8173-auxadc", }, + { .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt2712-auxadc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt7622-auxadc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt8173-auxadc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt6765-auxadc", .data = &mt6765_compat}, { } }; MODULE_DEVICE_TABLE(of, mt6577_auxadc_of_match); From patchwork Thu May 16 08:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bi1IdW5nIFd1ICjlt6vpp7/lro8p?= X-Patchwork-Id: 10945881 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 1376314DB for ; Thu, 16 May 2019 08:11:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0523228A9D for ; Thu, 16 May 2019 08:11:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDA3328AA1; Thu, 16 May 2019 08:11:49 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 976A628AA0 for ; Thu, 16 May 2019 08:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aWSAJE8heHGKLtmsKtByc/T4Qj6OvTMPkrySOgHk+sA=; b=SLPnjqlNRPOFv/ syhgwD5xv4zvTC0c17suWuTXEo/cz/yWs3dA06FtDvmqc1eKKdbk22pAGbrfVv2C5lTQDHZ2ACOdu fOK9ufCrAOM6e7jCeONUvlO0K8Pt0SWTZ3fOuZoj1NiiZvJaoFUWx+Ban801f84HD9OIdj8A3ZT2Z WOrcYHcMwIPv69jxFiCHVCkW9o3oOLB5lHc/L40WvknWIA22R3NcgG13LMaJp5uI4jSwl9ZPODjAR B3cZQTvSLMkh4b9ry6ksAoivgqWf3rXenYVFrla8WvFdgqL9dgfjJLXDUqEj6REWV4TABpePNYXrj juJ6RB7a0b6pL5xoTAXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBUR-0008M4-Pv; Thu, 16 May 2019 08:11:47 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBU4-0007p9-CA; Thu, 16 May 2019 08:11:26 +0000 X-UUID: 90029308ecd2461a87e2f476e16efc0d-20190516 X-UUID: 90029308ecd2461a87e2f476e16efc0d-20190516 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 834763790; Thu, 16 May 2019 00:11:17 -0800 Received: from mtkmbs03n2.mediatek.inc (172.21.101.182) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 01:11:16 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 16:11:13 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 16 May 2019 16:11:13 +0800 From: Chun-Hung Wu To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , Matthias Brugger Subject: [PATCH 3/4] iio: adc: mediatek: SET_LATE_SYSTEM_SLEEP_PM_OPS support Date: Thu, 16 May 2019 16:10:46 +0800 Message-ID: <1557994247-16739-4-git-send-email-chun-hung.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> References: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: F9CC925050B55AC7B0452B4120ABC255673E25AD8C095D8DABCA74CE87BE3D7E2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190516_011124_418171_9038EC5C X-CRM114-Status: UNSURE ( 9.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-iio@vger.kernel.org, Chun-Hung Wu , kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, jg_poxu@mediatek.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move suspend/resume to late_suspend and early_resume to gurantee users can use auxadc driver at suspend/resume stage. Signed-off-by: Chun-Hung Wu --- drivers/iio/adc/mt6577_auxadc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index e1bdcc0..58d7cb2 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) return 0; } -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops, - mt6577_auxadc_suspend, - mt6577_auxadc_resume); +static const struct dev_pm_ops mt6577_auxadc_pm_ops = { + SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend, + mt6577_auxadc_resume) +}; static const struct of_device_id mt6577_auxadc_of_match[] = { { .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat}, From patchwork Thu May 16 08:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bi1IdW5nIFd1ICjlt6vpp7/lro8p?= X-Patchwork-Id: 10945879 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 9497714DB for ; Thu, 16 May 2019 08:11:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86FB428A9D for ; Thu, 16 May 2019 08:11:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B22028AA4; Thu, 16 May 2019 08:11:47 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2950E28A9D for ; Thu, 16 May 2019 08:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nJai6nuFPWVEEOEQOPuCxiNzwh0CBU38OuqoJNClSe8=; b=QJqJabR/xw3yv8 YHHyi6fDKwqEdOYA1A2jk4h+zEsjR1RrP26b/CIgJjpeH1zWVVXCQso1NCVooEAsV5mV5O6Lvd/yr Hc1FiUUnFHsj5Pjqa8TLEwrdqJtmxQR2p0NdOgxRBPkaY+uKDjTln1woIYp9HZrDn7HiYwISDzlQP rJ29sGpZXfWBYIVpHPHvdV1g80TiBcc3X0/iFRzkho9KjcL/qYC2hrCnxExRboLV2nbGcQjxmxi25 7bVCVaZqB1RZplYEW45Sg6HTVK6cIJDJHgqNvyonV7f+Ud4WSig1Ola1WBmBpdW1ihr+sS8UFHNnl kQJbHU7wRgg2YRp8tyNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBUP-0008IR-Ix; Thu, 16 May 2019 08:11:45 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRBU3-0007p8-Qs; Thu, 16 May 2019 08:11:26 +0000 X-UUID: d4722b311b474a60ae1c2c2e4b479c00-20190516 X-UUID: d4722b311b474a60ae1c2c2e4b479c00-20190516 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1839425121; Thu, 16 May 2019 00:11:17 -0800 Received: from mtkmbs03n1.mediatek.inc (172.21.101.181) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 01:11:16 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 16 May 2019 16:11:14 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 16 May 2019 16:11:13 +0800 From: Chun-Hung Wu To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , Matthias Brugger Subject: [PATCH 4/4] iio: auxadc: mediatek: change to subsys_initcall Date: Thu, 16 May 2019 16:10:47 +0800 Message-ID: <1557994247-16739-5-git-send-email-chun-hung.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> References: <1557994247-16739-1-git-send-email-chun-hung.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190516_011123_876186_180E1A62 X-CRM114-Status: UNSURE ( 8.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-iio@vger.kernel.org, Chun-Hung Wu , kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, jg_poxu@mediatek.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move auxadc platform_driver_register() from module_init to subsys_initcall because auxadc user drivers are all moudle drivers, need to gurantee auxadc driver ready before module_init. Signed-off-by: Chun-Hung Wu --- drivers/iio/adc/mt6577_auxadc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index 58d7cb2..cb8e3dd 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -350,7 +350,19 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) .probe = mt6577_auxadc_probe, .remove = mt6577_auxadc_remove, }; -module_platform_driver(mt6577_auxadc_driver); + +static int __init mt6577_auxadc_init(void) +{ + return platform_driver_register(&mt6577_auxadc_driver); +} + +static void __exit mt6577_auxadc_exit(void) +{ + platform_driver_unregister(&mt6577_auxadc_driver); +} + +subsys_initcall(mt6577_auxadc_init); +module_exit(mt6577_auxadc_exit); MODULE_AUTHOR("Zhiyong Tao "); MODULE_DESCRIPTION("MTK AUXADC Device Driver");