Skip to content

Commit

Permalink
thermal: rockchip: use the usleep_range instead of udelay
Browse files Browse the repository at this point in the history
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 <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Suggested-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
  • Loading branch information
Caesar Wang authored and Eduardo Valentin committed May 17, 2016
1 parent 678065d commit 2fe5c1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/thermal/rockchip_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2fe5c1b

Please sign in to comment.