From patchwork Mon Aug 16 03:20:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 12437663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C06C4320E for ; Mon, 16 Aug 2021 03:20:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB20E617E3 for ; Mon, 16 Aug 2021 03:20:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AB20E617E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UQKKYbyX7WU9BTD1OiSFkNTN697IqoqjRzQJfq1K7j0=; b=eaDF1gwzroT/4Q NLphy6QfCCMJ1DXqlVKPFge9L+3xsnDvRA4qsPjeD2JIx56ZG4yP5Uz4NUxQYrfWIru1Am9CSGTV2 DnyG27odQyJ7ryZf/O/73T0AtuqRLBeNsMw8CNfvJH5lJnVjXDLLqrZyzmJ6NzxqfTTWFWq+2mOZa cUiiqHseEVCZLBKfDvfF951TvSHdXcWyy6JU2TH+CHV+nl7TczhHDZfKpzIQs5vgT5Nw7NEg6VHry S3g0PnFHKNEotNtUSEJ5EpLSW/xgqivojVmv0/old5pu/det3C7y6iYpktojzqXE6qcE46rTEYL8c cB/DG01A5lj6Qpo1ONPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAf-00G3WI-PI; Mon, 16 Aug 2021 03:20:17 +0000 Received: from lucky1.263xmail.com ([211.157.147.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAd-00G3UQ-K4 for linux-rockchip@lists.infradead.org; Mon, 16 Aug 2021 03:20:17 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id 99E9CD62E5; Mon, 16 Aug 2021 11:20:12 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P4989T139770959193856S1629084004780123_; Mon, 16 Aug 2021 11:20:06 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <4d0f75539e9bc9660cee06c1899b5596> X-RL-SENDER: jay.xu@rock-chips.com X-SENDER: xjq@rock-chips.com X-LOGIN-NAME: jay.xu@rock-chips.com X-FST-TO: lgirdwood@gmail.com X-RCPT-COUNT: 9 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jianqun Xu To: lgirdwood@gmail.com, broonie@kernel.org, ulf.hansson@linaro.org, lee.jones@linaro.org, zhangchangzhong@huawei.com, heiko@sntech.de Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jianqun Xu Subject: [PATCH 1/4] regulator: add PRE_ENABLE event define Date: Mon, 16 Aug 2021 11:20:00 +0800 Message-Id: <20210816032003.1162779-2-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210816032003.1162779-1-jay.xu@rock-chips.com> References: <20210816032003.1162779-1-jay.xu@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210815_202015_964108_0ACA1A28 X-CRM114-Status: GOOD ( 11.31 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add REGULATOR_EVENT_PRE_ENABLE to allow to notify driver that the regulator is about to enabled. Signed-off-by: Jianqun Xu --- include/linux/regulator/consumer.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 20e84a84fb77..edd31f0dad17 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -102,6 +102,7 @@ struct regulator_dev; * Data passed is old voltage cast to (void *). * PRE_DISABLE Regulator is about to be disabled * ABORT_DISABLE Regulator disable failed for some reason + * PRE_ENABLE Regulator is about to be enabled * * NOTE: These events can be OR'ed together when passed into handler. */ @@ -119,6 +120,7 @@ struct regulator_dev; #define REGULATOR_EVENT_PRE_DISABLE 0x400 #define REGULATOR_EVENT_ABORT_DISABLE 0x800 #define REGULATOR_EVENT_ENABLE 0x1000 +#define REGULATOR_EVENT_PRE_ENABLE 0x2000 /* * Regulator errors that can be queried using regulator_get_error_flags From patchwork Mon Aug 16 03:20:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 12437659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26026C432BE for ; Mon, 16 Aug 2021 03:20:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D9C2A617E6 for ; Mon, 16 Aug 2021 03:20:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D9C2A617E6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aXhCI1jmGoPaJpcVUXEaf/vrpp8MJeKUVcIo5FlfDKU=; b=SsgzYh/Vm3Gk8A 9mDElxk5Nkhw1WlS1N1C2XBaqOnnGON8hsoyLMNrNlZiomxvu8LeQVW0rtV104thvvvdjvveTtQpe qkkG0tFT9aq8MXWnjmsHymWqv9N5F5Ih1lAwswbmH6hWvTvgmz75seULDxiz6SC5kRs7MXwz0l8Yq 2CyOJlB0Q15PCVJtbwU7gxGnS9xHwpDppJf8O0i6RQLx5kiffoLp5JpXt+zDOW0Ub7aT1o51LNJDH b+zGmr+nF4wRZMMqtdWSPw8ERD6rQnl2DStruP9v8SkfqTbyWkXheSI11Q45gFGfh63tXPaU/qjbp jz9I+3CWZ0x9Lz1mXW4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAd-00G3VW-QT; Mon, 16 Aug 2021 03:20:15 +0000 Received: from lucky1.263xmail.com ([211.157.147.134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAZ-00G3Tm-Qo for linux-rockchip@lists.infradead.org; Mon, 16 Aug 2021 03:20:13 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id 30A04CF700; Mon, 16 Aug 2021 11:20:08 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P4989T139770959193856S1629084004780123_; Mon, 16 Aug 2021 11:20:07 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: jay.xu@rock-chips.com X-SENDER: xjq@rock-chips.com X-LOGIN-NAME: jay.xu@rock-chips.com X-FST-TO: lgirdwood@gmail.com X-RCPT-COUNT: 9 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jianqun Xu To: lgirdwood@gmail.com, broonie@kernel.org, ulf.hansson@linaro.org, lee.jones@linaro.org, zhangchangzhong@huawei.com, heiko@sntech.de Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jianqun Xu Subject: [PATCH 2/4] regulator: core: notify regulator enable with the voltage value Date: Mon, 16 Aug 2021 11:20:01 +0800 Message-Id: <20210816032003.1162779-3-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210816032003.1162779-1-jay.xu@rock-chips.com> References: <20210816032003.1162779-1-jay.xu@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210815_202012_147237_B5882FBE X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Get the voltage of regulator and then pass it as the parameter of notify, the driver could take it. The origin parameter for notify is NULL, so this patch do nothing effect to other driver who not care about the voltage value. Signed-off-by: Jianqun Xu --- drivers/regulator/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f192bf19492e..a53f1644a6f4 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2658,8 +2658,12 @@ static int _regulator_enable(struct regulator *regulator) if (ret < 0) goto err_consumer_disable; + ret = _regulator_get_voltage(rdev); + if (ret < 0) + ret = 0; + _notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE, - NULL); + &ret); } else if (ret < 0) { rdev_err(rdev, "is_enabled() failed: %pe\n", ERR_PTR(ret)); goto err_consumer_disable; From patchwork Mon Aug 16 03:20:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 12437661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25FF9C4338F for ; Mon, 16 Aug 2021 03:20:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA7AE617E3 for ; Mon, 16 Aug 2021 03:20:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DA7AE617E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CDB/v+ajOTYA0i76qK1ZhSIWSM4glg31ZAOPIgm2jZs=; b=iEk11bfS4OUybz 5/jpNuM3YqmI+49aikJHsMCVmmqyXZCEiymiZ1k1U/PdWhXloRZ8BvCQD79l1pYY11s6uNE0VjoDS oWta0dfAB0rYQhv6cghtK2OsxKosQmgqxGHB57gcuTc2g7VtShrZIaYxsJdBNYe6ZlLkzEPlZeFY1 6OuV5WYiCMj/5KozQs329eqV1ak6IcUG26t/hb5kFKlGxDKcHxsdhaQnIwQz7JNgW4ODH6OUkBull Luw65VS8In/kkO6Ux88BJS88GB1fMXykB8+/ryKsDVHijWysIn4Zvae0bFD4ozTYVgGMtdACiPAbk kznTIhInLIzTF8RLzIQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAf-00G3Vx-0f; Mon, 16 Aug 2021 03:20:17 +0000 Received: from lucky1.263xmail.com ([211.157.147.135]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAb-00G3U2-VB for linux-rockchip@lists.infradead.org; Mon, 16 Aug 2021 03:20:15 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id CA67AB2B78; Mon, 16 Aug 2021 11:20:08 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P4989T139770959193856S1629084004780123_; Mon, 16 Aug 2021 11:20:08 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <0892698090bf98ad3edcbbcd00073b7d> X-RL-SENDER: jay.xu@rock-chips.com X-SENDER: xjq@rock-chips.com X-LOGIN-NAME: jay.xu@rock-chips.com X-FST-TO: lgirdwood@gmail.com X-RCPT-COUNT: 9 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jianqun Xu To: lgirdwood@gmail.com, broonie@kernel.org, ulf.hansson@linaro.org, lee.jones@linaro.org, zhangchangzhong@huawei.com, heiko@sntech.de Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jianqun Xu Subject: [PATCH 3/4] regulator: core: add pre-enable event notify to regulator Date: Mon, 16 Aug 2021 11:20:02 +0800 Message-Id: <20210816032003.1162779-4-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210816032003.1162779-1-jay.xu@rock-chips.com> References: <20210816032003.1162779-1-jay.xu@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210815_202014_256143_88C1BB25 X-CRM114-Status: GOOD ( 10.48 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Notify the event about regulator to be enabled to driver. The IO-DOMAIN driver on Rockchip SoCs will take this event and then to configure the io-domain mode before regualtor_enable. Signed-off-by: Jianqun Xu --- drivers/regulator/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a53f1644a6f4..0eb7af487931 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2654,6 +2654,9 @@ static int _regulator_enable(struct regulator *regulator) goto err_consumer_disable; } + _notifier_call_chain(rdev, REGULATOR_EVENT_PRE_ENABLE, + NULL); + ret = _regulator_do_enable(rdev); if (ret < 0) goto err_consumer_disable; From patchwork Mon Aug 16 03:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 12437665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F14F4C43214 for ; Mon, 16 Aug 2021 03:20:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F377617E3 for ; Mon, 16 Aug 2021 03:20:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8F377617E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q3ME9XFDQWAMkxuyOhL0a6C9kTTecEiUmwd2E6RMsQE=; b=Mq+hJWspuqTVql cLNAbHe/hj6CdfccRdVbfSkXIY6l8sdGXjd8nQV/r2RzjfVWNK0Rnf/4e+h1LHd1NNyfIdmGsT8AE vTtvAymXLtmBhFWYoewHVwiL7SIJRDcw8gS0eGxXYmLViYZQzKqNT8L/35fTlbjIEqLuUhkKzO05+ 2BTAm+HMZLtj/dG9zuL0mMVcIftYlwVZ17Gb+6JIk8qfjjwXdOixMMo5bX7x9wGioHbtwOLrQWDhB 6rW4hRJ77f1/vqaPMfBMHb/Xb3TQo9pDyCSAG8Q+5UNQrXu36r/xiIyRsbugcjNzf7TiFXpa8QdkX JQX3KAhiirVERh0TMvzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAe-00G3Vr-E9; Mon, 16 Aug 2021 03:20:16 +0000 Received: from lucky1.263xmail.com ([211.157.147.131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFTAa-00G3Tp-Vq for linux-rockchip@lists.infradead.org; Mon, 16 Aug 2021 03:20:14 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id B41D9C25EB; Mon, 16 Aug 2021 11:20:09 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P4989T139770959193856S1629084004780123_; Mon, 16 Aug 2021 11:20:08 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: jay.xu@rock-chips.com X-SENDER: xjq@rock-chips.com X-LOGIN-NAME: jay.xu@rock-chips.com X-FST-TO: lgirdwood@gmail.com X-RCPT-COUNT: 9 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jianqun Xu To: lgirdwood@gmail.com, broonie@kernel.org, ulf.hansson@linaro.org, lee.jones@linaro.org, zhangchangzhong@huawei.com, heiko@sntech.de Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jianqun Xu Subject: [PATCH 4/4] soc: rockchip: io-domain: do more thing about regulator notify Date: Mon, 16 Aug 2021 11:20:03 +0800 Message-Id: <20210816032003.1162779-5-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210816032003.1162779-1-jay.xu@rock-chips.com> References: <20210816032003.1162779-1-jay.xu@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210815_202013_328788_5ED75BD3 X-CRM114-Status: GOOD ( 10.21 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Do a fix to rockchip io-domain, follow this orders: * system running state -> io-domain vsel to 3.3V -> regulator_enable -> vsel change according to regulator voltage * system running state -> io-domain vsel to 3.3V -> regulator_disable Found on some Rockchip SoCs, the regulator enable or disable without care about the io-domain maybe caused soc damaged. Signed-off-by: Jianqun Xu --- drivers/soc/rockchip/io-domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c index cf8182fc3642..af5fb11ad9a3 100644 --- a/drivers/soc/rockchip/io-domain.c +++ b/drivers/soc/rockchip/io-domain.c @@ -123,6 +123,12 @@ static int rockchip_iodomain_notify(struct notifier_block *nb, } else if (event & (REGULATOR_EVENT_VOLTAGE_CHANGE | REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE)) { uV = (unsigned long)data; + } else if (event & REGULATOR_EVENT_PRE_ENABLE) { + uV = MAX_VOLTAGE_3_3; + } else if (event & REGULATOR_EVENT_PRE_DISABLE) { + uV = MAX_VOLTAGE_3_3; + } else if (event & REGULATOR_EVENT_ENABLE) { + uV = (unsigned long)data; } else { return NOTIFY_OK; }