dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Thomas Zimmermann <tzimmermann@suse.de>, Dan.Sneddon@microchip.com
Cc: airlied@linux.ie, liviu.dudau@arm.com,
	amd-gfx@lists.freedesktop.org, anitha.chrisanthus@intel.com,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	edmund.j.dea@intel.com, s.hauer@pengutronix.de,
	alison.wang@nxp.com, dri-devel@lists.freedesktop.org,
	sean@poorly.run, linux-arm-kernel@lists.infradead.org,
	tomba@kernel.org, bbrezillon@kernel.org, jyri.sarha@iki.fi,
	nicolas.ferre@microchip.com, christian.koenig@amd.com,
	kernel@pengutronix.de, alexander.deucher@amd.com,
	shawnguo@kernel.org
Subject: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
Date: Wed, 28 Jul 2021 16:00:23 +0200	[thread overview]
Message-ID: <YQFi96yaYbTG4OO7@ravnborg.org> (raw)
In-Reply-To: <20210727182721.17981-4-tzimmermann@suse.de>

Hi Dan,

I hope you can fine to test this patch from Thomas.
If this works then we can forget about my attempt to do the same.

Hi Thomas,

IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
already.

With that considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

We shall wait for testing from Dan before you apply it as I had made a
similar patch that failed to work. I assume my patch was buggy but I
prefer to be sure.

	Sam

On Tue, Jul 27, 2021 at 08:27:10PM +0200, Thomas Zimmermann wrote:
> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
> don't benefit from using it. DRM IRQ callbacks are now being called
> directly or inlined.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>  1 file changed, 52 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index f09b6dd8754c..cfa8c2c9c8aa 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -22,7 +22,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int cfg = 0;
> +	int i;
> +
> +	/* Enable interrupts on activated layers */
> +	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> +		if (dc->layers[i])
> +			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> +	}
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> +}
> +
> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int isr;
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> +	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> +}
> +
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +
> +	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	atmel_hlcdc_dc_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +	free_irq(dc->hlcdc->irq, dev);
> +}
> +
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
>  	.atomic_check = drm_atomic_helper_check,
> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  	drm_mode_config_reset(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	ret = drm_irq_install(dev, dc->hlcdc->irq);
> +	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>  	pm_runtime_put_sync(dev->dev);
>  	if (ret < 0) {
>  		dev_err(dev->dev, "failed to install IRQ handler\n");
> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	drm_mode_config_cleanup(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	drm_irq_uninstall(dev);
> +	atmel_hlcdc_dc_irq_uninstall(dev);
>  	pm_runtime_put_sync(dev->dev);
>  
>  	dev->dev_private = NULL;
> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	clk_disable_unprepare(dc->hlcdc->periph_clk);
>  }
>  
> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int cfg = 0;
> -	int i;
> -
> -	/* Enable interrupts on activated layers */
> -	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> -		if (dc->layers[i])
> -			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> -	}
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> -
> -	return 0;
> -}
> -
> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int isr;
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> -	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = atmel_hlcdc_dc_irq_handler,
> -	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> -	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> -	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
> -- 
> 2.32.0

  reply	other threads:[~2021-07-28 14:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 18:27 [PATCH 00/14] drm: Make DRM's IRQ helpers legacy Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces Thomas Zimmermann
2021-07-28 10:27   ` Christian König
2021-07-28 14:03     ` Alex Deucher
2021-08-02  8:43       ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 02/14] drm/arm/hdlcd: " Thomas Zimmermann
2021-07-28 13:31   ` Sam Ravnborg
2021-07-28 18:15     ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 03/14] drm/atmel-hlcdc: " Thomas Zimmermann
2021-07-28 14:00   ` Sam Ravnborg [this message]
2021-07-28 15:11     ` Dan.Sneddon
2021-07-28 15:44       ` Sam Ravnborg
2021-07-28 17:50         ` Dan.Sneddon
2021-07-28 18:11           ` Sam Ravnborg
2021-07-28 18:17             ` Thomas Zimmermann
2021-07-28 18:46               ` Dan.Sneddon
2021-07-28 19:08                 ` Sam Ravnborg
2021-07-28 19:19                   ` Dan.Sneddon
2021-07-28 20:11                     ` Sam Ravnborg
2021-07-29 19:18                       ` Thomas Zimmermann
2021-07-29 19:21                         ` Thomas Zimmermann
2021-07-29 19:24                         ` Dan.Sneddon
2021-07-29 19:32                           ` Thomas Zimmermann
2021-07-29 19:48                         ` Sam Ravnborg
2021-07-29 19:55                           ` Dan.Sneddon
2021-07-30  8:31                             ` Thomas Zimmermann
2021-07-30 18:10                               ` Dan.Sneddon
2021-07-28 18:19             ` Dan.Sneddon
2021-07-27 18:27 ` [PATCH 04/14] drm/fsl-dcu: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 05/14] drm/gma500: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 06/14] drm/kmb: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 07/14] drm/msm: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 08/14] drm/mxsfb: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 09/14] drm/radeon: " Thomas Zimmermann
2021-08-02 15:27   ` Alex Deucher
2021-07-27 18:27 ` [PATCH 10/14] drm/tidss: " Thomas Zimmermann
2021-07-29  7:02   ` Tomi Valkeinen
2021-07-27 18:27 ` [PATCH 11/14] drm/tilcdc: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 12/14] drm/vc4: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 13/14] drm: Remove unused devm_drm_irq_install() Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 14/14] drm: IRQ midlayer is now legacy Thomas Zimmermann
2021-07-28 14:10   ` Sam Ravnborg
2021-07-27 18:51 ` [PATCH 00/14] drm: Make DRM's IRQ helpers legacy Sam Ravnborg
2021-07-28  5:19   ` Thomas Zimmermann
2021-07-31 18:50 ` Sam Ravnborg
2021-08-01 19:56   ` Thomas Zimmermann
2021-08-01 20:24     ` Sam Ravnborg
2021-08-02  8:42       ` Thomas Zimmermann

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=YQFi96yaYbTG4OO7@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=Dan.Sneddon@microchip.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=alison.wang@nxp.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=anitha.chrisanthus@intel.com \
    --cc=bbrezillon@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jyri.sarha@iki.fi \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --cc=tomba@kernel.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 NNTP newsgroup(s).