diff mbox series

[v15,1/7] drm/ingenic: Fix support for JZ4780 HDMI output

Message ID 9d3a2000d2bb014f1afb0613537bdc523202135d.1644681054.git.hns@goldelico.com (mailing list archive)
State New, archived
Headers show
Series MIPS: JZ4780 and CI20 HDMI | expand

Commit Message

H. Nikolaus Schaller Feb. 12, 2022, 3:50 p.m. UTC
From: Paul Boddie <paul@boddie.org.uk>

We have to make sure that
- JZ_LCD_OSDC_ALPHAEN is set
- plane f0 is disabled and not seen from user-space

Tested on MIPS Creator CI20 board.

Signed-off-by: Paul Boddie <paul@boddie.org.uk>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Paul Cercueil Feb. 14, 2022, 10:13 a.m. UTC | #1
Hi,

Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> From: Paul Boddie <paul@boddie.org.uk>
> 
> We have to make sure that
> - JZ_LCD_OSDC_ALPHAEN is set
> - plane f0 is disabled and not seen from user-space

Actually it will still be seen from user-space, but it won't be 
possible to use it. So before applying I'll change this to:
"plane f0 is disabled as it's not working yet"

If that's OK with you.

Cheers,
-Paul

> 
> Tested on MIPS Creator CI20 board.
> 
> Signed-off-by: Paul Boddie <paul@boddie.org.uk>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 7f10d6eed549d..dcf44cb00821f 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -65,8 +65,10 @@ struct ingenic_dma_hwdescs {
>  struct jz_soc_info {
>  	bool needs_dev_clk;
>  	bool has_osd;
> +	bool has_alpha;
>  	bool map_noncoherent;
>  	bool use_extended_hwdesc;
> +	bool plane_f0_not_working;
>  	unsigned int max_width, max_height;
>  	const u32 *formats_f0, *formats_f1;
>  	unsigned int num_formats_f0, num_formats_f1;
> @@ -453,7 +455,7 @@ static int ingenic_drm_plane_atomic_check(struct 
> drm_plane *plane,
>  	if (!crtc)
>  		return 0;
> 
> -	if (plane == &priv->f0)
> +	if (priv->soc_info->plane_f0_not_working && plane == &priv->f0)
>  		return -EINVAL;
> 
>  	crtc_state = drm_atomic_get_existing_crtc_state(state,
> @@ -1055,6 +1057,7 @@ static int ingenic_drm_bind(struct device *dev, 
> bool has_components)
>  	long parent_rate;
>  	unsigned int i, clone_mask = 0;
>  	int ret, irq;
> +	u32 osdc = 0;
> 
>  	soc_info = of_device_get_match_data(dev);
>  	if (!soc_info) {
> @@ -1312,7 +1315,10 @@ static int ingenic_drm_bind(struct device 
> *dev, bool has_components)
> 
>  	/* Enable OSD if available */
>  	if (soc_info->has_osd)
> -		regmap_write(priv->map, JZ_REG_LCD_OSDC, JZ_LCD_OSDC_OSDEN);
> +		osdc |= JZ_LCD_OSDC_OSDEN;
> +	if (soc_info->has_alpha)
> +		osdc |= JZ_LCD_OSDC_ALPHAEN;
> +	regmap_write(priv->map, JZ_REG_LCD_OSDC, osdc);
> 
>  	mutex_init(&priv->clk_mutex);
>  	priv->clock_nb.notifier_call = ingenic_drm_update_pixclk;
> @@ -1511,7 +1517,9 @@ static const struct jz_soc_info jz4770_soc_info 
> = {
>  static const struct jz_soc_info jz4780_soc_info = {
>  	.needs_dev_clk = true,
>  	.has_osd = true,
> +	.has_alpha = true,
>  	.use_extended_hwdesc = true,
> +	.plane_f0_not_working = true,	/* REVISIT */
>  	.max_width = 4096,
>  	.max_height = 2048,
>  	.formats_f1 = jz4770_formats_f1,
> --
> 2.33.0
>
H. Nikolaus Schaller Feb. 14, 2022, 10:19 a.m. UTC | #2
Hi Paul,


> Am 14.02.2022 um 11:13 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi,
> 
> Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> From: Paul Boddie <paul@boddie.org.uk>
>> We have to make sure that
>> - JZ_LCD_OSDC_ALPHAEN is set
>> - plane f0 is disabled and not seen from user-space
> 
> Actually it will still be seen from user-space, but it won't be possible to use it. So before applying I'll change this to:
> "plane f0 is disabled as it's not working yet"
> 
> If that's OK with you.

Yes. You understand much better than me the implications...

BR and thanks,
Nikolaus
Paul Cercueil Feb. 14, 2022, 12:29 p.m. UTC | #3
Hi,

Le lun., févr. 14 2022 at 11:19:40 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> Hi Paul,
> 
> 
>>  Am 14.02.2022 um 11:13 schrieb Paul Cercueil <paul@crapouillou.net>:
>> 
>>  Hi,
>> 
>>  Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller 
>> <hns@goldelico.com> a écrit :
>>>  From: Paul Boddie <paul@boddie.org.uk>
>>>  We have to make sure that
>>>  - JZ_LCD_OSDC_ALPHAEN is set
>>>  - plane f0 is disabled and not seen from user-space
>> 
>>  Actually it will still be seen from user-space, but it won't be 
>> possible to use it. So before applying I'll change this to:
>>  "plane f0 is disabled as it's not working yet"
>> 
>>  If that's OK with you.
> 
> Yes. You understand much better than me the implications...

I reworded it to "plane f0 is disabled as it's not working yet", added 
a Fixes: tag, and pushed this patch to drm-misc-next.

Cheers,
-Paul
H. Nikolaus Schaller Feb. 14, 2022, 12:33 p.m. UTC | #4
Hi Paul,

> Am 14.02.2022 um 13:29 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi,
> 
> Le lun., févr. 14 2022 at 11:19:40 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> Hi Paul,
>>> Am 14.02.2022 um 11:13 schrieb Paul Cercueil <paul@crapouillou.net>:
>>> Hi,
>>> Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>>>> From: Paul Boddie <paul@boddie.org.uk>
>>>> We have to make sure that
>>>> - JZ_LCD_OSDC_ALPHAEN is set
>>>> - plane f0 is disabled and not seen from user-space
>>> Actually it will still be seen from user-space, but it won't be possible to use it. So before applying I'll change this to:
>>> "plane f0 is disabled as it's not working yet"
>>> If that's OK with you.
>> Yes. You understand much better than me the implications...
> 
> I reworded it to "plane f0 is disabled as it's not working yet", added a Fixes: tag, and pushed this patch to drm-misc-next.

great and thanks.
So I drop it from v16.

BR and thanks,
Nikolaus
Paul Cercueil Feb. 14, 2022, 12:36 p.m. UTC | #5
Hi,

Le lun., févr. 14 2022 at 13:33:25 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> Hi Paul,
> 
>>  Am 14.02.2022 um 13:29 schrieb Paul Cercueil <paul@crapouillou.net>:
>> 
>>  Hi,
>> 
>>  Le lun., févr. 14 2022 at 11:19:40 +0100, H. Nikolaus Schaller 
>> <hns@goldelico.com> a écrit :
>>>  Hi Paul,
>>>>  Am 14.02.2022 um 11:13 schrieb Paul Cercueil 
>>>> <paul@crapouillou.net>:
>>>>  Hi,
>>>>  Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller 
>>>> <hns@goldelico.com> a écrit :
>>>>>  From: Paul Boddie <paul@boddie.org.uk>
>>>>>  We have to make sure that
>>>>>  - JZ_LCD_OSDC_ALPHAEN is set
>>>>>  - plane f0 is disabled and not seen from user-space
>>>>  Actually it will still be seen from user-space, but it won't be 
>>>> possible to use it. So before applying I'll change this to:
>>>>  "plane f0 is disabled as it's not working yet"
>>>>  If that's OK with you.
>>>  Yes. You understand much better than me the implications...
>> 
>>  I reworded it to "plane f0 is disabled as it's not working yet", 
>> added a Fixes: tag, and pushed this patch to drm-misc-next.
> 
> great and thanks.
> So I drop it from v16.

Neil told me he'd review patch [4/7] this week so maybe hold off v16 
for a few days.

Cheers,
-Paul
H. Nikolaus Schaller Feb. 14, 2022, 1:10 p.m. UTC | #6
> Am 14.02.2022 um 13:36 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi,
> 
> Le lun., févr. 14 2022 at 13:33:25 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> Hi Paul,
>>> Am 14.02.2022 um 13:29 schrieb Paul Cercueil <paul@crapouillou.net>:
>>> Hi,
>>> Le lun., févr. 14 2022 at 11:19:40 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>>>> Hi Paul,
>>>>> Am 14.02.2022 um 11:13 schrieb Paul Cercueil <paul@crapouillou.net>:
>>>>> Hi,
>>>>> Le sam., févr. 12 2022 at 16:50:49 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>>>>>> From: Paul Boddie <paul@boddie.org.uk>
>>>>>> We have to make sure that
>>>>>> - JZ_LCD_OSDC_ALPHAEN is set
>>>>>> - plane f0 is disabled and not seen from user-space
>>>>> Actually it will still be seen from user-space, but it won't be possible to use it. So before applying I'll change this to:
>>>>> "plane f0 is disabled as it's not working yet"
>>>>> If that's OK with you.
>>>> Yes. You understand much better than me the implications...
>>> I reworded it to "plane f0 is disabled as it's not working yet", added a Fixes: tag, and pushed this patch to drm-misc-next.
>> great and thanks.
>> So I drop it from v16.
> 
> Neil told me he'd review patch [4/7] this week so maybe hold off v16 for a few days.

Ok.

BR and thanks,
Nikolaus
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 7f10d6eed549d..dcf44cb00821f 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -65,8 +65,10 @@  struct ingenic_dma_hwdescs {
 struct jz_soc_info {
 	bool needs_dev_clk;
 	bool has_osd;
+	bool has_alpha;
 	bool map_noncoherent;
 	bool use_extended_hwdesc;
+	bool plane_f0_not_working;
 	unsigned int max_width, max_height;
 	const u32 *formats_f0, *formats_f1;
 	unsigned int num_formats_f0, num_formats_f1;
@@ -453,7 +455,7 @@  static int ingenic_drm_plane_atomic_check(struct drm_plane *plane,
 	if (!crtc)
 		return 0;
 
-	if (plane == &priv->f0)
+	if (priv->soc_info->plane_f0_not_working && plane == &priv->f0)
 		return -EINVAL;
 
 	crtc_state = drm_atomic_get_existing_crtc_state(state,
@@ -1055,6 +1057,7 @@  static int ingenic_drm_bind(struct device *dev, bool has_components)
 	long parent_rate;
 	unsigned int i, clone_mask = 0;
 	int ret, irq;
+	u32 osdc = 0;
 
 	soc_info = of_device_get_match_data(dev);
 	if (!soc_info) {
@@ -1312,7 +1315,10 @@  static int ingenic_drm_bind(struct device *dev, bool has_components)
 
 	/* Enable OSD if available */
 	if (soc_info->has_osd)
-		regmap_write(priv->map, JZ_REG_LCD_OSDC, JZ_LCD_OSDC_OSDEN);
+		osdc |= JZ_LCD_OSDC_OSDEN;
+	if (soc_info->has_alpha)
+		osdc |= JZ_LCD_OSDC_ALPHAEN;
+	regmap_write(priv->map, JZ_REG_LCD_OSDC, osdc);
 
 	mutex_init(&priv->clk_mutex);
 	priv->clock_nb.notifier_call = ingenic_drm_update_pixclk;
@@ -1511,7 +1517,9 @@  static const struct jz_soc_info jz4770_soc_info = {
 static const struct jz_soc_info jz4780_soc_info = {
 	.needs_dev_clk = true,
 	.has_osd = true,
+	.has_alpha = true,
 	.use_extended_hwdesc = true,
+	.plane_f0_not_working = true,	/* REVISIT */
 	.max_width = 4096,
 	.max_height = 2048,
 	.formats_f1 = jz4770_formats_f1,