Commit f5a5f04b authored by Manikandan Muralidharan's avatar Manikandan Muralidharan Committed by Sam Ravnborg

drm: atmel_hlcdc: replace regmap_read with regmap_read_poll_timeout

Replace regmap_read with regmap_read_poll_timeout to neatly handle
retries
Signed-off-by: default avatarManikandan Muralidharan <manikandan.m@microchip.com>
Acked-by: default avatarDharma Balasubiramani <dharma.b@microchip.com>
Reviewed-by: default avatarHari Prasath Gujulan Elango <hari.prasathge@microchip.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240424053351.589830-4-manikandan.m@microchip.com
parent 73fc9753
...@@ -203,19 +203,22 @@ static void atmel_hlcdc_crtc_atomic_disable(struct drm_crtc *c, ...@@ -203,19 +203,22 @@ static void atmel_hlcdc_crtc_atomic_disable(struct drm_crtc *c,
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_DISP); regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_DISP);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
(status & ATMEL_HLCDC_DISP)) !(status & ATMEL_HLCDC_DISP),
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_SYNC); regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_SYNC);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
(status & ATMEL_HLCDC_SYNC)) !(status & ATMEL_HLCDC_SYNC),
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_PIXEL_CLK); regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_PIXEL_CLK);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
(status & ATMEL_HLCDC_PIXEL_CLK)) !(status & ATMEL_HLCDC_PIXEL_CLK),
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
clk_disable_unprepare(crtc->dc->hlcdc->sys_clk); clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
pinctrl_pm_select_sleep_state(dev->dev); pinctrl_pm_select_sleep_state(dev->dev);
...@@ -241,20 +244,23 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c, ...@@ -241,20 +244,23 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
clk_prepare_enable(crtc->dc->hlcdc->sys_clk); clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_PIXEL_CLK); regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_PIXEL_CLK);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
!(status & ATMEL_HLCDC_PIXEL_CLK)) status & ATMEL_HLCDC_PIXEL_CLK,
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_SYNC); regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_SYNC);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
!(status & ATMEL_HLCDC_SYNC)) status & ATMEL_HLCDC_SYNC,
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_DISP); regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_DISP);
while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) && if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
!(status & ATMEL_HLCDC_DISP)) status & ATMEL_HLCDC_DISP,
cpu_relax(); 10, 1000))
dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment