aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2013-08-21 10:22:03 -0400
committerInki Dae <inki.dae@samsung.com>2013-09-05 00:43:44 -0400
commit562ad9f4a3e3870f4e3f00aac8277c49032bd6eb (patch)
treeb00bf4f434ad3cf270a37d638147b7a57410a370
parentb063f4af849e5f3a8a422dc10138814f58c73641 (diff)
drm/exynos: fimd: move platform data parsing to separate function
The patch moves platfrom_data and device tree parsing to separate function. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 6afcaf164549..130dea50c3e1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -122,7 +122,7 @@ struct fimd_context {
122 wait_queue_head_t wait_vsync_queue; 122 wait_queue_head_t wait_vsync_queue;
123 atomic_t wait_vsync_event; 123 atomic_t wait_vsync_event;
124 124
125 struct exynos_drm_panel_info *panel; 125 struct exynos_drm_panel_info panel;
126 struct fimd_driver_data *driver_data; 126 struct fimd_driver_data *driver_data;
127}; 127};
128 128
@@ -164,7 +164,7 @@ static void *fimd_get_panel(struct device *dev)
164{ 164{
165 struct fimd_context *ctx = get_fimd_context(dev); 165 struct fimd_context *ctx = get_fimd_context(dev);
166 166
167 return ctx->panel; 167 return &ctx->panel;
168} 168}
169 169
170static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) 170static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode)
@@ -244,7 +244,7 @@ static void fimd_apply(struct device *subdrv_dev)
244static void fimd_commit(struct device *dev) 244static void fimd_commit(struct device *dev)
245{ 245{
246 struct fimd_context *ctx = get_fimd_context(dev); 246 struct fimd_context *ctx = get_fimd_context(dev);
247 struct exynos_drm_panel_info *panel = ctx->panel; 247 struct exynos_drm_panel_info *panel = &ctx->panel;
248 struct videomode *vm = &panel->vm; 248 struct videomode *vm = &panel->vm;
249 struct fimd_driver_data *driver_data; 249 struct fimd_driver_data *driver_data;
250 u32 val; 250 u32 val;
@@ -755,7 +755,7 @@ static void fimd_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
755 755
756static int fimd_configure_clocks(struct fimd_context *ctx, struct device *dev) 756static int fimd_configure_clocks(struct fimd_context *ctx, struct device *dev)
757{ 757{
758 struct videomode *vm = &ctx->panel->vm; 758 struct videomode *vm = &ctx->panel.vm;
759 unsigned long clk; 759 unsigned long clk;
760 760
761 ctx->bus_clk = devm_clk_get(dev, "fimd"); 761 ctx->bus_clk = devm_clk_get(dev, "fimd");
@@ -892,24 +892,13 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)
892 return 0; 892 return 0;
893} 893}
894 894
895static int fimd_probe(struct platform_device *pdev) 895static int fimd_get_platform_data(struct fimd_context *ctx, struct device *dev)
896{ 896{
897 struct device *dev = &pdev->dev;
898 struct fimd_context *ctx;
899 struct exynos_drm_subdrv *subdrv;
900 struct exynos_drm_fimd_pdata *pdata;
901 struct exynos_drm_panel_info *panel;
902 struct resource *res;
903 int win;
904 int ret = -EINVAL;
905
906 if (dev->of_node) { 897 if (dev->of_node) {
907 struct videomode *vm; 898 struct videomode *vm;
908 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 899 int ret;
909 if (!pdata)
910 return -ENOMEM;
911 900
912 vm = &pdata->panel.vm; 901 vm = &ctx->panel.vm;
913 ret = of_get_videomode(dev->of_node, vm, OF_USE_NATIVE_MODE); 902 ret = of_get_videomode(dev->of_node, vm, OF_USE_NATIVE_MODE);
914 if (ret) { 903 if (ret) {
915 DRM_ERROR("failed: of_get_videomode() : %d\n", ret); 904 DRM_ERROR("failed: of_get_videomode() : %d\n", ret);
@@ -917,31 +906,45 @@ static int fimd_probe(struct platform_device *pdev)
917 } 906 }
918 907
919 if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW) 908 if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW)
920 pdata->vidcon1 |= VIDCON1_INV_VSYNC; 909 ctx->vidcon1 |= VIDCON1_INV_VSYNC;
921 if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW) 910 if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW)
922 pdata->vidcon1 |= VIDCON1_INV_HSYNC; 911 ctx->vidcon1 |= VIDCON1_INV_HSYNC;
923 if (vm->flags & DISPLAY_FLAGS_DE_LOW) 912 if (vm->flags & DISPLAY_FLAGS_DE_LOW)
924 pdata->vidcon1 |= VIDCON1_INV_VDEN; 913 ctx->vidcon1 |= VIDCON1_INV_VDEN;
925 if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) 914 if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
926 pdata->vidcon1 |= VIDCON1_INV_VCLK; 915 ctx->vidcon1 |= VIDCON1_INV_VCLK;
927 } else { 916 } else {
928 pdata = dev->platform_data; 917 struct exynos_drm_fimd_pdata *pdata = dev->platform_data;
929 if (!pdata) { 918 if (!pdata) {
930 DRM_ERROR("no platform data specified\n"); 919 DRM_ERROR("no platform data specified\n");
931 return -EINVAL; 920 return -EINVAL;
932 } 921 }
922 ctx->vidcon0 = pdata->vidcon0;
923 ctx->vidcon1 = pdata->vidcon1;
924 ctx->default_win = pdata->default_win;
925 ctx->panel = pdata->panel;
933 } 926 }
934 927
935 panel = &pdata->panel; 928 return 0;
936 if (!panel) { 929}
937 dev_err(dev, "panel is null.\n"); 930
938 return -EINVAL; 931static int fimd_probe(struct platform_device *pdev)
939 } 932{
933 struct device *dev = &pdev->dev;
934 struct fimd_context *ctx;
935 struct exynos_drm_subdrv *subdrv;
936 struct resource *res;
937 int win;
938 int ret = -EINVAL;
940 939
941 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 940 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
942 if (!ctx) 941 if (!ctx)
943 return -ENOMEM; 942 return -ENOMEM;
944 943
944 ret = fimd_get_platform_data(ctx, dev);
945 if (ret)
946 return ret;
947
945 ret = fimd_configure_clocks(ctx, dev); 948 ret = fimd_configure_clocks(ctx, dev);
946 if (ret) 949 if (ret)
947 return ret; 950 return ret;
@@ -968,10 +971,6 @@ static int fimd_probe(struct platform_device *pdev)
968 } 971 }
969 972
970 ctx->driver_data = drm_fimd_get_driver_data(pdev); 973 ctx->driver_data = drm_fimd_get_driver_data(pdev);
971 ctx->vidcon0 = pdata->vidcon0;
972 ctx->vidcon1 = pdata->vidcon1;
973 ctx->default_win = pdata->default_win;
974 ctx->panel = panel;
975 DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); 974 DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue);
976 atomic_set(&ctx->wait_vsync_event, 0); 975 atomic_set(&ctx->wait_vsync_event, 0);
977 976