From 6f45b03c8ee6ed88acca4c6f6ab92ff43eddf933 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Mon, 7 Nov 2022 17:35:12 +0800 Subject: [PATCH] thermal: rockchip: Sync with upstream Add some comments on rk_tsadcv7_initialize(). Signed-off-by: Tao Huang Change-Id: I5fa77880a0fd47a6c18e8e6ed1606ff8e327f0ad --- drivers/thermal/rockchip_thermal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 4e8b45219431..e91cca2f84a3 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -948,12 +948,26 @@ static void rk_tsadcv7_initialize(struct regmap *grf, void __iomem *regs, writel_relaxed(0U & ~TSADCV2_AUTO_TSHUT_POLARITY_HIGH, regs + TSADCV2_AUTO_CON); + /* + * The general register file will is optional + * and might not be available. + */ if (!IS_ERR(grf)) { regmap_write(grf, RK3568_GRF_TSADC_CON, RK3568_GRF_TSADC_TSEN); + /* + * RK3568 TRM, section 18.5. requires a delay no less + * than 10us between the rising edge of tsadc_tsen_en + * and the rising edge of tsadc_ana_reg_0/1/2. + */ udelay(15); regmap_write(grf, RK3568_GRF_TSADC_CON, RK3568_GRF_TSADC_ANA_REG0); regmap_write(grf, RK3568_GRF_TSADC_CON, RK3568_GRF_TSADC_ANA_REG1); regmap_write(grf, RK3568_GRF_TSADC_CON, RK3568_GRF_TSADC_ANA_REG2); + + /* + * RK3568 TRM, section 18.5. requires a delay no less + * than 90us after the rising edge of tsadc_ana_reg_0/1/2. + */ usleep_range(100, 200); } }