diff mbox

[v4,1/3] drm/exynos: mic: Add mode_set callback function

Message ID 1483513115-3068-2-git-send-email-hoegeun.kwon@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hoegeun Kwon Jan. 4, 2017, 6:58 a.m. UTC
Before applying the patch, used the of_get_videomode function to
parse the display-timings in the panel which is the child driver
of dsi in the devicetree. this is wrong. So removed the
of_get_videomode and fixed to get videomode struct through
mode_set callback function.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_mic.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

Comments

Inki Dae Jan. 4, 2017, 7:29 a.m. UTC | #1
2017년 01월 04일 15:58에 Hoegeun Kwon 이(가) 쓴 글:
> Before applying the patch, used the of_get_videomode function to
> parse the display-timings in the panel which is the child driver
> of dsi in the devicetree. this is wrong. So removed the
> of_get_videomode and fixed to get videomode struct through
> mode_set callback function.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_mic.c | 33 ++++++++++++++++++++++-----------
>  1 file changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> index a0def0b..9a50ceb 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> @@ -286,13 +286,6 @@ static int parse_dt(struct exynos_mic *mic)
>  			}
>  			nodes[j++] = remote_node;
>  
> -			ret = of_get_videomode(remote_node,
> -							&mic->vm, 0);
> -			if (ret) {
> -				DRM_ERROR("mic: failed to get videomode");
> -				goto exit;
> -			}
> -
>  			break;
>  		default:
>  			DRM_ERROR("mic: Unknown endpoint from MIC");
> @@ -329,6 +322,27 @@ static void mic_post_disable(struct drm_bridge *bridge)
>  	mutex_unlock(&mic_mutex);
>  }
>  
> +static void mic_mode_set(struct drm_bridge *bridge,
> +			struct drm_display_mode *mode,
> +			struct drm_display_mode *adjusted_mode)
> +{
> +	struct exynos_mic *mic = bridge->driver_private;
> +
> +	mutex_lock(&mic_mutex);
> +	if (mic->enabled)
> +		goto already_enabled;

mode setting should be performed every time mode_set callback is called so remove above two lines.

> +
> +	drm_display_mode_to_videomode(mode, &mic->vm);
> +
> +	if (!mic->i80_mode)
> +		mic_set_porch_timing(mic);
> +	mic_set_img_size(mic);
> +	mic_set_output_timing(mic);
> +
> +already_enabled:

So this label is unnecessary.

> +	mutex_unlock(&mic_mutex);
> +}
> +
>  static void mic_pre_enable(struct drm_bridge *bridge)
>  {
>  	struct exynos_mic *mic = bridge->driver_private;
> @@ -355,10 +369,6 @@ static void mic_pre_enable(struct drm_bridge *bridge)
>  		goto turn_off_clks;
>  	}
>  
> -	if (!mic->i80_mode)
> -		mic_set_porch_timing(mic);
> -	mic_set_img_size(mic);
> -	mic_set_output_timing(mic);
>  	mic_set_reg_on(mic, 1);
>  	mic->enabled = 1;
>  	mutex_unlock(&mic_mutex);
> @@ -377,6 +387,7 @@ static void mic_enable(struct drm_bridge *bridge) { }
>  static const struct drm_bridge_funcs mic_bridge_funcs = {
>  	.disable = mic_disable,
>  	.post_disable = mic_post_disable,
> +	.mode_set = mic_mode_set,
>  	.pre_enable = mic_pre_enable,
>  	.enable = mic_enable,
>  };
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index a0def0b..9a50ceb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -286,13 +286,6 @@  static int parse_dt(struct exynos_mic *mic)
 			}
 			nodes[j++] = remote_node;
 
-			ret = of_get_videomode(remote_node,
-							&mic->vm, 0);
-			if (ret) {
-				DRM_ERROR("mic: failed to get videomode");
-				goto exit;
-			}
-
 			break;
 		default:
 			DRM_ERROR("mic: Unknown endpoint from MIC");
@@ -329,6 +322,27 @@  static void mic_post_disable(struct drm_bridge *bridge)
 	mutex_unlock(&mic_mutex);
 }
 
+static void mic_mode_set(struct drm_bridge *bridge,
+			struct drm_display_mode *mode,
+			struct drm_display_mode *adjusted_mode)
+{
+	struct exynos_mic *mic = bridge->driver_private;
+
+	mutex_lock(&mic_mutex);
+	if (mic->enabled)
+		goto already_enabled;
+
+	drm_display_mode_to_videomode(mode, &mic->vm);
+
+	if (!mic->i80_mode)
+		mic_set_porch_timing(mic);
+	mic_set_img_size(mic);
+	mic_set_output_timing(mic);
+
+already_enabled:
+	mutex_unlock(&mic_mutex);
+}
+
 static void mic_pre_enable(struct drm_bridge *bridge)
 {
 	struct exynos_mic *mic = bridge->driver_private;
@@ -355,10 +369,6 @@  static void mic_pre_enable(struct drm_bridge *bridge)
 		goto turn_off_clks;
 	}
 
-	if (!mic->i80_mode)
-		mic_set_porch_timing(mic);
-	mic_set_img_size(mic);
-	mic_set_output_timing(mic);
 	mic_set_reg_on(mic, 1);
 	mic->enabled = 1;
 	mutex_unlock(&mic_mutex);
@@ -377,6 +387,7 @@  static void mic_enable(struct drm_bridge *bridge) { }
 static const struct drm_bridge_funcs mic_bridge_funcs = {
 	.disable = mic_disable,
 	.post_disable = mic_post_disable,
+	.mode_set = mic_mode_set,
 	.pre_enable = mic_pre_enable,
 	.enable = mic_enable,
 };