linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/stm: ltdc: add number of interrupts
@ 2020-01-21 10:13 Yannick Fertre
  2020-01-23  9:48 ` Philippe CORNU
  0 siblings, 1 reply; 3+ messages in thread
From: Yannick Fertre @ 2020-01-21 10:13 UTC (permalink / raw)
  To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard, David Airlie,
	Daniel Vetter, Maxime Coquelin, Alexandre Torgue, dri-devel,
	linux-stm32, linux-arm-kernel, linux-kernel

The number of interrupts depends on the ltdc version.
Don't try to get interrupt which not exist, avoiding
kernel warning messages.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
---
 drivers/gpu/drm/stm/ltdc.c | 30 +++++++++++++++---------------
 drivers/gpu/drm/stm/ltdc.h |  1 +
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8..58092b0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1146,12 +1146,14 @@ static int ltdc_get_caps(struct drm_device *ddev)
 		ldev->caps.pad_max_freq_hz = 90000000;
 		if (ldev->caps.hw_version == HWVER_10200)
 			ldev->caps.pad_max_freq_hz = 65000000;
+		ldev->caps.nb_irq = 2;
 		break;
 	case HWVER_20101:
 		ldev->caps.reg_ofs = REG_OFS_4;
 		ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1;
 		ldev->caps.non_alpha_only_l1 = false;
 		ldev->caps.pad_max_freq_hz = 150000000;
+		ldev->caps.nb_irq = 4;
 		break;
 	default:
 		return -ENODEV;
@@ -1251,13 +1253,21 @@ int ltdc_load(struct drm_device *ddev)
 	reg_clear(ldev->regs, LTDC_IER,
 		  IER_LIE | IER_RRIE | IER_FUIE | IER_TERRIE);
 
-	for (i = 0; i < MAX_IRQ; i++) {
+	ret = ltdc_get_caps(ddev);
+	if (ret) {
+		DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
+			  ldev->caps.hw_version);
+		goto err;
+	}
+
+	DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
+
+	for (i = 0; i < ldev->caps.nb_irq; i++) {
 		irq = platform_get_irq(pdev, i);
-		if (irq == -EPROBE_DEFER)
+		if (irq < 0) {
+			ret = irq;
 			goto err;
-
-		if (irq < 0)
-			continue;
+		}
 
 		ret = devm_request_threaded_irq(dev, irq, ltdc_irq,
 						ltdc_irq_thread, IRQF_ONESHOT,
@@ -1268,16 +1278,6 @@ int ltdc_load(struct drm_device *ddev)
 		}
 	}
 
-
-	ret = ltdc_get_caps(ddev);
-	if (ret) {
-		DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
-			  ldev->caps.hw_version);
-		goto err;
-	}
-
-	DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
-
 	/* Add endpoints panels or bridges if any */
 	for (i = 0; i < MAX_ENDPOINTS; i++) {
 		if (panel[i]) {
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae..310e87f 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -19,6 +19,7 @@ struct ltdc_caps {
 	const u32 *pix_fmt_hw;	/* supported pixel formats */
 	bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
 	int pad_max_freq_hz;	/* max frequency supported by pad */
+	int nb_irq;		/* number of hardware interrupts */
 };
 
 #define LTDC_MAX_LAYER	4
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add number of interrupts
  2020-01-21 10:13 [PATCH] drm/stm: ltdc: add number of interrupts Yannick Fertre
@ 2020-01-23  9:48 ` Philippe CORNU
  2020-02-04 10:57   ` Benjamin Gaignard
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe CORNU @ 2020-01-23  9:48 UTC (permalink / raw)
  To: Yannick FERTRE, Benjamin GAIGNARD, David Airlie, Daniel Vetter,
	Maxime Coquelin, Alexandre TORGUE, dri-devel, linux-stm32,
	linux-arm-kernel, linux-kernel

Dear Yannick,
Thank you for your patch,

Acked-by: Philippe Cornu <philippe.cornu@st.com>

Philippe :-)

On 1/21/20 11:13 AM, Yannick Fertre wrote:
> The number of interrupts depends on the ltdc version.
> Don't try to get interrupt which not exist, avoiding
> kernel warning messages.
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 30 +++++++++++++++---------------
>   drivers/gpu/drm/stm/ltdc.h |  1 +
>   2 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index c2815e8..58092b0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -1146,12 +1146,14 @@ static int ltdc_get_caps(struct drm_device *ddev)
>   		ldev->caps.pad_max_freq_hz = 90000000;
>   		if (ldev->caps.hw_version == HWVER_10200)
>   			ldev->caps.pad_max_freq_hz = 65000000;
> +		ldev->caps.nb_irq = 2;
>   		break;
>   	case HWVER_20101:
>   		ldev->caps.reg_ofs = REG_OFS_4;
>   		ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1;
>   		ldev->caps.non_alpha_only_l1 = false;
>   		ldev->caps.pad_max_freq_hz = 150000000;
> +		ldev->caps.nb_irq = 4;
>   		break;
>   	default:
>   		return -ENODEV;
> @@ -1251,13 +1253,21 @@ int ltdc_load(struct drm_device *ddev)
>   	reg_clear(ldev->regs, LTDC_IER,
>   		  IER_LIE | IER_RRIE | IER_FUIE | IER_TERRIE);
>   
> -	for (i = 0; i < MAX_IRQ; i++) {
> +	ret = ltdc_get_caps(ddev);
> +	if (ret) {
> +		DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> +			  ldev->caps.hw_version);
> +		goto err;
> +	}
> +
> +	DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> +
> +	for (i = 0; i < ldev->caps.nb_irq; i++) {
>   		irq = platform_get_irq(pdev, i);
> -		if (irq == -EPROBE_DEFER)
> +		if (irq < 0) {
> +			ret = irq;
>   			goto err;
> -
> -		if (irq < 0)
> -			continue;
> +		}
>   
>   		ret = devm_request_threaded_irq(dev, irq, ltdc_irq,
>   						ltdc_irq_thread, IRQF_ONESHOT,
> @@ -1268,16 +1278,6 @@ int ltdc_load(struct drm_device *ddev)
>   		}
>   	}
>   
> -
> -	ret = ltdc_get_caps(ddev);
> -	if (ret) {
> -		DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> -			  ldev->caps.hw_version);
> -		goto err;
> -	}
> -
> -	DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> -
>   	/* Add endpoints panels or bridges if any */
>   	for (i = 0; i < MAX_ENDPOINTS; i++) {
>   		if (panel[i]) {
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index a1ad0ae..310e87f 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -19,6 +19,7 @@ struct ltdc_caps {
>   	const u32 *pix_fmt_hw;	/* supported pixel formats */
>   	bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
>   	int pad_max_freq_hz;	/* max frequency supported by pad */
> +	int nb_irq;		/* number of hardware interrupts */
>   };
>   
>   #define LTDC_MAX_LAYER	4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add number of interrupts
  2020-01-23  9:48 ` Philippe CORNU
@ 2020-02-04 10:57   ` Benjamin Gaignard
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Gaignard @ 2020-02-04 10:57 UTC (permalink / raw)
  To: Philippe CORNU
  Cc: Yannick FERTRE, Benjamin GAIGNARD, David Airlie, Daniel Vetter,
	Maxime Coquelin, Alexandre TORGUE, dri-devel, linux-stm32,
	linux-arm-kernel, linux-kernel

Le jeu. 23 janv. 2020 à 10:49, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu <philippe.cornu@st.com>
>
> Philippe :-)
>
> On 1/21/20 11:13 AM, Yannick Fertre wrote:
> > The number of interrupts depends on the ltdc version.
> > Don't try to get interrupt which not exist, avoiding
> > kernel warning messages.

Applied on drm-misc-next.

Thanks,
Benjamin

> >
> > Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 30 +++++++++++++++---------------
> >   drivers/gpu/drm/stm/ltdc.h |  1 +
> >   2 files changed, 16 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index c2815e8..58092b0 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -1146,12 +1146,14 @@ static int ltdc_get_caps(struct drm_device *ddev)
> >               ldev->caps.pad_max_freq_hz = 90000000;
> >               if (ldev->caps.hw_version == HWVER_10200)
> >                       ldev->caps.pad_max_freq_hz = 65000000;
> > +             ldev->caps.nb_irq = 2;
> >               break;
> >       case HWVER_20101:
> >               ldev->caps.reg_ofs = REG_OFS_4;
> >               ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1;
> >               ldev->caps.non_alpha_only_l1 = false;
> >               ldev->caps.pad_max_freq_hz = 150000000;
> > +             ldev->caps.nb_irq = 4;
> >               break;
> >       default:
> >               return -ENODEV;
> > @@ -1251,13 +1253,21 @@ int ltdc_load(struct drm_device *ddev)
> >       reg_clear(ldev->regs, LTDC_IER,
> >                 IER_LIE | IER_RRIE | IER_FUIE | IER_TERRIE);
> >
> > -     for (i = 0; i < MAX_IRQ; i++) {
> > +     ret = ltdc_get_caps(ddev);
> > +     if (ret) {
> > +             DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> > +                       ldev->caps.hw_version);
> > +             goto err;
> > +     }
> > +
> > +     DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> > +
> > +     for (i = 0; i < ldev->caps.nb_irq; i++) {
> >               irq = platform_get_irq(pdev, i);
> > -             if (irq == -EPROBE_DEFER)
> > +             if (irq < 0) {
> > +                     ret = irq;
> >                       goto err;
> > -
> > -             if (irq < 0)
> > -                     continue;
> > +             }
> >
> >               ret = devm_request_threaded_irq(dev, irq, ltdc_irq,
> >                                               ltdc_irq_thread, IRQF_ONESHOT,
> > @@ -1268,16 +1278,6 @@ int ltdc_load(struct drm_device *ddev)
> >               }
> >       }
> >
> > -
> > -     ret = ltdc_get_caps(ddev);
> > -     if (ret) {
> > -             DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> > -                       ldev->caps.hw_version);
> > -             goto err;
> > -     }
> > -
> > -     DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> > -
> >       /* Add endpoints panels or bridges if any */
> >       for (i = 0; i < MAX_ENDPOINTS; i++) {
> >               if (panel[i]) {
> > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> > index a1ad0ae..310e87f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.h
> > +++ b/drivers/gpu/drm/stm/ltdc.h
> > @@ -19,6 +19,7 @@ struct ltdc_caps {
> >       const u32 *pix_fmt_hw;  /* supported pixel formats */
> >       bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
> >       int pad_max_freq_hz;    /* max frequency supported by pad */
> > +     int nb_irq;             /* number of hardware interrupts */
> >   };
> >
> >   #define LTDC_MAX_LAYER      4
> >
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-04 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 10:13 [PATCH] drm/stm: ltdc: add number of interrupts Yannick Fertre
2020-01-23  9:48 ` Philippe CORNU
2020-02-04 10:57   ` Benjamin Gaignard

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).