From patchwork Tue May 3 02:23:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8999951 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1F1A39F1C1 for ; Tue, 3 May 2016 02:24:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F3422028D for ; Tue, 3 May 2016 02:24:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 226C2200FE for ; Tue, 3 May 2016 02:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932389AbcECCYO (ORCPT ); Mon, 2 May 2016 22:24:14 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:36261 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932239AbcECCYO (ORCPT ); Mon, 2 May 2016 22:24:14 -0400 Received: by mail-pa0-f52.google.com with SMTP id bt5so2997024pac.3; Mon, 02 May 2016 19:24:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Wbl7c1H5EEwYXds3DzHm3yqvhHeIR28g8GdZObgAmjg=; b=QWJ9r0N3//NQb3bs5qRQpLw1Ibv9uThXX96EwluTUC4XAZskfFhDj9h0XzRv7E4LVM HBAzcQQgQJsmUv2z7QwHrcch+eYN2ZfjwxDuClaq3loHl9mJjrx4AtJsM8Q+Mbjl+x8n PzogY2eAwtyY4WZdQndQpN5Sv6yv2MGMT4Ffh2Md4CYyaPe7dMdS0nNV/0bs452UPXcf 0uFNt4IFLJYuFvlCaBH/Wd1AVYgHAMtmR4gMcJ8YRUCVWVEAxWm3vBuhyIWrzJHSToBH R8sHLM9CtDJDwvQl+2wzc8gGVgrM4bf10Fkj2AtNAOwD86wbuqgmOqEFx677/12ZQmbn NyWQ== X-Gm-Message-State: AOPr4FVRowDMFSL/b/B8ow1SWz+NLNWv7BEKEBtN1BPv+4nz8c5gRJmj74JIJtJiZv4Z5g== X-Received: by 10.66.2.165 with SMTP id 5mr14885215pav.18.1462242253141; Mon, 02 May 2016 19:24:13 -0700 (PDT) Received: from localhost.localdomain ([104.37.5.149]) by smtp.gmail.com with ESMTPSA id c190sm1035535pfb.33.2016.05.02.19.24.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 May 2016 19:24:11 -0700 (PDT) From: Caesar Wang To: edubezval@gmail.com Cc: rui.zhang@intel.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, huangtao@rock-chips.com, Caesar Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: rockchip: use the usleep_range instead of udelay Date: Tue, 3 May 2016 10:23:50 +0800 Message-Id: <1462242230-20873-1-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Documentation/timers/timers-howto.txt recommends to use usleep_range on delays > 10usec. The usleep_range indeed reduces CPU load, since the udelay will busy wait for enough loop cycles to achieve the desired delay. Fixes commit b06c52db39fd ("thermal: rockchip: handle the power sequence for tsadc controller"). Cc: Zhang Rui Cc: Eduardo Valentin Cc: Heiko Stuebner Suggested-by: Eduardo Valentin Signed-off-by: Caesar Wang --- drivers/thermal/rockchip_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 86a1ab0..5d491f1 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -547,10 +547,10 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs, regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON); mdelay(10); regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_OFF); - udelay(100); /* The spec note says at least 15 us */ + usleep_range(15, 100); /* The spec note says at least 15 us */ regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON); regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON); - udelay(200); /* The spec note says at least 90 us */ + usleep_range(90, 200); /* The spec note says at least 90 us */ } if (tshut_polarity == TSHUT_HIGH_ACTIVE)