aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-01-27 02:16:27 -0500
committerDave Airlie <airlied@redhat.com>2012-01-27 02:16:27 -0500
commit24a7eb7954bc22a1d514155d56a3c4cd5e9a6faa (patch)
treea506424edac1363cb2bc339387a2d51e1493b479 /drivers
parent590dfe2f3bbbbeee806ee91bef68ba2a6afc16d2 (diff)
parent373af0c0c539b109ea978e96f217df0fc20aa261 (diff)
Merge branch 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-samsung into drm-fixes
* 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-samsung: drm/exynos: fixed pm feature for fimd module. MAINTAINERS: added maintainer entry for Exynos DRM Driver. drm/exynos: fixed build dependency for DRM_EXYNOS_FIMD drm/exynos: fix build dependency for DRM_EXYNOS_HDMI drm/exynos: use release_mem_region instead of release_resource
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/exynos/Kconfig4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c109
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c8
3 files changed, 65 insertions, 56 deletions
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index f9aaa56eae07..b9e5266c341b 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -13,7 +13,7 @@ config DRM_EXYNOS
13 13
14config DRM_EXYNOS_FIMD 14config DRM_EXYNOS_FIMD
15 tristate "Exynos DRM FIMD" 15 tristate "Exynos DRM FIMD"
16 depends on DRM_EXYNOS 16 depends on DRM_EXYNOS && !FB_S3C
17 default n 17 default n
18 help 18 help
19 Choose this option if you want to use Exynos FIMD for DRM. 19 Choose this option if you want to use Exynos FIMD for DRM.
@@ -21,7 +21,7 @@ config DRM_EXYNOS_FIMD
21 21
22config DRM_EXYNOS_HDMI 22config DRM_EXYNOS_HDMI
23 tristate "Exynos DRM HDMI" 23 tristate "Exynos DRM HDMI"
24 depends on DRM_EXYNOS 24 depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV
25 help 25 help
26 Choose this option if you want to use Exynos HDMI for DRM. 26 Choose this option if you want to use Exynos HDMI for DRM.
27 If M is selected, the module will be called exynos_drm_hdmi 27 If M is selected, the module will be called exynos_drm_hdmi
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ca83139cd309..b6a737d196ae 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -158,7 +158,8 @@ static void fimd_dpms(struct device *subdrv_dev, int mode)
158 case DRM_MODE_DPMS_STANDBY: 158 case DRM_MODE_DPMS_STANDBY:
159 case DRM_MODE_DPMS_SUSPEND: 159 case DRM_MODE_DPMS_SUSPEND:
160 case DRM_MODE_DPMS_OFF: 160 case DRM_MODE_DPMS_OFF:
161 pm_runtime_put_sync(subdrv_dev); 161 if (!ctx->suspended)
162 pm_runtime_put_sync(subdrv_dev);
162 break; 163 break;
163 default: 164 default:
164 DRM_DEBUG_KMS("unspecified mode %d\n", mode); 165 DRM_DEBUG_KMS("unspecified mode %d\n", mode);
@@ -734,6 +735,46 @@ static void fimd_clear_win(struct fimd_context *ctx, int win)
734 writel(val, ctx->regs + SHADOWCON); 735 writel(val, ctx->regs + SHADOWCON);
735} 736}
736 737
738static int fimd_power_on(struct fimd_context *ctx, bool enable)
739{
740 struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
741 struct device *dev = subdrv->manager.dev;
742
743 DRM_DEBUG_KMS("%s\n", __FILE__);
744
745 if (enable != false && enable != true)
746 return -EINVAL;
747
748 if (enable) {
749 int ret;
750
751 ret = clk_enable(ctx->bus_clk);
752 if (ret < 0)
753 return ret;
754
755 ret = clk_enable(ctx->lcd_clk);
756 if (ret < 0) {
757 clk_disable(ctx->bus_clk);
758 return ret;
759 }
760
761 ctx->suspended = false;
762
763 /* if vblank was enabled status, enable it again. */
764 if (test_and_clear_bit(0, &ctx->irq_flags))
765 fimd_enable_vblank(dev);
766
767 fimd_apply(dev);
768 } else {
769 clk_disable(ctx->lcd_clk);
770 clk_disable(ctx->bus_clk);
771
772 ctx->suspended = true;
773 }
774
775 return 0;
776}
777
737static int __devinit fimd_probe(struct platform_device *pdev) 778static int __devinit fimd_probe(struct platform_device *pdev)
738{ 779{
739 struct device *dev = &pdev->dev; 780 struct device *dev = &pdev->dev;
@@ -911,39 +952,30 @@ out:
911#ifdef CONFIG_PM_SLEEP 952#ifdef CONFIG_PM_SLEEP
912static int fimd_suspend(struct device *dev) 953static int fimd_suspend(struct device *dev)
913{ 954{
914 int ret; 955 struct fimd_context *ctx = get_fimd_context(dev);
915 956
916 if (pm_runtime_suspended(dev)) 957 if (pm_runtime_suspended(dev))
917 return 0; 958 return 0;
918 959
919 ret = pm_runtime_suspend(dev); 960 /*
920 if (ret < 0) 961 * do not use pm_runtime_suspend(). if pm_runtime_suspend() is
921 return ret; 962 * called here, an error would be returned by that interface
922 963 * because the usage_count of pm runtime is more than 1.
923 return 0; 964 */
965 return fimd_power_on(ctx, false);
924} 966}
925 967
926static int fimd_resume(struct device *dev) 968static int fimd_resume(struct device *dev)
927{ 969{
928 int ret; 970 struct fimd_context *ctx = get_fimd_context(dev);
929
930 ret = pm_runtime_resume(dev);
931 if (ret < 0) {
932 DRM_ERROR("failed to resume runtime pm.\n");
933 return ret;
934 }
935
936 pm_runtime_disable(dev);
937
938 ret = pm_runtime_set_active(dev);
939 if (ret < 0) {
940 DRM_ERROR("failed to active runtime pm.\n");
941 pm_runtime_enable(dev);
942 pm_runtime_suspend(dev);
943 return ret;
944 }
945 971
946 pm_runtime_enable(dev); 972 /*
973 * if entered to sleep when lcd panel was on, the usage_count
974 * of pm runtime would still be 1 so in this case, fimd driver
975 * should be on directly not drawing on pm runtime interface.
976 */
977 if (!pm_runtime_suspended(dev))
978 return fimd_power_on(ctx, true);
947 979
948 return 0; 980 return 0;
949} 981}
@@ -956,39 +988,16 @@ static int fimd_runtime_suspend(struct device *dev)
956 988
957 DRM_DEBUG_KMS("%s\n", __FILE__); 989 DRM_DEBUG_KMS("%s\n", __FILE__);
958 990
959 clk_disable(ctx->lcd_clk); 991 return fimd_power_on(ctx, false);
960 clk_disable(ctx->bus_clk);
961
962 ctx->suspended = true;
963 return 0;
964} 992}
965 993
966static int fimd_runtime_resume(struct device *dev) 994static int fimd_runtime_resume(struct device *dev)
967{ 995{
968 struct fimd_context *ctx = get_fimd_context(dev); 996 struct fimd_context *ctx = get_fimd_context(dev);
969 int ret;
970 997
971 DRM_DEBUG_KMS("%s\n", __FILE__); 998 DRM_DEBUG_KMS("%s\n", __FILE__);
972 999
973 ret = clk_enable(ctx->bus_clk); 1000 return fimd_power_on(ctx, true);
974 if (ret < 0)
975 return ret;
976
977 ret = clk_enable(ctx->lcd_clk);
978 if (ret < 0) {
979 clk_disable(ctx->bus_clk);
980 return ret;
981 }
982
983 ctx->suspended = false;
984
985 /* if vblank was enabled status, enable it again. */
986 if (test_and_clear_bit(0, &ctx->irq_flags))
987 fimd_enable_vblank(dev);
988
989 fimd_apply(dev);
990
991 return 0;
992} 1001}
993#endif 1002#endif
994 1003
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index f48f7ce92f5f..3429d3fd93f3 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1116,8 +1116,8 @@ err_ddc:
1116err_iomap: 1116err_iomap:
1117 iounmap(hdata->regs); 1117 iounmap(hdata->regs);
1118err_req_region: 1118err_req_region:
1119 release_resource(hdata->regs_res); 1119 release_mem_region(hdata->regs_res->start,
1120 kfree(hdata->regs_res); 1120 resource_size(hdata->regs_res));
1121err_resource: 1121err_resource:
1122 hdmi_resources_cleanup(hdata); 1122 hdmi_resources_cleanup(hdata);
1123err_data: 1123err_data:
@@ -1145,8 +1145,8 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
1145 1145
1146 iounmap(hdata->regs); 1146 iounmap(hdata->regs);
1147 1147
1148 release_resource(hdata->regs_res); 1148 release_mem_region(hdata->regs_res->start,
1149 kfree(hdata->regs_res); 1149 resource_size(hdata->regs_res));
1150 1150
1151 /* hdmiphy i2c driver */ 1151 /* hdmiphy i2c driver */
1152 i2c_del_driver(&hdmiphy_driver); 1152 i2c_del_driver(&hdmiphy_driver);