Linux-ARM-Kernel Archive mirror
 help / color / mirror / Atom feed
From: <Hari.PrasathGE@microchip.com>
To: <Manikandan.M@microchip.com>, <sam@ravnborg.org>,
	<bbrezillon@kernel.org>, <maarten.lankhorst@linux.intel.com>,
	<mripard@kernel.org>, <tzimmermann@suse.de>, <airlied@gmail.com>,
	<daniel@ffwll.ch>, <Nicolas.Ferre@microchip.com>,
	<alexandre.belloni@bootlin.com>, <claudiu.beznea@tuxon.dev>,
	<lee@kernel.org>, <dri-devel@lists.freedesktop.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: <Balamanikandan.Gunasundar@microchip.com>,
	<Durai.ManickamKR@microchip.com>,
	<Nayabbasha.Sayed@microchip.com>, <Dharma.B@microchip.com>,
	<Varshini.Rajendran@microchip.com>,
	<Balakrishnan.S@microchip.com>, <Charan.Pedumuru@microchip.com>
Subject: Re: [PATCH RESEND v9 3/8] drm: atmel_hlcdc: replace regmap_read with regmap_read_poll_timeout
Date: Tue, 14 May 2024 10:41:22 +0000	[thread overview]
Message-ID: <072a27fd-2d7f-47f8-8f22-d2814e4ea1a1@microchip.com> (raw)
In-Reply-To: <20240424053351.589830-4-manikandan.m@microchip.com>



On 4/24/24 11:03 AM, Manikandan Muralidharan wrote:
> Replace regmap_read with regmap_read_poll_timeout to neatly handle
> retries
> 

Reviewed-by: Hari Prasath Gujulan Elango <hari.prasathge@microchip.com>

> Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
>   .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c    | 44 +++++++++++--------
>   1 file changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index cc5cf4c2faf7..b229692a27ca 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -203,19 +203,22 @@ static void atmel_hlcdc_crtc_atomic_disable(struct drm_crtc *c,
>   	pm_runtime_get_sync(dev->dev);
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_DISP);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_DISP))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_DISP),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_SYNC);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_SYNC))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_SYNC),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_PIXEL_CLK);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_PIXEL_CLK))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_PIXEL_CLK),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
>   
>   	clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
>   	pinctrl_pm_select_sleep_state(dev->dev);
> @@ -241,20 +244,23 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
>   	clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_PIXEL_CLK);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_PIXEL_CLK))
> -		cpu_relax();
> -
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_PIXEL_CLK,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_SYNC);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_SYNC))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_SYNC,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_DISP);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_DISP))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_DISP,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
> +
>   
>   	pm_runtime_put_sync(dev->dev);
>   
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-05-14 10:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  5:33 [PATCH RESEND v9 0/8] Add support for XLCDC to sam9x7 SoC family Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 1/8] drm: atmel-hlcdc: add driver ops to differentiate HLCDC and XLCDC IP Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 2/8] drm: atmel-hlcdc: Define XLCDC specific registers Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 3/8] drm: atmel_hlcdc: replace regmap_read with regmap_read_poll_timeout Manikandan Muralidharan
2024-04-25  4:41   ` Dharma.B
2024-05-14 10:41   ` Hari.PrasathGE [this message]
2024-04-24  5:33 ` [PATCH RESEND v9 4/8] drm: atmel_hlcdc: Add support for XLCDC using IP specific driver ops Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 5/8] drm: atmel-hlcdc: add DPI mode support for XLCDC Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 6/8] drm: atmel-hlcdc: add vertical and horizontal scaling " Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 7/8] drm: atmel-hlcdc: add support for DSI output formats Manikandan Muralidharan
2024-04-24  5:33 ` [PATCH RESEND v9 8/8] drm: atmel-hlcdc: add LCD controller layer definition for sam9x75 Manikandan Muralidharan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=072a27fd-2d7f-47f8-8f22-d2814e4ea1a1@microchip.com \
    --to=hari.prasathge@microchip.com \
    --cc=Balakrishnan.S@microchip.com \
    --cc=Balamanikandan.Gunasundar@microchip.com \
    --cc=Charan.Pedumuru@microchip.com \
    --cc=Dharma.B@microchip.com \
    --cc=Durai.ManickamKR@microchip.com \
    --cc=Manikandan.M@microchip.com \
    --cc=Nayabbasha.Sayed@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=Varshini.Rajendran@microchip.com \
    --cc=airlied@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).