diff mbox

[v3,1/5] drm/fsl-dcu: enable TCON bypass mode by default

Message ID 20161017213321.8074-2-stefan@agner.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Agner Oct. 17, 2016, 9:33 p.m. UTC
Do not use encoder disable/enable callbacks to control bypass
mode as this seems to mess with the signals not liked by
displays. This also makes more sense since the encoder is
already defined to be parallel RGB/LVDS at creation time.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c |  2 ++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 39 ++++---------------------------
 2 files changed, 7 insertions(+), 34 deletions(-)

Comments

Meng Yi Oct. 19, 2016, 9:35 a.m. UTC | #1
> 
> Do not use encoder disable/enable callbacks to control bypass mode as this
> seems to mess with the signals not liked by displays. This also makes more
> sense since the encoder is already defined to be parallel RGB/LVDS at creation
> time.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c |  2 ++  drivers/gpu/drm/fsl-
> dcu/fsl_dcu_drm_rgb.c | 39 ++++---------------------------
>  2 files changed, 7 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-
> dcu/fsl_dcu_drm_drv.c
> index 0884c45..3897f56 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -273,6 +273,8 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
>  		goto disable_dcu_clk;
>  	}
> 
> +	if (fsl_dev->tcon)
> +		fsl_tcon_bypass_enable(fsl_dev->tcon);
>  	fsl_dcu_drm_init_planes(fsl_dev->drm);
>  	drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-
> dcu/fsl_dcu_drm_rgb.c
> index 26edcc8..e1dd75b 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -20,38 +20,6 @@
>  #include "fsl_dcu_drm_drv.h"
>  #include "fsl_tcon.h"
> 
> -static int
> -fsl_dcu_drm_encoder_atomic_check(struct drm_encoder *encoder,
> -				 struct drm_crtc_state *crtc_state,
> -				 struct drm_connector_state *conn_state)
> -{
> -	return 0;
> -}
> -
> -static void fsl_dcu_drm_encoder_disable(struct drm_encoder *encoder) -{
> -	struct drm_device *dev = encoder->dev;
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
> -	if (fsl_dev->tcon)
> -		fsl_tcon_bypass_disable(fsl_dev->tcon);
> -}
> -
> -static void fsl_dcu_drm_encoder_enable(struct drm_encoder *encoder) -{
> -	struct drm_device *dev = encoder->dev;
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
> -	if (fsl_dev->tcon)
> -		fsl_tcon_bypass_enable(fsl_dev->tcon);
> -}
> -
> -static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
> -	.atomic_check = fsl_dcu_drm_encoder_atomic_check,
> -	.disable = fsl_dcu_drm_encoder_disable,
> -	.enable = fsl_dcu_drm_encoder_enable,
> -};
> -
>  static void fsl_dcu_drm_encoder_destroy(struct drm_encoder *encoder)  {
>  	drm_encoder_cleanup(encoder);
> @@ -68,13 +36,16 @@ int fsl_dcu_drm_encoder_create(struct
> fsl_dcu_drm_device *fsl_dev,
>  	int ret;
> 
>  	encoder->possible_crtcs = 1;
> +
> +	/* Use bypass mode for parallel RGB/LVDS encoder */
> +	if (fsl_dev->tcon)
> +		fsl_tcon_bypass_enable(fsl_dev->tcon);
> +
>  	ret = drm_encoder_init(fsl_dev->drm, encoder, &encoder_funcs,
>  			       DRM_MODE_ENCODER_LVDS, NULL);
>  	if (ret < 0)
>  		return ret;
> 
> -	drm_encoder_helper_add(encoder, &encoder_helper_funcs);
> -
>  	return 0;
>  }
> 
> --
> 2.10.0

Tested-By: Meng Yi <meng.yi@nxp.com>

Tested those 5 patches on LS1021a-twr, and everything is fine.

Meng
Stefan Agner Oct. 20, 2016, 12:01 a.m. UTC | #2
On 2016-10-19 02:35, Meng Yi wrote:
>>
>> Do not use encoder disable/enable callbacks to control bypass mode as this
>> seems to mess with the signals not liked by displays. This also makes more
>> sense since the encoder is already defined to be parallel RGB/LVDS at creation
>> time.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c |  2 ++  drivers/gpu/drm/fsl-
>> dcu/fsl_dcu_drm_rgb.c | 39 ++++---------------------------
>>  2 files changed, 7 insertions(+), 34 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-
>> dcu/fsl_dcu_drm_drv.c
>> index 0884c45..3897f56 100644
>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> @@ -273,6 +273,8 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
>>  		goto disable_dcu_clk;
>>  	}
>>
>> +	if (fsl_dev->tcon)
>> +		fsl_tcon_bypass_enable(fsl_dev->tcon);
>>  	fsl_dcu_drm_init_planes(fsl_dev->drm);
>>  	drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
>>
>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-
>> dcu/fsl_dcu_drm_rgb.c
>> index 26edcc8..e1dd75b 100644
>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
>> @@ -20,38 +20,6 @@
>>  #include "fsl_dcu_drm_drv.h"
>>  #include "fsl_tcon.h"
>>
>> -static int
>> -fsl_dcu_drm_encoder_atomic_check(struct drm_encoder *encoder,
>> -				 struct drm_crtc_state *crtc_state,
>> -				 struct drm_connector_state *conn_state)
>> -{
>> -	return 0;
>> -}
>> -
>> -static void fsl_dcu_drm_encoder_disable(struct drm_encoder *encoder) -{
>> -	struct drm_device *dev = encoder->dev;
>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>> -
>> -	if (fsl_dev->tcon)
>> -		fsl_tcon_bypass_disable(fsl_dev->tcon);
>> -}
>> -
>> -static void fsl_dcu_drm_encoder_enable(struct drm_encoder *encoder) -{
>> -	struct drm_device *dev = encoder->dev;
>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>> -
>> -	if (fsl_dev->tcon)
>> -		fsl_tcon_bypass_enable(fsl_dev->tcon);
>> -}
>> -
>> -static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
>> -	.atomic_check = fsl_dcu_drm_encoder_atomic_check,
>> -	.disable = fsl_dcu_drm_encoder_disable,
>> -	.enable = fsl_dcu_drm_encoder_enable,
>> -};
>> -
>>  static void fsl_dcu_drm_encoder_destroy(struct drm_encoder *encoder)  {
>>  	drm_encoder_cleanup(encoder);
>> @@ -68,13 +36,16 @@ int fsl_dcu_drm_encoder_create(struct
>> fsl_dcu_drm_device *fsl_dev,
>>  	int ret;
>>
>>  	encoder->possible_crtcs = 1;
>> +
>> +	/* Use bypass mode for parallel RGB/LVDS encoder */
>> +	if (fsl_dev->tcon)
>> +		fsl_tcon_bypass_enable(fsl_dev->tcon);
>> +
>>  	ret = drm_encoder_init(fsl_dev->drm, encoder, &encoder_funcs,
>>  			       DRM_MODE_ENCODER_LVDS, NULL);
>>  	if (ret < 0)
>>  		return ret;
>>
>> -	drm_encoder_helper_add(encoder, &encoder_helper_funcs);
>> -
>>  	return 0;
>>  }
>>
>> --
>> 2.10.0
> 
> Tested-By: Meng Yi <meng.yi@nxp.com>
> 
> Tested those 5 patches on LS1021a-twr, and everything is fine.

Thanks.

Applied 1~4.

--
Stefan
diff mbox

Patch

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 0884c45..3897f56 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -273,6 +273,8 @@  static int fsl_dcu_drm_pm_resume(struct device *dev)
 		goto disable_dcu_clk;
 	}
 
+	if (fsl_dev->tcon)
+		fsl_tcon_bypass_enable(fsl_dev->tcon);
 	fsl_dcu_drm_init_planes(fsl_dev->drm);
 	drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
 
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index 26edcc8..e1dd75b 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -20,38 +20,6 @@ 
 #include "fsl_dcu_drm_drv.h"
 #include "fsl_tcon.h"
 
-static int
-fsl_dcu_drm_encoder_atomic_check(struct drm_encoder *encoder,
-				 struct drm_crtc_state *crtc_state,
-				 struct drm_connector_state *conn_state)
-{
-	return 0;
-}
-
-static void fsl_dcu_drm_encoder_disable(struct drm_encoder *encoder)
-{
-	struct drm_device *dev = encoder->dev;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
-	if (fsl_dev->tcon)
-		fsl_tcon_bypass_disable(fsl_dev->tcon);
-}
-
-static void fsl_dcu_drm_encoder_enable(struct drm_encoder *encoder)
-{
-	struct drm_device *dev = encoder->dev;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
-	if (fsl_dev->tcon)
-		fsl_tcon_bypass_enable(fsl_dev->tcon);
-}
-
-static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
-	.atomic_check = fsl_dcu_drm_encoder_atomic_check,
-	.disable = fsl_dcu_drm_encoder_disable,
-	.enable = fsl_dcu_drm_encoder_enable,
-};
-
 static void fsl_dcu_drm_encoder_destroy(struct drm_encoder *encoder)
 {
 	drm_encoder_cleanup(encoder);
@@ -68,13 +36,16 @@  int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev,
 	int ret;
 
 	encoder->possible_crtcs = 1;
+
+	/* Use bypass mode for parallel RGB/LVDS encoder */
+	if (fsl_dev->tcon)
+		fsl_tcon_bypass_enable(fsl_dev->tcon);
+
 	ret = drm_encoder_init(fsl_dev->drm, encoder, &encoder_funcs,
 			       DRM_MODE_ENCODER_LVDS, NULL);
 	if (ret < 0)
 		return ret;
 
-	drm_encoder_helper_add(encoder, &encoder_helper_funcs);
-
 	return 0;
 }