From patchwork Thu Aug 30 15:44:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582149 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 5CCE9920 for ; Thu, 30 Aug 2018 15:48:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DDD02BDB6 for ; Thu, 30 Aug 2018 15:48:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 415012BDF1; Thu, 30 Aug 2018 15:48:31 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 EF37F2BDB6 for ; Thu, 30 Aug 2018 15:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbeH3TsH (ORCPT ); Thu, 30 Aug 2018 15:48:07 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41642 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbeH3TsH (ORCPT ); Thu, 30 Aug 2018 15:48:07 -0400 Received: by mail-wr1-f68.google.com with SMTP id z96-v6so8504322wrb.8; Thu, 30 Aug 2018 08:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uKaqCBtqbdCV/0TVjaETReatm7uuORq7A9AVhZo/H2k=; b=MdimOYrvBalJQGow12JrkZb9Z+nFDifixx/09VVtkcHjKWHMmHdAWPWvYtddt+tC7b L8M8//VrgxJa9o2Zl04ghmXhnT5ZbOv2dPrUtj+1eWmAfP6I9lq4kv2vK0fsRx9Mqx1F HSF4x7K5B5ByCAHPKcDnEmOTJmeoQL/74NTXfBBAFx5MsnUV4w0sqRcgc15lqH2gOA3S KA4ij8MwsUxPr7AJTrCLQ+yzQSjsiriYMqMPQb0ilQE8K8hkSD01HvOD09DOG59MnJLe pzhBhO3ycAG6LAVnr8S86ctgppJMCRc3xnUJlcGh5zZEET/Zfxw6/YDtJOKJfWzBCQyX KBkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uKaqCBtqbdCV/0TVjaETReatm7uuORq7A9AVhZo/H2k=; b=c/ztCFPW3DAWYEF8W2nV2d4GQcjFFuPd9uUZUdYhLkcrBQoxAqeyIxkkN0G82c/xA6 UkMKCbS72dOcRisuq3COZv5w7sEmm9mMkbCrWX5d8z4yDTWjBxw6i/Z8jn6CrUYlScQp 97T8i4j17bnj/hgJSoff2b06yukVydN0SE8TtZqpAsi37c7svUGqpVwy7nrhcdiyXO2V 3QfFclve+tteSkbAaqjoWRgouoSlOa6uE36hQZvi4sCi+UTgIhVvBGKx+64LuFbQaknD XTX5UOdhCATKjx6wvzIZmsfJJ9FxLELlD1/AvMQkp8XrE5Jh1vVKIC7GwbtA4Ns8f01C J1cA== X-Gm-Message-State: APzg51Dj8jNM8cBcShFbu89zYPSXy68xxatJWYr/c/4XCV6zjRWppG7W XmCKhEFHozESA+oSrNQ8W9U= X-Google-Smtp-Source: ANB0VdZBgvThGOX3zWlLEdEaVRf+EF4fwRTyq3QBhWWN/DWfFzj8me3ReeFRerAT2PSj6ch7wyRT2g== X-Received: by 2002:adf:ffc7:: with SMTP id x7-v6mr3501604wrs.137.1535643920777; Thu, 30 Aug 2018 08:45:20 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:20 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 01/30] mfd: Makefile: Remove build option for MFD:sun4i-gpadc Date: Thu, 30 Aug 2018 17:44:49 +0200 Message-Id: <20180830154518.29507-2-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we are merging the mfd driver into the sun4i-gpadc driver we need to remove the build options for the sun4i-gpadc driver. Signed-off-by: Philipp Rossak --- drivers/mfd/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index e9fd20dba18d..c680994db988 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -220,7 +220,6 @@ obj-$(CONFIG_INTEL_SOC_PMIC_CHTDC_TI) += intel_soc_pmic_chtdc_ti.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o -obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_LPTIMER) += stm32-lptimer.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o From patchwork Thu Aug 30 15:44:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582145 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 49C7A14BD for ; Thu, 30 Aug 2018 15:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A5BB2B7BD for ; Thu, 30 Aug 2018 15:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DD292BB4F; Thu, 30 Aug 2018 15:48:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 D4BEC2B7BD for ; Thu, 30 Aug 2018 15:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbeH3TsK (ORCPT ); Thu, 30 Aug 2018 15:48:10 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:55429 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbeH3TsJ (ORCPT ); Thu, 30 Aug 2018 15:48:09 -0400 Received: by mail-wm0-f68.google.com with SMTP id f21-v6so2476852wmc.5; Thu, 30 Aug 2018 08:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=znNWD4c7xwHHzdKt+r4w+sW2qQCB/x6+Cp4Db3nfkDE=; b=V92Tq2KDAuTOS5ZXCjBYkHKFg44ritecrZ7ZE5O8ofAH/laW5wgzuFHy5iebseuYd2 UMiflbVHAilN/P8jgZ12r5Z33fJOFqmsL4031S5dzCt/yLUuyqaCRUvnIsGE3qR+dOws SlYVxfX3DhOvr+oPlqQ4zISSUm/awMlTxnw/cmojhxFMzlGqdOmcEP6/47oa8U2og+jx vXob4+bNCmF9XoBlRD0EGa6KGRnKDEaDpbxBujheuWRMuHxnceL7XXYLWgDZnnoZVBPU hgpLUrjbFe+452AdUNT1DdZSJa/NDd+hug4pGvw2BcRdKgNchVRYzipAsQvLwQDe7NNS wbkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=znNWD4c7xwHHzdKt+r4w+sW2qQCB/x6+Cp4Db3nfkDE=; b=Ai3+TgITTZNnY+pEWGxgx1HzlaMjjiMMTLOQtl2xG738z2ApYVD/vf/FcdpsPI52Pj i0OvmVwRFpmElNtmmw0xHKnTD4EKAsSIOfybguI0W7ou8078XXCwPcrrkr97VMVzZnhI bzsvcZ7ORUn3ql+DD31fg8KYqa52ZRv7bZ5qTuax3Qeqxm5vZEJa0bfDpg5oZf6hLy33 X+YoYofuKd6ms81WC/OCbvbdrZMh3K3tz2Vc+iuWKpaV/phE22wikeBWfjPbgr//d7sP f/nRA/7D6bu8KmDQY0CNwwR7VMeKBEa/J1ouTplQAzRVJSuNPiRk0W8/3XNGkOpZ7dwF aDWA== X-Gm-Message-State: APzg51BYWc3NwLopvBzAXtiMhpMJVHaFsFNiW4W4Sg8TPzVFBA/PWkU1 SfqqMqUHlB67ZZ5S80FcCvw= X-Google-Smtp-Source: ANB0VdZuXnaUMR0j5QPHrOlZECbitDpFtxY1nXAYEg80kpo4MiZSe5qr0nk3dEhEG6VGCPHu5ajrlA== X-Received: by 2002:a1c:48d:: with SMTP id 135-v6mr2082908wme.106.1535643921740; Thu, 30 Aug 2018 08:45:21 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:21 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 02/30] mfd: Kconfig: Remove MFD_SUN4I_GPADC config option Date: Thu, 30 Aug 2018 17:44:50 +0200 Message-Id: <20180830154518.29507-3-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are merging the mfd:sun4i-gpadc driver into the iio/adc/sun4i-gpadc driver. So we need to remove the MFD_SUN4I_GPADC config option. Signed-off-by: Philipp Rossak --- drivers/mfd/Kconfig | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index b860eb5aa194..c7ab57d65610 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -40,23 +40,6 @@ config MFD_ACT8945A linear regulators, along with a complete ActivePath battery charger. -config MFD_SUN4I_GPADC - tristate "Allwinner sunxi platforms' GPADC MFD driver" - select MFD_CORE - select REGMAP_MMIO - select REGMAP_IRQ - depends on ARCH_SUNXI || COMPILE_TEST - depends on !TOUCHSCREEN_SUN4I - help - Select this to get support for Allwinner SoCs (A10, A13 and A31) ADC. - This driver will only map the hardware interrupt and registers, you - have to select individual drivers based on this MFD to be able to use - the ADC or the thermal sensor. This will try to probe the ADC driver - sun4i-gpadc-iio and the hwmon driver iio_hwmon. - - To compile this driver as a module, choose M here: the module will be - called sun4i-gpadc. - config MFD_AS3711 bool "AMS AS3711" select MFD_CORE From patchwork Thu Aug 30 15:44:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582147 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 4BA0A14BD for ; Thu, 30 Aug 2018 15:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1AF2B7BD for ; Thu, 30 Aug 2018 15:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E7822BB4F; Thu, 30 Aug 2018 15:48:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 D7DD92B7BD for ; Thu, 30 Aug 2018 15:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727552AbeH3TvC (ORCPT ); Thu, 30 Aug 2018 15:51:02 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38741 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbeH3TsK (ORCPT ); Thu, 30 Aug 2018 15:48:10 -0400 Received: by mail-wr1-f65.google.com with SMTP id w11-v6so8508136wrc.5; Thu, 30 Aug 2018 08:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eOlesON9JEbI3RiqZ3yU2XvULXMLDkhbr+tAcyHX1jI=; b=Nq1+ke7O/3ya6/cyzzgBbnofTTSbq4B8nYtp63N3AU68AKwaR+lq1bS44T09X84raD ogLjL22wB1uB1eCKw8HIgJghhEU7FBsguP8qW1kJ1mOOGfS11dpuJPWvStDCuVkmTezB DlDGNdk0GTnDOkz+XmzpDaZKGq99jrzNBZELlDXGiYtSgib2Fon8jvJRejlIT7had5RP LA1EZpPD43sEqxtM6Zt1+jirAzGcTTpCXZ5LW9Dn+U95rVDwdhqpQQw4SdwrjzqVGQPk Sv3HjM19hXRbosqiSPdFLauT3y/FOsKHLmlkgXBnlC/vN9kzRkSyc0AI1/eq92t2ZC5W fMuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eOlesON9JEbI3RiqZ3yU2XvULXMLDkhbr+tAcyHX1jI=; b=h/9/0uBF/LrUyQ3SrT09B84koft1oZMWTL4HDU+wVZxbA3DYFLKZQ+2zDEkgUmPxbD nx/nX1W9++SeIM5Gckt6SN18epoMUD1MLoMtZHLfCDWgbIBGbaFaowE85/H13dTpkVRJ cTpNxZ3jXun8sxlB8tMOvjdEFmdmYIExR/a8Rj4RxfEt0YhO9vCRy+O/cI0x3pyyBLg5 GqP/d3P+cpOWAoFpDry4C2hZEuXS2QUjju1s7ia8DpFXCRTMXfgIf7fBa89uXLSUGP7R IFo0w6bpeKkyB0bPNhYX3rQdBYCqKMD9svsZn2Hj9vBb05r0uGFK3ln+ojtn4qpR4LBW 16sg== X-Gm-Message-State: APzg51Ac5QkCAxPWN2py/5/Nss041uHfYCjo6Vzebwc01B7gcu7xQKbM AS856YGWSia4eUBsMqQgJQk= X-Google-Smtp-Source: ANB0VdZydzVwlgmNC9jd6c1kvxIV3So3eSC9twIoJ2AGHHYmBHN7Vik0oavzqD6xr/AuRK25jSD16Q== X-Received: by 2002:adf:8504:: with SMTP id 4-v6mr7768377wrh.72.1535643922732; Thu, 30 Aug 2018 08:45:22 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:22 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 03/30] iio: adc: Remove ID table Date: Thu, 30 Aug 2018 17:44:51 +0200 Message-Id: <20180830154518.29507-4-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To disable the driver we are removing the compatibles. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 04d7147e0110..d95dd0fde2a6 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -698,21 +698,12 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) return 0; } -static const struct platform_device_id sun4i_gpadc_id[] = { - { "sun4i-a10-gpadc-iio", (kernel_ulong_t)&sun4i_gpadc_data }, - { "sun5i-a13-gpadc-iio", (kernel_ulong_t)&sun5i_gpadc_data }, - { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data }, - { /* sentinel */ }, -}; -MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id); - static struct platform_driver sun4i_gpadc_driver = { .driver = { .name = "sun4i-gpadc-iio", .of_match_table = sun4i_gpadc_of_id, .pm = &sun4i_gpadc_pm_ops, }, - .id_table = sun4i_gpadc_id, .probe = sun4i_gpadc_probe, .remove = sun4i_gpadc_remove, }; From patchwork Thu Aug 30 15:44:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582143 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 999D2920 for ; Thu, 30 Aug 2018 15:48:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89B212BB3B for ; Thu, 30 Aug 2018 15:48:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C1FD2BB53; Thu, 30 Aug 2018 15:48:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 27C1C2BB3B for ; Thu, 30 Aug 2018 15:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727540AbeH3TsL (ORCPT ); Thu, 30 Aug 2018 15:48:11 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34113 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbeH3TsK (ORCPT ); Thu, 30 Aug 2018 15:48:10 -0400 Received: by mail-wr1-f68.google.com with SMTP id g33-v6so8531771wrd.1; Thu, 30 Aug 2018 08:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tHWKgVQ+LP5A64YbmsQPQ4TQy6BjNkjDuA1WjJuVxFc=; b=jm1AAAVuPY9EOrIexteon5sSq6w2VUiphdwBnzPsfyVT6LIAk9QR/qg4M1GELtOviP prOerDSGFrglpAQ8GjsmboVORQgKaEWyNqhlzrNm4FEd8p5IshSNYuWrWDJmiLfL57BO meRhdxxGdTx2glX5HXepaEwqTUj+IeAL3vth3OQlmQel6DitQYhA//5Gc4sJhMecLpIS 3uVbJr/k4HC0yGome2RNhFF+lwOd/kvDzLiV3EnULya0ns/Sz7KFrljAjL9dpZBu+vtt kZKwnMYc+i7KJfFswbxm9PdJJoZBTCyOddwFkbmcqK72Hrfni/4896lbD4bUTV6QXhDs NCug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tHWKgVQ+LP5A64YbmsQPQ4TQy6BjNkjDuA1WjJuVxFc=; b=TJE4UO0k+CNywKBK8Ml2Ymkro8lwE6PfWQ2uMLNAkBS2MwgHlXcf7F72N4ZeLqIfTs ys7IOj38d60WP6StBmcYbajegplU5i0goxkFjpF3v6ZMNp8BoBxOSZxrgBJA0Ka/S1HA gEgsRYbF+W4sgdh4/YJvvGjfnae6gkSePeAV49EIBFnJKUGvmJoC6DvuJc5E6AC6jhMO tKi0Tk1gsWwOMFZPFeAxSXojwdTbMUMx9vag5NpAdKmQvRDsQV2AkeEUwHxbIa9gSGE9 QJiS7dxjBlczXu7KrJyjbDyjHn/h362fapPfEBOe0gUHxPxFbeiXXpbVMvUvQNcVfkna 4Lpg== X-Gm-Message-State: APzg51DJH2B7NJhFZ6lij599c7dVKVpM093M7033WMRoCe2Ba0FnmlKa +n/h7vSFuyCkH17copi9f3U= X-Google-Smtp-Source: ANB0VdbABIGLqoYMoOjdStNEiEpxSnI4a5wV60mvWIm2iY431vbsOeGYB+GEp93JCTnxaB51r0mu5Q== X-Received: by 2002:a5d:6243:: with SMTP id m3-v6mr8147675wrv.179.1535643923775; Thu, 30 Aug 2018 08:45:23 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:23 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 04/30] iio: adc: Kconfig: Update Kconfig to new build options Date: Thu, 30 Aug 2018 17:44:52 +0200 Message-Id: <20180830154518.29507-5-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we are merging the mfd driver into the iio adc driver we need to update the Kconfig build options. Signed-off-by: Philipp Rossak --- drivers/iio/adc/Kconfig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 9da79070357c..5d0cffd6d2e4 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -713,13 +713,16 @@ config STX104 array module parameter. config SUN4I_GPADC - tristate "Support for the Allwinner SoCs GPADC" + tristate "Allwinner sunxi platforms' GPADC/Thermal driver" + select REGMAP_MMIO + select REGMAP_IRQ depends on IIO - depends on MFD_SUN4I_GPADC || MACH_SUN8I - depends on THERMAL || !THERMAL_OF + depends on ARCH_SUNXI || MACH_SUN8I + depends on THERMAL && THERMAL_OF help Say yes here to build support for Allwinner (A10, A13 and A31) SoCs - GPADC. This ADC provides 4 channels which can be used as an ADC or as + GPADC or newer SOCs (A33, H3, A83T, ...) Thermal sensor driver. + This ADC provides 4 channels which can be used as an ADC or as a touchscreen input and one channel for thermal sensor. The thermal sensor slows down ADC readings and can be disabled by From patchwork Thu Aug 30 15:44:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582139 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 1417414BD for ; Thu, 30 Aug 2018 15:47:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01DC02B7BD for ; Thu, 30 Aug 2018 15:47:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8BE52B7E7; Thu, 30 Aug 2018 15:47:57 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 952122B7BD for ; Thu, 30 Aug 2018 15:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727577AbeH3TsM (ORCPT ); Thu, 30 Aug 2018 15:48:12 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36115 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727514AbeH3TsM (ORCPT ); Thu, 30 Aug 2018 15:48:12 -0400 Received: by mail-wm0-f68.google.com with SMTP id j192-v6so2528012wmj.1; Thu, 30 Aug 2018 08:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c6Ey3Xe6CN/vhTyJgfjyN2P4uA8psZ12lezphNsl3O8=; b=WT2aLqwbvZWYRL1x96iSTzU+B4CACYgVizEDuSTCdgumBQ2wlbmQC+50S6MwT29d0p O/8kqtcyg8In7OQH5WzkOu3UBR+PhFZth9mUoNsViY0Nt/bJxxqZgEsa0b5mFkdR8J4f wC0dT1XNeCWc0HDsfXOKuzZp0sqPMxguf6bNYS2J3YoFtr0KUmKlT/Ao7sQmz1Jz3nOe 9pAr2pPxwEtMJ10GrdDl8AcOaYlpx7aaAbj+MAGrGPxPH1lAEU61kQZTTtaoXmuc3u0Z nRc3HEtT/oQ3y9Png8XVbSe2BAoFYc0OoFg7RMFXYrVbcsbbrlrJG4lgSntS4BQrdtBF EHcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c6Ey3Xe6CN/vhTyJgfjyN2P4uA8psZ12lezphNsl3O8=; b=iS/A7cbkMgB8frkrkKyDWw+B2x3UUUWAi0xmzZswau1nhfCloOtaIrnrD4sTTQjTLm x6jTP5tXsrlmCUpKSKnGLQuRBzVS/k/TCQgKrC1E+pS9wj2xrS2bwx9RRnNsRJgH3c1a Rb5C44Ykz5/RzjCVK8Y0xLVdLA8ESgbfuErGsh/SuZ33GXL2GBcoLfI7kvKZzVBMS7yP 43OpozOQQDaZqwNZBMHD8tc4pkGIrzkpw9MnsyU7+0CmPr0H287dU9Rq+z1J6bPfo+bB fMon0s2dj+TgWI9Trb7nIVm/Rr+epTpOsJM/3vNI9hnyVUP3X9Qj3oqwhs/1I0zJ09Vu c07w== X-Gm-Message-State: APzg51AhUkf7zyshjm0JW1Mr5gIg23elCEbx4i+CJg6O2Mq4CbPdRcLx im4narmlVkT9nleqxrI66Zw= X-Google-Smtp-Source: ANB0VdY0ssrNPLY2K5WNdfkiCKFiZwOWX1cXOMfVV1gHhZ+53D8544pYl1mtXuXsbZORGEEy6PQmcw== X-Received: by 2002:a1c:1f48:: with SMTP id f69-v6mr2113339wmf.152.1535643924712; Thu, 30 Aug 2018 08:45:24 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:24 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 05/30] iio: adc: move SUN4I_GPADC_CHANNEL define to header file Date: Thu, 30 Aug 2018 17:44:53 +0200 Message-Id: <20180830154518.29507-6-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are moving the SUN4I_GPADC_CHANNEL define to the header file. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 9 --------- include/linux/mfd/sun4i-gpadc.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index d95dd0fde2a6..666329940e1e 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -109,15 +109,6 @@ struct sun4i_gpadc_iio { struct device *sensor_device; }; -#define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .channel = _channel, \ - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ - .datasheet_name = _name, \ -} - static struct iio_map sun4i_gpadc_hwmon_maps[] = { { .adc_channel_label = "temp_adc", diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h index 139872c2e0fe..54c7c9375c1b 100644 --- a/include/linux/mfd/sun4i-gpadc.h +++ b/include/linux/mfd/sun4i-gpadc.h @@ -90,6 +90,15 @@ /* 10s delay before suspending the IP */ #define SUN4I_GPADC_AUTOSUSPEND_DELAY 10000 +#define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = _channel, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + .datasheet_name = _name, \ +} + struct sun4i_gpadc_dev { struct device *dev; struct regmap *regmap; From patchwork Thu Aug 30 15:44:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582141 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 DFF1E14BD for ; Thu, 30 Aug 2018 15:48:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D04242BB32 for ; Thu, 30 Aug 2018 15:48:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C335F2BB4F; Thu, 30 Aug 2018 15:48:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 7AB322BB32 for ; Thu, 30 Aug 2018 15:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727212AbeH3Tuq (ORCPT ); Thu, 30 Aug 2018 15:50:46 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37044 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727552AbeH3TsM (ORCPT ); Thu, 30 Aug 2018 15:48:12 -0400 Received: by mail-wm0-f67.google.com with SMTP id n11-v6so2499231wmc.2; Thu, 30 Aug 2018 08:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C/2oeBXZG2toeVaxCNErDpJ78AmhA9HYwAbujF41JBk=; b=HRuOW3x+mL/ZvNRvFqJCIIeFQQNu9h/tJfKgB5v3MbBkDgBtiof62xHrmjNnc7pYqM iTmH5yX5OTmpd7WIYd2t0hm1AfJfJvvOpii7hA6Wv2/PWlQ9cqlCMLulmuinfmcFv+RI FIT2tBUcQUgWT9yDCNYl6zr2GmD6DCH9H2L4zUOXIIs8fJ9AvVTym/37wuYHDGtPZbVK RZ8zZMjrAKBIetYy4PLEIcqAI+bs3IzgFq0l2awbp4HQ9fJGd+oNltqacQQtJrgh0fcq 3agh3monCyBTiiB8J8OKohDiQND+UWp9FKkwTBMYLSKctOwVxhFnING93jk6AhWF8HiD pqcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C/2oeBXZG2toeVaxCNErDpJ78AmhA9HYwAbujF41JBk=; b=A4Ai7xlPSEEB6i4SN/DJmt7Mbf+2q6Bkdok3IHe7tD+mYmJEreSCrn+pW7o6V39EMI 2WHyYHvm0P6LWSTQBY+qnpxKSxTkPca+swDpFTSxjJqaVTQzRYmt7Yr+GSChkeOWQZyx eOz1Yer56heGUFAaEoNwILrkIB/a7sIGLoztRbnpSgrZhBMFXhZzkSsdOOGUXBZK9UjW akThRaReYfV5mO//6q5nX/iEpz0BPAOa/JYOAWjIfqFbNzU91oJHhoaGZe5Pflo8wTPl ylN/Xwx1qYl8i7ZtypndPIsYB7s+cuGtMXp574Px9QaQvlXGCT1vFtOfRzectWq6xsaC rPHQ== X-Gm-Message-State: APzg51DgoTJvO/gWLxiNPri1JXaBSEwCA8FO8NcQeaCMp+ArIukjdC/8 hyfgEeoBoxWDwt+HUPmbBv4= X-Google-Smtp-Source: ANB0VdY5OJC4oBNA4YlKI1hMCWl+v+fAxR7nO0Q/xPnW4zGhwma0BGpFRT3R5qxowVxN+zetieEcrw== X-Received: by 2002:a1c:64c:: with SMTP id 73-v6mr2090110wmg.7.1535643925668; Thu, 30 Aug 2018 08:45:25 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:25 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 06/30] iio: adc: remove ofnode options Date: Thu, 30 Aug 2018 17:44:54 +0200 Message-Id: <20180830154518.29507-7-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we are merging the mfd dirver into the adc driver we don't need two different probing functions. Thus we remove the ofnode options Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 666329940e1e..d6f00d3b802d 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -622,10 +622,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) indio_dev->info = &sun4i_gpadc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; - if (pdev->dev.of_node) - ret = sun4i_gpadc_probe_dt(pdev, indio_dev); - else - ret = sun4i_gpadc_probe_mfd(pdev, indio_dev); + ret = sun4i_gpadc_probe_dt(pdev, indio_dev); if (ret) return ret; From patchwork Thu Aug 30 15:44:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582137 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 E01EE17DE for ; Thu, 30 Aug 2018 15:47:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF8AE2C0B0 for ; Thu, 30 Aug 2018 15:47:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C37BB2C0B2; Thu, 30 Aug 2018 15:47:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 3FE752C0B1 for ; Thu, 30 Aug 2018 15:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727608AbeH3TsO (ORCPT ); Thu, 30 Aug 2018 15:48:14 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:47060 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbeH3TsN (ORCPT ); Thu, 30 Aug 2018 15:48:13 -0400 Received: by mail-wr1-f66.google.com with SMTP id a108-v6so8481997wrc.13; Thu, 30 Aug 2018 08:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tFfQ9c8YXGxQQwqrjR6oys9dfg5aGNdXZejyyuPf1vg=; b=YnVLxEatWQEYx0jHq0IAvzD9z53G/4ynMvpPRtxkaxEI3G1r7xDvs4lBRl8BKK8sVC D5/DAi1jGWwWcEyBNzp2KrXMslYIwz/nCM/rpdE77V3LZ+YVPFOs8xrO6jvk/axBNTTw MkKG3wT8DM5RE9G3TSon4Jf/EwCE1MGW4cJblbzEUbgBxcJrZYnTGlhzAx5o97g4csS/ 6ctjYf3028zCgUg9aOdMQrqIudXpw4GRZzkp9JzOry0Hkx4XDWR4vMbEIfnI+BuoyGGp A1UfSjhlocjJ3Pad4GikQ/RED085n+gCm7azaCschaGpWhG+I6cg5GmnV1VqBGAWMNQn qEoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tFfQ9c8YXGxQQwqrjR6oys9dfg5aGNdXZejyyuPf1vg=; b=nMnrIWUxWdO34w/x/JT2QnZXnHh0x97CXRIw8Ghsd4aeHONk2+6bZ19UhPr4tiq514 igzkgdeG/ntUpu0/CnnCgC28FLNhOkYNsR4zHyITgkZ+RXD1rV1jRoXDpSUoaXXXmVef OoxYUmapVZ017e+d6JhkdNm3t45VzHYB8W/3S2kgJZNJWkwj5WE2O7dlrsm7ykNlPumN BjjefPDLtdX6azcOwEt8NvZUJLJ099hzXKVafpVPp45TbFa3r7KjvAo/2RzOw9psAttP wIKK1fQCvDpG+Jbhp2p16LiairVedA+91D45S5RupAMmwnI4z8itOSNhAc3O4pAHFbQn 5Tcw== X-Gm-Message-State: APzg51Db+Ca7h5ymOfflMtINw/BI0i5Fms19HE+QGKVwjV2mrEgDTAbn Az/O+YUej8X8D0o1H7mizy4= X-Google-Smtp-Source: ANB0Vda7gM6oXRTKYIaCexUkUiShe9Jn2An6YoMbuiIqmF7diafLDl42iCOez3qQIYf63qK/9HpN2A== X-Received: by 2002:a5d:4512:: with SMTP id s18-v6mr8486837wrq.82.1535643926751; Thu, 30 Aug 2018 08:45:26 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:26 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 07/30] iio: adc: remove mfd_probe & sunwi_irq_init function Date: Thu, 30 Aug 2018 17:44:55 +0200 Message-Id: <20180830154518.29507-8-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the previous commit we removed the function call, now we remove the unused functions. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 126 -------------------------------------- 1 file changed, 126 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index d6f00d3b802d..f787442a9e5f 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -431,55 +431,6 @@ static const struct dev_pm_ops sun4i_gpadc_pm_ops = { .runtime_resume = &sun4i_gpadc_runtime_resume, }; -static int sun4i_irq_init(struct platform_device *pdev, const char *name, - irq_handler_t handler, const char *devname, - unsigned int *irq, atomic_t *atomic) -{ - int ret; - struct sun4i_gpadc_dev *mfd_dev = dev_get_drvdata(pdev->dev.parent); - struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(&pdev->dev)); - - /* - * Once the interrupt is activated, the IP continuously performs - * conversions thus throws interrupts. The interrupt is activated right - * after being requested but we want to control when these interrupts - * occur thus we disable it right after being requested. However, an - * interrupt might occur between these two instructions and we have to - * make sure that does not happen, by using atomic flags. We set the - * flag before requesting the interrupt and unset it right after - * disabling the interrupt. When an interrupt occurs between these two - * instructions, reading the atomic flag will tell us to ignore the - * interrupt. - */ - atomic_set(atomic, 1); - - ret = platform_get_irq_byname(pdev, name); - if (ret < 0) { - dev_err(&pdev->dev, "no %s interrupt registered\n", name); - return ret; - } - - ret = regmap_irq_get_virq(mfd_dev->regmap_irqc, ret); - if (ret < 0) { - dev_err(&pdev->dev, "failed to get virq for irq %s\n", name); - return ret; - } - - *irq = ret; - ret = devm_request_any_context_irq(&pdev->dev, *irq, handler, 0, - devname, info); - if (ret < 0) { - dev_err(&pdev->dev, "could not request %s interrupt: %d\n", - name, ret); - return ret; - } - - disable_irq(*irq); - atomic_set(atomic, 0); - - return 0; -} - static const struct of_device_id sun4i_gpadc_of_id[] = { { .compatible = "allwinner,sun8i-a33-ths", @@ -523,83 +474,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, return 0; } -static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, - struct iio_dev *indio_dev) -{ - struct sun4i_gpadc_iio *info = iio_priv(indio_dev); - struct sun4i_gpadc_dev *sun4i_gpadc_dev = - dev_get_drvdata(pdev->dev.parent); - int ret; - - info->no_irq = false; - info->regmap = sun4i_gpadc_dev->regmap; - - indio_dev->num_channels = ARRAY_SIZE(sun4i_gpadc_channels); - indio_dev->channels = sun4i_gpadc_channels; - - info->data = (struct gpadc_data *)platform_get_device_id(pdev)->driver_data; - - /* - * Since the controller needs to be in touchscreen mode for its thermal - * sensor to operate properly, and that switching between the two modes - * needs a delay, always registering in the thermal framework will - * significantly slow down the conversion rate of the ADCs. - * - * Therefore, instead of depending on THERMAL_OF in Kconfig, we only - * register the sensor if that option is enabled, eventually leaving - * that choice to the user. - */ - - if (IS_ENABLED(CONFIG_THERMAL_OF)) { - /* - * This driver is a child of an MFD which has a node in the DT - * but not its children, because of DT backward compatibility - * for A10, A13 and A31 SoCs. Therefore, the resulting devices - * of this driver do not have an of_node variable. - * However, its parent (the MFD driver) has an of_node variable - * and since devm_thermal_zone_of_sensor_register uses its first - * argument to match the phandle defined in the node of the - * thermal driver with the of_node of the device passed as first - * argument and the third argument to call ops from - * thermal_zone_of_device_ops, the solution is to use the parent - * device as first argument to match the phandle with its - * of_node, and the device from this driver as third argument to - * return the temperature. - */ - info->sensor_device = pdev->dev.parent; - } else { - indio_dev->num_channels = - ARRAY_SIZE(sun4i_gpadc_channels_no_temp); - indio_dev->channels = sun4i_gpadc_channels_no_temp; - } - - if (IS_ENABLED(CONFIG_THERMAL_OF)) { - ret = sun4i_irq_init(pdev, "TEMP_DATA_PENDING", - sun4i_gpadc_temp_data_irq_handler, - "temp_data", &info->temp_data_irq, - &info->ignore_temp_data_irq); - if (ret < 0) - return ret; - } - - ret = sun4i_irq_init(pdev, "FIFO_DATA_PENDING", - sun4i_gpadc_fifo_data_irq_handler, "fifo_data", - &info->fifo_data_irq, &info->ignore_fifo_data_irq); - if (ret < 0) - return ret; - - if (IS_ENABLED(CONFIG_THERMAL_OF)) { - ret = iio_map_array_register(indio_dev, sun4i_gpadc_hwmon_maps); - if (ret < 0) { - dev_err(&pdev->dev, - "failed to register iio map array\n"); - return ret; - } - } - - return 0; -} - static int sun4i_gpadc_probe(struct platform_device *pdev) { struct sun4i_gpadc_iio *info; From patchwork Thu Aug 30 15:44:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582135 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 8F381175A for ; Thu, 30 Aug 2018 15:47:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EB382C0B1 for ; Thu, 30 Aug 2018 15:47:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71D512C0B4; Thu, 30 Aug 2018 15:47:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 2BCD62C0B1 for ; Thu, 30 Aug 2018 15:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbeH3Tu2 (ORCPT ); Thu, 30 Aug 2018 15:50:28 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:55437 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727530AbeH3TsO (ORCPT ); Thu, 30 Aug 2018 15:48:14 -0400 Received: by mail-wm0-f68.google.com with SMTP id f21-v6so2477184wmc.5; Thu, 30 Aug 2018 08:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=awFDsrjcpE5oAq0WnCWku0Gz21mtatXT2tD8s1pCm9w=; b=CVRJpklCpNJsCTdg11FncVMkwcUQVQA1BlM9n47a9EIY+R8d0ofPHmS9q1EC0UfDpz H2452z7JiwuolbMoiF3yM8uBLqKqjxwwzTTyYnsXToWWncvcQatk5kdzcjJF3OMmra9u /YVDw+o+2STQj+nJ27FduOkNCuLLMzKbCauXkUMDbKROroYSTPwrubhV+qFrgpXltUrz Lf+9SNEDKW2pq3y4UctwY1h35sbR9XFJ6oOTDaOnH9k7xxBNm8/qHPyi42CBOwMs/i35 hYGEmuv2bPwXDMCze5yzAUgs1ncm+KZ/YCKWY/I5sh27ZeQDdvTS+EgwbaZ6C5fmRax0 cELQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=awFDsrjcpE5oAq0WnCWku0Gz21mtatXT2tD8s1pCm9w=; b=fRKJlsl6cD8VX8kNct1dU+XXaPJv6kuSSfO1kRCYQs0CzP2KgOwDkWjiOPDBQzrX3k kCorsr0RXi8LDAeSJ1hVlbTVsevC30bJA0IG5WN2EKxqtN6Q8LBfzmR3afio9xJdR0BE /cmxZl3DBauTUgDmVW3eL2o7nHPATLSXsTtHJeJo61euczpq313729GLyFwO74rK4Qbc UvFbXEwwpueAZ0QWrB8l+YKkayZ5oYCC7TL75auMdltkNe6B0JLBbpAlp/yqEx/T7zL6 C69nxowdhTrsFDMx5k49qfQTLLKN/1dPvhfxbbIDioHm8OgaizJxyTdwhxTzNRaOIu0f 3YAQ== X-Gm-Message-State: APzg51B/5wBPRg/GHTGLke4O55lmuLKPL9VgUo9TV7PEiHdZjziVL8H4 a69ddz2hrEBgLu3XbAtUfT8= X-Google-Smtp-Source: ANB0VdaiSw2OprTQRSxIQK11FYUAWcbWxEvRfhNWqaQJhP7+j8aNXVGYvRjkqXfQz97UM7mg5BLNIw== X-Received: by 2002:a7b:c096:: with SMTP id r22-v6mr1839371wmh.118.1535643927725; Thu, 30 Aug 2018 08:45:27 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:27 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 08/30] iio: adc: remove hwmon structure Date: Thu, 30 Aug 2018 17:44:56 +0200 Message-Id: <20180830154518.29507-9-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We remove the hwmon structure that was requiered for the mfd driver. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index f787442a9e5f..ab474ce86fb6 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -109,14 +109,6 @@ struct sun4i_gpadc_iio { struct device *sensor_device; }; -static struct iio_map sun4i_gpadc_hwmon_maps[] = { - { - .adc_channel_label = "temp_adc", - .consumer_dev_name = "iio_hwmon.0", - }, - { /* sentinel */ }, -}; - static const struct iio_chan_spec sun4i_gpadc_channels[] = { SUN4I_GPADC_ADC_CHANNEL(0, "adc_chan0"), SUN4I_GPADC_ADC_CHANNEL(1, "adc_chan1"), From patchwork Thu Aug 30 15:44:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582131 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 66D6817DE for ; Thu, 30 Aug 2018 15:47:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 581B32C0B0 for ; Thu, 30 Aug 2018 15:47:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C3F22C0B2; Thu, 30 Aug 2018 15:47:40 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 ED8832C0B0 for ; Thu, 30 Aug 2018 15:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727629AbeH3TsQ (ORCPT ); Thu, 30 Aug 2018 15:48:16 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43347 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727602AbeH3TsP (ORCPT ); Thu, 30 Aug 2018 15:48:15 -0400 Received: by mail-wr1-f67.google.com with SMTP id k5-v6so8500348wre.10; Thu, 30 Aug 2018 08:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5XND9vHjfuJCOwJpFz7zMX/u/hpV4Qa0BGP58J/DvOk=; b=TNWOp0PAQHFrUDVCcHK0c4JtKL0NoAr5sk9Sj+OC0whe1rqb0aWUX2gGlSE0Vm+aMp j5Ti6Sc7JwEFNxgodD1mBSZDfxesQvlBe6cqTSBS8eHPj8NkJ4X6gqUUfC4et2Rih3SR TNVIpnaevlZtr2lMfAVo7sGUg/dvjSfUO3V73cTNsDLBctf2ET2j1nth9a05CdtkdlZ9 o+U/hl+6+3TM83z0q2vQXzMSen+DzFC10If2E2/1lGhCrZP9kSt4ZRiQc+6E2+3Z1nhL KnIXLIcBGl8+0l4QawJdXQeGcIiZFMz6B+Fj9e0HgsLXQ8ELyS0qruBhznyrSX/cTRpp ddKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5XND9vHjfuJCOwJpFz7zMX/u/hpV4Qa0BGP58J/DvOk=; b=HrsyCCrQPw01/4lKluHxg8JA0S9lu6s70wXJlV9cpZJI73taE4fFSTJabskN4E+nRz OrwVL6vZ1+pTBmdzUS93mgSoS3Dk7jRSyF056T2tbG+jFdxf4JpsF6qrJCA92FgiI0Xt y2RZ/ztFfFU89pN5U/xJmv5XPelPOLmEySxqFZ+vNxmGL+QhrjEcL8vHK3rI2msjwqQh DucbBKO1Ot5/AY/kcsLi6ZhaCqmfP9/TNXlNkyl+u+/Dhuqf2golqYww5yxcJVZ/C5WW y5YrKkSXKDPEv+wDfYYVAprKidQY5ZX7xFS1J2K6zx+OJaYwgt2fHzeey61vUmSbeHYH +xbA== X-Gm-Message-State: APzg51CzCH4JEFgsiAJVFVaG+bFNP/dTaSV25ccK+wW48lQY4NyjBGkm Bmd50UDiPd4nOSXbxekNbms= X-Google-Smtp-Source: ANB0VdbimhtaitKvqHvNaGjItKwbG+oI0Tg7BVULZDbnbRdQ/1/LwDiOKY96rI7o/z4NQ0cRTyM6xQ== X-Received: by 2002:adf:e648:: with SMTP id b8-v6mr8388682wrn.254.1535643928697; Thu, 30 Aug 2018 08:45:28 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:28 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 09/30] iio: adc: Threat A33 as thermal sensor and remove non thermal sun4i channel Date: Thu, 30 Aug 2018 17:44:57 +0200 Message-Id: <20180830154518.29507-10-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We want to use this driver mostly as thermal sensor, that still supports the adc for the older chips, thus we threat the A33 as thermal sensor. We also remove the adc channel without thermal support. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index ab474ce86fb6..658a7e3e3370 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -123,23 +123,6 @@ static const struct iio_chan_spec sun4i_gpadc_channels[] = { }, }; -static const struct iio_chan_spec sun4i_gpadc_channels_no_temp[] = { - SUN4I_GPADC_ADC_CHANNEL(0, "adc_chan0"), - SUN4I_GPADC_ADC_CHANNEL(1, "adc_chan1"), - SUN4I_GPADC_ADC_CHANNEL(2, "adc_chan2"), - SUN4I_GPADC_ADC_CHANNEL(3, "adc_chan3"), -}; - -static const struct iio_chan_spec sun8i_a33_gpadc_channels[] = { - { - .type = IIO_TEMP, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_SCALE) | - BIT(IIO_CHAN_INFO_OFFSET), - .datasheet_name = "temp_adc", - }, -}; - static const struct regmap_config sun4i_gpadc_regmap_config = { .reg_bits = 32, .val_bits = 32, @@ -444,8 +427,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, return -ENODEV; info->no_irq = true; - indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels); - indio_dev->channels = sun8i_a33_gpadc_channels; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, mem); From patchwork Thu Aug 30 15:44:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582127 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 EB0C3175A for ; Thu, 30 Aug 2018 15:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D98B52C0B0 for ; Thu, 30 Aug 2018 15:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD1C82C0B2; Thu, 30 Aug 2018 15:47:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 EA1712C0B0 for ; Thu, 30 Aug 2018 15:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727653AbeH3TsS (ORCPT ); Thu, 30 Aug 2018 15:48:18 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43348 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbeH3TsR (ORCPT ); Thu, 30 Aug 2018 15:48:17 -0400 Received: by mail-wr1-f67.google.com with SMTP id k5-v6so8500409wre.10; Thu, 30 Aug 2018 08:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mXI7YLqzNDhs6RSyLDcVkfytbFORNGi/mH3nk05eeaE=; b=W5w0iO859tPzJ9JRie5xBabMOuDB9vR2y1RC9nw2fbrYX3KKvTLjLtaua8B1BOM5oz 1hqkpNtJrpqN6tkV1XoO/isRMS1KRZ6nP/M8TIDjs/04BQIO5xgayFNqjk/3gXnvaAYg AoPfbrqzxSrjjrqPfmro+qTy6Jeay0e/cdEpXgSsAgiJijjVuu+C4GfXFi585qN5vCP/ 0KbIyYmj0B39FYw20TduAGUU4PvU3Ii9pY7rhUoZv0Tif8MCerIdGjS6gEzpd/co8ymc g8/BFgxwRsYAWcyB+qKeri1kZeYsQIaHFExXI9SKxIEeC4kkM7VZeXhlXLn8WSLQD/hi UNjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mXI7YLqzNDhs6RSyLDcVkfytbFORNGi/mH3nk05eeaE=; b=iDtk+SXn3eiRwb/W4ag2aL+RP8IeGQVJQmh2ckXeXpgTKNsVO6kcztd4C3NembM2/2 MRzu9uynnhn0Q9rtn4QfT0O/xPh7Gvmm7MIV/5LrEupd6RghISQZcFQKjaT/qcjcPtzs HbcDvdY9qZHqqvzhk3+YVeeTH6wGZN1wARYtvdbF3pz/DkrN77dsSKR19b28EGa4fuAD Rmy5sCOTgLMGmFi7xNWKeVjmRYEgS3mb3ywcVMcq1cf7zeCF2vO0/hLfYAf9rhtgAUv0 99zd9OA7ZBMdrolsU0b0/px409Ki1I/E6hQpCbb8AMxJL6tAuMHOhwRLr85SwxZdoMw/ zXaw== X-Gm-Message-State: APzg51BVG5xwj+EJ7cDqD1A+Pxrr7U9UjtGqPagSTGRdDveI5Vq1dTlp DgrHzwBW48Pq9jjeuBaMdSs= X-Google-Smtp-Source: ANB0VdZfMB7UKkMwjYrSKvIHKJU3Z6dtJe9EuPt2DSx7PfyFooItBq5MUBxSu0Jx3vyrYtRtSlBslA== X-Received: by 2002:adf:e30e:: with SMTP id b14-v6mr7914950wrj.158.1535643929706; Thu, 30 Aug 2018 08:45:29 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:29 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 10/30] iio: adc: rework irq and adc_channel handling Date: Thu, 30 Aug 2018 17:44:58 +0200 Message-Id: <20180830154518.29507-11-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We rework the irq handling and the adc_channel handling. This is requiered since we merge the mfd driver into the adc driver. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 157 ++++++++++++++++++++++++-------------- include/linux/mfd/sun4i-gpadc.h | 7 -- 2 files changed, 98 insertions(+), 66 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 658a7e3e3370..a2027614ee0c 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -49,6 +49,8 @@ static unsigned int sun6i_gpadc_chan_select(unsigned int chan) return SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(chan); } +struct sun4i_gpadc_iio; + struct gpadc_data { int temp_offset; int temp_scale; @@ -56,8 +58,15 @@ struct gpadc_data { unsigned int tp_adc_select; unsigned int (*adc_chan_select)(unsigned int chan); unsigned int adc_chan_mask; + bool adc_channel; + irqreturn_t (*ths_irq_thread)(int irq, void *dev_id); + int (*ths_suspend)(struct sun4i_gpadc_iio *info); + int (*ths_resume)(struct sun4i_gpadc_iio *info); + bool support_irq; }; +static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); + static const struct gpadc_data sun4i_gpadc_data = { .temp_offset = -1932, .temp_scale = 133, @@ -65,6 +74,9 @@ static const struct gpadc_data sun4i_gpadc_data = { .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT, .adc_chan_select = &sun4i_gpadc_chan_select, .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK, + .adc_channel = true, + .ths_irq_thread = sun4i_gpadc_data_irq_handler, + .support_irq = true, }; static const struct gpadc_data sun5i_gpadc_data = { @@ -74,6 +86,9 @@ static const struct gpadc_data sun5i_gpadc_data = { .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT, .adc_chan_select = &sun4i_gpadc_chan_select, .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK, + .adc_channel = true, + .ths_irq_thread = sun4i_gpadc_data_irq_handler, + .support_irq = true, }; static const struct gpadc_data sun6i_gpadc_data = { @@ -83,6 +98,9 @@ static const struct gpadc_data sun6i_gpadc_data = { .tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT, .adc_chan_select = &sun6i_gpadc_chan_select, .adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK, + .adc_channel = true, + .ths_irq_thread = sun4i_gpadc_data_irq_handler, + .support_irq = true, }; static const struct gpadc_data sun8i_a33_gpadc_data = { @@ -96,13 +114,10 @@ struct sun4i_gpadc_iio { struct completion completion; int temp_data; u32 adc_data; + unsigned int irq_data_type; struct regmap *regmap; - unsigned int fifo_data_irq; - atomic_t ignore_fifo_data_irq; - unsigned int temp_data_irq; - atomic_t ignore_temp_data_irq; + unsigned int irq; const struct gpadc_data *data; - bool no_irq; /* prevents concurrent reads of temperature and ADC */ struct mutex mutex; struct thermal_zone_device *tzd; @@ -130,6 +145,20 @@ static const struct regmap_config sun4i_gpadc_regmap_config = { .fast_io = true, }; +static int sun4i_gpadc_irq_init(struct sun4i_gpadc_iio *info) +{ + u32 reg; + + if (info->irq_data_type == SUN4I_GPADC_IRQ_FIFO_DATA) + reg = SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN; + else + reg = SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN; + + regmap_write(info->regmap, SUN4I_GPADC_INT_FIFOC, reg); + + return 0; +} + static int sun4i_prepare_for_irq(struct iio_dev *indio_dev, int channel, unsigned int irq) { @@ -151,7 +180,7 @@ static int sun4i_prepare_for_irq(struct iio_dev *indio_dev, int channel, if (ret) return ret; - if (irq == info->fifo_data_irq) { + if (irq == SUN4I_GPADC_IRQ_FIFO_DATA) { ret = regmap_write(info->regmap, SUN4I_GPADC_CTRL1, info->data->tp_mode_en | info->data->tp_adc_select | @@ -172,6 +201,8 @@ static int sun4i_prepare_for_irq(struct iio_dev *indio_dev, int channel, ret = regmap_write(info->regmap, SUN4I_GPADC_CTRL1, info->data->tp_mode_en); } + if (info->data->support_irq) + sun4i_gpadc_irq_init(info); if (ret) return ret; @@ -194,11 +225,12 @@ static int sun4i_gpadc_read(struct iio_dev *indio_dev, int channel, int *val, mutex_lock(&info->mutex); + info->irq_data_type = irq; ret = sun4i_prepare_for_irq(indio_dev, channel, irq); if (ret) goto err; - enable_irq(irq); + enable_irq(info->irq); /* * The temperature sensor throws an interruption periodically (currently @@ -212,7 +244,7 @@ static int sun4i_gpadc_read(struct iio_dev *indio_dev, int channel, int *val, goto err; } - if (irq == info->fifo_data_irq) + if (irq == SUN4I_GPADC_IRQ_FIFO_DATA) *val = info->adc_data; else *val = info->temp_data; @@ -222,7 +254,7 @@ static int sun4i_gpadc_read(struct iio_dev *indio_dev, int channel, int *val, err: pm_runtime_put_autosuspend(indio_dev->dev.parent); - disable_irq(irq); + disable_irq(info->irq); mutex_unlock(&info->mutex); return ret; @@ -231,16 +263,15 @@ static int sun4i_gpadc_read(struct iio_dev *indio_dev, int channel, int *val, static int sun4i_gpadc_adc_read(struct iio_dev *indio_dev, int channel, int *val) { - struct sun4i_gpadc_iio *info = iio_priv(indio_dev); - - return sun4i_gpadc_read(indio_dev, channel, val, info->fifo_data_irq); + return sun4i_gpadc_read(indio_dev, channel, val, + SUN4I_GPADC_IRQ_FIFO_DATA); } static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val) { struct sun4i_gpadc_iio *info = iio_priv(indio_dev); - if (info->no_irq) { + if (!info->data->support_irq) { pm_runtime_get_sync(indio_dev->dev.parent); regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, val); @@ -251,7 +282,7 @@ static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val) return 0; } - return sun4i_gpadc_read(indio_dev, 0, val, info->temp_data_irq); + return sun4i_gpadc_read(indio_dev, 0, val, SUN4I_GPADC_IRQ_TEMP_DATA); } static int sun4i_gpadc_temp_offset(struct iio_dev *indio_dev, int *val) @@ -320,31 +351,21 @@ static const struct iio_info sun4i_gpadc_iio_info = { .read_raw = sun4i_gpadc_read_raw, }; -static irqreturn_t sun4i_gpadc_temp_data_irq_handler(int irq, void *dev_id) +static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id) { struct sun4i_gpadc_iio *info = dev_id; - if (atomic_read(&info->ignore_temp_data_irq)) - goto out; - - if (!regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, &info->temp_data)) - complete(&info->completion); - -out: - return IRQ_HANDLED; -} - -static irqreturn_t sun4i_gpadc_fifo_data_irq_handler(int irq, void *dev_id) -{ - struct sun4i_gpadc_iio *info = dev_id; - - if (atomic_read(&info->ignore_fifo_data_irq)) - goto out; - - if (!regmap_read(info->regmap, SUN4I_GPADC_DATA, &info->adc_data)) - complete(&info->completion); - -out: + if (info->irq_data_type == SUN4I_GPADC_IRQ_FIFO_DATA) { + /* read fifo data */ + if (!regmap_read(info->regmap, SUN4I_GPADC_DATA, + &info->adc_data)) + complete(&info->completion); + } else { + /* read temp data */ + if (!regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, + &info->temp_data)) + complete(&info->completion); + } return IRQ_HANDLED; } @@ -356,6 +377,8 @@ static int sun4i_gpadc_runtime_suspend(struct device *dev) regmap_write(info->regmap, SUN4I_GPADC_CTRL1, 0); /* Disable temperature sensor on IP */ regmap_write(info->regmap, SUN4I_GPADC_TPR, 0); + /* Disable irq*/ + regmap_write(info->regmap, SUN4I_GPADC_INT_FIFOC, 0); return 0; } @@ -378,6 +401,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev) SUN4I_GPADC_TPR_TEMP_ENABLE | SUN4I_GPADC_TPR_TEMP_PERIOD(800)); + return 0; } @@ -426,8 +450,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, if (!info->data) return -ENODEV; - info->no_irq = true; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, mem); if (IS_ERR(base)) @@ -441,8 +463,25 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, return ret; } - if (IS_ENABLED(CONFIG_THERMAL_OF)) - info->sensor_device = &pdev->dev; + if (info->data->support_irq) { + + /* ths interrupt */ + info->irq = platform_get_irq(pdev, 0); + + ret = devm_request_threaded_irq(&pdev->dev, info->irq, + NULL, info->data->ths_irq_thread, + IRQF_ONESHOT, dev_name(&pdev->dev), info); + + if (info->data->adc_channel) + disable_irq(info->irq); + + if (ret) { + dev_err(&pdev->dev, "failed to add ths irq: %d\n", ret); + return ret; + } + } + + info->sensor_device = &pdev->dev; return 0; } @@ -469,6 +508,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) indio_dev->info = &sun4i_gpadc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; + if (&info->data->adc_channel) { + indio_dev->num_channels = ARRAY_SIZE(sun4i_gpadc_channels); + indio_dev->channels = sun4i_gpadc_channels; + } + ret = sun4i_gpadc_probe_dt(pdev, indio_dev); if (ret) @@ -480,20 +524,18 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) pm_runtime_set_suspended(&pdev->dev); pm_runtime_enable(&pdev->dev); - if (IS_ENABLED(CONFIG_THERMAL_OF)) { - info->tzd = thermal_zone_of_sensor_register(info->sensor_device, - 0, info, - &sun4i_ts_tz_ops); - /* - * Do not fail driver probing when failing to register in - * thermal because no thermal DT node is found. - */ - if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) { - dev_err(&pdev->dev, - "could not register thermal sensor: %ld\n", - PTR_ERR(info->tzd)); - return PTR_ERR(info->tzd); - } + info->tzd = thermal_zone_of_sensor_register(info->sensor_device, + 0, info, + &sun4i_ts_tz_ops); + /* + * Do not fail driver probing when failing to register in + * thermal because no thermal DT node is found. + */ + if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) { + dev_err(&pdev->dev, + "could not register thermal sensor: %ld\n", + PTR_ERR(info->tzd)); + return PTR_ERR(info->tzd); } ret = devm_iio_device_register(&pdev->dev, indio_dev); @@ -505,7 +547,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) return 0; err_map: - if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF)) + if (!info->data->support_irq) iio_map_array_unregister(indio_dev); pm_runtime_put(&pdev->dev); @@ -522,12 +564,9 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); - if (!IS_ENABLED(CONFIG_THERMAL_OF)) - return 0; - thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd); - if (!info->no_irq) + if (!info->data->support_irq) iio_map_array_unregister(indio_dev); return 0; diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h index 54c7c9375c1b..ca59336f246b 100644 --- a/include/linux/mfd/sun4i-gpadc.h +++ b/include/linux/mfd/sun4i-gpadc.h @@ -99,11 +99,4 @@ .datasheet_name = _name, \ } -struct sun4i_gpadc_dev { - struct device *dev; - struct regmap *regmap; - struct regmap_irq_chip_data *regmap_irqc; - void __iomem *base; -}; - #endif From patchwork Thu Aug 30 15:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582129 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 EC0FC175A for ; Thu, 30 Aug 2018 15:47:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC7692C0B0 for ; Thu, 30 Aug 2018 15:47:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFF682C0B2; Thu, 30 Aug 2018 15:47:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 8A0CA2C0B0 for ; Thu, 30 Aug 2018 15:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727645AbeH3TsS (ORCPT ); Thu, 30 Aug 2018 15:48:18 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37930 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727624AbeH3TsR (ORCPT ); Thu, 30 Aug 2018 15:48:17 -0400 Received: by mail-wm0-f67.google.com with SMTP id t25-v6so2496178wmi.3; Thu, 30 Aug 2018 08:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=m9HSKer3qo7NlJvusjul6JsIn+NxC9/6alEw8B/KC/k=; b=iiibwLdS7N0B9ID4gjVEPs7HkFAeGvUubNGYDDNOV07qucdQKY13uaBNDTpIufpp0a qiFBm5mrsc2aKEcA1N+QN0YjRd+nIcgeDrWXY03HAma75dfrQayKUW5VF0Q6N743PyF7 6hm006I4SoSicQPELV1Mn55HVrDiQ/69Z7F1W/7egJLYHlYNt7MGRhKF48kpI/EJ5J3V 9R+LYZuuswJa+8RalklVMXEwq89BL0rqMyjcb5sSeB8RqdHoyZU8uyGk1WZsQakhHRdn bwMHZnamyja8uU5yaHUZGljp1MKRHNOEyD2AjA1OiT+kiPaxu5ADF8Nr9UjFG/S2P+q6 wMCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=m9HSKer3qo7NlJvusjul6JsIn+NxC9/6alEw8B/KC/k=; b=JWcdasJLyMeyAzNdaxaqRjM7F1MAKJ1vbyn1Xvy/AgyjOv0qJnAs3P59GuDRleeSek +edcNbWO1UNGy4fIsmLo3PIkyRXyWZ3eyNslca4Ifs2scqooqMvSCaTja97jpl2nx0Ew vRCxGkk9MBUMkBis8yEvwELoX4LomWm5qJGVI09ZWr8WeAXQ0HDftigyIV5NKCNhPgk1 B2WR7Ayv8b4YSxe+u43nyn5bMwEg5Nw/C7VpcJ+ZtcRVP10xvwGakzRC2auo6nQ2I2Yr FSKduWafZ2eiw8e2gGTgcpLEs1iZIRO74GicrRhzl4wL7TKwRGVrduCH5EHwNQMV1mJR MggQ== X-Gm-Message-State: APzg51CbO9uyrTBJcPVGQ+b6fCX1kTTdn2JfP5SwLohdaCbn48PgFyio NGY8aaBeLhFrYVC4J8qbfhA= X-Google-Smtp-Source: ANB0VdaFJAhWXJk78Cp9OiQ7ErZu6Y2oVsDKehJC0EBmwDHpPpfWkJ02s5JAn59gEXR0m8DSt46Ejw== X-Received: by 2002:a1c:a8d0:: with SMTP id r199-v6mr2041463wme.97.1535643930663; Thu, 30 Aug 2018 08:45:30 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:30 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 11/30] iio: adc: add new compatibles Date: Thu, 30 Aug 2018 17:44:59 +0200 Message-Id: <20180830154518.29507-12-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are now adding the new compatibles. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index a2027614ee0c..79b8efdab803 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -435,6 +435,18 @@ static const struct of_device_id sun4i_gpadc_of_id[] = { .compatible = "allwinner,sun8i-a33-ths", .data = &sun8i_a33_gpadc_data, }, + { + .compatible = "allwinner,sun4i-a10-gpadc", + .data = &sun4i_gpadc_data + }, + { + .compatible = "allwinner,sun5i-a13-gpadc", + .data = &sun5i_gpadc_data + }, + { + .compatible = "allwinner,sun6i-a31-gpadc", + .data = &sun6i_gpadc_data + }, { /* sentinel */ } }; From patchwork Thu Aug 30 15:45:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582125 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 50D16180E for ; Thu, 30 Aug 2018 15:47:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4076D2C0B1 for ; Thu, 30 Aug 2018 15:47:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28FAB2C0B0; Thu, 30 Aug 2018 15:47:30 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 0A91B2C0A7 for ; Thu, 30 Aug 2018 15:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727957AbeH3TuN (ORCPT ); Thu, 30 Aug 2018 15:50:13 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37061 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727602AbeH3TsS (ORCPT ); Thu, 30 Aug 2018 15:48:18 -0400 Received: by mail-wm0-f67.google.com with SMTP id n11-v6so2499607wmc.2; Thu, 30 Aug 2018 08:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qLNFVsnalsTHWh23gsrqklrbEjw/wwp/7aVPhkgH9x4=; b=QnUeDD7ZZM1CBfOJRqCxDyBRr+ap7TNw/6J6K3t7p3ncLYv8rpyzyQQz+f85p4drd3 3ccGlLTb2MftRC5G7Fpjv8Q/P+ylg1QTI0vlpnZsniMNnHJqvY4WQ6XPKFYCZDg2BZ6E wGJ/q9l7Uhn+R2Czg1KUbVt7QkmzvYIVzyfQOAsuLcsk/UA3VoOMTuQOb/15YkUGRYLB 3aKL7BVFTDYVVi5rc1d8MXWvC50bme5HUtpwwcA1hBJZY6DbewWZX/p1/s5AdnodWSIx +IR38s2dI83eGdyaCV5YYkizbUn2PSMPytoOzABKMdSSeZMGa2Fukmt2TkrbqCfMp7Hf Lp7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qLNFVsnalsTHWh23gsrqklrbEjw/wwp/7aVPhkgH9x4=; b=cqlVVvhtmp1zxH4014SMO8KyzY0QZDA6Vpkdfh76/s+Fe3DGF7dmB2QyRwU5KSGDEA 2Iaue/MeFD2DjCrVd69xvzF/W637OxjL+eTusaDBuqDxdGRlqgyIhHFGFFon/PPKcuHj KXBMrmgiumtNEmkrLc7SsItvbxlstGNodNxwTiUwiCRnBErwAibhrTPTpuWz9Vfppz15 2+BZkVzJWfRSZHggTYUO8Qd5u2d9LuR3qoCs0YcxAlqn508LIZqTZSp78FzuNpFc6qc4 XHjroQa1g55GDxOyU+/WFFFoizElxGCk+/ICm7sgoklsK8/za/XRW0pwGw8VjdDTk8db NeAg== X-Gm-Message-State: APzg51B0rVEdYD5md0mW9yGkiRf+M1cWeGyG/N3tp3vtJ49ZGZ7blBmC Ucd6z5zvbtBC6YyGeNgHsQ8= X-Google-Smtp-Source: ANB0VdZeA0GpfeJjw90+9v/XXayda1G+dh1963DlyIDiLrg8hKzK+hSUBtqoBGzLRpjSP25+WKb3fg== X-Received: by 2002:a1c:1351:: with SMTP id 78-v6mr2121271wmt.127.1535643931693; Thu, 30 Aug 2018 08:45:31 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:31 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 12/30] mfd: Remove old mfd driver & Move sun4i-gpadc.h to iio/adc/ Date: Thu, 30 Aug 2018 17:45:00 +0200 Message-Id: <20180830154518.29507-13-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we reworked the sun4i-gpadc iio driver we can now remove the mfd driver and move it's header to include/linux/iio/adc. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 2 +- drivers/mfd/sun4i-gpadc.c | 181 --------------------------- include/linux/{mfd => iio/adc}/sun4i-gpadc.h | 0 3 files changed, 1 insertion(+), 182 deletions(-) delete mode 100644 drivers/mfd/sun4i-gpadc.c rename include/linux/{mfd => iio/adc}/sun4i-gpadc.h (100%) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 79b8efdab803..e1fe5e8e9dc0 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include static unsigned int sun4i_gpadc_chan_select(unsigned int chan) { diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c deleted file mode 100644 index 9cfc88134d03..000000000000 --- a/drivers/mfd/sun4i-gpadc.c +++ /dev/null @@ -1,181 +0,0 @@ -/* ADC MFD core driver for sunxi platforms - * - * Copyright (c) 2016 Quentin Schulz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#define ARCH_SUN4I_A10 0 -#define ARCH_SUN5I_A13 1 -#define ARCH_SUN6I_A31 2 - -static struct resource adc_resources[] = { - DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_FIFO_DATA, "FIFO_DATA_PENDING"), - DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_TEMP_DATA, "TEMP_DATA_PENDING"), -}; - -static const struct regmap_irq sun4i_gpadc_regmap_irq[] = { - REGMAP_IRQ_REG(SUN4I_GPADC_IRQ_FIFO_DATA, 0, - SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN), - REGMAP_IRQ_REG(SUN4I_GPADC_IRQ_TEMP_DATA, 0, - SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN), -}; - -static const struct regmap_irq_chip sun4i_gpadc_regmap_irq_chip = { - .name = "sun4i_gpadc_irq_chip", - .status_base = SUN4I_GPADC_INT_FIFOS, - .ack_base = SUN4I_GPADC_INT_FIFOS, - .mask_base = SUN4I_GPADC_INT_FIFOC, - .init_ack_masked = true, - .mask_invert = true, - .irqs = sun4i_gpadc_regmap_irq, - .num_irqs = ARRAY_SIZE(sun4i_gpadc_regmap_irq), - .num_regs = 1, -}; - -static struct mfd_cell sun4i_gpadc_cells[] = { - { - .name = "sun4i-a10-gpadc-iio", - .resources = adc_resources, - .num_resources = ARRAY_SIZE(adc_resources), - }, - { .name = "iio_hwmon" } -}; - -static struct mfd_cell sun5i_gpadc_cells[] = { - { - .name = "sun5i-a13-gpadc-iio", - .resources = adc_resources, - .num_resources = ARRAY_SIZE(adc_resources), - }, - { .name = "iio_hwmon" }, -}; - -static struct mfd_cell sun6i_gpadc_cells[] = { - { - .name = "sun6i-a31-gpadc-iio", - .resources = adc_resources, - .num_resources = ARRAY_SIZE(adc_resources), - }, - { .name = "iio_hwmon" }, -}; - -static const struct regmap_config sun4i_gpadc_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - .fast_io = true, -}; - -static const struct of_device_id sun4i_gpadc_of_match[] = { - { - .compatible = "allwinner,sun4i-a10-ts", - .data = (void *)ARCH_SUN4I_A10, - }, { - .compatible = "allwinner,sun5i-a13-ts", - .data = (void *)ARCH_SUN5I_A13, - }, { - .compatible = "allwinner,sun6i-a31-ts", - .data = (void *)ARCH_SUN6I_A31, - }, { /* sentinel */ } -}; - -MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_match); - -static int sun4i_gpadc_probe(struct platform_device *pdev) -{ - struct sun4i_gpadc_dev *dev; - struct resource *mem; - const struct of_device_id *of_id; - const struct mfd_cell *cells; - unsigned int irq, size; - int ret; - - of_id = of_match_node(sun4i_gpadc_of_match, pdev->dev.of_node); - if (!of_id) - return -EINVAL; - - switch ((long)of_id->data) { - case ARCH_SUN4I_A10: - cells = sun4i_gpadc_cells; - size = ARRAY_SIZE(sun4i_gpadc_cells); - break; - case ARCH_SUN5I_A13: - cells = sun5i_gpadc_cells; - size = ARRAY_SIZE(sun5i_gpadc_cells); - break; - case ARCH_SUN6I_A31: - cells = sun6i_gpadc_cells; - size = ARRAY_SIZE(sun6i_gpadc_cells); - break; - default: - return -EINVAL; - } - - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); - if (!dev) - return -ENOMEM; - - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dev->base = devm_ioremap_resource(&pdev->dev, mem); - if (IS_ERR(dev->base)) - return PTR_ERR(dev->base); - - dev->dev = &pdev->dev; - dev_set_drvdata(dev->dev, dev); - - dev->regmap = devm_regmap_init_mmio(dev->dev, dev->base, - &sun4i_gpadc_regmap_config); - if (IS_ERR(dev->regmap)) { - ret = PTR_ERR(dev->regmap); - dev_err(&pdev->dev, "failed to init regmap: %d\n", ret); - return ret; - } - - /* Disable all interrupts */ - regmap_write(dev->regmap, SUN4I_GPADC_INT_FIFOC, 0); - - irq = platform_get_irq(pdev, 0); - ret = devm_regmap_add_irq_chip(&pdev->dev, dev->regmap, irq, - IRQF_ONESHOT, 0, - &sun4i_gpadc_regmap_irq_chip, - &dev->regmap_irqc); - if (ret) { - dev_err(&pdev->dev, "failed to add irq chip: %d\n", ret); - return ret; - } - - ret = devm_mfd_add_devices(dev->dev, 0, cells, size, NULL, 0, NULL); - if (ret) { - dev_err(&pdev->dev, "failed to add MFD devices: %d\n", ret); - return ret; - } - - return 0; -} - -static struct platform_driver sun4i_gpadc_driver = { - .driver = { - .name = "sun4i-gpadc", - .of_match_table = of_match_ptr(sun4i_gpadc_of_match), - }, - .probe = sun4i_gpadc_probe, -}; - -module_platform_driver(sun4i_gpadc_driver); - -MODULE_DESCRIPTION("Allwinner sunxi platforms' GPADC MFD core driver"); -MODULE_AUTHOR("Quentin Schulz "); -MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/iio/adc/sun4i-gpadc.h similarity index 100% rename from include/linux/mfd/sun4i-gpadc.h rename to include/linux/iio/adc/sun4i-gpadc.h From patchwork Thu Aug 30 15:45:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582123 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 04DE417DE for ; Thu, 30 Aug 2018 15:47:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E73C82C0A7 for ; Thu, 30 Aug 2018 15:47:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D924F2C0B0; Thu, 30 Aug 2018 15:47:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 89AC52C0A7 for ; Thu, 30 Aug 2018 15:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbeH3TsU (ORCPT ); Thu, 30 Aug 2018 15:48:20 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54866 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727642AbeH3TsT (ORCPT ); Thu, 30 Aug 2018 15:48:19 -0400 Received: by mail-wm0-f68.google.com with SMTP id c14-v6so2472489wmb.4; Thu, 30 Aug 2018 08:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/SC5i8JP4t8++oAR2mX2JW6l48vvz33dbW/6zVBuRL4=; b=TCRD4xO+1P11C2egwwKOMJhII4iYcUVlekbe6kDOlOTwzPR2/AsGcMNYK5/zyOMcP4 hf4mYEPT7qPIvpJpEIYIOitl5KuE6/tiZXV0sMX3Vb1sI3QtqVuRSxIpB/7jAaR5Dmyh nvobXecTK8ZUe1YOCf/EJzPKgppOZRk6nmSUTnpWVvkpfc8gmJlofyfN04w89Hi9NmVA szZ79KDQAnVY9FXMLIt2NcoRNEeECdWLTHHReKLFSh6sedsqR1RtlwBd9nzgo5G5GqXo pVy6Qi5zUNVvlfymNE7zGE0868zhCjNAlTzXYpcHrKlMjsFtpBTQXnqTNnuUjbNHw8eh yneg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/SC5i8JP4t8++oAR2mX2JW6l48vvz33dbW/6zVBuRL4=; b=WHy9TNLXZJZ+NnJYkTGBpNJ4gbtd6j1EHf1GXU8YAzPSTV2EHrCzfkJaAVx0koellH DY8HkieD8TGc2hkrnArMMoawVV+Gjv90v1Uzp3ErjwYRTLlpzWOhB0pEHlzbjjVL3Nzr 2GzOw9BOWclz9izxdRahcdpZjjlgyFXRUmItIQwEhc5sp37NvzKc0QbOtBlpiiqBYUVt 1kSKf1eA+xhAhsNVXMn5Djbbd6dOp2qAl/48WLfq4/AdUMFLSMxRGzAXO4E9hluxu7zi OaC2KZs9xr9AibkM1LnhEWWzvoqZVxtTuCz4c4GMOPk2huyj0+xT8wNMzjLUKOECRowQ PQ5g== X-Gm-Message-State: APzg51Aopht6/HzZAYTr22fdnKtomLApyyLAOIwV5QYam7KGCig3jtCG WcmVEOwThKYBLaHLlJ2Kzac= X-Google-Smtp-Source: ANB0VdaLjA7zyEY01kY8ytkdtd7jeSNKwZ6haIieI8UVzOWiFROpu2oWoL9rBquUlscVb+GPgEv0bw== X-Received: by 2002:a1c:8dd1:: with SMTP id p200-v6mr2023371wmd.145.1535643932712; Thu, 30 Aug 2018 08:45:32 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:32 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 13/30] arm: config: Enable SUN4I_GPADC in defconfig Date: Thu, 30 Aug 2018 17:45:01 +0200 Message-Id: <20180830154518.29507-14-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we have now new compatibles we can enable the SUN4I_GPADC driver next to the sun4i-ts driver. Signed-off-by: Philipp Rossak --- arch/arm/configs/sunxi_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig index df433abfcb02..2189349820ac 100644 --- a/arch/arm/configs/sunxi_defconfig +++ b/arch/arm/configs/sunxi_defconfig @@ -132,6 +132,7 @@ CONFIG_DMA_SUN6I=y # CONFIG_IOMMU_SUPPORT is not set CONFIG_EXTCON=y CONFIG_IIO=y +CONFIG_SUN4I_GPADC=y CONFIG_AXP20X_ADC=y CONFIG_PWM=y CONFIG_PWM_SUN4I=y From patchwork Thu Aug 30 15:45:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582119 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 2352B17DE for ; Thu, 30 Aug 2018 15:47:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1159E2C0AB for ; Thu, 30 Aug 2018 15:47:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03B4F2C0A7; Thu, 30 Aug 2018 15:47: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 9569B2C0A7 for ; Thu, 30 Aug 2018 15:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727705AbeH3TsW (ORCPT ); Thu, 30 Aug 2018 15:48:22 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40864 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbeH3TsU (ORCPT ); Thu, 30 Aug 2018 15:48:20 -0400 Received: by mail-wm0-f66.google.com with SMTP id 207-v6so2491373wme.5; Thu, 30 Aug 2018 08:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KQMFFCtjVJMB79OboK16hKVLwCLSA0PsOx2A/8CBESc=; b=uSl/Vax1IuA+CFRUIKwTxxFUvJfRWakNh5g16Kc0q07Q68gw45yu6ugu2nZm/dMKko QadCBK52Wf+8QPU4hVqpjMsnFMfMhPxGReEQknxirOo1kHhARPI0a1btuB90dm730IkN 1OO6dsLT8qznPCn7cgcBZ93F0MWNoU2Kle15pJEe73mC8+Osqt/9YiQnijDe87Z7c7Ov AFNXVGKcDcnmBvVQyuGcR6n/G6zuYTX7MOItqnR9zmK8pmklbB0+m+sz43o2YD4D9DTF hSj+RBgWWLsMkwnaE/tcMpPG1EignyUBXHtPfw1XPE4H74HINyNmEPeZMLQkUcn57dja nHVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KQMFFCtjVJMB79OboK16hKVLwCLSA0PsOx2A/8CBESc=; b=KW6h+rmxQNH/Y+HfGlf3uv/U+/2aF2VWoPeXOrtT5hZaGnqKbppYiEr/MUNDtV6e3d +Mr1bV4K1CplLGqWvNIpvGwKAqtZUA2bUKaDrPh6ZxF7Ev8YFL9+8bYHufTwugod5aUx mj6PhtLUFkcc/veZ5iNtQwM23rcLJD0C1NSewiQD927FpsTTxOpDzILnqSaNN584cZ7n dYNgKPndQVl4g10VYwq+jMR9BIWjPtr1unCj4L5CY//nO5kIy59CtVqgQCWExlT3QSrC YRGrXw7RERA6yTIj1ya6yIdq0XSWK3KO91a4DA9LtyuILr/tAeVa+Gh4e3T6VvykQWXB mAyg== X-Gm-Message-State: APzg51DMaUCSMD+1Ya2PAAeBgQou6ej2TSnFhQrnLfOxwnKmFsoDVkmR xxeNwN1/XXhOap8Oh07WaJY= X-Google-Smtp-Source: ANB0VdYDy7wn0q0bTBfQwfLF4nhftHhBI9Gwyly1JXh4FK3AUDx60kkf66i1PFdimUNMVOn1/QjC9A== X-Received: by 2002:a1c:ba84:: with SMTP id k126-v6mr2051153wmf.96.1535643933705; Thu, 30 Aug 2018 08:45:33 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:33 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 14/30] dt-bindings: update the Allwinner GPADC device tree binding for H3 & A83T Date: Thu, 30 Aug 2018 17:45:02 +0200 Message-Id: <20180830154518.29507-15-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allwinner H3 features a thermal sensor like the one in A33, but has its register re-arranged, the clock divider moved to CCU (originally the clock divider is in ADC) and added a pair of bus clock and reset. Allwinner A83T features a thermal sensor similar to the H3, the ths clock, the bus clock and the reset was removed from the CCU. The THS in A83T has a clock that is directly connected and runs with 24 MHz. Update the binding document to cover H3 and A83T. Signed-off-by: Philipp Rossak --- .../devicetree/bindings/iio/adc/sun4i-gpadc.txt | 41 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc.txt b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc.txt index a7ef9dd21f04..9116ad308cf1 100644 --- a/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc.txt +++ b/Documentation/devicetree/bindings/iio/adc/sun4i-gpadc.txt @@ -4,12 +4,35 @@ The Allwinner SoCs all have an ADC that can also act as a thermal sensor and sometimes as a touchscreen controller. Required properties: - - compatible: "allwinner,sun8i-a33-ths", + - compatible: must contain one of the following compatibles: + - "allwinner,sun8i-a33-ths" + - "allwinner,sun8i-h3-ths" + - "allwinner,sun8i-a83t-ths" - reg: mmio address range of the chip, - - #thermal-sensor-cells: shall be 0, + - #thermal-sensor-cells: + Please refer , - #io-channel-cells: shall be 0, -Example: +Required properties for the following compatibles: + - "allwinner,sun8i-h3-ths" + - "allwinner,sun8i-a83t-ths" + - interrupts: the sampling interrupt of the ADC, + +Required properties for the following compatibles: + - "allwinner,sun8i-h3-ths" + - clocks: the bus clock and the input clock of the ADC, + - clock-names: should be "bus" and "mod", + - resets: the bus reset of the ADC, + +Optional properties for the following compatibles: + - "allwinner,sun8i-h3-ths" + - "allwinner,sun8i-a83t-ths" + - nvmem-cells: A phandle to the calibration data provided by a nvmem device. + - nvmem-cell-names: Should be "calibration". + +Details see: bindings/nvmem/nvmem.txt + +Example for A33: ths: ths@1c25000 { compatible = "allwinner,sun8i-a33-ths"; reg = <0x01c25000 0x100>; @@ -17,6 +40,18 @@ Example: #io-channel-cells = <0>; }; +Example for H3: + ths: thermal-sensor@1c25000 { + compatible = "allwinner,sun8i-h3-ths"; + reg = <0x01c25000 0x400>; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + interrupts = ; + #thermal-sensor-cells = <0>; + #io-channel-cells = <0>; + }; + sun4i, sun5i and sun6i SoCs are also supported via these bindings: Required properties: From patchwork Thu Aug 30 15:45:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582121 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 7926B181E for ; Thu, 30 Aug 2018 15:47:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6944E2C0A7 for ; Thu, 30 Aug 2018 15:47:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AB6B2C0AB; Thu, 30 Aug 2018 15:47:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 E27A12C0B0 for ; Thu, 30 Aug 2018 15:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727185AbeH3Ttz (ORCPT ); Thu, 30 Aug 2018 15:49:55 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40615 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727642AbeH3TsV (ORCPT ); Thu, 30 Aug 2018 15:48:21 -0400 Received: by mail-wr1-f67.google.com with SMTP id n2-v6so8510552wrw.7; Thu, 30 Aug 2018 08:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tH+coJrBrADIqfyrRfncPAy+/dBVRmXaC+ssyvweTRQ=; b=tSomAZIfZ4Bt/SxfSxf/Vm1zKdiYAyr1R/H/C4bmYm6GUnDwr+TeazwGUEfCwUxOC+ RDJuxwTtxQ+D22LUu3G0J5w/nhxHwQthP4dwpZv/Ib/N6ZEmEiUl/gYmDRR0hZuWWxne FGyyH7Alsg5YAM9BQF7w7V+mpAL0Oy4a05OAPc+3IWztjjdV/Y0OX6EVQcpI5bcdZQyJ 2ZNBa/nnw+wm0sFvfIgAT4AO7W7TFUs+tGT5X9HYbBqf/5J1PjaYVa2aeknIAEIIjw39 nDOCQhg9u2JXbXs7wYdB9nuiWDma0KRPEYLprib8b6IGjdop9YqO2euA+2f4OX0fyPb+ yoPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tH+coJrBrADIqfyrRfncPAy+/dBVRmXaC+ssyvweTRQ=; b=lxB6JoC+wFY2gJmHh/tteZYY36d4vngHtPXRYKJpxeQvKip3kEyCMpf9mpYhqdifAU UIWd9zx1fqCWIY1kadSnFZEBHjm1ev8h+PvLgF3miqEf0aNMPZH7w02sUPnD+trdVeWP uOoKw7Pk3aIM7i1myq5YTArvjoOOgvlklJygsdD2SoLqsSbVnwQiKqjQiBG4UuTGj/0b 8KYHhX3aHFy7eNBNY6bUvMZ2yHBqg3UblUPaVcua5mPuBXSaEwCRDQNj9H7CuCP9LEWt I0Dtv6FTgsaPji8l32M+9QW/vZHAwnnJEgQKt1PkS0f9il3Pduk5Z6bt+cQk7X/JdxKD VBHA== X-Gm-Message-State: APzg51BIHFmZr/jBk0BtukfUE5jKqgHwyk3wxxuiuBsoGOmYY06bzEDv HQw4rnDvsk7wSmP+It5XsdA= X-Google-Smtp-Source: ANB0VdYSolJLm8cuC5xWQsxS+GbMgnObtfCJ9RZYtvbZrdjeMUkgcnzZlH1oDuWWGIYLOM3Dq+uLxg== X-Received: by 2002:adf:c64e:: with SMTP id u14-v6mr7702233wrg.177.1535643934972; Thu, 30 Aug 2018 08:45:34 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:34 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 15/30] iio: adc: sun4i-gpadc-iio: rename A33-specified registers to contain A33 Date: Thu, 30 Aug 2018 17:45:03 +0200 Message-Id: <20180830154518.29507-16-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Icenowy Zheng As the H3 SoC, which is also in sun8i line, has totally different register map for the thermal sensor (a cut down version of GPADC), we should rename A23/A33-specified registers to contain A33, in order to prevent obfuscation with H3 registers. Currently these registers are only prefixed "SUN8I", not "SUN8I_A33". Add "_A33" after "SUN8I" on the register names. Signed-off-by: Icenowy Zheng Reviewed-by: Chen-Yu Tsai Acked-by: Maxime Ripard Acked-by: Lee Jones Acked-by: Jonathan Cameron --- drivers/iio/adc/sun4i-gpadc-iio.c | 2 +- include/linux/iio/adc/sun4i-gpadc.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index e1fe5e8e9dc0..d48f338af563 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -106,7 +106,7 @@ static const struct gpadc_data sun6i_gpadc_data = { static const struct gpadc_data sun8i_a33_gpadc_data = { .temp_offset = -1662, .temp_scale = 162, - .tp_mode_en = SUN8I_GPADC_CTRL1_CHOP_TEMP_EN, + .tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN, }; struct sun4i_gpadc_iio { diff --git a/include/linux/iio/adc/sun4i-gpadc.h b/include/linux/iio/adc/sun4i-gpadc.h index ca59336f246b..d6850f39dcfb 100644 --- a/include/linux/iio/adc/sun4i-gpadc.h +++ b/include/linux/iio/adc/sun4i-gpadc.h @@ -38,9 +38,9 @@ #define SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(3, 0) & BIT(x)) #define SUN6I_GPADC_CTRL1_ADC_CHAN_MASK GENMASK(3, 0) -/* TP_CTRL1 bits for sun8i SoCs */ -#define SUN8I_GPADC_CTRL1_CHOP_TEMP_EN BIT(8) -#define SUN8I_GPADC_CTRL1_GPADC_CALI_EN BIT(7) +/* TP_CTRL1 bits for A33 */ +#define SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN BIT(8) +#define SUN8I_A33_GPADC_CTRL1_GPADC_CALI_EN BIT(7) #define SUN4I_GPADC_CTRL2 0x08 From patchwork Thu Aug 30 15:45:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582117 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 BE19B174C for ; Thu, 30 Aug 2018 15:47:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE8802C0A7 for ; Thu, 30 Aug 2018 15:47:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2B992C0B0; Thu, 30 Aug 2018 15:47:06 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 42E932C0A7 for ; Thu, 30 Aug 2018 15:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727729AbeH3TsY (ORCPT ); Thu, 30 Aug 2018 15:48:24 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53882 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbeH3TsX (ORCPT ); Thu, 30 Aug 2018 15:48:23 -0400 Received: by mail-wm0-f65.google.com with SMTP id b19-v6so2472763wme.3; Thu, 30 Aug 2018 08:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GG6wm40smk2VetGm2lnviKqcGAT7hYe3vQr/oTzaQVI=; b=bmaS1q+BXPmP+DBPMWuqMWjvwRfnyLvqywziuN95cD4E2O2H/937CWvaU7dZGRLfIB TNRg2u02nRjE/1uV1ZWJ3llffiaf+/xJvWhJNkNe1rffeAUhxNF84g5U6aQsjPVj1W/8 SImjeOvtj2Tzv3c8OPFIrUY/VnOon5z6mX4nijxLnSN3qwRqX5ZcmTakFNd/OmrHR6Wz s9eWI6ggYw9pOxvwuATKCl1KZ9jY/ejuGwVwLnvsRxgYJm4Z9UaRD0u1jnwd3HnBSAxw Zu5W1BxReIWEFeXrxzTprw77LxhzdxvJw3yXI+Wtf4/yfprWDsSh8TjI+i25nCXdJaOW Y0lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GG6wm40smk2VetGm2lnviKqcGAT7hYe3vQr/oTzaQVI=; b=dWQlmP2YnFN7O75a3P9PCahB5+wLd3FDQzZ3eMdHkSe5odC6oD4ia6JPi9BHHCoKAL 5MwVTvitWhZwCDA5ZyFZo0kHdHkVnKlH3QsSngbaiO5dXKPgbIu+XbBSWgeIMF5ZSdLU hc8zDNUNq41hjf1yWN3IOwcIUySWasKYWXeRuQhk8HAouSY/f+IQHm7E4Z2cQUUB0CBQ Wb9j83vOSUWFKidFdGt9tSuGSMhNJ0JPX0fsEPcJa2CPcJUL3iBCxs/0ke6S0yUHBeOS 7LlcKzTviNLEOcYZOVzUGxHf68h3tTGofGmmfrypmR8jZRkTPEX94q0qlfGmGwlKkYtk pudw== X-Gm-Message-State: APzg51BIniBWQnBRFMRmcEgVidehMns7dZ8bPaO+xbjTsdjEzej24TGI n4/KFcZwPrqclqOkichT+RI= X-Google-Smtp-Source: ANB0VdartHcfUT/nLcBRFFSP0xJuRdhM2ofPyAGtXEWOSTAVOlQdEA31+/7iJBAgj7G7lNw7quj1hw== X-Received: by 2002:a1c:c3c6:: with SMTP id t189-v6mr2114853wmf.59.1535643936145; Thu, 30 Aug 2018 08:45:36 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:35 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 16/30] iio: adc: sun4i-gpadc-iio: rework: readout temp_data Date: Thu, 30 Aug 2018 17:45:04 +0200 Message-Id: <20180830154518.29507-17-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For adding newer sensor some basic rework of the code is necessary. This commit reworks the code and uses regmap field to read out temp_data. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index d48f338af563..c278e165e161 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -63,6 +63,7 @@ struct gpadc_data { int (*ths_suspend)(struct sun4i_gpadc_iio *info); int (*ths_resume)(struct sun4i_gpadc_iio *info); bool support_irq; + u32 temp_data_base; }; static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); @@ -77,6 +78,7 @@ static const struct gpadc_data sun4i_gpadc_data = { .adc_channel = true, .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, + .temp_data_base = SUN4I_GPADC_TEMP_DATA, }; static const struct gpadc_data sun5i_gpadc_data = { @@ -89,6 +91,7 @@ static const struct gpadc_data sun5i_gpadc_data = { .adc_channel = true, .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, + .temp_data_base = SUN4I_GPADC_TEMP_DATA, }; static const struct gpadc_data sun6i_gpadc_data = { @@ -101,12 +104,14 @@ static const struct gpadc_data sun6i_gpadc_data = { .adc_channel = true, .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, + .temp_data_base = SUN4I_GPADC_TEMP_DATA, }; static const struct gpadc_data sun8i_a33_gpadc_data = { .temp_offset = -1662, .temp_scale = 162, .tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN, + .temp_data_base = SUN4I_GPADC_TEMP_DATA, }; struct sun4i_gpadc_iio { @@ -271,18 +276,18 @@ static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val) { struct sun4i_gpadc_iio *info = iio_priv(indio_dev); - if (!info->data->support_irq) { - pm_runtime_get_sync(indio_dev->dev.parent); + if (info->data->adc_channel) + return sun4i_gpadc_read(indio_dev, 0, val, + SUN4I_GPADC_IRQ_TEMP_DATA); - regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, val); + pm_runtime_get_sync(indio_dev->dev.parent); - pm_runtime_mark_last_busy(indio_dev->dev.parent); - pm_runtime_put_autosuspend(indio_dev->dev.parent); + regmap_read(info->regmap, info->data->temp_data_base, val); - return 0; - } + pm_runtime_mark_last_busy(indio_dev->dev.parent); + pm_runtime_put_autosuspend(indio_dev->dev.parent); - return sun4i_gpadc_read(indio_dev, 0, val, SUN4I_GPADC_IRQ_TEMP_DATA); + return 0; } static int sun4i_gpadc_temp_offset(struct iio_dev *indio_dev, int *val) From patchwork Thu Aug 30 15:45:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582085 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 C34D614BD for ; Thu, 30 Aug 2018 15:45:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B280B2C0AB for ; Thu, 30 Aug 2018 15:45:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5D372C0AE; Thu, 30 Aug 2018 15:45:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 3494B2C0AB for ; Thu, 30 Aug 2018 15:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727745AbeH3TsZ (ORCPT ); Thu, 30 Aug 2018 15:48:25 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52409 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbeH3TsZ (ORCPT ); Thu, 30 Aug 2018 15:48:25 -0400 Received: by mail-wm0-f65.google.com with SMTP id y139-v6so2458893wmc.2; Thu, 30 Aug 2018 08:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=awc7lOb1lT80drwezjxAgYVu4AbsJ53UXF1LdxXOCho=; b=X0MxvQAWNa/QHG1a/x8gvN03aFC9bPKcstD3++OvpK/mWPr/Nu71ydd6Bi41ISzadw qIrOAT4F4OdsZ2kzh+q00Iis58hoEqbdTQiaJXXSzS2z9xTXQ5TxEH5tqgZjYazGaWjL bgRuTIATJ9oEsL4Wiu0TCg4IYGtnZMurHeihga0x6jkxCqTnuwwGYQJO+iPhrO6Es8uG PfJfsu2w7Xck8vTApyDRlNjCvRFoI5IwEtRAnxtxmXrFhmaoTmiGArLtORnF021wvrAd TAL+o92qdd4pPHPE+vbp5YWVnctSPkhqkJ92iBaWO2vxPhz1KGnXaQA3f6nl67oaEha3 JKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=awc7lOb1lT80drwezjxAgYVu4AbsJ53UXF1LdxXOCho=; b=RlO5JBPY1Ynt6MAlVm7Q3VyjKbiF8PLuXEEC4f6fEfw7d6NjdEOL4dg1K+uEI6XuZU yH08gy9rL8vmV+0GdXichfRnk99oGr4OoObqxUptVWQwcFuVvakiYyoMG3YFG9e3c7lq Wkhtb5yf1f3KBhE+X7f/YvH6xyEyiqvX3NhXpizea6QNjI7jbZm6XE3PdEUVPhyXWwm6 v+AqbPhE+opsnZOmX2yuSZlB/Put9l6jVFvaqoafkwK9CXxb/aQR+lbJ/cYwmk8Ua1d4 a/KGr6exwwO8QFh/BbWPCoExLobq0XEP6JPUL9MX2n3Yr4ZlKDx8pSpLit8HJG6yeb2b h5Eg== X-Gm-Message-State: APzg51DqrotD9OusUHyFbj/9ZLvcMlEPpA+KWV2WGgycXJaa3HYtvNs8 Zs1R05QkhMDrUODYyVGteSU= X-Google-Smtp-Source: ANB0VdZ9TFSjSij1veJmjfSvCzyhdYiErnmAIpTWPnan95g96ps8uKTdevRe8LnmmxEcbDyC2EYNlg== X-Received: by 2002:a1c:7e13:: with SMTP id z19-v6mr2044367wmc.156.1535643937235; Thu, 30 Aug 2018 08:45:37 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:36 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 17/30] iio: adc: sun4i-gpadc-iio: rework: support clocks and reset Date: Thu, 30 Aug 2018 17:45:05 +0200 Message-Id: <20180830154518.29507-18-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For adding newer sensor some basic rework of the code is necessary. The SoCs after H3 has newer thermal sensor ADCs, which have two clock inputs (bus clock and sampling clock) and a reset. The registers are also re-arranged. This commit reworks the code, adds the process of the clocks and resets. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 72 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index c278e165e161..c12de48c4e86 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -22,6 +22,7 @@ * shutdown for not being used. */ +#include #include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include @@ -63,6 +65,9 @@ struct gpadc_data { int (*ths_suspend)(struct sun4i_gpadc_iio *info); int (*ths_resume)(struct sun4i_gpadc_iio *info); bool support_irq; + bool has_bus_clk; + bool has_bus_rst; + bool has_mod_clk; u32 temp_data_base; }; @@ -127,6 +132,9 @@ struct sun4i_gpadc_iio { struct mutex mutex; struct thermal_zone_device *tzd; struct device *sensor_device; + struct clk *bus_clk; + struct clk *mod_clk; + struct reset_control *reset; }; static const struct iio_chan_spec sun4i_gpadc_channels[] = { @@ -472,8 +480,13 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, if (IS_ERR(base)) return PTR_ERR(base); - info->regmap = devm_regmap_init_mmio(&pdev->dev, base, - &sun4i_gpadc_regmap_config); + if (info->data->has_bus_clk) + info->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "bus", + base, &sun4i_gpadc_regmap_config); + else + info->regmap = devm_regmap_init_mmio(&pdev->dev, base, + &sun4i_gpadc_regmap_config); + if (IS_ERR(info->regmap)) { ret = PTR_ERR(info->regmap); dev_err(&pdev->dev, "failed to init regmap: %d\n", ret); @@ -498,9 +511,58 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, } } + if (info->data->has_bus_rst) { + info->reset = devm_reset_control_get(&pdev->dev, NULL); + if (IS_ERR(info->reset)) { + ret = PTR_ERR(info->reset); + return ret; + } + + ret = reset_control_deassert(info->reset); + if (ret) + return ret; + } + + if (info->data->has_bus_clk) { + info->bus_clk = devm_clk_get(&pdev->dev, "bus"); + if (IS_ERR(info->bus_clk)) { + ret = PTR_ERR(info->bus_clk); + goto assert_reset; + } + + ret = clk_prepare_enable(info->bus_clk); + if (ret) + goto assert_reset; + } + + if (info->data->has_mod_clk) { + info->mod_clk = devm_clk_get(&pdev->dev, "mod"); + if (IS_ERR(info->mod_clk)) { + ret = PTR_ERR(info->mod_clk); + goto disable_bus_clk; + } + + /* Running at 4MHz */ + ret = clk_set_rate(info->mod_clk, 4000000); + if (ret) + goto disable_bus_clk; + + ret = clk_prepare_enable(info->mod_clk); + if (ret) + goto disable_bus_clk; + } + info->sensor_device = &pdev->dev; return 0; + +disable_bus_clk: + clk_disable_unprepare(info->bus_clk); + +assert_reset: + reset_control_assert(info->reset); + + return ret; } static int sun4i_gpadc_probe(struct platform_device *pdev) @@ -586,6 +648,12 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) if (!info->data->support_irq) iio_map_array_unregister(indio_dev); + clk_disable_unprepare(info->mod_clk); + + clk_disable_unprepare(info->bus_clk); + + reset_control_assert(info->reset); + return 0; } From patchwork Thu Aug 30 15:45:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582111 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 B0245175A for ; Thu, 30 Aug 2018 15:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A11E42C0AB for ; Thu, 30 Aug 2018 15:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94F872C0B1; Thu, 30 Aug 2018 15:46:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 0ABF12C0B0 for ; Thu, 30 Aug 2018 15:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727793AbeH3Ts1 (ORCPT ); Thu, 30 Aug 2018 15:48:27 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52411 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbeH3Ts0 (ORCPT ); Thu, 30 Aug 2018 15:48:26 -0400 Received: by mail-wm0-f66.google.com with SMTP id y139-v6so2458958wmc.2; Thu, 30 Aug 2018 08:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N6141Ki7LdUw674d0MdnXgMDsiqsMsbsw/lSIG8XBVs=; b=NT6lYmI5yFXY3XhT2a8Myi90wRHmOlJKv2BJqHJ1T3iKAEZyEQN+XDucZN+mkifPI4 2QhItys/+hIIWExLpXM5V4dRGNd/2Ks8P/7iof1q03TL5DZ6NPbPQF7ISFWOb/J4V5f4 QgI8TeafNUXWSKBK6eWXrqaQtRkJjHdLTL95IPtKaQrAtnNnGHOwEkh4/7Tdcc3ZHBIN Fbge05vGS4AwKfeOT665K2vrIkGIB5e4CdpOd+5XdGbyyuFH8qvw0qMw+B7XaxLSCni/ W0G8xPHcFdtafkFsJnOTsypN1xCAaSozfW9ZZ3DDwWWU/nHqSgvUFmWLhXtT1LLWIv2N nYcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N6141Ki7LdUw674d0MdnXgMDsiqsMsbsw/lSIG8XBVs=; b=OYV/16T7jxGrCLWUYCQBTGg4snFLikllVqet4NrKzH0+wAerEgWXQMryIvP4w3eEjv KvN1IW7m7b21TFxWFORMs74bZbw9Md9V+W7M5SVg6rvA0mpS8KXhz9Rm6L8BMdyicFMV B3a1INN0KQoy2D2G9dng+/b3iUoOQ9Cx5wX42OVY0HtwAvgSe6FnYi22PlsqQKfr93Zy Vi5Fba9HmtrL3xjfuVAXcd4b95aMNpI6PU6EyvfmJ77RytoCpR8+Lb65JLMkPKTaeJWf taaNHLnSVuqSpCaPVIQJX4G3tgBRXkXWJWSG9bWotP7+t4pc6TjD3h105fUv1MZHCb6Z nq+Q== X-Gm-Message-State: APzg51BjbIe6n4nBiN08Tcy8P2fK8LTdxnar//WgCI414k8rwTbalsnN rOVMdToyWZRO/MO7YsiMuY8= X-Google-Smtp-Source: ANB0VdZ8sncvXVWUgtJ/cgboupUxORCKh5ILa2CfhCfUImztEU9/DcFFeKHRuzX3YsdxRGBHNYcpxQ== X-Received: by 2002:a1c:4182:: with SMTP id o124-v6mr2123984wma.101.1535643938382; Thu, 30 Aug 2018 08:45:38 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:37 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 18/30] iio: adc: sun4i-gpadc-iio: rework: support multiple sensors Date: Thu, 30 Aug 2018 17:45:06 +0200 Message-Id: <20180830154518.29507-19-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For adding newer sensor some basic rework of the code is necessary. This patch reworks the driver to be able to handle more than one thermal sensor. Newer SoC like the A80 have 4 thermal sensors. Because of this the maximal sensor count value was set to 4. The sensor_id value is set during sensor registration and is for each registered sensor indiviual. This makes it able to differntiate the sensors when the value is read from the register. In function sun4i_gpadc_read_raw(), the sensor number of the ths sensor was directly set to 0 (sun4i_gpadc_temp_read(x,x,0)). This selects in the temp_read function automatically sensor 0. A check for the sensor_id is here not required since the old sensors only have one thermal sensor. In addition to that is the sun4i_gpadc_read_raw() function only used by the "older" sensors (before A33) where the thermal sensor was a cobination of an adc and a thermal sensor. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 63 +++++++++++++++++++++++++------------ include/linux/iio/adc/sun4i-gpadc.h | 3 ++ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index c12de48c4e86..18ab72e52d78 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -69,6 +69,7 @@ struct gpadc_data { bool has_bus_rst; bool has_mod_clk; u32 temp_data_base; + int sensor_count; }; static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); @@ -84,6 +85,7 @@ static const struct gpadc_data sun4i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .sensor_count = 1, }; static const struct gpadc_data sun5i_gpadc_data = { @@ -97,6 +99,7 @@ static const struct gpadc_data sun5i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .sensor_count = 1, }; static const struct gpadc_data sun6i_gpadc_data = { @@ -110,6 +113,7 @@ static const struct gpadc_data sun6i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .sensor_count = 1, }; static const struct gpadc_data sun8i_a33_gpadc_data = { @@ -117,6 +121,13 @@ static const struct gpadc_data sun8i_a33_gpadc_data = { .temp_scale = 162, .tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .sensor_count = 1, +}; + +struct sun4i_sensor_tzd { + struct sun4i_gpadc_iio *info; + struct thermal_zone_device *tzd; + unsigned int sensor_id; }; struct sun4i_gpadc_iio { @@ -130,7 +141,7 @@ struct sun4i_gpadc_iio { const struct gpadc_data *data; /* prevents concurrent reads of temperature and ADC */ struct mutex mutex; - struct thermal_zone_device *tzd; + struct sun4i_sensor_tzd tzds[MAX_SENSOR_COUNT]; struct device *sensor_device; struct clk *bus_clk; struct clk *mod_clk; @@ -280,7 +291,8 @@ static int sun4i_gpadc_adc_read(struct iio_dev *indio_dev, int channel, SUN4I_GPADC_IRQ_FIFO_DATA); } -static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val) +static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val, + int sensor) { struct sun4i_gpadc_iio *info = iio_priv(indio_dev); @@ -290,7 +302,8 @@ static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val) pm_runtime_get_sync(indio_dev->dev.parent); - regmap_read(info->regmap, info->data->temp_data_base, val); + regmap_read(info->regmap, info->data->temp_data_base + 0x4 * sensor, + val); pm_runtime_mark_last_busy(indio_dev->dev.parent); pm_runtime_put_autosuspend(indio_dev->dev.parent); @@ -334,7 +347,7 @@ static int sun4i_gpadc_read_raw(struct iio_dev *indio_dev, ret = sun4i_gpadc_adc_read(indio_dev, chan->channel, val); else - ret = sun4i_gpadc_temp_read(indio_dev, val); + ret = sun4i_gpadc_temp_read(indio_dev, val, 0); if (ret) return ret; @@ -420,10 +433,11 @@ static int sun4i_gpadc_runtime_resume(struct device *dev) static int sun4i_gpadc_get_temp(void *data, int *temp) { - struct sun4i_gpadc_iio *info = data; + struct sun4i_sensor_tzd *tzd = data; + struct sun4i_gpadc_iio *info = tzd->info; int val, scale, offset; - if (sun4i_gpadc_temp_read(info->indio_dev, &val)) + if (sun4i_gpadc_temp_read(info->indio_dev, &val, tzd->sensor_id)) return -ETIMEDOUT; sun4i_gpadc_temp_scale(info->indio_dev, &scale); @@ -569,7 +583,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) { struct sun4i_gpadc_iio *info; struct iio_dev *indio_dev; - int ret; + int ret, i; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); if (!indio_dev) @@ -603,18 +617,24 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) pm_runtime_set_suspended(&pdev->dev); pm_runtime_enable(&pdev->dev); - info->tzd = thermal_zone_of_sensor_register(info->sensor_device, - 0, info, - &sun4i_ts_tz_ops); - /* - * Do not fail driver probing when failing to register in - * thermal because no thermal DT node is found. - */ - if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) { - dev_err(&pdev->dev, - "could not register thermal sensor: %ld\n", - PTR_ERR(info->tzd)); - return PTR_ERR(info->tzd); + for (i = 0; i < info->data->sensor_count; i++) { + info->tzds[i].info = info; + info->tzds[i].sensor_id = i; + + info->tzds[i].tzd = thermal_zone_of_sensor_register( + info->sensor_device, + i, &info->tzds[i], &sun4i_ts_tz_ops); + /* + * Do not fail driver probing when failing to register in + * thermal because no thermal DT node is found. + */ + if (IS_ERR(info->tzds[i].tzd) && \ + PTR_ERR(info->tzds[i].tzd) != -ENODEV) { + dev_err(&pdev->dev, + "could not register thermal sensor: %ld\n", + PTR_ERR(info->tzds[i].tzd)); + return PTR_ERR(info->tzds[i].tzd); + } } ret = devm_iio_device_register(&pdev->dev, indio_dev); @@ -639,11 +659,14 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) { struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct sun4i_gpadc_iio *info = iio_priv(indio_dev); + int i; pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); - thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd); + for (i = 0; i < info->data->sensor_count; i++) + thermal_zone_of_sensor_unregister(info->sensor_device, + info->tzds[i].tzd); if (!info->data->support_irq) iio_map_array_unregister(indio_dev); diff --git a/include/linux/iio/adc/sun4i-gpadc.h b/include/linux/iio/adc/sun4i-gpadc.h index d6850f39dcfb..99feeba28105 100644 --- a/include/linux/iio/adc/sun4i-gpadc.h +++ b/include/linux/iio/adc/sun4i-gpadc.h @@ -99,4 +99,7 @@ .datasheet_name = _name, \ } +/* SUNXI_THS COMMON REGISTERS + DEFINES */ +#define MAX_SENSOR_COUNT 4 + #endif From patchwork Thu Aug 30 15:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582109 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 601AB14E1 for ; Thu, 30 Aug 2018 15:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 514412C0AB for ; Thu, 30 Aug 2018 15:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44E602C0B2; Thu, 30 Aug 2018 15:46:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 DE2782C0AB for ; Thu, 30 Aug 2018 15:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727723AbeH3Ts1 (ORCPT ); Thu, 30 Aug 2018 15:48:27 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37215 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbeH3Ts0 (ORCPT ); Thu, 30 Aug 2018 15:48:26 -0400 Received: by mail-wr1-f65.google.com with SMTP id u12-v6so8499652wrr.4; Thu, 30 Aug 2018 08:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pQqP9NLkOkVzk7D1LMI8Y+J0UMHbo42I8dLSpZuhXRc=; b=ifjRSj4labF3yu/ZzTuSbrT/tXp0Y94XnTmFsd7hGvpHksuOTJFkstfQyLwsdSeuhg 2cQOsLTCbSQ/peuCBn+Scy3WOGD6UqaEAOfoOFyy6ImZdzy0LMrgYMDLGIZKkcZ426J2 fytPVBhEHAqXxCS9LJdkT7br17YVBn8152BzGmYR7hbvRwVS0KMevexNN3I3XIFUSiKa QgmXIUaFF9bqwtBDZ80VEBYG9mmhI6CLG+A2QdbWAmIM+vVoTZpiGLwvy5HsQavSNFIH CTHaCqDSkjNf6oBEX367tVx3X/lizfdCeNa7ftNg8Aa2J/WAfRJjgvkqJJtJOky876zo fRAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pQqP9NLkOkVzk7D1LMI8Y+J0UMHbo42I8dLSpZuhXRc=; b=Kd7uFW52UtkYNM9kACVpvyS1uUZIaVSAUH2CjU/SEA+FIhphZQ3kVxWZjOD6NovAAS kX//eyZX6Mx905BsDlj6yj3cfkekGMhSqQ12FIzQTE4ek7SBbQVJ7Y2JYrZzDYpPaV/8 qz2+BOdK4iRi5mJVtYPdkV/FeyCNj2Cw10tsbLrJ5i3sqV+sZvsmiITwmVzVEsfXRJNo D0zpVszDxLb9aEJXK3ApZTydzscYI2BOrU3LsMChKY6wllb95RY1k6Tqv9lMLw3X/2wL gOpP3npvMosvPpmPcmf0b219gCioU4G9Sk6LKzhY0Y3kvtE1HsCukTKTHKPDYZ5/XHrf IkIA== X-Gm-Message-State: APzg51CVC5PVDn8mKnwnrqkjrmmAm5JlOd91fID1Vh/voZS0+ldy/Xzw /rNqzceVvlWCtiGZSGrDPJ8= X-Google-Smtp-Source: ANB0VdbPUje7m+TY75vPDhE9sYa/+ktpN26Akzo30ji9NJssK0h+wSx/ea7ItLTibVU6zFY3qvT0gw== X-Received: by 2002:adf:bb41:: with SMTP id x1-v6mr7702826wrg.24.1535643939495; Thu, 30 Aug 2018 08:45:39 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:38 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 19/30] iio: adc: sun4i-gpadc-iio: rework: support nvmem calibration data Date: Thu, 30 Aug 2018 17:45:07 +0200 Message-Id: <20180830154518.29507-20-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch reworks the driver to support nvmem calibration cells. The driver checks if the nvmem calibration is supported and reads out the nvmem. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 18ab72e52d78..2fd73d143815 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ struct gpadc_data { bool has_mod_clk; u32 temp_data_base; int sensor_count; + bool supports_nvmem; }; static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); @@ -146,6 +148,7 @@ struct sun4i_gpadc_iio { struct clk *bus_clk; struct clk *mod_clk; struct reset_control *reset; + u32 calibration_data[2]; }; static const struct iio_chan_spec sun4i_gpadc_channels[] = { @@ -484,6 +487,9 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, struct resource *mem; void __iomem *base; int ret; + struct nvmem_cell *cell; + ssize_t cell_size; + u32 *cell_data; info->data = of_device_get_match_data(&pdev->dev); if (!info->data) @@ -494,6 +500,24 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, if (IS_ERR(base)) return PTR_ERR(base); + if (info->data->supports_nvmem) { + + cell = nvmem_cell_get(&pdev->dev, "calibration"); + if (IS_ERR(cell)) { + if (PTR_ERR(cell) == -EPROBE_DEFER) + return PTR_ERR(cell); + } else { + cell_data = (u32 *)nvmem_cell_read(cell, &cell_size); + if (cell_size != 8) + dev_err(&pdev->dev, + "Calibration data has wrong size\n"); + else { + info->calibration_data[0] = cell_data[0]; + info->calibration_data[1] = cell_data[1]; + } + } + } + if (info->data->has_bus_clk) info->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "bus", base, &sun4i_gpadc_regmap_config); From patchwork Thu Aug 30 15:45:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582113 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 DBA5F175A for ; Thu, 30 Aug 2018 15:46:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1AF2C0AB for ; Thu, 30 Aug 2018 15:46:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF2B32C0B1; Thu, 30 Aug 2018 15:46:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 577572C0AB for ; Thu, 30 Aug 2018 15:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbeH3Tta (ORCPT ); Thu, 30 Aug 2018 15:49:30 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:55456 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbeH3Ts1 (ORCPT ); Thu, 30 Aug 2018 15:48:27 -0400 Received: by mail-wm0-f68.google.com with SMTP id f21-v6so2477870wmc.5; Thu, 30 Aug 2018 08:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yEZZzXd7EqL0QVZwjKI2SdtLyI0ltZvJ5hxxkextUgQ=; b=CZtkdVtp06Yg5sR3ngIwd7L3KZq3/8j6SAEeTg0uaSi+JSVl+cDdDJEIvqRX5/PArS wFGgH/7HekLrY8j6dDC+YVVW5BXKbeGLkUGM7jgJa/oyhiENbrtXAv4zrDiW+xJlBkYM vfE18JH3/kUupsg24QSbbZN7uS68p/gXoiKYDqV9Fi2zKK0uGlQsf9Gp6fH9xYbX3f5x mng/6G+VfhJwFyj6xQvbNI1S2dLMIFFWyqQIUgPAdPqZJT3s/22HkVgocnkVB4I6tGpw k4IVea8z5V5+J/XKnrgbx4vnVjNoUtdAFN4HBZr4ymAhoYK170zmK+s8ZuNDiid8xIOV tYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yEZZzXd7EqL0QVZwjKI2SdtLyI0ltZvJ5hxxkextUgQ=; b=bdlaj52u2Nob73CyuzvSxY19eSLdrHPHzKkaZ0XRrJVDkZYeRyR1IzLhkKza5fVdRM 7nemLc4nAFF4fvo45gva1aK9rnvTGrZmjlEBxzGq0t2LsbDjgjVxOOC8+Okzt+X7dD7/ yrJfESROHc1mRt+GIRWyzaoj4YWjUt6BWoRQodpXXa+is6Y3xmbG8ZTDekGon5vOMqev PFYtyzS5n7jtrq3vtHhpgFzM9QJmuc2tDmWZ7uTmWZJ5ezblqyzP+nR//9Bzfd6rJtqv quaIi1eU+Cn5Dlq+LU/NspsFuaOtAq//FXNzIzYY9kw93G1STqF+uvvlEFQg4hWqTpKv Emyw== X-Gm-Message-State: APzg51AklzTlDY60bZ89n0ZdAzCQB/TEakOkkFjCa4Y98jkGDGbzcbyQ EqoFS2AII/eByAHZo2WpzN4= X-Google-Smtp-Source: ANB0Vdb4pUa0lLdosCK8FR5C6yVnMsY5GJ3f0A6QraMpJ04jdB2+jJlgh34MIlB8Vt40xIlnGqDMjQ== X-Received: by 2002:a1c:1943:: with SMTP id 64-v6mr2087807wmz.89.1535643940503; Thu, 30 Aug 2018 08:45:40 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:40 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 20/30] iio: adc: sun4i-gpadc-iio: rework: device specific suspend & resume Date: Thu, 30 Aug 2018 17:45:08 +0200 Message-Id: <20180830154518.29507-21-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Different sensors will have different suspend and resume functions. So we are modularize the suspend and resume functions. The resume function configures and initializes the thermal sensor and the suspend function disables the sensors. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 2fd73d143815..c7b46c82e3e5 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -76,6 +76,9 @@ struct gpadc_data { static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); +static int sun4i_ths_resume(struct sun4i_gpadc_iio *info); +static int sun4i_ths_suspend(struct sun4i_gpadc_iio *info); + static const struct gpadc_data sun4i_gpadc_data = { .temp_offset = -1932, .temp_scale = 133, @@ -87,6 +90,8 @@ static const struct gpadc_data sun4i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .ths_resume = sun4i_ths_resume, + .ths_suspend = sun4i_ths_suspend, .sensor_count = 1, }; @@ -101,6 +106,8 @@ static const struct gpadc_data sun5i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .ths_resume = sun4i_ths_resume, + .ths_suspend = sun4i_ths_suspend, .sensor_count = 1, }; @@ -115,6 +122,8 @@ static const struct gpadc_data sun6i_gpadc_data = { .ths_irq_thread = sun4i_gpadc_data_irq_handler, .support_irq = true, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .ths_resume = sun4i_ths_resume, + .ths_suspend = sun4i_ths_suspend, .sensor_count = 1, }; @@ -123,6 +132,8 @@ static const struct gpadc_data sun8i_a33_gpadc_data = { .temp_scale = 162, .tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN, .temp_data_base = SUN4I_GPADC_TEMP_DATA, + .ths_resume = sun4i_ths_resume, + .ths_suspend = sun4i_ths_suspend, .sensor_count = 1, }; @@ -401,6 +412,11 @@ static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id) static int sun4i_gpadc_runtime_suspend(struct device *dev) { struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev)); + return info->data->ths_suspend(info); +} + +static int sun4i_ths_suspend(struct sun4i_gpadc_iio *info) +{ /* Disable the ADC on IP */ regmap_write(info->regmap, SUN4I_GPADC_CTRL1, 0); @@ -415,7 +431,11 @@ static int sun4i_gpadc_runtime_suspend(struct device *dev) static int sun4i_gpadc_runtime_resume(struct device *dev) { struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev)); + return info->data->ths_resume(info); +} +static int sun4i_ths_resume(struct sun4i_gpadc_iio *info) +{ /* clkin = 6MHz */ regmap_write(info->regmap, SUN4I_GPADC_CTRL0, SUN4I_GPADC_CTRL0_ADC_CLK_DIVIDER(2) | From patchwork Thu Aug 30 15:45:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582087 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 E39DD14E1 for ; Thu, 30 Aug 2018 15:45:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B0CA2C0AB for ; Thu, 30 Aug 2018 15:45:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F19C2C0AE; Thu, 30 Aug 2018 15:45:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 082672C0AB for ; Thu, 30 Aug 2018 15:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbeH3Tsa (ORCPT ); Thu, 30 Aug 2018 15:48:30 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53894 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727774AbeH3Tsa (ORCPT ); Thu, 30 Aug 2018 15:48:30 -0400 Received: by mail-wm0-f67.google.com with SMTP id b19-v6so2473068wme.3; Thu, 30 Aug 2018 08:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b2zxZmF66f/SGjGiyfXMgDZt5Mg/3SRsrJ3/gODIh50=; b=sdBzcH8Z+kmG2MsK3JOyYOMnaCTEWGosz8IllZNPMzA1HxZQSUXlRHhpmtVmrE1HDH GFVdnwYAxwh+HS12i8Ya0FoobYfUe6ydC80Yim+7rs7nlz6PHfoGRFu7mlth/0M8K8fY sbUO31FGRzXRrk10sBMDhf+WUWYa4Js9G8s9v3B+XDLSrXIgvvDOXmGWvI8FzseibVke 7zWeBcvh6uZ7fLQC/zuMCJ1fWrzR/r5C7jo7tnzUhs1K5L3B2LTZg/T94Icc1vjLKR3K zp8LMHInnj3LW/YOKIZ7nLPFxHOxbs77UsBPVJAJzgPOW2AFxEmdURXws0MIsj7twWvB KD9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b2zxZmF66f/SGjGiyfXMgDZt5Mg/3SRsrJ3/gODIh50=; b=MY7JAo/eKEtwpG4a3pjSzofH8deKTN7ID3ZvYkHbSRim/3pc/kvch7UAjgO4Y5Sci3 nsH0KX2UOcSSS3MF6mZm9wRqtf3ubhNFNv8eYY0KZmVcemhZpLB7tDCdLOjNlioLsZ1w eSDLbkHJv9RGK5b47u2TMDk/ehAms8TDrv9+mulpChFr/y4BRGtvbTa49ykxIdSc8EEJ arofYynepnyI81wpXoa0R1IkhrSDimR9qgjXXyxydVgnuijVt3Y7N/LHbdzwCSDDFpLk ZZaMrxBfTkKw4EG0yHF0unDxpIRHJUL8ZBjmSj7AnBr/j5UOEvSflvLelDuLuGQbXdok wtGg== X-Gm-Message-State: APzg51AzgTozmrzUgEmsov4WH8c3OPpew/jsH6IZPSbtmTBkKatUlO3R VpsvVZjDd+a54TXv9jHpIos= X-Google-Smtp-Source: ANB0VdYcUxmaX3paoffVbArTEOrzuPojZJJBRZZSqslIppADvaZtOVIADliwRY8DD4rsi27xqh64IA== X-Received: by 2002:a1c:4008:: with SMTP id n8-v6mr2155458wma.32.1535643941790; Thu, 30 Aug 2018 08:45:41 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:41 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 21/30] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor Date: Thu, 30 Aug 2018 17:45:09 +0200 Message-Id: <20180830154518.29507-22-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for the H3 ths sensor. The H3 supports interrupts. The interrupt is configured to update the the sensor values every second. The calibration data is writen at the begin of the init process. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 91 +++++++++++++++++++++++++++++++++++++ include/linux/iio/adc/sun4i-gpadc.h | 18 ++++++++ 2 files changed, 109 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index c7b46c82e3e5..d5c7971b2558 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -72,6 +72,7 @@ struct gpadc_data { u32 temp_data_base; int sensor_count; bool supports_nvmem; + u32 ths_irq_clear; }; static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); @@ -79,6 +80,10 @@ static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id); static int sun4i_ths_resume(struct sun4i_gpadc_iio *info); static int sun4i_ths_suspend(struct sun4i_gpadc_iio *info); +static int sun8i_h3_ths_resume(struct sun4i_gpadc_iio *info); +static int sun8i_h3_ths_suspend(struct sun4i_gpadc_iio *info); +static irqreturn_t sunx8i_h3_irq_thread(int irq, void *data); + static const struct gpadc_data sun4i_gpadc_data = { .temp_offset = -1932, .temp_scale = 133, @@ -137,6 +142,22 @@ static const struct gpadc_data sun8i_a33_gpadc_data = { .sensor_count = 1, }; +static const struct gpadc_data sun8i_h3_ths_data = { + .temp_offset = -1791, + .temp_scale = -121, + .temp_data_base = SUN8I_H3_THS_TDATA0, + .ths_irq_thread = sunx8i_h3_irq_thread, + .support_irq = true, + .has_bus_clk = true, + .has_bus_rst = true, + .has_mod_clk = true, + .sensor_count = 1, + .supports_nvmem = true, + .ths_resume = sun8i_h3_ths_resume, + .ths_suspend = sun8i_h3_ths_suspend, + .ths_irq_clear = SUN8I_H3_THS_INTS_TDATA_IRQ_0, +}; + struct sun4i_sensor_tzd { struct sun4i_gpadc_iio *info; struct thermal_zone_device *tzd; @@ -409,6 +430,31 @@ static irqreturn_t sun4i_gpadc_data_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t sunx8i_h3_irq_thread(int irq, void *data) +{ + struct sun4i_gpadc_iio *info = data; + int i; + + regmap_write(info->regmap, SUN8I_H3_THS_STAT, + info->data->ths_irq_clear); + + for (i = 0; i < info->data->sensor_count; i++) + thermal_zone_device_update(info->tzds[i].tzd, + THERMAL_EVENT_TEMP_SAMPLE); + + return IRQ_HANDLED; +} + +static int sun8i_h3_calibrate(struct sun4i_gpadc_iio *info) +{ +// regmap_write(info->regmap, SUNXI_THS_CDATA_0_1, +// info->calibration_data[0]); +// regmap_write(info->regmap, SUNXI_THS_CDATA_2_3, +// info->calibration_data[1]); + + return 0; +} + static int sun4i_gpadc_runtime_suspend(struct device *dev) { struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev)); @@ -428,6 +474,16 @@ static int sun4i_ths_suspend(struct sun4i_gpadc_iio *info) return 0; } +static int sun8i_h3_ths_suspend(struct sun4i_gpadc_iio *info) +{ + /* Disable ths interrupt */ + regmap_write(info->regmap, SUN8I_H3_THS_INTC, 0x0); + /* Disable temperature sensor */ + regmap_write(info->regmap, SUN8I_H3_THS_CTRL2, 0x0); + + return 0; +} + static int sun4i_gpadc_runtime_resume(struct device *dev) { struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev)); @@ -454,6 +510,37 @@ static int sun4i_ths_resume(struct sun4i_gpadc_iio *info) return 0; } +static int sun8i_h3_ths_resume(struct sun4i_gpadc_iio *info) +{ + u32 value; + + sun8i_h3_calibrate(info); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL0, + SUN4I_GPADC_CTRL0_T_ACQ(0xff)); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL2, + SUN8I_H3_THS_ACQ1(0x3f)); + + regmap_write(info->regmap, SUN8I_H3_THS_STAT, + SUN8I_H3_THS_INTS_TDATA_IRQ_0); + + regmap_write(info->regmap, SUN8I_H3_THS_FILTER, + SUN4I_GPADC_CTRL3_FILTER_EN | + SUN4I_GPADC_CTRL3_FILTER_TYPE(0x2)); + + regmap_write(info->regmap, SUN8I_H3_THS_INTC, + SUN8I_H3_THS_INTC_TDATA_IRQ_EN0 | + SUN8I_H3_THS_TEMP_PERIOD(0x55)); + + regmap_read(info->regmap, SUN8I_H3_THS_CTRL2, &value); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL2, + SUN8I_H3_THS_TEMP_SENSE_EN0 | value); + + return 0; +} + static int sun4i_gpadc_get_temp(void *data, int *temp) { struct sun4i_sensor_tzd *tzd = data; @@ -497,6 +584,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = { .compatible = "allwinner,sun6i-a31-gpadc", .data = &sun6i_gpadc_data }, + { + .compatible = "allwinner,sun8i-h3-ths", + .data = &sun8i_h3_ths_data, + }, { /* sentinel */ } }; diff --git a/include/linux/iio/adc/sun4i-gpadc.h b/include/linux/iio/adc/sun4i-gpadc.h index 99feeba28105..169b4de9a34d 100644 --- a/include/linux/iio/adc/sun4i-gpadc.h +++ b/include/linux/iio/adc/sun4i-gpadc.h @@ -100,6 +100,24 @@ } /* SUNXI_THS COMMON REGISTERS + DEFINES */ +#define SUN8I_H3_THS_CTRL0 0x00 + +#define SUN8I_H3_THS_CTRL2 0x40 +#define SUN8I_H3_THS_ACQ1(x) (GENMASK(31, 16) & ((x) << 16)) +#define SUN8I_H3_THS_TEMP_SENSE_EN0 BIT(0) + +#define SUN8I_H3_THS_INTC 0x44 +#define SUN8I_H3_THS_TEMP_PERIOD(x) (GENMASK(31, 12) & ((x) << 12)) +#define SUN8I_H3_THS_INTC_TDATA_IRQ_EN0 BIT(8) + +#define SUN8I_H3_THS_STAT 0x48 +#define SUN8I_H3_THS_INTS_TDATA_IRQ_0 BIT(8) + +#define SUN8I_H3_THS_FILTER 0x70 +#define SUNXI_THS_CDATA_0_1 0x74 +#define SUNXI_THS_CDATA_2_3 0x78 +#define SUN8I_H3_THS_TDATA0 0x80 + #define MAX_SENSOR_COUNT 4 #endif From patchwork Thu Aug 30 15:45:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582107 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 73ABE14BD for ; Thu, 30 Aug 2018 15:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 650C02C0AB for ; Thu, 30 Aug 2018 15:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5924D2C0B2; Thu, 30 Aug 2018 15:46:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 E4E062C0AB for ; Thu, 30 Aug 2018 15:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbeH3Tsb (ORCPT ); Thu, 30 Aug 2018 15:48:31 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37078 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbeH3Tsa (ORCPT ); Thu, 30 Aug 2018 15:48:30 -0400 Received: by mail-wm0-f67.google.com with SMTP id n11-v6so2500260wmc.2; Thu, 30 Aug 2018 08:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uoEW1Lce/hl33oDLPjB5cxodu2SyLnmSsJFrygMlmqs=; b=Jh6RwoWxDC3TNp+VvxHA+iolxoDzrXV+U7Lig65VMEdphV+dgKItdD0cdGltj+F4/m Jkisj0SVxZvgvCy2jnDA1jWzMx+3wU2dfB2MWxCQLCcWkv23PAXb2L6x5MgL7BaGpdz8 B6h3Xx7ndTOT23W8++WlBtHZZUH3UwxFT9PdPmVhppFFEzxHMBHkdGlzJFThpsaNf9Fj wrUPRh0BVAW10kNHPDr3s/1Q7J/RdS7qlA0eqxIk5b7PZaGAQ36ea33uMd2/mcibOHo+ RYJxY/57n7StOFIrrSozokTZRRcRjSZNxOqzmmyq98Kx8L957SeiWjaVicnwSuiPADWm pOFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uoEW1Lce/hl33oDLPjB5cxodu2SyLnmSsJFrygMlmqs=; b=lrSt2rMpnUX5dlGJ3u+2+GtTaLiAwfR6ueaOplfy952lqOCUaqcB0/0T4Dig8+Peoj nM0JlE07j0fD/xBfMoj7ZZwrJnLQdhi8mL9tXnpB22rZ9zY5PfKBGbDAfUXBvOLGIZGI TkvuOYRjMT1WGy7CgpXsQ8BGdICxkF+3D/Apj3SO7bJ75WIAOJGMGmebGzAlcvHcyTiw Jj3oSEnHbS/Gg5+L8hGr3XvTMpPCV7TVkqlKgkW7K8aUMTLbJ1oX/SmrwQoT7U4Hh96u 1jd3aH82pHNIDujxwK6GGmgzyjc7wM6PcJXoLbjDsaFHHwMRPK5WgUoc7M4GA4w4wZ4e GPig== X-Gm-Message-State: APzg51Bc3Efrgarne7t+B8YZzH/xE8+kpgeW1CLosQOImHvJK20LP0DV vUkiL+CMW5GwCbSGUJ6LXm8= X-Google-Smtp-Source: ANB0Vdaq010tVp+C/vjyjcNY1De7ly6z1Dl5gNXx3Cp9eE4zj+WxCXnCKw1WvQ9PtrcXGG7mXER/Eg== X-Received: by 2002:a1c:1748:: with SMTP id 69-v6mr2139131wmx.75.1535643943254; Thu, 30 Aug 2018 08:45:43 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:42 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 22/30] iio: adc: sun4i-gpadc-iio: add support for A83T thermal sensor Date: Thu, 30 Aug 2018 17:45:10 +0200 Message-Id: <20180830154518.29507-23-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for the A83T ths sensor. The A83T supports interrupts. The interrupt is configured to update the the sensor values every second. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 59 +++++++++++++++++++++++++++++++++++++ include/linux/iio/adc/sun4i-gpadc.h | 6 ++++ 2 files changed, 65 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index d5c7971b2558..a184a87c56d4 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -84,6 +84,8 @@ static int sun8i_h3_ths_resume(struct sun4i_gpadc_iio *info); static int sun8i_h3_ths_suspend(struct sun4i_gpadc_iio *info); static irqreturn_t sunx8i_h3_irq_thread(int irq, void *data); +static int sun8i_a83t_ths_resume(struct sun4i_gpadc_iio *info); + static const struct gpadc_data sun4i_gpadc_data = { .temp_offset = -1932, .temp_scale = 133, @@ -158,6 +160,21 @@ static const struct gpadc_data sun8i_h3_ths_data = { .ths_irq_clear = SUN8I_H3_THS_INTS_TDATA_IRQ_0, }; +static const struct gpadc_data sun8i_a83t_ths_data = { + .temp_offset = -2724, + .temp_scale = -70, + .temp_data_base = SUN8I_H3_THS_TDATA0, + .ths_irq_thread = sunx8i_h3_irq_thread, + .support_irq = true, + .sensor_count = 3, + .supports_nvmem = true, + .ths_resume = sun8i_a83t_ths_resume, + .ths_suspend = sun8i_h3_ths_suspend, + .ths_irq_clear = SUN8I_H3_THS_INTS_TDATA_IRQ_0 | + SUN8I_A83T_THS_INTS_TDATA_IRQ_1 | + SUN8I_A83T_THS_INTS_TDATA_IRQ_2, +}; + struct sun4i_sensor_tzd { struct sun4i_gpadc_iio *info; struct thermal_zone_device *tzd; @@ -541,6 +558,44 @@ static int sun8i_h3_ths_resume(struct sun4i_gpadc_iio *info) return 0; } +static int sun8i_a83t_ths_resume(struct sun4i_gpadc_iio *info) +{ + u32 value; + + sun8i_h3_calibrate(info); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL0, + SUN4I_GPADC_CTRL0_T_ACQ(0x13f)); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL2, + SUN8I_H3_THS_ACQ1(0x13f)); + + regmap_write(info->regmap, SUN8I_H3_THS_STAT, + SUN8I_H3_THS_INTS_TDATA_IRQ_0 | + SUN8I_A83T_THS_INTS_TDATA_IRQ_1 | + SUN8I_A83T_THS_INTS_TDATA_IRQ_2); + + regmap_write(info->regmap, SUN8I_H3_THS_FILTER, + SUN4I_GPADC_CTRL3_FILTER_EN | + SUN4I_GPADC_CTRL3_FILTER_TYPE(0x2)); + + regmap_write(info->regmap, SUN8I_H3_THS_INTC, + SUN8I_H3_THS_INTC_TDATA_IRQ_EN0 | + SUN8I_A83T_THS_INTC_TDATA_IRQ_EN1 | + SUN8I_A83T_THS_INTC_TDATA_IRQ_EN2 | + SUN8I_H3_THS_TEMP_PERIOD(0x257)); + + regmap_read(info->regmap, SUN8I_H3_THS_CTRL2, &value); + + regmap_write(info->regmap, SUN8I_H3_THS_CTRL2, + SUN8I_H3_THS_TEMP_SENSE_EN0 | + SUN8I_A83T_THS_TEMP_SENSE_EN1 | + SUN8I_A83T_THS_TEMP_SENSE_EN2 | + value); + + return 0; +} + static int sun4i_gpadc_get_temp(void *data, int *temp) { struct sun4i_sensor_tzd *tzd = data; @@ -588,6 +643,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths_data, }, + { + .compatible = "allwinner,sun8i-a83t-ths", + .data = &sun8i_a83t_ths_data, + }, { /* sentinel */ } }; diff --git a/include/linux/iio/adc/sun4i-gpadc.h b/include/linux/iio/adc/sun4i-gpadc.h index 169b4de9a34d..673459bb3ec3 100644 --- a/include/linux/iio/adc/sun4i-gpadc.h +++ b/include/linux/iio/adc/sun4i-gpadc.h @@ -105,13 +105,19 @@ #define SUN8I_H3_THS_CTRL2 0x40 #define SUN8I_H3_THS_ACQ1(x) (GENMASK(31, 16) & ((x) << 16)) #define SUN8I_H3_THS_TEMP_SENSE_EN0 BIT(0) +#define SUN8I_A83T_THS_TEMP_SENSE_EN1 BIT(1) +#define SUN8I_A83T_THS_TEMP_SENSE_EN2 BIT(2) #define SUN8I_H3_THS_INTC 0x44 #define SUN8I_H3_THS_TEMP_PERIOD(x) (GENMASK(31, 12) & ((x) << 12)) #define SUN8I_H3_THS_INTC_TDATA_IRQ_EN0 BIT(8) +#define SUN8I_A83T_THS_INTC_TDATA_IRQ_EN1 BIT(9) +#define SUN8I_A83T_THS_INTC_TDATA_IRQ_EN2 BIT(10) #define SUN8I_H3_THS_STAT 0x48 #define SUN8I_H3_THS_INTS_TDATA_IRQ_0 BIT(8) +#define SUN8I_A83T_THS_INTS_TDATA_IRQ_1 BIT(9) +#define SUN8I_A83T_THS_INTS_TDATA_IRQ_2 BIT(10) #define SUN8I_H3_THS_FILTER 0x70 #define SUNXI_THS_CDATA_0_1 0x74 From patchwork Thu Aug 30 15:45:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582105 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 7F2FE14BD for ; Thu, 30 Aug 2018 15:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F5472C0AB for ; Thu, 30 Aug 2018 15:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63A0D2C0B1; Thu, 30 Aug 2018 15:46:33 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 1021E2C0AB for ; Thu, 30 Aug 2018 15:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727851AbeH3Tsc (ORCPT ); Thu, 30 Aug 2018 15:48:32 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33413 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeH3Tsb (ORCPT ); Thu, 30 Aug 2018 15:48:31 -0400 Received: by mail-wm0-f65.google.com with SMTP id i134-v6so2158676wmf.0; Thu, 30 Aug 2018 08:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l6QLRCww2N/gUDx4YyzxlMvXx8PICjJAWIzj33m3Y8k=; b=P4KY/wjMkYPFDbNjOeAzFPGXuvhGIkJHHgDVR/QUrBYJaPSFyZhLU/OKgDyVAtRfsL cwSC1UBpmTYC4KGzF43ZJNLd6bYwypq0T2oubDiL28AaiJ8wjL/FgxTn6rtbyrS2nnqz wRhinzDJs7882wZMTxrM5fu2QqFdfSRgns+WlBW7PhgOBoECmglfi85eFUZEKCjuBVy+ bhL4hdRKCHKMD7QwvrYawCYayaIMKVhc6ZhkzwTUIpMK+kmvcFs+OSQ3DSxClClQpnz5 5DKEEWANnKfCgSsYXHh2nXpcoQWGIP51an2xdKrHm5GroqXHhMEJI49pLwx4u/svWKbO 7HVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l6QLRCww2N/gUDx4YyzxlMvXx8PICjJAWIzj33m3Y8k=; b=Bpz3LV6h0oC/61v1xUJUPqc37g/SZ9uQA3nvdkQXDJ+xfVLKx15nu8PlhbZl8MF9zk PwfQviFiXh4YGFoEKCqsMPMYKF/zjSc5gX2vnf9rvL+RjNPEBKC1606TIUufVyQUXdLQ ApCQfyrGJmUU41wrymgL6ibbPXclrpc8zL+MbePwjPkA/9UdOz6z/8EQtg2Gl+O6koIv nIzDYOODuv0DwJ6wH6P1T7+eKahwR2BdSzzJkNjQm69LOz57l6cakNmRezfr6K1V/Q4E fQD8zptIYMLe+rjZyUQViu9Ic6+TvxPo4wJG4hYHDgGqWDQAA15Oj6htYiFoMbJLaE7H y4mw== X-Gm-Message-State: APzg51CiNurjcgwLMFEwbDaeA/7FG3hO6BKwKOn5xSD6TU+3J8saWpvR Th554tpI2dRs5GTu2ksH8gI= X-Google-Smtp-Source: ANB0VdatYCV55jeDhSuK82bQ3CoqrHQ8yzytm678XM5qd4qnGTaM7Jb2ZLl8iGE3cli+4sSVNjUMNw== X-Received: by 2002:a1c:b80a:: with SMTP id i10-v6mr2123262wmf.30.1535643944392; Thu, 30 Aug 2018 08:45:44 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:43 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 23/30] ARM: dts: sunxi-h3-h5: add support for the thermal sensor in H3 and H5 Date: Thu, 30 Aug 2018 17:45:11 +0200 Message-Id: <20180830154518.29507-24-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As we have gained the support for the thermal sensor in H3 and H5, we can now add its device nodes to the device tree. The H3 and H5 share most of its compatible. The compatible and the thermal sensor cells will be added in an additional patch per device. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sunxi-h3-h5.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index c3bff1105e5d..3520e4ad6042 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -488,6 +488,15 @@ }; }; + ths: thermal-sensor@1c25000 { + reg = <0x01c25000 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + #io-channel-cells = <0>; + }; + timer@1c20c00 { compatible = "allwinner,sun4i-a10-timer"; reg = <0x01c20c00 0xa0>; From patchwork Thu Aug 30 15:45:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582103 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 C2B5814BD for ; Thu, 30 Aug 2018 15:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2D2B2C0AB for ; Thu, 30 Aug 2018 15:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6A642C0B1; Thu, 30 Aug 2018 15:46:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 832B02C0B0 for ; Thu, 30 Aug 2018 15:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbeH3Tse (ORCPT ); Thu, 30 Aug 2018 15:48:34 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37953 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbeH3Tsc (ORCPT ); Thu, 30 Aug 2018 15:48:32 -0400 Received: by mail-wm0-f67.google.com with SMTP id t25-v6so2496953wmi.3; Thu, 30 Aug 2018 08:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FywbVIB0mybZGQlha7NFbll0y71vzt8iOO5Bixlf4OM=; b=TGIpwGhzBwkzCA2k0q5aqOzmNO+gwTDQe4W2eznKJAMCoTOXzszi8sLJRBl7S+ejXD uS/I6378Cpn3/kvXXhk7mbJiZy9gF8G/ni3z10hQ/cMvBJD8mnxxvLSYIEcePM8GjmNR WSTQcyCm+2ae7LYYQAu3wxn8SQ+8uLzzHoxC6oGnlCFn9SIMmheek819Ta+LhtfoeqIp HLrq21b75L2B90xqlKsZ43PR4UDzaIGLRHfisQjBKwH1CwksFiHjijVUhdazU9Ri665b ArbI+MXODDsgYB4Lzoez9/nB2I4+73LNMeW3yvEH5uFpHI+AuiBQLMr6Gkf4dl2bXg9v BfnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FywbVIB0mybZGQlha7NFbll0y71vzt8iOO5Bixlf4OM=; b=aehmTq4Uk5IKUCqILUUMCtlKRl5ECBx3M6ipxhUz7dD38KUKMufNzEaETyaRynjbYt 4GSgFYoesYUYOYY3yz+U2Z94O/em9KY4KiFMbsuWpRxRMs4JBhlw5mig3+OinmysaE6M d/3JMaRdLVSfvfNiSBcfT1aFsLEfD5ayGiluVC4YZse+jOFoDS2nIq/csHuUe0LDtcOa QDRJzqmyhFmHq/Zqvj1g9ichWH2ImkPOT+85O+GK3hFFRFirTPlkpoIMX9TowbX7Awmz dsRUua0EE64XNDRxCNAhmvkD6Xn3pOKcZJqO8Rb2fRw3xfMxRxwLNuCq4/y2lWYLy6CO 1o/w== X-Gm-Message-State: APzg51A7YoWeDOkoss8ZiAh9mtip6Rb2uKsqRjy5pqk3jyhNZfbBkbI7 SX/8u/MhTnLYs1Dn1eKgt5M= X-Google-Smtp-Source: ANB0Vdb49E8FXdr5hCrNgeojqWMHwts1H1t3PCXOFkIgWsf3OM1BOR5eP1POMRnYkyXEudrQryqrSA== X-Received: by 2002:a1c:e70b:: with SMTP id e11-v6mr2127387wmh.22.1535643945694; Thu, 30 Aug 2018 08:45:45 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:45 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 24/30] ARM: dts: sun8i: h3: add support for the thermal sensor in H3 Date: Thu, 30 Aug 2018 17:45:12 +0200 Message-Id: <20180830154518.29507-25-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the missing compatible and the thermal sensor cells. The H3 has one sensor. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-h3.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index 41d57c76f290..5b7994cb1471 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -185,3 +185,8 @@ &pio { compatible = "allwinner,sun8i-h3-pinctrl"; }; + +&ths { + compatible = "allwinner,sun8i-h3-ths"; + #thermal-sensor-cells = <0>; +}; From patchwork Thu Aug 30 15:45:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582091 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 DB13F14BD for ; Thu, 30 Aug 2018 15:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB27D2C0AB for ; Thu, 30 Aug 2018 15:45:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF56F2C0AE; Thu, 30 Aug 2018 15:45:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 6DE882C0AB for ; Thu, 30 Aug 2018 15:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbeH3Tse (ORCPT ); Thu, 30 Aug 2018 15:48:34 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40627 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeH3Tse (ORCPT ); Thu, 30 Aug 2018 15:48:34 -0400 Received: by mail-wr1-f67.google.com with SMTP id n2-v6so8511125wrw.7; Thu, 30 Aug 2018 08:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CrbjzCGKhuy1hrMWFjimT5Qh6ZU+NM8doLLYCKA9NAU=; b=qb8wKlxN8ikE8T9BDdtgn/W5hhtut7faqPOVpHaPelKnSWMqpgdxRy/1KVJexwbnE1 QPPwPWsXnMFU6fr4x/X01yC6CQ1uCPHP2l8oDZYuE4CeUzFGoEve711z5j54qN6+tLet GUpUOfDgWTDE73HpW6HllXyHBZ7nOXvQTCXqpiU34Fki4IGdpFhpx2NbVGVCaIXlMgMk s87CECAcyq+qfzPZMEa/JVajSaG6AfQn34QJUKEp5vhtruikchZOTlamYgnLHpRNh5H7 TqOxYpNsC004LJyoJwCDlaedW9/f9w0OI0zAPhJ5cvUYiVFJTiW4gVud4sYnLlR8OMoF oUwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CrbjzCGKhuy1hrMWFjimT5Qh6ZU+NM8doLLYCKA9NAU=; b=BaOk47475ZlvsOSP6zs/GW/CgldwGqwKIXJBL+Lylb7l1fUKtYiebPn0tRqTElnu/j fUv7yyrYdYSIh1WpQqqYpx/OTYkHx+kgSIHT4qxleoexw23iSdQDxq3OEO0E7yPHgOwo ngXAnhhE98wI9NIsEivt1RJcTHn+h8mV+lL37iJT4m8pl5egDgX9TNb9etpFAf46UHBy i+OCjqG6f+5s7nCJvaIhw80VHQ9MyH4PsHBp8fRVqV4VherUgo9G4C6r5nW3PPrPLUxK OI1zYHI7GQhwB+A4JhhoMyfZB0LEfr+jEqqf7D5Lh8gYeaDi3FW13p0KW5JtnHtmDDIF Q99g== X-Gm-Message-State: APzg51BmQ7VRJcwz400hZnvrr0p7MRRtr1SUNrQXDZ4eV7jHh3zBVcpy 26d9Ei3jhZ2YLz1We0RI7RE= X-Google-Smtp-Source: ANB0VdZP4PYxxNOjOMzNiV+xt7u6wr8jjl4VjFuXGazBQIsNzc0NEBrxi9riWD9Hd9ZUOnghnMxBxg== X-Received: by 2002:adf:ea4f:: with SMTP id j15-v6mr8358259wrn.224.1535643946851; Thu, 30 Aug 2018 08:45:46 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:46 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 25/30] ARM: dts: sun8i: h3: add thermal zone to H3 Date: Thu, 30 Aug 2018 17:45:13 +0200 Message-Id: <20180830154518.29507-26-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the thermal zones to the H3. We have only one sensor and that is placed in the cpu. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-h3.dtsi | 31 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/sunxi-h3-h5.dtsi | 1 + 2 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index 5b7994cb1471..954848d5df50 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -78,6 +78,8 @@ clock-names = "cpu"; operating-points-v2 = <&cpu0_opp_table>; #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <15>; }; cpu@1 { @@ -102,6 +104,35 @@ }; }; + thermal-zones { + cpu-thermal { + /* milliseconds */ + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&ths>; + + trips { + cpu_hot_trip: cpu-warm { + temperature = <65000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_very_hot_trip: cpu-very-hot { + temperature = <90000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + cpu-warm-limit { + trip = <&cpu_hot_trip>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + timer { compatible = "arm,armv7-timer"; interrupts = , diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index 3520e4ad6042..2c83f4893757 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -47,6 +47,7 @@ #include #include #include +#include / { interrupt-parent = <&gic>; From patchwork Thu Aug 30 15:45:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582093 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 E7FE814BD for ; Thu, 30 Aug 2018 15:45:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D98CF2C0AB for ; Thu, 30 Aug 2018 15:45:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD9C12C0AE; Thu, 30 Aug 2018 15:45:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 891882C0AB for ; Thu, 30 Aug 2018 15:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727989AbeH3Tsf (ORCPT ); Thu, 30 Aug 2018 15:48:35 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42690 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbeH3Tse (ORCPT ); Thu, 30 Aug 2018 15:48:34 -0400 Received: by mail-wr1-f67.google.com with SMTP id v17-v6so8515880wrr.9; Thu, 30 Aug 2018 08:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7fcz895GUsu55hC5nTmUgHw6xA+IJt+1id8NXirwNlM=; b=SjKPkeLySCJEK4Y13+HT7/9l6WrLyE/c73c83Fykti/+fVoYb+P/DCvpKQhMPgbbt3 Z+k6EjZIYPEQm4kpEZTDYryKCniBgzyx5mfO1U8Srco38IgQG23lyT2H4ahmcXZwpaLB a59gxBRF4QmavAd9aErhRSafN2cLz3oS1P5JFlEoibmP/muy+TCx+rV6rfWUHKdcot8z jgA2TiO6dpZu0WWiycqUHdKQKJk1OoTHdpbCGARMe7Wc+B3YkrhnaRLG9oWgoTexK4uW /zUKd6Wc7xMmNmRJAx17ksXQrTL2hfSl4fKz647kiSQzgaJbkJlvSxtrzddULpUt441E gQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7fcz895GUsu55hC5nTmUgHw6xA+IJt+1id8NXirwNlM=; b=CWgEA6S0tlE0svwFyyqTXCAaX8zc0TWNLiJX7czM/EBIJTT4kdpCym0ELxSm6RHcB/ fy034QE5ZQ75D03xQoQfoVNja+Oe3nv2/3++o3gmE/j5cbdpTZh4QqzpQRVlhAODWa+4 3r+RQtMpGKptOWJ1V7cGEQ5Q/HGqFg0V1oiyVshMX5s94lN9zlrTB5G5tTHPXCVvNgE5 6y2J1o00bjZ0/Lp2yMGAT6ObRwSA2CsrVpIQmS8V4tev3J6wd+yBnbTxk/OMjlw2luSX nDFxu7xy98wARYrhW+sTcoEathjEvdB+w88jJumyJcB0PGI7XOfukNVD2THF4bYViX/W nQ6g== X-Gm-Message-State: APzg51A2lSs+8CTaz8qXMzN3yyBDr7ZXiDf6VOwg0d+gMFmxSgc8XFUg 6xyEYBOHyYcW53DBb1YK3sk= X-Google-Smtp-Source: ANB0VdYY8IRyJyHvIIx2ksl+ThEEVOKF+FOMBA3dpXx+QuDAFvRk7+O2kpuCoTl06PlR48Or1XA4GQ== X-Received: by 2002:adf:cc91:: with SMTP id p17-v6mr8042454wrj.226.1535643947922; Thu, 30 Aug 2018 08:45:47 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:47 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 26/30] ARM: dts: sun8i: h3: enable H3 sid controller Date: Thu, 30 Aug 2018 17:45:14 +0200 Message-Id: <20180830154518.29507-27-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables the the sid controller in the H3. It can be used for thermal calibration data. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index 954848d5df50..1866aec69ec1 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -104,6 +104,13 @@ }; }; + soc { + sid: eeprom@1c14000 { + compatible = "allwinner,sun8i-h3-sid"; + reg = <0x01c14000 0x400>; + }; + }; + thermal-zones { cpu-thermal { /* milliseconds */ From patchwork Thu Aug 30 15:45:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582101 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 D495C14BD for ; Thu, 30 Aug 2018 15:46:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C39A32C0AB for ; Thu, 30 Aug 2018 15:46:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B75EA2C0AE; Thu, 30 Aug 2018 15:46: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 6A1B52C0AB for ; Thu, 30 Aug 2018 15:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727999AbeH3Tsg (ORCPT ); Thu, 30 Aug 2018 15:48:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54893 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbeH3Tsg (ORCPT ); Thu, 30 Aug 2018 15:48:36 -0400 Received: by mail-wm0-f67.google.com with SMTP id c14-v6so2473410wmb.4; Thu, 30 Aug 2018 08:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uL+RlF1B8X/odxljz0MZSNmhjxVAqq2N7EvHMawx/vQ=; b=sTH3nV6t6alJ644hRiZ1vJjRhtz7c2syDksMfEE0JxXa+Woh1JxBWUovFdbpuw8uzV Xo4/UrH5Li9xXOkir35nIx0HeDLVJKSXIrI0U3KbXNBlIz4731zitPTit7jObJu+hTEd HTtHbzNT0rDImceTuciYxQIKotQbzw/DEK59yGvvp6wb/MDsJiejbJ0Djd9Eg8g05g7w eokB9Cq3ZUzoIEP4cq2UIS1EhQ5ALtYbQ6HUWfcAGvWIDZAaf2axj7LSm5puMhRvutHU rhPI5yleS7mM7Svzn3NR5dK5X4TGHGC7qCdetgr2HpUrP4Q0874BabnexHcftqaT6CDa PMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uL+RlF1B8X/odxljz0MZSNmhjxVAqq2N7EvHMawx/vQ=; b=e1XX8Jnc8KbjREIPGe3gUvaykPmQjKwSGxu08v1EPssEE0j1geMkzoUnxlyHEg+wfk gX5ZzxSkfggd3WIHSFNm9bzpVfPXxA32PpSA4POzKDgLjcmRynTx53ux2f9URkzdBEpG UyLzmn3UH+GLbhQD/e/Tz8faCav2prLx0CXjGLn28uBSCIb3PG3ARDI/g251bJU8VTO4 jmR+g/AahJuV06xOV3BSH/fN8ouyw2iEer6SECiF1y39TXO64wc7EZYzR+nxWqzAVO3h JXcA+QYpvu3fFLcJnyNOrOtZufEn33yTaVdPiaHvgVQt3lyeC0cPNECJEKpQYI5h55QY hipw== X-Gm-Message-State: APzg51AMn1QUuif9XaK3VTt1xg/h98rGZ9hSxwGqEko+9JCUgIYde57c lfaOFI42a1xbT1+hvciFsYg= X-Google-Smtp-Source: ANB0VdbcppwMi0pbfqC1/1hcsx8Wa1g8hjNqGUhDOM+NvoVaj4+RzzJnlnPWk8L6qomTrkarfHUCig== X-Received: by 2002:a1c:1f48:: with SMTP id f69-v6mr2114357wmf.152.1535643948953; Thu, 30 Aug 2018 08:45:48 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:48 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 27/30] ARM: dts: sun8i: h3: use calibration for ths Date: Thu, 30 Aug 2018 17:45:15 +0200 Message-Id: <20180830154518.29507-28-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The H3 SID is supported by the kernel so we can add a NVMEM Data cell, that contains the calibration data. On the H3 the eFuses are located at the offset 0x200. The thermal data itself has an offset of 0x34 from the eFuse base. So we end on an offset of 0x234. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-h3.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index 1866aec69ec1..0fc447f0c02a 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -106,8 +106,15 @@ soc { sid: eeprom@1c14000 { + #address-cells = <1>; + #size-cells = <1>; compatible = "allwinner,sun8i-h3-sid"; reg = <0x01c14000 0x400>; + + /* Data cells */ + thermal_calibration: calib@234 { + reg = <0x234 0x8>; + }; }; }; @@ -227,4 +234,6 @@ &ths { compatible = "allwinner,sun8i-h3-ths"; #thermal-sensor-cells = <0>; + nvmem-cells = <&thermal_calibration>; + nvmem-cell-names = "calibration"; }; From patchwork Thu Aug 30 15:45:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582099 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 BBDBB14E1 for ; Thu, 30 Aug 2018 15:46:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACA552C0AB for ; Thu, 30 Aug 2018 15:46:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0A6D2C0AE; Thu, 30 Aug 2018 15:46: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5780A2C0AB for ; Thu, 30 Aug 2018 15:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727703AbeH3Tsh (ORCPT ); Thu, 30 Aug 2018 15:48:37 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34144 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbeH3Tsh (ORCPT ); Thu, 30 Aug 2018 15:48:37 -0400 Received: by mail-wr1-f66.google.com with SMTP id g33-v6so8533049wrd.1; Thu, 30 Aug 2018 08:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y/Fj6KILOvy4Hub0AlnmhTfrUDXUWebrPBRvX31vXgc=; b=TIsgTYwpO0JSXsFCAR1gBgU4yOWMOe7YlHBfRlrGLorlzSjKvfBEMgg5cZt11Oud2j i2DU+7SYH/UXgrqjScKBzQwBtQrpdWU9JP2Er/9rOkXzlqkKrNJIVsoHQ7opKHMlso6/ dhslqj6NMOMt8pkEIkvJzkiP0tE0ni3IK/VhmYJrpx7OMb+BjvCTrUzpRn4Itwl5bbxg mlDVB9w1rF4pLCa85smzJZMdbdzlbGMzhvN32mie0bhHoH7vnoqFqxRyfD3pwr3aai2S MITLssiZJ2Od90VcPFzI4BijdPDVhDd1S9F0cnRKThVTQunMt6pd+QGNwfyOX/WZyqhz HKWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/Fj6KILOvy4Hub0AlnmhTfrUDXUWebrPBRvX31vXgc=; b=dHtcqfw/Y1KHhmqUkfj8NHb+7TgGKtmc5PvJj2XYYWt1oZLbWQls6E+VPxxjYUcP2N DXCNIMvyQjkZfMGc/hcqAMbBgrf/jrwBtpmlylNPy6NmJmggMOlapgV0xFUYun0itGvl QyNr+7dY6gGoQu8ns/bIvw0H3bmaq92ihSC2P7NNaGpuCwhzKJlPdYWUm0WtZ6bvwL7H uBl5LSRAkuAthLddI9g/or7W4fan0zpKmNvQS21VMGawpPJY1CuztA+bHrcSYqJKILDi +tC5hyAweJNcV4glT4oL8INDR1YnNsIPBlcCuNpSXv5HRuJybQk0IyaEyvy9wQFiH0X0 bRGg== X-Gm-Message-State: APzg51Bo2UBKV2+kh3cClF7TrO32+iw4Mr5v3qIEVRZJfVPpQ1OcAr4Z 2mJ0snUKnzSDlT8xtoDIAQI= X-Google-Smtp-Source: ANB0Vdbc61xQJObw7vzUpdLQCS/u4BaJGuaWXTUg2M+HtFLPJancYx3rVv+/+CbFv0zcDYP+W/DtZw== X-Received: by 2002:adf:ffc7:: with SMTP id x7-v6mr3502999wrs.137.1535643950090; Thu, 30 Aug 2018 08:45:50 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:49 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 28/30] ARM: dts: sun8i: a83t: add support for the thermal sensor in A83T Date: Thu, 30 Aug 2018 17:45:16 +0200 Message-Id: <20180830154518.29507-29-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As we have gained the support for the thermal sensor in A83T, we can now add its device nodes to the device tree. The A83T seems to have a broken IRQ 31, thus we use here IRQ 41. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-a83t.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi index 2be23d600957..f2f745930b08 100644 --- a/arch/arm/boot/dts/sun8i-a83t.dtsi +++ b/arch/arm/boot/dts/sun8i-a83t.dtsi @@ -757,6 +757,14 @@ clocks = <&osc24M>; }; + ths: thermal-sensor@1f04000 { + compatible = "allwinner,sun8i-a83t-ths"; + reg = <0x01f04000 0x100>; + interrupts = ; + #thermal-sensor-cells = <1>; + #io-channel-cells = <0>; + }; + watchdog@1c20ca0 { compatible = "allwinner,sun6i-a31-wdt"; reg = <0x01c20ca0 0x20>; From patchwork Thu Aug 30 15:45:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582095 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 E0A5E14E1 for ; Thu, 30 Aug 2018 15:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D13E82C0AB for ; Thu, 30 Aug 2018 15:45:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4CCA2C0AE; Thu, 30 Aug 2018 15:45:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 4747F2C0AB for ; Thu, 30 Aug 2018 15:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbeH3Tsi (ORCPT ); Thu, 30 Aug 2018 15:48:38 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42692 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727996AbeH3Tsi (ORCPT ); Thu, 30 Aug 2018 15:48:38 -0400 Received: by mail-wr1-f66.google.com with SMTP id v17-v6so8516011wrr.9; Thu, 30 Aug 2018 08:45:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sICcaZN9SuHUxjIoI4iQcsXgJZYewubrScoChP39YpI=; b=Aw9v103kYcLLYZnLacNAi2w5W6W18WUc1/2IS7u1/9HUeYKyu4eVfDzJpD1PybEatM MrznRHu0Dyec+WLTggEvXmp5Kv0AyCMgzolRBcFSo0gyBteDJBPi4A3FbFhuf+bVVJSr c1plByogpJ61B/oG/PH35mpesTFkcO7qUY76jxP8pTCn7XnBOtLXxgNT2WGs4rSCcFrx 1CpIT5w6d56m/eCqh2mYJ9XgYLwEf0A5sLm4P28K/L8XHYSP8UyvztV8hXy6EtYlXBAA dPIIgci9jS3fMMvNK2OTj7tLhbedaZocdsbA8R+/5Bkh1jiKxN4AiDz31Uttg+7SNhPU Ry6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sICcaZN9SuHUxjIoI4iQcsXgJZYewubrScoChP39YpI=; b=KESzq0anMIYAhm1SWuBQlmpY0smijBLFOPfS51XRuESEhWUMC2YCr++0b2n5FAu8ga 0d5282ZvoAKSU1Y+l2Kt1iRQrv8XxqRdQo54EpHi+z+b+2lQ8CUh76VYycZzn6UQt8CB 7+oba2rnvxvPHTTfmYzk020Dgb7poQWqCP2x8IeFBGRCPLT45kqovoH1GSPBJZgBfyBC B4i7EG8++6ae9yu0j8vM1njj5YU/REKSDPW60wBvXjfOhyF9ycBkOo35GCkrE7IW1W+t ll4jVWOXqPVNgNKrtrfvWf/CIfBw4tUqmU0ALXb/Hn13ADZy5l0DkwEmqEsxbY9qV4uD i3fg== X-Gm-Message-State: APzg51CijB2MKa2uSnaUbE0PeVeQqdT4zWf7G5i0knSwsBERS2oQEbYR Yk18l08IKysU+LKloWU0Aeg= X-Google-Smtp-Source: ANB0VdZ0MikSKsrAa87d0u3AUJ+5RqMu1iRmXtZH7fLGRlp1wDHMuNiCDvEZEfF05cd4AM5E4NiNTA== X-Received: by 2002:adf:8504:: with SMTP id 4-v6mr7769616wrh.72.1535643951102; Thu, 30 Aug 2018 08:45:51 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:50 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 29/30] ARM: dts: sun8i: a83t: add thermal zone to A83T Date: Thu, 30 Aug 2018 17:45:17 +0200 Message-Id: <20180830154518.29507-30-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the thermal zones to the A83T. Sensor 0 is located besides the cpu cluster 0. Sensor 1 is located besides cluster 1 and sensor 2 is located besides in the gpu. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-a83t.dtsi | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi index f2f745930b08..78aa448e869f 100644 --- a/arch/arm/boot/dts/sun8i-a83t.dtsi +++ b/arch/arm/boot/dts/sun8i-a83t.dtsi @@ -50,6 +50,7 @@ #include #include #include +#include / { interrupt-parent = <&gic>; @@ -69,6 +70,9 @@ cci-control-port = <&cci_control0>; enable-method = "allwinner,sun8i-a83t-smp"; reg = <0>; + #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <7>; }; cpu@1 { @@ -107,6 +111,9 @@ cci-control-port = <&cci_control1>; enable-method = "allwinner,sun8i-a83t-smp"; reg = <0x100>; + #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <7>; }; cpu@101 { @@ -1035,4 +1042,100 @@ #size-cells = <0>; }; }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>; + thermal-sensors = <&ths 0>; + + trips { + cpu0_warm: cpu_warm { + temperature = <70000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu0_hot: cpu_hot { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu0_very_hot: cpu_very_hot { + temperature = <90000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu0_crit: cpu_crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + cpu_warm_limit_cpu { + trip = <&cpu0_warm>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT 4>; + }; + cpu_hot_limit_cpu { + trip = <&cpu0_hot>; + cooling-device = <&cpu0 5 5>; + }; + cpu_very_hot_limit_cpu { + trip = <&cpu0_very_hot>; + cooling-device = <&cpu0 7 THERMAL_NO_LIMIT>; + }; + }; + }; + + cpu1_thermal: cpu1-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>; + thermal-sensors = <&ths 1>; + + trips { + cpu1_warm: cpu_warm { + temperature = <70000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu1_hot: cpu_hot { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu1_very_hot: cpu_very_hot { + temperature = <90000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu1_crit: cpu_crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + cpu_warm_limit_cpu { + trip = <&cpu1_warm>; + cooling-device = <&cpu100 THERMAL_NO_LIMIT 4>; + }; + cpu_hot_limit_cpu { + trip = <&cpu1_hot>; + cooling-device = <&cpu100 5 5>; + }; + cpu_very_hot_limit_cpu { + trip = <&cpu1_very_hot>; + cooling-device = <&cpu100 7 THERMAL_NO_LIMIT>; + }; + }; + }; + + gpu_thermal: gpu-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>; + thermal-sensors = <&ths 2>; + }; + }; }; From patchwork Thu Aug 30 15:45:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10582097 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 DB72114BD for ; Thu, 30 Aug 2018 15:46:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBA602C0AB for ; Thu, 30 Aug 2018 15:46:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF1A22C0AE; Thu, 30 Aug 2018 15:46:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 6A5C72C0AB for ; Thu, 30 Aug 2018 15:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728060AbeH3Tsk (ORCPT ); Thu, 30 Aug 2018 15:48:40 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37233 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbeH3Tsj (ORCPT ); Thu, 30 Aug 2018 15:48:39 -0400 Received: by mail-wr1-f68.google.com with SMTP id u12-v6so8500295wrr.4; Thu, 30 Aug 2018 08:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3W91bGBF1HpXiJKP9B53w9fhR17jbGJS1HMpVllHUDg=; b=gbvr/F2HG8fxSR5G3qpM1w/HDHaOhquocX4t4s4Iriv1Oag0KkMCt9kVdUenhdLo7z Vg0c1ulZlgLpzC/nCYix1MfpC4qwbWUaTHI0/Poj2KgrmM3d4dDxW4hilvyjeASrCKEV SK6WKzwU4wLyE/w8Qd4m+b2+YXhn6i8oQhnfhjIX6cdMk4P+HQrE4rE/q2NqHWFzbM9l bZryZTbOSAMUpVzoRSDO/xe5wN1yuZDogc4vD2TBED7YswaCWPgwbH/RBT1HI8MkDKdw FexGMW99YGWdbO8Sm5ayMzwuG3q+3GGuyAtHuLgyJo9DNth2OPHQrPGo6od3HbOj/DWM 4Qtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3W91bGBF1HpXiJKP9B53w9fhR17jbGJS1HMpVllHUDg=; b=RppLhabFFiGUhH4YqLQ6ketMYhWAA0WmA+jqkekXUTmraTJu5NjmQW/8aBWOMmx8bB PLzoy9Ptk8rp6BFwoVooK4iSYbu9Sq60g6WUMPyzugrQqKdh+S6hPJSH0aAefVX0ubI6 Crd8YsKREOKQrDCl+SKoQqnnza1dfSlGEw57qog103elsn5amaX/sBdKnwZPfyokmfhS yNRTs9K/Kp6jycp9eclJgrSEh+Vb/3OyWtfd7DjJFMJh5HYYJLgl5BBVhozspll99mgY TfKBSjm/SWPlBX4R59R8gTHR62TwEc0LZKATNIRn2cOf5jhRGPwgZrIiiPT9F5drmAgv s4Iw== X-Gm-Message-State: APzg51Dr5V53pI87Vp7vQDS0XihINYdOzCuhsNmpAfTxGq5STScybG0O BDF9pqmhqv0As8ZUJIoMRmM= X-Google-Smtp-Source: ANB0VdYplH+KyHB34+f5e/lpoUakLxXB/+ITZhkOm7a8OcAvHUtBBgtm0J1cFOmXZ/SchLPMerKIkw== X-Received: by 2002:adf:824f:: with SMTP id 73-v6mr8055934wrb.130.1535643952128; Thu, 30 Aug 2018 08:45:52 -0700 (PDT) Received: from debian-hp.wlan.uni-ulm.de (eduroam170-020.wlan.uni-ulm.de. [134.60.170.20]) by smtp.gmail.com with ESMTPSA id j20-v6sm1362759wmh.9.2018.08.30.08.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 08:45:51 -0700 (PDT) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 30/30] ARM: sun8i: a83t: full range OPP tables and CPUfreq Date: Thu, 30 Aug 2018 17:45:18 +0200 Message-Id: <20180830154518.29507-31-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830154518.29507-1-embed3d@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we have now thermal trotteling enabeled we can now add the full range of the OPP table. The operating points were found in Allwinner BSP and fex files. Signed-off-by: Philipp Rossak --- arch/arm/boot/dts/sun8i-a83t.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi index 78aa448e869f..ddcf404f9c80 100644 --- a/arch/arm/boot/dts/sun8i-a83t.dtsi +++ b/arch/arm/boot/dts/sun8i-a83t.dtsi @@ -250,6 +250,22 @@ opp-microvolt = <840000>; clock-latency-ns = <244144>; /* 8 32k periods */ }; + + opp-1608000000 { + opp-hz = /bits/ 64 <1608000000>; + opp-microvolt = <920000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1800000000 { /* BOOT FREQ */ + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-2016000000 { + opp-hz = /bits/ 64 <2016000000>; + opp-microvolt = <1080000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; }; cpu1_opp_table: opp_table1 { @@ -303,6 +319,22 @@ opp-microvolt = <840000>; clock-latency-ns = <244144>; /* 8 32k periods */ }; + + opp-1608000000 { + opp-hz = /bits/ 64 <1608000000>; + opp-microvolt = <920000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1800000000 { /* BOOT FREQ */ + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-2016000000 { + opp-hz = /bits/ 64 <2016000000>; + opp-microvolt = <1080000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; }; soc {