From patchwork Tue Mar 29 11:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhiyong.tao" X-Patchwork-Id: 12794731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 915B6C433EF for ; Tue, 29 Mar 2022 11:59:07 +0000 (UTC) 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=dDA2U3+v3UtNPSFnJ2j+tUKAfFFmxMqj9ThNVppjGmA=; b=sZLUQrcYU207MS kt0L+j3vJ769s/4ZH98XgoH6neRwFrz0AL8FHXSk7APr80zH7QsKrTXOvfCDHgiJQbtXn1sMQglGw FNnC3PP5DGhZ+BAsxbI4GMtLpORp9SeX32vmEhe411h6MqThd4Yf9dlWRU7REF5O7s4B09WQc2pbM Xy4TPZN+SQC3jt/YtK56WV55g39qnfNsrjCpK5Wq4LEZVN1S2i0+UuvgLxGQj54y5R3xLhADpPidY o9v7c0HklV2aWGCBs7Kj/Sub3nPfYxud9E6B6co/VgwjZR+OKWCzZPgS7Rww88WWHfS1jpFWQFzje y/Z4vYfI2w0GSApWeWHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZAV4-00C6or-9W; Tue, 29 Mar 2022 11:59:02 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZAUf-00C6hf-BX; Tue, 29 Mar 2022 11:58:38 +0000 X-UUID: e7ffbeb537c54ed9912e2eeca3960058-20220329 X-UUID: e7ffbeb537c54ed9912e2eeca3960058-20220329 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 331783843; Tue, 29 Mar 2022 04:58:32 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Mar 2022 04:58:30 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Tue, 29 Mar 2022 19:58:28 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Mar 2022 19:58:27 +0800 From: Zhiyong Tao To: , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v1 1/1] pwrap: mediatek: fix wait time out issue Date: Tue, 29 Mar 2022 19:58:24 +0800 Message-ID: <20220329115824.13005-2-zhiyong.tao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220329115824.13005-1-zhiyong.tao@mediatek.com> References: <20220329115824.13005-1-zhiyong.tao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220329_045837_429797_710B45F8 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: "Zhiyong.Tao" add sleep delay before read "jiffies" Signed-off-by: Zhiyong.Tao --- drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/soc/mediatek/mtk-pmic-wrap.c diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c old mode 100644 new mode 100755 index 952bc554f443..ac7139a67e87 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -12,6 +12,7 @@ #include #include #include +#include #define PWRAP_MT8135_BRIDGE_IORD_ARB_EN 0x4 #define PWRAP_MT8135_BRIDGE_WACS3_EN 0x10 @@ -1197,10 +1198,13 @@ static int pwrap_wait_for_state(struct pmic_wrapper *wrp, timeout = jiffies + usecs_to_jiffies(10000); do { - if (time_after(jiffies, timeout)) - return fp(wrp) ? 0 : -ETIMEDOUT; if (fp(wrp)) return 0; + + usleep_range(10, 11); + + if (time_after(jiffies, timeout)) + return fp(wrp) ? 0 : -ETIMEDOUT; } while (1); }