diff options
author | Vaibhav Hiremath <hvaibhav@ti.com> | 2010-03-27 08:37:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:52:45 -0400 |
commit | e333bab73e848d72904f39c7a0f5ba6425ba41f3 (patch) | |
tree | 3fb7f57cd82d185b707f4f0d5c46865c4709fa8f /drivers/media/video/davinci | |
parent | aa2dc9034859531206889b6bf07b5f9adae487a6 (diff) |
V4L/DVB: V4L: dm644x_ccdc: Add Suspend/Resume Support
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Muralidharan Karicheri <mkaricheri@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci')
-rw-r--r-- | drivers/media/video/davinci/dm644x_ccdc.c | 114 | ||||
-rw-r--r-- | drivers/media/video/davinci/dm644x_ccdc_regs.h | 2 |
2 files changed, 115 insertions, 1 deletions
diff --git a/drivers/media/video/davinci/dm644x_ccdc.c b/drivers/media/video/davinci/dm644x_ccdc.c index a1d353125c84..490aafb34e2f 100644 --- a/drivers/media/video/davinci/dm644x_ccdc.c +++ b/drivers/media/video/davinci/dm644x_ccdc.c | |||
@@ -101,6 +101,9 @@ static u32 ccdc_raw_bayer_pix_formats[] = | |||
101 | static u32 ccdc_raw_yuv_pix_formats[] = | 101 | static u32 ccdc_raw_yuv_pix_formats[] = |
102 | {V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV}; | 102 | {V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV}; |
103 | 103 | ||
104 | /* CCDC Save/Restore context */ | ||
105 | static u32 ccdc_ctx[CCDC_REG_END / sizeof(u32)]; | ||
106 | |||
104 | /* register access routines */ | 107 | /* register access routines */ |
105 | static inline u32 regr(u32 offset) | 108 | static inline u32 regr(u32 offset) |
106 | { | 109 | { |
@@ -846,6 +849,87 @@ static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params) | |||
846 | return 0; | 849 | return 0; |
847 | } | 850 | } |
848 | 851 | ||
852 | static void ccdc_save_context(void) | ||
853 | { | ||
854 | ccdc_ctx[CCDC_PCR >> 2] = regr(CCDC_PCR); | ||
855 | ccdc_ctx[CCDC_SYN_MODE >> 2] = regr(CCDC_SYN_MODE); | ||
856 | ccdc_ctx[CCDC_HD_VD_WID >> 2] = regr(CCDC_HD_VD_WID); | ||
857 | ccdc_ctx[CCDC_PIX_LINES >> 2] = regr(CCDC_PIX_LINES); | ||
858 | ccdc_ctx[CCDC_HORZ_INFO >> 2] = regr(CCDC_HORZ_INFO); | ||
859 | ccdc_ctx[CCDC_VERT_START >> 2] = regr(CCDC_VERT_START); | ||
860 | ccdc_ctx[CCDC_VERT_LINES >> 2] = regr(CCDC_VERT_LINES); | ||
861 | ccdc_ctx[CCDC_CULLING >> 2] = regr(CCDC_CULLING); | ||
862 | ccdc_ctx[CCDC_HSIZE_OFF >> 2] = regr(CCDC_HSIZE_OFF); | ||
863 | ccdc_ctx[CCDC_SDOFST >> 2] = regr(CCDC_SDOFST); | ||
864 | ccdc_ctx[CCDC_SDR_ADDR >> 2] = regr(CCDC_SDR_ADDR); | ||
865 | ccdc_ctx[CCDC_CLAMP >> 2] = regr(CCDC_CLAMP); | ||
866 | ccdc_ctx[CCDC_DCSUB >> 2] = regr(CCDC_DCSUB); | ||
867 | ccdc_ctx[CCDC_COLPTN >> 2] = regr(CCDC_COLPTN); | ||
868 | ccdc_ctx[CCDC_BLKCMP >> 2] = regr(CCDC_BLKCMP); | ||
869 | ccdc_ctx[CCDC_FPC >> 2] = regr(CCDC_FPC); | ||
870 | ccdc_ctx[CCDC_FPC_ADDR >> 2] = regr(CCDC_FPC_ADDR); | ||
871 | ccdc_ctx[CCDC_VDINT >> 2] = regr(CCDC_VDINT); | ||
872 | ccdc_ctx[CCDC_ALAW >> 2] = regr(CCDC_ALAW); | ||
873 | ccdc_ctx[CCDC_REC656IF >> 2] = regr(CCDC_REC656IF); | ||
874 | ccdc_ctx[CCDC_CCDCFG >> 2] = regr(CCDC_CCDCFG); | ||
875 | ccdc_ctx[CCDC_FMTCFG >> 2] = regr(CCDC_FMTCFG); | ||
876 | ccdc_ctx[CCDC_FMT_HORZ >> 2] = regr(CCDC_FMT_HORZ); | ||
877 | ccdc_ctx[CCDC_FMT_VERT >> 2] = regr(CCDC_FMT_VERT); | ||
878 | ccdc_ctx[CCDC_FMT_ADDR0 >> 2] = regr(CCDC_FMT_ADDR0); | ||
879 | ccdc_ctx[CCDC_FMT_ADDR1 >> 2] = regr(CCDC_FMT_ADDR1); | ||
880 | ccdc_ctx[CCDC_FMT_ADDR2 >> 2] = regr(CCDC_FMT_ADDR2); | ||
881 | ccdc_ctx[CCDC_FMT_ADDR3 >> 2] = regr(CCDC_FMT_ADDR3); | ||
882 | ccdc_ctx[CCDC_FMT_ADDR4 >> 2] = regr(CCDC_FMT_ADDR4); | ||
883 | ccdc_ctx[CCDC_FMT_ADDR5 >> 2] = regr(CCDC_FMT_ADDR5); | ||
884 | ccdc_ctx[CCDC_FMT_ADDR6 >> 2] = regr(CCDC_FMT_ADDR6); | ||
885 | ccdc_ctx[CCDC_FMT_ADDR7 >> 2] = regr(CCDC_FMT_ADDR7); | ||
886 | ccdc_ctx[CCDC_PRGEVEN_0 >> 2] = regr(CCDC_PRGEVEN_0); | ||
887 | ccdc_ctx[CCDC_PRGEVEN_1 >> 2] = regr(CCDC_PRGEVEN_1); | ||
888 | ccdc_ctx[CCDC_PRGODD_0 >> 2] = regr(CCDC_PRGODD_0); | ||
889 | ccdc_ctx[CCDC_PRGODD_1 >> 2] = regr(CCDC_PRGODD_1); | ||
890 | ccdc_ctx[CCDC_VP_OUT >> 2] = regr(CCDC_VP_OUT); | ||
891 | } | ||
892 | |||
893 | static void ccdc_restore_context(void) | ||
894 | { | ||
895 | regw(ccdc_ctx[CCDC_SYN_MODE >> 2], CCDC_SYN_MODE); | ||
896 | regw(ccdc_ctx[CCDC_HD_VD_WID >> 2], CCDC_HD_VD_WID); | ||
897 | regw(ccdc_ctx[CCDC_PIX_LINES >> 2], CCDC_PIX_LINES); | ||
898 | regw(ccdc_ctx[CCDC_HORZ_INFO >> 2], CCDC_HORZ_INFO); | ||
899 | regw(ccdc_ctx[CCDC_VERT_START >> 2], CCDC_VERT_START); | ||
900 | regw(ccdc_ctx[CCDC_VERT_LINES >> 2], CCDC_VERT_LINES); | ||
901 | regw(ccdc_ctx[CCDC_CULLING >> 2], CCDC_CULLING); | ||
902 | regw(ccdc_ctx[CCDC_HSIZE_OFF >> 2], CCDC_HSIZE_OFF); | ||
903 | regw(ccdc_ctx[CCDC_SDOFST >> 2], CCDC_SDOFST); | ||
904 | regw(ccdc_ctx[CCDC_SDR_ADDR >> 2], CCDC_SDR_ADDR); | ||
905 | regw(ccdc_ctx[CCDC_CLAMP >> 2], CCDC_CLAMP); | ||
906 | regw(ccdc_ctx[CCDC_DCSUB >> 2], CCDC_DCSUB); | ||
907 | regw(ccdc_ctx[CCDC_COLPTN >> 2], CCDC_COLPTN); | ||
908 | regw(ccdc_ctx[CCDC_BLKCMP >> 2], CCDC_BLKCMP); | ||
909 | regw(ccdc_ctx[CCDC_FPC >> 2], CCDC_FPC); | ||
910 | regw(ccdc_ctx[CCDC_FPC_ADDR >> 2], CCDC_FPC_ADDR); | ||
911 | regw(ccdc_ctx[CCDC_VDINT >> 2], CCDC_VDINT); | ||
912 | regw(ccdc_ctx[CCDC_ALAW >> 2], CCDC_ALAW); | ||
913 | regw(ccdc_ctx[CCDC_REC656IF >> 2], CCDC_REC656IF); | ||
914 | regw(ccdc_ctx[CCDC_CCDCFG >> 2], CCDC_CCDCFG); | ||
915 | regw(ccdc_ctx[CCDC_FMTCFG >> 2], CCDC_FMTCFG); | ||
916 | regw(ccdc_ctx[CCDC_FMT_HORZ >> 2], CCDC_FMT_HORZ); | ||
917 | regw(ccdc_ctx[CCDC_FMT_VERT >> 2], CCDC_FMT_VERT); | ||
918 | regw(ccdc_ctx[CCDC_FMT_ADDR0 >> 2], CCDC_FMT_ADDR0); | ||
919 | regw(ccdc_ctx[CCDC_FMT_ADDR1 >> 2], CCDC_FMT_ADDR1); | ||
920 | regw(ccdc_ctx[CCDC_FMT_ADDR2 >> 2], CCDC_FMT_ADDR2); | ||
921 | regw(ccdc_ctx[CCDC_FMT_ADDR3 >> 2], CCDC_FMT_ADDR3); | ||
922 | regw(ccdc_ctx[CCDC_FMT_ADDR4 >> 2], CCDC_FMT_ADDR4); | ||
923 | regw(ccdc_ctx[CCDC_FMT_ADDR5 >> 2], CCDC_FMT_ADDR5); | ||
924 | regw(ccdc_ctx[CCDC_FMT_ADDR6 >> 2], CCDC_FMT_ADDR6); | ||
925 | regw(ccdc_ctx[CCDC_FMT_ADDR7 >> 2], CCDC_FMT_ADDR7); | ||
926 | regw(ccdc_ctx[CCDC_PRGEVEN_0 >> 2], CCDC_PRGEVEN_0); | ||
927 | regw(ccdc_ctx[CCDC_PRGEVEN_1 >> 2], CCDC_PRGEVEN_1); | ||
928 | regw(ccdc_ctx[CCDC_PRGODD_0 >> 2], CCDC_PRGODD_0); | ||
929 | regw(ccdc_ctx[CCDC_PRGODD_1 >> 2], CCDC_PRGODD_1); | ||
930 | regw(ccdc_ctx[CCDC_VP_OUT >> 2], CCDC_VP_OUT); | ||
931 | regw(ccdc_ctx[CCDC_PCR >> 2], CCDC_PCR); | ||
932 | } | ||
849 | static struct ccdc_hw_device ccdc_hw_dev = { | 933 | static struct ccdc_hw_device ccdc_hw_dev = { |
850 | .name = "DM6446 CCDC", | 934 | .name = "DM6446 CCDC", |
851 | .owner = THIS_MODULE, | 935 | .owner = THIS_MODULE, |
@@ -954,10 +1038,40 @@ static int dm644x_ccdc_remove(struct platform_device *pdev) | |||
954 | return 0; | 1038 | return 0; |
955 | } | 1039 | } |
956 | 1040 | ||
1041 | static int dm644x_ccdc_suspend(struct device *dev) | ||
1042 | { | ||
1043 | /* Save CCDC context */ | ||
1044 | ccdc_save_context(); | ||
1045 | /* Disable CCDC */ | ||
1046 | ccdc_enable(0); | ||
1047 | /* Disable both master and slave clock */ | ||
1048 | clk_disable(ccdc_cfg.mclk); | ||
1049 | clk_disable(ccdc_cfg.sclk); | ||
1050 | |||
1051 | return 0; | ||
1052 | } | ||
1053 | |||
1054 | static int dm644x_ccdc_resume(struct device *dev) | ||
1055 | { | ||
1056 | /* Enable both master and slave clock */ | ||
1057 | clk_enable(ccdc_cfg.mclk); | ||
1058 | clk_enable(ccdc_cfg.sclk); | ||
1059 | /* Restore CCDC context */ | ||
1060 | ccdc_restore_context(); | ||
1061 | |||
1062 | return 0; | ||
1063 | } | ||
1064 | |||
1065 | static const struct dev_pm_ops dm644x_ccdc_pm_ops = { | ||
1066 | .suspend = dm644x_ccdc_suspend, | ||
1067 | .resume = dm644x_ccdc_resume, | ||
1068 | }; | ||
1069 | |||
957 | static struct platform_driver dm644x_ccdc_driver = { | 1070 | static struct platform_driver dm644x_ccdc_driver = { |
958 | .driver = { | 1071 | .driver = { |
959 | .name = "dm644x_ccdc", | 1072 | .name = "dm644x_ccdc", |
960 | .owner = THIS_MODULE, | 1073 | .owner = THIS_MODULE, |
1074 | .pm = &dm644x_ccdc_pm_ops, | ||
961 | }, | 1075 | }, |
962 | .remove = __devexit_p(dm644x_ccdc_remove), | 1076 | .remove = __devexit_p(dm644x_ccdc_remove), |
963 | .probe = dm644x_ccdc_probe, | 1077 | .probe = dm644x_ccdc_probe, |
diff --git a/drivers/media/video/davinci/dm644x_ccdc_regs.h b/drivers/media/video/davinci/dm644x_ccdc_regs.h index b18d166f1815..90370e414e2c 100644 --- a/drivers/media/video/davinci/dm644x_ccdc_regs.h +++ b/drivers/media/video/davinci/dm644x_ccdc_regs.h | |||
@@ -59,7 +59,7 @@ | |||
59 | #define CCDC_PRGODD_0 0x8c | 59 | #define CCDC_PRGODD_0 0x8c |
60 | #define CCDC_PRGODD_1 0x90 | 60 | #define CCDC_PRGODD_1 0x90 |
61 | #define CCDC_VP_OUT 0x94 | 61 | #define CCDC_VP_OUT 0x94 |
62 | 62 | #define CCDC_REG_END 0x98 | |
63 | 63 | ||
64 | /*************************************************************** | 64 | /*************************************************************** |
65 | * Define for various register bit mask and shifts for CCDC | 65 | * Define for various register bit mask and shifts for CCDC |