diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:58:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:58:16 -0400 |
commit | 240c3c3424366c8109babd2a0fe80855de511b35 (patch) | |
tree | 72eb8652c8e513715efee1e254644b4b670333fd /drivers/media/platform/davinci | |
parent | 19b344efa35dbc253e2d10403dafe6aafda73c56 (diff) | |
parent | df90e2258950fd631cdbf322c1ee1f22068391aa (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media update from Mauro Carvalho Chehab:
- OF documentation and patches at core and drivers, to be used by for
embedded media systems
- some I2C drivers used on go7007 were rewritten/promoted from staging:
sony-btf-mpx, tw2804, tw9903, tw9906, wis-ov7640, wis-uda1342
- add fimc-is driver (Exynos)
- add a new radio driver: radio-si476x
- add a two new tuners: r820t and tuner_it913x
- split camera code on em28xx driver and add more models
- the cypress firmware load is used outside dvb usb drivers. So, move
it to a common directory to make easier to re-use it
- siano media driver updated to work with sms2270 devices
- several work done in order to promote go7007 and solo6x1x out of
staging (still, there are some pending issues)
- several API compliance fixes at v4l2 drivers that don't behave as
expected
- as usual, lots of driver fixes, improvements, cleanups and new device
addition at the existing drivers.
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (831 commits)
[media] cx88: make core less verbose
[media] em28xx: fix oops at em28xx_dvb_bus_ctrl()
[media] s5c73m3: fix indentation of the help section in Kconfig
[media] cx25821-alsa: get rid of a __must_check warning
[media] cx25821-video: declare cx25821_vidioc_s_std as static
[media] cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap
[media] r820t: Remove a warning for an unused value
[media] dib0090: Fix a warning at dib0090_set_EFUSE
[media] dib8000: fix a warning
[media] dib8000: Fix sub-channel range
[media] dib8000: store dtv_property_cache in a temp var
[media] dib8000: warning fix: declare internal functions as static
[media] r820t: quiet gcc warning on n_ring
[media] r820t: memory leak in release()
[media] r820t: precendence bug in r820t_xtal_check()
[media] videodev2.h: Remove the unused old V4L1 buffer types
[media] anysee: Grammar s/report the/report to/
[media] anysee: Initialize ret = 0 in anysee_frontend_attach()
[media] media: videobuf2: fix the length check for mmap
[media] em28xx: save isoc endpoint number for DVB only if endpoint has alt settings with xMaxPacketSize != 0
...
Diffstat (limited to 'drivers/media/platform/davinci')
-rw-r--r-- | drivers/media/platform/davinci/Kconfig | 103 | ||||
-rw-r--r-- | drivers/media/platform/davinci/Makefile | 17 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm355_ccdc.c | 49 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm355_ccdc_regs.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm644x_ccdc.c | 57 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm644x_ccdc_regs.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/davinci/isif.c | 30 | ||||
-rw-r--r-- | drivers/media/platform/davinci/isif_regs.h | 4 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe.c | 16 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_display.c | 17 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_osd.c | 3 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_venc.c | 36 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpfe_capture.c | 62 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif.c | 32 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.c | 12 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.c | 16 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpss.c | 36 |
18 files changed, 183 insertions, 313 deletions
diff --git a/drivers/media/platform/davinci/Kconfig b/drivers/media/platform/davinci/Kconfig index ccfde4eb626a..afb3aec1320e 100644 --- a/drivers/media/platform/davinci/Kconfig +++ b/drivers/media/platform/davinci/Kconfig | |||
@@ -1,79 +1,47 @@ | |||
1 | config VIDEO_DAVINCI_VPIF_DISPLAY | 1 | config VIDEO_DAVINCI_VPIF_DISPLAY |
2 | tristate "DM646x/DA850/OMAPL138 EVM Video Display" | 2 | tristate "TI DaVinci VPIF V4L2-Display driver" |
3 | depends on VIDEO_DEV && (MACH_DAVINCI_DM6467_EVM || MACH_DAVINCI_DA850_EVM) | 3 | depends on VIDEO_DEV && ARCH_DAVINCI |
4 | select VIDEOBUF2_DMA_CONTIG | 4 | select VIDEOBUF2_DMA_CONTIG |
5 | select VIDEO_DAVINCI_VPIF | ||
6 | select VIDEO_ADV7343 if MEDIA_SUBDRV_AUTOSELECT | 5 | select VIDEO_ADV7343 if MEDIA_SUBDRV_AUTOSELECT |
7 | select VIDEO_THS7303 if MEDIA_SUBDRV_AUTOSELECT | 6 | select VIDEO_THS7303 if MEDIA_SUBDRV_AUTOSELECT |
8 | help | 7 | help |
9 | Enables Davinci VPIF module used for display devices. | 8 | Enables Davinci VPIF module used for display devices. |
10 | This module is common for following DM6467/DA850/OMAPL138 | 9 | This module is used for display on TI DM6467/DA850/OMAPL138 |
11 | based display devices. | 10 | SoCs. |
12 | 11 | ||
13 | To compile this driver as a module, choose M here: the | 12 | To compile this driver as a module, choose M here. There will |
14 | module will be called vpif_display. | 13 | be two modules called vpif.ko and vpif_display.ko |
15 | 14 | ||
16 | config VIDEO_DAVINCI_VPIF_CAPTURE | 15 | config VIDEO_DAVINCI_VPIF_CAPTURE |
17 | tristate "DM646x/DA850/OMAPL138 EVM Video Capture" | 16 | tristate "TI DaVinci VPIF video capture driver" |
18 | depends on VIDEO_DEV && (MACH_DAVINCI_DM6467_EVM || MACH_DAVINCI_DA850_EVM) | 17 | depends on VIDEO_DEV && ARCH_DAVINCI |
19 | select VIDEOBUF2_DMA_CONTIG | 18 | select VIDEOBUF2_DMA_CONTIG |
20 | select VIDEO_DAVINCI_VPIF | ||
21 | help | 19 | help |
22 | Enables Davinci VPIF module used for captur devices. | 20 | Enables Davinci VPIF module used for capture devices. |
23 | This module is common for following DM6467/DA850/OMAPL138 | 21 | This module is used for capture on TI DM6467/DA850/OMAPL138 |
24 | based capture devices. | 22 | SoCs. |
25 | 23 | ||
26 | To compile this driver as a module, choose M here: the | 24 | To compile this driver as a module, choose M here. There will |
27 | module will be called vpif_capture. | 25 | be two modules called vpif.ko and vpif_capture.ko |
28 | 26 | ||
29 | config VIDEO_DAVINCI_VPIF | 27 | config VIDEO_DM6446_CCDC |
30 | tristate "DaVinci VPIF Driver" | 28 | tristate "TI DM6446 CCDC video capture driver" |
31 | depends on VIDEO_DAVINCI_VPIF_DISPLAY || VIDEO_DAVINCI_VPIF_CAPTURE | ||
32 | help | ||
33 | Support for DaVinci VPIF Driver. | ||
34 | |||
35 | To compile this driver as a module, choose M here: the | ||
36 | module will be called vpif. | ||
37 | |||
38 | config VIDEO_VPSS_SYSTEM | ||
39 | tristate "VPSS System module driver" | ||
40 | depends on ARCH_DAVINCI | ||
41 | help | ||
42 | Support for vpss system module for video driver | ||
43 | |||
44 | config VIDEO_VPFE_CAPTURE | ||
45 | tristate "VPFE Video Capture Driver" | ||
46 | depends on VIDEO_V4L2 && (ARCH_DAVINCI || ARCH_OMAP3) | 29 | depends on VIDEO_V4L2 && (ARCH_DAVINCI || ARCH_OMAP3) |
47 | depends on I2C | ||
48 | select VIDEOBUF_DMA_CONTIG | 30 | select VIDEOBUF_DMA_CONTIG |
49 | help | 31 | help |
50 | Support for DMx/AMx VPFE based frame grabber. This is the | ||
51 | common V4L2 module for following DMx/AMx SoCs from Texas | ||
52 | Instruments:- DM6446, DM365, DM355 & AM3517/05. | ||
53 | |||
54 | To compile this driver as a module, choose M here: the | ||
55 | module will be called vpfe-capture. | ||
56 | |||
57 | config VIDEO_DM6446_CCDC | ||
58 | tristate "DM6446 CCDC HW module" | ||
59 | depends on VIDEO_VPFE_CAPTURE | ||
60 | select VIDEO_VPSS_SYSTEM | ||
61 | default y | ||
62 | help | ||
63 | Enables DaVinci CCD hw module. DaVinci CCDC hw interfaces | 32 | Enables DaVinci CCD hw module. DaVinci CCDC hw interfaces |
64 | with decoder modules such as TVP5146 over BT656 or | 33 | with decoder modules such as TVP5146 over BT656 or |
65 | sensor module such as MT9T001 over a raw interface. This | 34 | sensor module such as MT9T001 over a raw interface. This |
66 | module configures the interface and CCDC/ISIF to do | 35 | module configures the interface and CCDC/ISIF to do |
67 | video frame capture from slave decoders. | 36 | video frame capture from slave decoders. |
68 | 37 | ||
69 | To compile this driver as a module, choose M here: the | 38 | To compile this driver as a module, choose M here. There will |
70 | module will be called vpfe. | 39 | be three modules called vpfe_capture.ko, vpss.ko and dm644x_ccdc.ko |
71 | 40 | ||
72 | config VIDEO_DM355_CCDC | 41 | config VIDEO_DM355_CCDC |
73 | tristate "DM355 CCDC HW module" | 42 | tristate "TI DM355 CCDC video capture driver" |
74 | depends on ARCH_DAVINCI_DM355 && VIDEO_VPFE_CAPTURE | 43 | depends on VIDEO_V4L2 && ARCH_DAVINCI |
75 | select VIDEO_VPSS_SYSTEM | 44 | select VIDEOBUF_DMA_CONTIG |
76 | default y | ||
77 | help | 45 | help |
78 | Enables DM355 CCD hw module. DM355 CCDC hw interfaces | 46 | Enables DM355 CCD hw module. DM355 CCDC hw interfaces |
79 | with decoder modules such as TVP5146 over BT656 or | 47 | with decoder modules such as TVP5146 over BT656 or |
@@ -81,31 +49,30 @@ config VIDEO_DM355_CCDC | |||
81 | module configures the interface and CCDC/ISIF to do | 49 | module configures the interface and CCDC/ISIF to do |
82 | video frame capture from a slave decoders | 50 | video frame capture from a slave decoders |
83 | 51 | ||
84 | To compile this driver as a module, choose M here: the | 52 | To compile this driver as a module, choose M here. There will |
85 | module will be called vpfe. | 53 | be three modules called vpfe_capture.ko, vpss.ko and dm355_ccdc.ko |
86 | 54 | ||
87 | config VIDEO_ISIF | 55 | config VIDEO_DM365_ISIF |
88 | tristate "ISIF HW module" | 56 | tristate "TI DM365 ISIF video capture driver" |
89 | depends on ARCH_DAVINCI_DM365 && VIDEO_VPFE_CAPTURE | 57 | depends on VIDEO_V4L2 && ARCH_DAVINCI |
90 | select VIDEO_VPSS_SYSTEM | 58 | select VIDEOBUF_DMA_CONTIG |
91 | default y | ||
92 | help | 59 | help |
93 | Enables ISIF hw module. This is the hardware module for | 60 | Enables ISIF hw module. This is the hardware module for |
94 | configuring ISIF in VPFE to capture Raw Bayer RGB data from | 61 | configuring ISIF in VPFE to capture Raw Bayer RGB data from |
95 | a image sensor or YUV data from a YUV source. | 62 | a image sensor or YUV data from a YUV source. |
96 | 63 | ||
97 | To compile this driver as a module, choose M here: the | 64 | To compile this driver as a module, choose M here. There will |
98 | module will be called vpfe. | 65 | be three modules called vpfe_capture.ko, vpss.ko and isif.ko |
99 | 66 | ||
100 | config VIDEO_DAVINCI_VPBE_DISPLAY | 67 | config VIDEO_DAVINCI_VPBE_DISPLAY |
101 | tristate "DM644X/DM365/DM355 VPBE HW module" | 68 | tristate "TI DaVinci VPBE V4L2-Display driver" |
102 | depends on ARCH_DAVINCI_DM644x || ARCH_DAVINCI_DM355 || ARCH_DAVINCI_DM365 | 69 | depends on ARCH_DAVINCI |
103 | select VIDEO_VPSS_SYSTEM | ||
104 | select VIDEOBUF2_DMA_CONTIG | 70 | select VIDEOBUF2_DMA_CONTIG |
105 | help | 71 | help |
106 | Enables Davinci VPBE module used for display devices. | 72 | Enables Davinci VPBE module used for display devices. |
107 | This module is common for following DM644x/DM365/DM355 | 73 | This module is used for display on TI DM644x/DM365/DM355 |
108 | based display devices. | 74 | based display devices. |
109 | 75 | ||
110 | To compile this driver as a module, choose M here: the | 76 | To compile this driver as a module, choose M here. There will |
111 | module will be called vpbe. | 77 | be five modules created called vpss.ko, vpbe.ko, vpbe_osd.ko, |
78 | vpbe_venc.ko and vpbe_display.ko | ||
diff --git a/drivers/media/platform/davinci/Makefile b/drivers/media/platform/davinci/Makefile index f40f5219ca50..d74d9eeb0e9e 100644 --- a/drivers/media/platform/davinci/Makefile +++ b/drivers/media/platform/davinci/Makefile | |||
@@ -2,19 +2,14 @@ | |||
2 | # Makefile for the davinci video device drivers. | 2 | # Makefile for the davinci video device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | # VPIF | ||
6 | obj-$(CONFIG_VIDEO_DAVINCI_VPIF) += vpif.o | ||
7 | |||
8 | #VPIF Display driver | 5 | #VPIF Display driver |
9 | obj-$(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY) += vpif_display.o | 6 | obj-$(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY) += vpif.o vpif_display.o |
10 | #VPIF Capture driver | 7 | #VPIF Capture driver |
11 | obj-$(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) += vpif_capture.o | 8 | obj-$(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) += vpif.o vpif_capture.o |
12 | 9 | ||
13 | # Capture: DM6446 and DM355 | 10 | # Capture: DM6446 and DM355 |
14 | obj-$(CONFIG_VIDEO_VPSS_SYSTEM) += vpss.o | 11 | obj-$(CONFIG_VIDEO_DM6446_CCDC) += vpfe_capture.o vpss.o dm644x_ccdc.o |
15 | obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o | 12 | obj-$(CONFIG_VIDEO_DM355_CCDC) += vpfe_capture.o vpss.o dm355_ccdc.o |
16 | obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o | 13 | obj-$(CONFIG_VIDEO_DM365_ISIF) += vpfe_capture.o vpss.o isif.o |
17 | obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o | 14 | obj-$(CONFIG_VIDEO_DAVINCI_VPBE_DISPLAY) += vpss.o vpbe.o vpbe_osd.o \ |
18 | obj-$(CONFIG_VIDEO_ISIF) += isif.o | ||
19 | obj-$(CONFIG_VIDEO_DAVINCI_VPBE_DISPLAY) += vpbe.o vpbe_osd.o \ | ||
20 | vpbe_venc.o vpbe_display.o | 15 | vpbe_venc.o vpbe_display.o |
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c index 4277e4ad810c..05f8fb7f7b70 100644 --- a/drivers/media/platform/davinci/dm355_ccdc.c +++ b/drivers/media/platform/davinci/dm355_ccdc.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | #include <linux/videodev2.h> | 39 | #include <linux/videodev2.h> |
40 | #include <linux/clk.h> | ||
41 | #include <linux/err.h> | 40 | #include <linux/err.h> |
42 | #include <linux/module.h> | 41 | #include <linux/module.h> |
43 | 42 | ||
@@ -59,10 +58,6 @@ static struct ccdc_oper_config { | |||
59 | struct ccdc_params_raw bayer; | 58 | struct ccdc_params_raw bayer; |
60 | /* YCbCr configuration */ | 59 | /* YCbCr configuration */ |
61 | struct ccdc_params_ycbcr ycbcr; | 60 | struct ccdc_params_ycbcr ycbcr; |
62 | /* Master clock */ | ||
63 | struct clk *mclk; | ||
64 | /* slave clock */ | ||
65 | struct clk *sclk; | ||
66 | /* ccdc base address */ | 61 | /* ccdc base address */ |
67 | void __iomem *base_addr; | 62 | void __iomem *base_addr; |
68 | } ccdc_cfg = { | 63 | } ccdc_cfg = { |
@@ -85,7 +80,7 @@ static struct ccdc_oper_config { | |||
85 | .mfilt1 = CCDC_NO_MEDIAN_FILTER1, | 80 | .mfilt1 = CCDC_NO_MEDIAN_FILTER1, |
86 | .mfilt2 = CCDC_NO_MEDIAN_FILTER2, | 81 | .mfilt2 = CCDC_NO_MEDIAN_FILTER2, |
87 | .alaw = { | 82 | .alaw = { |
88 | .gama_wd = 2, | 83 | .gamma_wd = 2, |
89 | }, | 84 | }, |
90 | .blk_clamp = { | 85 | .blk_clamp = { |
91 | .sample_pixel = 1, | 86 | .sample_pixel = 1, |
@@ -303,8 +298,8 @@ static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) | |||
303 | } | 298 | } |
304 | 299 | ||
305 | if (ccdcparam->alaw.enable) { | 300 | if (ccdcparam->alaw.enable) { |
306 | if (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_13_4 || | 301 | if (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_13_4 || |
307 | ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) { | 302 | ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) { |
308 | dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n"); | 303 | dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n"); |
309 | return -EINVAL; | 304 | return -EINVAL; |
310 | } | 305 | } |
@@ -680,8 +675,8 @@ static int ccdc_config_raw(void) | |||
680 | /* Enable and configure aLaw register if needed */ | 675 | /* Enable and configure aLaw register if needed */ |
681 | if (config_params->alaw.enable) { | 676 | if (config_params->alaw.enable) { |
682 | val |= (CCDC_ALAW_ENABLE | | 677 | val |= (CCDC_ALAW_ENABLE | |
683 | ((config_params->alaw.gama_wd & | 678 | ((config_params->alaw.gamma_wd & |
684 | CCDC_ALAW_GAMA_WD_MASK) << | 679 | CCDC_ALAW_GAMMA_WD_MASK) << |
685 | CCDC_GAMMAWD_INPUT_SHIFT)); | 680 | CCDC_GAMMAWD_INPUT_SHIFT)); |
686 | } | 681 | } |
687 | 682 | ||
@@ -997,32 +992,10 @@ static int dm355_ccdc_probe(struct platform_device *pdev) | |||
997 | goto fail_nomem; | 992 | goto fail_nomem; |
998 | } | 993 | } |
999 | 994 | ||
1000 | /* Get and enable Master clock */ | ||
1001 | ccdc_cfg.mclk = clk_get(&pdev->dev, "master"); | ||
1002 | if (IS_ERR(ccdc_cfg.mclk)) { | ||
1003 | status = PTR_ERR(ccdc_cfg.mclk); | ||
1004 | goto fail_nomap; | ||
1005 | } | ||
1006 | if (clk_prepare_enable(ccdc_cfg.mclk)) { | ||
1007 | status = -ENODEV; | ||
1008 | goto fail_mclk; | ||
1009 | } | ||
1010 | |||
1011 | /* Get and enable Slave clock */ | ||
1012 | ccdc_cfg.sclk = clk_get(&pdev->dev, "slave"); | ||
1013 | if (IS_ERR(ccdc_cfg.sclk)) { | ||
1014 | status = PTR_ERR(ccdc_cfg.sclk); | ||
1015 | goto fail_mclk; | ||
1016 | } | ||
1017 | if (clk_prepare_enable(ccdc_cfg.sclk)) { | ||
1018 | status = -ENODEV; | ||
1019 | goto fail_sclk; | ||
1020 | } | ||
1021 | |||
1022 | /* Platform data holds setup_pinmux function ptr */ | 995 | /* Platform data holds setup_pinmux function ptr */ |
1023 | if (NULL == pdev->dev.platform_data) { | 996 | if (NULL == pdev->dev.platform_data) { |
1024 | status = -ENODEV; | 997 | status = -ENODEV; |
1025 | goto fail_sclk; | 998 | goto fail_nomap; |
1026 | } | 999 | } |
1027 | setup_pinmux = pdev->dev.platform_data; | 1000 | setup_pinmux = pdev->dev.platform_data; |
1028 | /* | 1001 | /* |
@@ -1033,12 +1006,6 @@ static int dm355_ccdc_probe(struct platform_device *pdev) | |||
1033 | ccdc_cfg.dev = &pdev->dev; | 1006 | ccdc_cfg.dev = &pdev->dev; |
1034 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); | 1007 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); |
1035 | return 0; | 1008 | return 0; |
1036 | fail_sclk: | ||
1037 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
1038 | clk_put(ccdc_cfg.sclk); | ||
1039 | fail_mclk: | ||
1040 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
1041 | clk_put(ccdc_cfg.mclk); | ||
1042 | fail_nomap: | 1009 | fail_nomap: |
1043 | iounmap(ccdc_cfg.base_addr); | 1010 | iounmap(ccdc_cfg.base_addr); |
1044 | fail_nomem: | 1011 | fail_nomem: |
@@ -1052,10 +1019,6 @@ static int dm355_ccdc_remove(struct platform_device *pdev) | |||
1052 | { | 1019 | { |
1053 | struct resource *res; | 1020 | struct resource *res; |
1054 | 1021 | ||
1055 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
1056 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
1057 | clk_put(ccdc_cfg.mclk); | ||
1058 | clk_put(ccdc_cfg.sclk); | ||
1059 | iounmap(ccdc_cfg.base_addr); | 1022 | iounmap(ccdc_cfg.base_addr); |
1060 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1023 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1061 | if (res) | 1024 | if (res) |
diff --git a/drivers/media/platform/davinci/dm355_ccdc_regs.h b/drivers/media/platform/davinci/dm355_ccdc_regs.h index d6d2ef0533b5..2e1946e0b99f 100644 --- a/drivers/media/platform/davinci/dm355_ccdc_regs.h +++ b/drivers/media/platform/davinci/dm355_ccdc_regs.h | |||
@@ -153,7 +153,7 @@ | |||
153 | #define CCDC_VDHDEN_ENABLE (1 << 16) | 153 | #define CCDC_VDHDEN_ENABLE (1 << 16) |
154 | #define CCDC_LPF_ENABLE (1 << 14) | 154 | #define CCDC_LPF_ENABLE (1 << 14) |
155 | #define CCDC_ALAW_ENABLE 1 | 155 | #define CCDC_ALAW_ENABLE 1 |
156 | #define CCDC_ALAW_GAMA_WD_MASK 7 | 156 | #define CCDC_ALAW_GAMMA_WD_MASK 7 |
157 | #define CCDC_REC656IF_BT656_EN 3 | 157 | #define CCDC_REC656IF_BT656_EN 3 |
158 | 158 | ||
159 | #define CCDC_FMTCFG_FMTMODE_MASK 3 | 159 | #define CCDC_FMTCFG_FMTMODE_MASK 3 |
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c index 318e80512998..30fa08405d61 100644 --- a/drivers/media/platform/davinci/dm644x_ccdc.c +++ b/drivers/media/platform/davinci/dm644x_ccdc.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | #include <linux/videodev2.h> | 39 | #include <linux/videodev2.h> |
40 | #include <linux/gfp.h> | 40 | #include <linux/gfp.h> |
41 | #include <linux/clk.h> | ||
42 | #include <linux/err.h> | 41 | #include <linux/err.h> |
43 | #include <linux/module.h> | 42 | #include <linux/module.h> |
44 | 43 | ||
@@ -60,10 +59,6 @@ static struct ccdc_oper_config { | |||
60 | struct ccdc_params_raw bayer; | 59 | struct ccdc_params_raw bayer; |
61 | /* YCbCr configuration */ | 60 | /* YCbCr configuration */ |
62 | struct ccdc_params_ycbcr ycbcr; | 61 | struct ccdc_params_ycbcr ycbcr; |
63 | /* Master clock */ | ||
64 | struct clk *mclk; | ||
65 | /* slave clock */ | ||
66 | struct clk *sclk; | ||
67 | /* ccdc base address */ | 62 | /* ccdc base address */ |
68 | void __iomem *base_addr; | 63 | void __iomem *base_addr; |
69 | } ccdc_cfg = { | 64 | } ccdc_cfg = { |
@@ -228,9 +223,12 @@ static void ccdc_readregs(void) | |||
228 | static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) | 223 | static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) |
229 | { | 224 | { |
230 | if (ccdcparam->alaw.enable) { | 225 | if (ccdcparam->alaw.enable) { |
231 | if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) || | 226 | u8 max_gamma = ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd); |
232 | (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) || | 227 | u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz); |
233 | (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) { | 228 | |
229 | if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) || | ||
230 | (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) || | ||
231 | (max_gamma > max_data)) { | ||
234 | dev_dbg(ccdc_cfg.dev, "\nInvalid data line select"); | 232 | dev_dbg(ccdc_cfg.dev, "\nInvalid data line select"); |
235 | return -1; | 233 | return -1; |
236 | } | 234 | } |
@@ -560,8 +558,8 @@ void ccdc_config_raw(void) | |||
560 | 558 | ||
561 | /* Enable and configure aLaw register if needed */ | 559 | /* Enable and configure aLaw register if needed */ |
562 | if (config_params->alaw.enable) { | 560 | if (config_params->alaw.enable) { |
563 | val = ((config_params->alaw.gama_wd & | 561 | val = ((config_params->alaw.gamma_wd & |
564 | CCDC_ALAW_GAMA_WD_MASK) | CCDC_ALAW_ENABLE); | 562 | CCDC_ALAW_GAMMA_WD_MASK) | CCDC_ALAW_ENABLE); |
565 | regw(val, CCDC_ALAW); | 563 | regw(val, CCDC_ALAW); |
566 | dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val); | 564 | dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val); |
567 | } | 565 | } |
@@ -988,38 +986,9 @@ static int dm644x_ccdc_probe(struct platform_device *pdev) | |||
988 | goto fail_nomem; | 986 | goto fail_nomem; |
989 | } | 987 | } |
990 | 988 | ||
991 | /* Get and enable Master clock */ | ||
992 | ccdc_cfg.mclk = clk_get(&pdev->dev, "master"); | ||
993 | if (IS_ERR(ccdc_cfg.mclk)) { | ||
994 | status = PTR_ERR(ccdc_cfg.mclk); | ||
995 | goto fail_nomap; | ||
996 | } | ||
997 | if (clk_prepare_enable(ccdc_cfg.mclk)) { | ||
998 | status = -ENODEV; | ||
999 | goto fail_mclk; | ||
1000 | } | ||
1001 | |||
1002 | /* Get and enable Slave clock */ | ||
1003 | ccdc_cfg.sclk = clk_get(&pdev->dev, "slave"); | ||
1004 | if (IS_ERR(ccdc_cfg.sclk)) { | ||
1005 | status = PTR_ERR(ccdc_cfg.sclk); | ||
1006 | goto fail_mclk; | ||
1007 | } | ||
1008 | if (clk_prepare_enable(ccdc_cfg.sclk)) { | ||
1009 | status = -ENODEV; | ||
1010 | goto fail_sclk; | ||
1011 | } | ||
1012 | ccdc_cfg.dev = &pdev->dev; | 989 | ccdc_cfg.dev = &pdev->dev; |
1013 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); | 990 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); |
1014 | return 0; | 991 | return 0; |
1015 | fail_sclk: | ||
1016 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
1017 | clk_put(ccdc_cfg.sclk); | ||
1018 | fail_mclk: | ||
1019 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
1020 | clk_put(ccdc_cfg.mclk); | ||
1021 | fail_nomap: | ||
1022 | iounmap(ccdc_cfg.base_addr); | ||
1023 | fail_nomem: | 992 | fail_nomem: |
1024 | release_mem_region(res->start, resource_size(res)); | 993 | release_mem_region(res->start, resource_size(res)); |
1025 | fail_nores: | 994 | fail_nores: |
@@ -1031,10 +1000,6 @@ static int dm644x_ccdc_remove(struct platform_device *pdev) | |||
1031 | { | 1000 | { |
1032 | struct resource *res; | 1001 | struct resource *res; |
1033 | 1002 | ||
1034 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
1035 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
1036 | clk_put(ccdc_cfg.mclk); | ||
1037 | clk_put(ccdc_cfg.sclk); | ||
1038 | iounmap(ccdc_cfg.base_addr); | 1003 | iounmap(ccdc_cfg.base_addr); |
1039 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1004 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1040 | if (res) | 1005 | if (res) |
@@ -1049,18 +1014,12 @@ static int dm644x_ccdc_suspend(struct device *dev) | |||
1049 | ccdc_save_context(); | 1014 | ccdc_save_context(); |
1050 | /* Disable CCDC */ | 1015 | /* Disable CCDC */ |
1051 | ccdc_enable(0); | 1016 | ccdc_enable(0); |
1052 | /* Disable both master and slave clock */ | ||
1053 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
1054 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
1055 | 1017 | ||
1056 | return 0; | 1018 | return 0; |
1057 | } | 1019 | } |
1058 | 1020 | ||
1059 | static int dm644x_ccdc_resume(struct device *dev) | 1021 | static int dm644x_ccdc_resume(struct device *dev) |
1060 | { | 1022 | { |
1061 | /* Enable both master and slave clock */ | ||
1062 | clk_prepare_enable(ccdc_cfg.mclk); | ||
1063 | clk_prepare_enable(ccdc_cfg.sclk); | ||
1064 | /* Restore CCDC context */ | 1023 | /* Restore CCDC context */ |
1065 | ccdc_restore_context(); | 1024 | ccdc_restore_context(); |
1066 | 1025 | ||
diff --git a/drivers/media/platform/davinci/dm644x_ccdc_regs.h b/drivers/media/platform/davinci/dm644x_ccdc_regs.h index 90370e414e2c..2b0aca5383f0 100644 --- a/drivers/media/platform/davinci/dm644x_ccdc_regs.h +++ b/drivers/media/platform/davinci/dm644x_ccdc_regs.h | |||
@@ -84,7 +84,7 @@ | |||
84 | #define CCDC_VDHDEN_ENABLE (1 << 16) | 84 | #define CCDC_VDHDEN_ENABLE (1 << 16) |
85 | #define CCDC_LPF_ENABLE (1 << 14) | 85 | #define CCDC_LPF_ENABLE (1 << 14) |
86 | #define CCDC_ALAW_ENABLE (1 << 3) | 86 | #define CCDC_ALAW_ENABLE (1 << 3) |
87 | #define CCDC_ALAW_GAMA_WD_MASK 7 | 87 | #define CCDC_ALAW_GAMMA_WD_MASK 7 |
88 | #define CCDC_BLK_CLAMP_ENABLE (1 << 31) | 88 | #define CCDC_BLK_CLAMP_ENABLE (1 << 31) |
89 | #define CCDC_BLK_SGAIN_MASK 0x1F | 89 | #define CCDC_BLK_SGAIN_MASK 0x1F |
90 | #define CCDC_BLK_ST_PXL_MASK 0x7FFF | 90 | #define CCDC_BLK_ST_PXL_MASK 0x7FFF |
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c index 5050f9265f48..3332cca632e5 100644 --- a/drivers/media/platform/davinci/isif.c +++ b/drivers/media/platform/davinci/isif.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/videodev2.h> | 34 | #include <linux/videodev2.h> |
35 | #include <linux/clk.h> | ||
36 | #include <linux/err.h> | 35 | #include <linux/err.h> |
37 | #include <linux/module.h> | 36 | #include <linux/module.h> |
38 | 37 | ||
@@ -88,8 +87,6 @@ static struct isif_oper_config { | |||
88 | struct isif_ycbcr_config ycbcr; | 87 | struct isif_ycbcr_config ycbcr; |
89 | struct isif_params_raw bayer; | 88 | struct isif_params_raw bayer; |
90 | enum isif_data_pack data_pack; | 89 | enum isif_data_pack data_pack; |
91 | /* Master clock */ | ||
92 | struct clk *mclk; | ||
93 | /* ISIF base address */ | 90 | /* ISIF base address */ |
94 | void __iomem *base_addr; | 91 | void __iomem *base_addr; |
95 | /* ISIF Linear Table 0 */ | 92 | /* ISIF Linear Table 0 */ |
@@ -604,7 +601,7 @@ static int isif_config_raw(void) | |||
604 | if (module_params->compress.alg == ISIF_ALAW) | 601 | if (module_params->compress.alg == ISIF_ALAW) |
605 | val |= ISIF_ALAW_ENABLE; | 602 | val |= ISIF_ALAW_ENABLE; |
606 | 603 | ||
607 | val |= (params->data_msb << ISIF_ALAW_GAMA_WD_SHIFT); | 604 | val |= (params->data_msb << ISIF_ALAW_GAMMA_WD_SHIFT); |
608 | regw(val, CGAMMAWD); | 605 | regw(val, CGAMMAWD); |
609 | 606 | ||
610 | /* Configure DPCM compression settings */ | 607 | /* Configure DPCM compression settings */ |
@@ -1039,6 +1036,10 @@ static int isif_probe(struct platform_device *pdev) | |||
1039 | void *__iomem addr; | 1036 | void *__iomem addr; |
1040 | int status = 0, i; | 1037 | int status = 0, i; |
1041 | 1038 | ||
1039 | /* Platform data holds setup_pinmux function ptr */ | ||
1040 | if (!pdev->dev.platform_data) | ||
1041 | return -ENODEV; | ||
1042 | |||
1042 | /* | 1043 | /* |
1043 | * first try to register with vpfe. If not correct platform, then we | 1044 | * first try to register with vpfe. If not correct platform, then we |
1044 | * don't have to iomap | 1045 | * don't have to iomap |
@@ -1047,22 +1048,6 @@ static int isif_probe(struct platform_device *pdev) | |||
1047 | if (status < 0) | 1048 | if (status < 0) |
1048 | return status; | 1049 | return status; |
1049 | 1050 | ||
1050 | /* Get and enable Master clock */ | ||
1051 | isif_cfg.mclk = clk_get(&pdev->dev, "master"); | ||
1052 | if (IS_ERR(isif_cfg.mclk)) { | ||
1053 | status = PTR_ERR(isif_cfg.mclk); | ||
1054 | goto fail_mclk; | ||
1055 | } | ||
1056 | if (clk_prepare_enable(isif_cfg.mclk)) { | ||
1057 | status = -ENODEV; | ||
1058 | goto fail_mclk; | ||
1059 | } | ||
1060 | |||
1061 | /* Platform data holds setup_pinmux function ptr */ | ||
1062 | if (NULL == pdev->dev.platform_data) { | ||
1063 | status = -ENODEV; | ||
1064 | goto fail_mclk; | ||
1065 | } | ||
1066 | setup_pinmux = pdev->dev.platform_data; | 1051 | setup_pinmux = pdev->dev.platform_data; |
1067 | /* | 1052 | /* |
1068 | * setup Mux configuration for ccdc which may be different for | 1053 | * setup Mux configuration for ccdc which may be different for |
@@ -1124,9 +1109,6 @@ fail_nobase_res: | |||
1124 | release_mem_region(res->start, resource_size(res)); | 1109 | release_mem_region(res->start, resource_size(res)); |
1125 | i--; | 1110 | i--; |
1126 | } | 1111 | } |
1127 | fail_mclk: | ||
1128 | clk_disable_unprepare(isif_cfg.mclk); | ||
1129 | clk_put(isif_cfg.mclk); | ||
1130 | vpfe_unregister_ccdc_device(&isif_hw_dev); | 1112 | vpfe_unregister_ccdc_device(&isif_hw_dev); |
1131 | return status; | 1113 | return status; |
1132 | } | 1114 | } |
@@ -1146,8 +1128,6 @@ static int isif_remove(struct platform_device *pdev) | |||
1146 | i++; | 1128 | i++; |
1147 | } | 1129 | } |
1148 | vpfe_unregister_ccdc_device(&isif_hw_dev); | 1130 | vpfe_unregister_ccdc_device(&isif_hw_dev); |
1149 | clk_disable_unprepare(isif_cfg.mclk); | ||
1150 | clk_put(isif_cfg.mclk); | ||
1151 | return 0; | 1131 | return 0; |
1152 | } | 1132 | } |
1153 | 1133 | ||
diff --git a/drivers/media/platform/davinci/isif_regs.h b/drivers/media/platform/davinci/isif_regs.h index aa69a463c122..3993aece821b 100644 --- a/drivers/media/platform/davinci/isif_regs.h +++ b/drivers/media/platform/davinci/isif_regs.h | |||
@@ -203,8 +203,8 @@ | |||
203 | #define ISIF_LPF_MASK 1 | 203 | #define ISIF_LPF_MASK 1 |
204 | 204 | ||
205 | /* GAMMAWD registers */ | 205 | /* GAMMAWD registers */ |
206 | #define ISIF_ALAW_GAMA_WD_MASK 0xF | 206 | #define ISIF_ALAW_GAMMA_WD_MASK 0xF |
207 | #define ISIF_ALAW_GAMA_WD_SHIFT 1 | 207 | #define ISIF_ALAW_GAMMA_WD_SHIFT 1 |
208 | #define ISIF_ALAW_ENABLE 1 | 208 | #define ISIF_ALAW_ENABLE 1 |
209 | #define ISIF_GAMMAWD_CFA_SHIFT 5 | 209 | #define ISIF_GAMMAWD_CFA_SHIFT 5 |
210 | 210 | ||
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c index 4ca0f9a2ad8a..33b9660b7f77 100644 --- a/drivers/media/platform/davinci/vpbe.c +++ b/drivers/media/platform/davinci/vpbe.c | |||
@@ -344,7 +344,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev, | |||
344 | return -EINVAL; | 344 | return -EINVAL; |
345 | 345 | ||
346 | for (i = 0; i < output->num_modes; i++) { | 346 | for (i = 0; i < output->num_modes; i++) { |
347 | if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS && | 347 | if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS && |
348 | !memcmp(&output->modes[i].dv_timings, | 348 | !memcmp(&output->modes[i].dv_timings, |
349 | dv_timings, sizeof(*dv_timings))) | 349 | dv_timings, sizeof(*dv_timings))) |
350 | break; | 350 | break; |
@@ -385,7 +385,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev, | |||
385 | struct v4l2_dv_timings *dv_timings) | 385 | struct v4l2_dv_timings *dv_timings) |
386 | { | 386 | { |
387 | if (vpbe_dev->current_timings.timings_type & | 387 | if (vpbe_dev->current_timings.timings_type & |
388 | VPBE_ENC_CUSTOM_TIMINGS) { | 388 | VPBE_ENC_DV_TIMINGS) { |
389 | *dv_timings = vpbe_dev->current_timings.dv_timings; | 389 | *dv_timings = vpbe_dev->current_timings.dv_timings; |
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
@@ -412,7 +412,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev, | |||
412 | return -EINVAL; | 412 | return -EINVAL; |
413 | 413 | ||
414 | for (i = 0; i < output->num_modes; i++) { | 414 | for (i = 0; i < output->num_modes; i++) { |
415 | if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) { | 415 | if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS) { |
416 | if (j == timings->index) | 416 | if (j == timings->index) |
417 | break; | 417 | break; |
418 | j++; | 418 | j++; |
@@ -431,7 +431,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev, | |||
431 | * Sets the standard if supported by the current encoder. Return the status. | 431 | * Sets the standard if supported by the current encoder. Return the status. |
432 | * 0 - success & -EINVAL on error | 432 | * 0 - success & -EINVAL on error |
433 | */ | 433 | */ |
434 | static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) | 434 | static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id std_id) |
435 | { | 435 | { |
436 | struct vpbe_config *cfg = vpbe_dev->cfg; | 436 | struct vpbe_config *cfg = vpbe_dev->cfg; |
437 | int out_index = vpbe_dev->current_out_index; | 437 | int out_index = vpbe_dev->current_out_index; |
@@ -442,14 +442,14 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) | |||
442 | V4L2_OUT_CAP_STD)) | 442 | V4L2_OUT_CAP_STD)) |
443 | return -EINVAL; | 443 | return -EINVAL; |
444 | 444 | ||
445 | ret = vpbe_get_std_info(vpbe_dev, *std_id); | 445 | ret = vpbe_get_std_info(vpbe_dev, std_id); |
446 | if (ret) | 446 | if (ret) |
447 | return ret; | 447 | return ret; |
448 | 448 | ||
449 | mutex_lock(&vpbe_dev->lock); | 449 | mutex_lock(&vpbe_dev->lock); |
450 | 450 | ||
451 | ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, | 451 | ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, |
452 | s_std_output, *std_id); | 452 | s_std_output, std_id); |
453 | /* set the lcd controller output for the given mode */ | 453 | /* set the lcd controller output for the given mode */ |
454 | if (!ret) { | 454 | if (!ret) { |
455 | struct osd_state *osd_device = vpbe_dev->osd_device; | 455 | struct osd_state *osd_device = vpbe_dev->osd_device; |
@@ -513,9 +513,9 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, | |||
513 | */ | 513 | */ |
514 | if (preset_mode->timings_type & VPBE_ENC_STD) | 514 | if (preset_mode->timings_type & VPBE_ENC_STD) |
515 | return vpbe_s_std(vpbe_dev, | 515 | return vpbe_s_std(vpbe_dev, |
516 | &preset_mode->std_id); | 516 | preset_mode->std_id); |
517 | if (preset_mode->timings_type & | 517 | if (preset_mode->timings_type & |
518 | VPBE_ENC_CUSTOM_TIMINGS) { | 518 | VPBE_ENC_DV_TIMINGS) { |
519 | dv_timings = | 519 | dv_timings = |
520 | preset_mode->dv_timings; | 520 | preset_mode->dv_timings; |
521 | return vpbe_s_dv_timings(vpbe_dev, &dv_timings); | 521 | return vpbe_s_dv_timings(vpbe_dev, &dv_timings); |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 5e6b0cab514b..1802f11e939f 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -983,7 +983,7 @@ static int vpbe_display_try_fmt(struct file *file, void *priv, | |||
983 | * 0 - success & -EINVAL on error | 983 | * 0 - success & -EINVAL on error |
984 | */ | 984 | */ |
985 | static int vpbe_display_s_std(struct file *file, void *priv, | 985 | static int vpbe_display_s_std(struct file *file, void *priv, |
986 | v4l2_std_id *std_id) | 986 | v4l2_std_id std_id) |
987 | { | 987 | { |
988 | struct vpbe_fh *fh = priv; | 988 | struct vpbe_fh *fh = priv; |
989 | struct vpbe_layer *layer = fh->layer; | 989 | struct vpbe_layer *layer = fh->layer; |
@@ -1176,10 +1176,6 @@ vpbe_display_s_dv_timings(struct file *file, void *priv, | |||
1176 | "Failed to set the dv timings info\n"); | 1176 | "Failed to set the dv timings info\n"); |
1177 | return -EINVAL; | 1177 | return -EINVAL; |
1178 | } | 1178 | } |
1179 | /* set the current norm to zero to be consistent. If STD is used | ||
1180 | * v4l2 layer will set the norm properly on successful s_std call | ||
1181 | */ | ||
1182 | layer->video_dev.current_norm = 0; | ||
1183 | 1179 | ||
1184 | return 0; | 1180 | return 0; |
1185 | } | 1181 | } |
@@ -1202,7 +1198,7 @@ vpbe_display_g_dv_timings(struct file *file, void *priv, | |||
1202 | /* Get the given standard in the encoder */ | 1198 | /* Get the given standard in the encoder */ |
1203 | 1199 | ||
1204 | if (vpbe_dev->current_timings.timings_type & | 1200 | if (vpbe_dev->current_timings.timings_type & |
1205 | VPBE_ENC_CUSTOM_TIMINGS) { | 1201 | VPBE_ENC_DV_TIMINGS) { |
1206 | *dv_timings = vpbe_dev->current_timings.dv_timings; | 1202 | *dv_timings = vpbe_dev->current_timings.dv_timings; |
1207 | } else { | 1203 | } else { |
1208 | return -EINVAL; | 1204 | return -EINVAL; |
@@ -1404,6 +1400,7 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, | |||
1404 | q->ops = &video_qops; | 1400 | q->ops = &video_qops; |
1405 | q->mem_ops = &vb2_dma_contig_memops; | 1401 | q->mem_ops = &vb2_dma_contig_memops; |
1406 | q->buf_struct_size = sizeof(struct vpbe_disp_buffer); | 1402 | q->buf_struct_size = sizeof(struct vpbe_disp_buffer); |
1403 | q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | ||
1407 | 1404 | ||
1408 | ret = vb2_queue_init(q); | 1405 | ret = vb2_queue_init(q); |
1409 | if (ret) { | 1406 | if (ret) { |
@@ -1600,7 +1597,7 @@ static int vpbe_display_g_register(struct file *file, void *priv, | |||
1600 | } | 1597 | } |
1601 | 1598 | ||
1602 | static int vpbe_display_s_register(struct file *file, void *priv, | 1599 | static int vpbe_display_s_register(struct file *file, void *priv, |
1603 | struct v4l2_dbg_register *reg) | 1600 | const struct v4l2_dbg_register *reg) |
1604 | { | 1601 | { |
1605 | return 0; | 1602 | return 0; |
1606 | } | 1603 | } |
@@ -1693,12 +1690,8 @@ static int init_vpbe_layer(int i, struct vpbe_display *disp_dev, | |||
1693 | vbd->vfl_dir = VFL_DIR_TX; | 1690 | vbd->vfl_dir = VFL_DIR_TX; |
1694 | 1691 | ||
1695 | if (disp_dev->vpbe_dev->current_timings.timings_type & | 1692 | if (disp_dev->vpbe_dev->current_timings.timings_type & |
1696 | VPBE_ENC_STD) { | 1693 | VPBE_ENC_STD) |
1697 | vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); | 1694 | vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); |
1698 | vbd->current_norm = | ||
1699 | disp_dev->vpbe_dev->current_timings.std_id; | ||
1700 | } else | ||
1701 | vbd->current_norm = 0; | ||
1702 | 1695 | ||
1703 | snprintf(vbd->name, sizeof(vbd->name), | 1696 | snprintf(vbd->name, sizeof(vbd->name), |
1704 | "DaVinci_VPBE Display_DRIVER_V%d.%d.%d", | 1697 | "DaVinci_VPBE Display_DRIVER_V%d.%d.%d", |
diff --git a/drivers/media/platform/davinci/vpbe_osd.c b/drivers/media/platform/davinci/vpbe_osd.c index 12ad17c52ef3..396a51cbede7 100644 --- a/drivers/media/platform/davinci/vpbe_osd.c +++ b/drivers/media/platform/davinci/vpbe_osd.c | |||
@@ -52,6 +52,9 @@ static struct platform_device_id vpbe_osd_devtype[] = { | |||
52 | .name = DM355_VPBE_OSD_SUBDEV_NAME, | 52 | .name = DM355_VPBE_OSD_SUBDEV_NAME, |
53 | .driver_data = VPBE_VERSION_3, | 53 | .driver_data = VPBE_VERSION_3, |
54 | }, | 54 | }, |
55 | { | ||
56 | /* sentinel */ | ||
57 | } | ||
55 | }; | 58 | }; |
56 | 59 | ||
57 | MODULE_DEVICE_TABLE(platform, vpbe_osd_devtype); | 60 | MODULE_DEVICE_TABLE(platform, vpbe_osd_devtype); |
diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c index bdbebd59df98..87eef9be08ed 100644 --- a/drivers/media/platform/davinci/vpbe_venc.c +++ b/drivers/media/platform/davinci/vpbe_venc.c | |||
@@ -51,6 +51,9 @@ static struct platform_device_id vpbe_venc_devtype[] = { | |||
51 | .name = DM355_VPBE_VENC_SUBDEV_NAME, | 51 | .name = DM355_VPBE_VENC_SUBDEV_NAME, |
52 | .driver_data = VPBE_VERSION_3, | 52 | .driver_data = VPBE_VERSION_3, |
53 | }, | 53 | }, |
54 | { | ||
55 | /* sentinel */ | ||
56 | } | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | MODULE_DEVICE_TABLE(platform, vpbe_venc_devtype); | 59 | MODULE_DEVICE_TABLE(platform, vpbe_venc_devtype); |
@@ -199,6 +202,25 @@ static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable) | |||
199 | } | 202 | } |
200 | } | 203 | } |
201 | 204 | ||
205 | static void | ||
206 | venc_enable_vpss_clock(int venc_type, | ||
207 | enum vpbe_enc_timings_type type, | ||
208 | unsigned int pclock) | ||
209 | { | ||
210 | if (venc_type == VPBE_VERSION_1) | ||
211 | return; | ||
212 | |||
213 | if (venc_type == VPBE_VERSION_2 && (type == VPBE_ENC_STD || (type == | ||
214 | VPBE_ENC_DV_TIMINGS && pclock <= 27000000))) { | ||
215 | vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 1); | ||
216 | vpss_enable_clock(VPSS_VPBE_CLOCK, 1); | ||
217 | return; | ||
218 | } | ||
219 | |||
220 | if (venc_type == VPBE_VERSION_3 && type == VPBE_ENC_STD) | ||
221 | vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 0); | ||
222 | } | ||
223 | |||
202 | #define VDAC_CONFIG_SD_V3 0x0E21A6B6 | 224 | #define VDAC_CONFIG_SD_V3 0x0E21A6B6 |
203 | #define VDAC_CONFIG_SD_V2 0x081141CF | 225 | #define VDAC_CONFIG_SD_V2 0x081141CF |
204 | /* | 226 | /* |
@@ -217,6 +239,7 @@ static int venc_set_ntsc(struct v4l2_subdev *sd) | |||
217 | if (pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_525_60) < 0) | 239 | if (pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_525_60) < 0) |
218 | return -EINVAL; | 240 | return -EINVAL; |
219 | 241 | ||
242 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_STD, V4L2_STD_525_60); | ||
220 | venc_enabledigitaloutput(sd, 0); | 243 | venc_enabledigitaloutput(sd, 0); |
221 | 244 | ||
222 | if (venc->venc_type == VPBE_VERSION_3) { | 245 | if (venc->venc_type == VPBE_VERSION_3) { |
@@ -262,6 +285,7 @@ static int venc_set_pal(struct v4l2_subdev *sd) | |||
262 | if (venc->pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_625_50) < 0) | 285 | if (venc->pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_625_50) < 0) |
263 | return -EINVAL; | 286 | return -EINVAL; |
264 | 287 | ||
288 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_STD, V4L2_STD_625_50); | ||
265 | venc_enabledigitaloutput(sd, 0); | 289 | venc_enabledigitaloutput(sd, 0); |
266 | 290 | ||
267 | if (venc->venc_type == VPBE_VERSION_3) { | 291 | if (venc->venc_type == VPBE_VERSION_3) { |
@@ -313,9 +337,10 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd) | |||
313 | return -EINVAL; | 337 | return -EINVAL; |
314 | 338 | ||
315 | /* Setup clock at VPSS & VENC for SD */ | 339 | /* Setup clock at VPSS & VENC for SD */ |
316 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0) | 340 | if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0) |
317 | return -EINVAL; | 341 | return -EINVAL; |
318 | 342 | ||
343 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 27000000); | ||
319 | venc_enabledigitaloutput(sd, 0); | 344 | venc_enabledigitaloutput(sd, 0); |
320 | 345 | ||
321 | if (venc->venc_type == VPBE_VERSION_2) | 346 | if (venc->venc_type == VPBE_VERSION_2) |
@@ -360,9 +385,10 @@ static int venc_set_576p50(struct v4l2_subdev *sd) | |||
360 | venc->venc_type != VPBE_VERSION_2) | 385 | venc->venc_type != VPBE_VERSION_2) |
361 | return -EINVAL; | 386 | return -EINVAL; |
362 | /* Setup clock at VPSS & VENC for SD */ | 387 | /* Setup clock at VPSS & VENC for SD */ |
363 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0) | 388 | if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0) |
364 | return -EINVAL; | 389 | return -EINVAL; |
365 | 390 | ||
391 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 27000000); | ||
366 | venc_enabledigitaloutput(sd, 0); | 392 | venc_enabledigitaloutput(sd, 0); |
367 | 393 | ||
368 | if (venc->venc_type == VPBE_VERSION_2) | 394 | if (venc->venc_type == VPBE_VERSION_2) |
@@ -400,9 +426,10 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd) | |||
400 | struct venc_state *venc = to_state(sd); | 426 | struct venc_state *venc = to_state(sd); |
401 | struct venc_platform_data *pdata = venc->pdata; | 427 | struct venc_platform_data *pdata = venc->pdata; |
402 | 428 | ||
403 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0) | 429 | if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0) |
404 | return -EINVAL; | 430 | return -EINVAL; |
405 | 431 | ||
432 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 74250000); | ||
406 | venc_enabledigitaloutput(sd, 0); | 433 | venc_enabledigitaloutput(sd, 0); |
407 | 434 | ||
408 | venc_write(sd, VENC_OSDCLK0, 0); | 435 | venc_write(sd, VENC_OSDCLK0, 0); |
@@ -428,9 +455,10 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd) | |||
428 | struct venc_state *venc = to_state(sd); | 455 | struct venc_state *venc = to_state(sd); |
429 | struct venc_platform_data *pdata = venc->pdata; | 456 | struct venc_platform_data *pdata = venc->pdata; |
430 | 457 | ||
431 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0) | 458 | if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0) |
432 | return -EINVAL; | 459 | return -EINVAL; |
433 | 460 | ||
461 | venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 74250000); | ||
434 | venc_enabledigitaloutput(sd, 0); | 462 | venc_enabledigitaloutput(sd, 0); |
435 | 463 | ||
436 | venc_write(sd, VENC_OSDCLK0, 0); | 464 | venc_write(sd, VENC_OSDCLK0, 0); |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 28d019da4c01..8c50d3074866 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -376,7 +376,7 @@ static int vpfe_config_ccdc_image_format(struct vpfe_device *vpfe_dev) | |||
376 | * values in ccdc | 376 | * values in ccdc |
377 | */ | 377 | */ |
378 | static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, | 378 | static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, |
379 | const v4l2_std_id *std_id) | 379 | v4l2_std_id std_id) |
380 | { | 380 | { |
381 | struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev; | 381 | struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev; |
382 | struct v4l2_mbus_framefmt mbus_fmt; | 382 | struct v4l2_mbus_framefmt mbus_fmt; |
@@ -384,7 +384,7 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, | |||
384 | int i, ret = 0; | 384 | int i, ret = 0; |
385 | 385 | ||
386 | for (i = 0; i < ARRAY_SIZE(vpfe_standards); i++) { | 386 | for (i = 0; i < ARRAY_SIZE(vpfe_standards); i++) { |
387 | if (vpfe_standards[i].std_id & *std_id) { | 387 | if (vpfe_standards[i].std_id & std_id) { |
388 | vpfe_dev->std_info.active_pixels = | 388 | vpfe_dev->std_info.active_pixels = |
389 | vpfe_standards[i].width; | 389 | vpfe_standards[i].width; |
390 | vpfe_dev->std_info.active_lines = | 390 | vpfe_dev->std_info.active_lines = |
@@ -461,7 +461,7 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev) | |||
461 | 461 | ||
462 | /* Configure the default format information */ | 462 | /* Configure the default format information */ |
463 | ret = vpfe_config_image_format(vpfe_dev, | 463 | ret = vpfe_config_image_format(vpfe_dev, |
464 | &vpfe_standards[vpfe_dev->std_index].std_id); | 464 | vpfe_standards[vpfe_dev->std_index].std_id); |
465 | if (ret) | 465 | if (ret) |
466 | return ret; | 466 | return ret; |
467 | 467 | ||
@@ -1107,6 +1107,7 @@ static int vpfe_g_input(struct file *file, void *priv, unsigned int *index) | |||
1107 | static int vpfe_s_input(struct file *file, void *priv, unsigned int index) | 1107 | static int vpfe_s_input(struct file *file, void *priv, unsigned int index) |
1108 | { | 1108 | { |
1109 | struct vpfe_device *vpfe_dev = video_drvdata(file); | 1109 | struct vpfe_device *vpfe_dev = video_drvdata(file); |
1110 | struct v4l2_subdev *sd; | ||
1110 | struct vpfe_subdev_info *sdinfo; | 1111 | struct vpfe_subdev_info *sdinfo; |
1111 | int subdev_index, inp_index; | 1112 | int subdev_index, inp_index; |
1112 | struct vpfe_route *route; | 1113 | struct vpfe_route *route; |
@@ -1138,14 +1139,15 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) | |||
1138 | } | 1139 | } |
1139 | 1140 | ||
1140 | sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index]; | 1141 | sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index]; |
1142 | sd = vpfe_dev->sd[subdev_index]; | ||
1141 | route = &sdinfo->routes[inp_index]; | 1143 | route = &sdinfo->routes[inp_index]; |
1142 | if (route && sdinfo->can_route) { | 1144 | if (route && sdinfo->can_route) { |
1143 | input = route->input; | 1145 | input = route->input; |
1144 | output = route->output; | 1146 | output = route->output; |
1145 | } | 1147 | } |
1146 | 1148 | ||
1147 | ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, | 1149 | if (sd) |
1148 | video, s_routing, input, output, 0); | 1150 | ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0); |
1149 | 1151 | ||
1150 | if (ret) { | 1152 | if (ret) { |
1151 | v4l2_err(&vpfe_dev->v4l2_dev, | 1153 | v4l2_err(&vpfe_dev->v4l2_dev, |
@@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) | |||
1154 | goto unlock_out; | 1156 | goto unlock_out; |
1155 | } | 1157 | } |
1156 | vpfe_dev->current_subdev = sdinfo; | 1158 | vpfe_dev->current_subdev = sdinfo; |
1159 | if (sd) | ||
1160 | vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler; | ||
1157 | vpfe_dev->current_input = index; | 1161 | vpfe_dev->current_input = index; |
1158 | vpfe_dev->std_index = 0; | 1162 | vpfe_dev->std_index = 0; |
1159 | 1163 | ||
@@ -1164,7 +1168,7 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) | |||
1164 | 1168 | ||
1165 | /* set the default image parameters in the device */ | 1169 | /* set the default image parameters in the device */ |
1166 | ret = vpfe_config_image_format(vpfe_dev, | 1170 | ret = vpfe_config_image_format(vpfe_dev, |
1167 | &vpfe_standards[vpfe_dev->std_index].std_id); | 1171 | vpfe_standards[vpfe_dev->std_index].std_id); |
1168 | unlock_out: | 1172 | unlock_out: |
1169 | mutex_unlock(&vpfe_dev->lock); | 1173 | mutex_unlock(&vpfe_dev->lock); |
1170 | return ret; | 1174 | return ret; |
@@ -1189,7 +1193,7 @@ static int vpfe_querystd(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1189 | return ret; | 1193 | return ret; |
1190 | } | 1194 | } |
1191 | 1195 | ||
1192 | static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | 1196 | static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
1193 | { | 1197 | { |
1194 | struct vpfe_device *vpfe_dev = video_drvdata(file); | 1198 | struct vpfe_device *vpfe_dev = video_drvdata(file); |
1195 | struct vpfe_subdev_info *sdinfo; | 1199 | struct vpfe_subdev_info *sdinfo; |
@@ -1211,7 +1215,7 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1211 | } | 1215 | } |
1212 | 1216 | ||
1213 | ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, | 1217 | ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, |
1214 | core, s_std, *std_id); | 1218 | core, s_std, std_id); |
1215 | if (ret < 0) { | 1219 | if (ret < 0) { |
1216 | v4l2_err(&vpfe_dev->v4l2_dev, "Failed to set standard\n"); | 1220 | v4l2_err(&vpfe_dev->v4l2_dev, "Failed to set standard\n"); |
1217 | goto unlock_out; | 1221 | goto unlock_out; |
@@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv, | |||
1439 | buf, file->f_flags & O_NONBLOCK); | 1443 | buf, file->f_flags & O_NONBLOCK); |
1440 | } | 1444 | } |
1441 | 1445 | ||
1442 | static int vpfe_queryctrl(struct file *file, void *priv, | ||
1443 | struct v4l2_queryctrl *qctrl) | ||
1444 | { | ||
1445 | struct vpfe_device *vpfe_dev = video_drvdata(file); | ||
1446 | struct vpfe_subdev_info *sdinfo; | ||
1447 | |||
1448 | sdinfo = vpfe_dev->current_subdev; | ||
1449 | |||
1450 | return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, | ||
1451 | core, queryctrl, qctrl); | ||
1452 | |||
1453 | } | ||
1454 | |||
1455 | static int vpfe_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) | ||
1456 | { | ||
1457 | struct vpfe_device *vpfe_dev = video_drvdata(file); | ||
1458 | struct vpfe_subdev_info *sdinfo; | ||
1459 | |||
1460 | sdinfo = vpfe_dev->current_subdev; | ||
1461 | |||
1462 | return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, | ||
1463 | core, g_ctrl, ctrl); | ||
1464 | } | ||
1465 | |||
1466 | static int vpfe_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) | ||
1467 | { | ||
1468 | struct vpfe_device *vpfe_dev = video_drvdata(file); | ||
1469 | struct vpfe_subdev_info *sdinfo; | ||
1470 | |||
1471 | sdinfo = vpfe_dev->current_subdev; | ||
1472 | |||
1473 | return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, | ||
1474 | core, s_ctrl, ctrl); | ||
1475 | } | ||
1476 | |||
1477 | /* | 1446 | /* |
1478 | * vpfe_calculate_offsets : This function calculates buffers offset | 1447 | * vpfe_calculate_offsets : This function calculates buffers offset |
1479 | * for top and bottom field | 1448 | * for top and bottom field |
@@ -1717,7 +1686,7 @@ unlock_out: | |||
1717 | 1686 | ||
1718 | 1687 | ||
1719 | static long vpfe_param_handler(struct file *file, void *priv, | 1688 | static long vpfe_param_handler(struct file *file, void *priv, |
1720 | bool valid_prio, int cmd, void *param) | 1689 | bool valid_prio, unsigned int cmd, void *param) |
1721 | { | 1690 | { |
1722 | struct vpfe_device *vpfe_dev = video_drvdata(file); | 1691 | struct vpfe_device *vpfe_dev = video_drvdata(file); |
1723 | int ret = 0; | 1692 | int ret = 0; |
@@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { | |||
1781 | .vidioc_querystd = vpfe_querystd, | 1750 | .vidioc_querystd = vpfe_querystd, |
1782 | .vidioc_s_std = vpfe_s_std, | 1751 | .vidioc_s_std = vpfe_s_std, |
1783 | .vidioc_g_std = vpfe_g_std, | 1752 | .vidioc_g_std = vpfe_g_std, |
1784 | .vidioc_queryctrl = vpfe_queryctrl, | ||
1785 | .vidioc_g_ctrl = vpfe_g_ctrl, | ||
1786 | .vidioc_s_ctrl = vpfe_s_ctrl, | ||
1787 | .vidioc_reqbufs = vpfe_reqbufs, | 1753 | .vidioc_reqbufs = vpfe_reqbufs, |
1788 | .vidioc_querybuf = vpfe_querybuf, | 1754 | .vidioc_querybuf = vpfe_querybuf, |
1789 | .vidioc_qbuf = vpfe_qbuf, | 1755 | .vidioc_qbuf = vpfe_qbuf, |
@@ -1918,7 +1884,6 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1918 | vfd->fops = &vpfe_fops; | 1884 | vfd->fops = &vpfe_fops; |
1919 | vfd->ioctl_ops = &vpfe_ioctl_ops; | 1885 | vfd->ioctl_ops = &vpfe_ioctl_ops; |
1920 | vfd->tvnorms = 0; | 1886 | vfd->tvnorms = 0; |
1921 | vfd->current_norm = V4L2_STD_PAL; | ||
1922 | vfd->v4l2_dev = &vpfe_dev->v4l2_dev; | 1887 | vfd->v4l2_dev = &vpfe_dev->v4l2_dev; |
1923 | snprintf(vfd->name, sizeof(vfd->name), | 1888 | snprintf(vfd->name, sizeof(vfd->name), |
1924 | "%s_V%d.%d.%d", | 1889 | "%s_V%d.%d.%d", |
@@ -2007,6 +1972,7 @@ static int vpfe_probe(struct platform_device *pdev) | |||
2007 | 1972 | ||
2008 | /* set first sub device as current one */ | 1973 | /* set first sub device as current one */ |
2009 | vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0]; | 1974 | vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0]; |
1975 | vpfe_dev->v4l2_dev.ctrl_handler = vpfe_dev->sd[0]->ctrl_handler; | ||
2010 | 1976 | ||
2011 | /* We have at least one sub device to work with */ | 1977 | /* We have at least one sub device to work with */ |
2012 | mutex_unlock(&ccdc_lock); | 1978 | mutex_unlock(&ccdc_lock); |
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 28638a86f129..ea82a8bd2803 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | ||
27 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/v4l2-dv-timings.h> | 28 | #include <linux/v4l2-dv-timings.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
@@ -44,13 +44,13 @@ static struct resource *res; | |||
44 | spinlock_t vpif_lock; | 44 | spinlock_t vpif_lock; |
45 | 45 | ||
46 | void __iomem *vpif_base; | 46 | void __iomem *vpif_base; |
47 | struct clk *vpif_clk; | 47 | EXPORT_SYMBOL_GPL(vpif_base); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * ch_params: video standard configuration parameters for vpif | 50 | * vpif_ch_params: video standard configuration parameters for vpif |
51 | * The table must include all presets from supported subdevices. | 51 | * The table must include all presets from supported subdevices. |
52 | */ | 52 | */ |
53 | const struct vpif_channel_config_params ch_params[] = { | 53 | const struct vpif_channel_config_params vpif_ch_params[] = { |
54 | /* HDTV formats */ | 54 | /* HDTV formats */ |
55 | { | 55 | { |
56 | .name = "480p59_94", | 56 | .name = "480p59_94", |
@@ -220,8 +220,10 @@ const struct vpif_channel_config_params ch_params[] = { | |||
220 | .stdid = V4L2_STD_625_50, | 220 | .stdid = V4L2_STD_625_50, |
221 | }, | 221 | }, |
222 | }; | 222 | }; |
223 | EXPORT_SYMBOL_GPL(vpif_ch_params); | ||
223 | 224 | ||
224 | const unsigned int vpif_ch_params_count = ARRAY_SIZE(ch_params); | 225 | const unsigned int vpif_ch_params_count = ARRAY_SIZE(vpif_ch_params); |
226 | EXPORT_SYMBOL_GPL(vpif_ch_params_count); | ||
225 | 227 | ||
226 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) | 228 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) |
227 | { | 229 | { |
@@ -439,19 +441,13 @@ static int vpif_probe(struct platform_device *pdev) | |||
439 | goto fail; | 441 | goto fail; |
440 | } | 442 | } |
441 | 443 | ||
442 | vpif_clk = clk_get(&pdev->dev, "vpif"); | 444 | pm_runtime_enable(&pdev->dev); |
443 | if (IS_ERR(vpif_clk)) { | 445 | pm_runtime_get(&pdev->dev); |
444 | status = PTR_ERR(vpif_clk); | ||
445 | goto clk_fail; | ||
446 | } | ||
447 | clk_prepare_enable(vpif_clk); | ||
448 | 446 | ||
449 | spin_lock_init(&vpif_lock); | 447 | spin_lock_init(&vpif_lock); |
450 | dev_info(&pdev->dev, "vpif probe success\n"); | 448 | dev_info(&pdev->dev, "vpif probe success\n"); |
451 | return 0; | 449 | return 0; |
452 | 450 | ||
453 | clk_fail: | ||
454 | iounmap(vpif_base); | ||
455 | fail: | 451 | fail: |
456 | release_mem_region(res->start, res_len); | 452 | release_mem_region(res->start, res_len); |
457 | return status; | 453 | return status; |
@@ -459,11 +455,7 @@ fail: | |||
459 | 455 | ||
460 | static int vpif_remove(struct platform_device *pdev) | 456 | static int vpif_remove(struct platform_device *pdev) |
461 | { | 457 | { |
462 | if (vpif_clk) { | 458 | pm_runtime_disable(&pdev->dev); |
463 | clk_disable_unprepare(vpif_clk); | ||
464 | clk_put(vpif_clk); | ||
465 | } | ||
466 | |||
467 | iounmap(vpif_base); | 459 | iounmap(vpif_base); |
468 | release_mem_region(res->start, res_len); | 460 | release_mem_region(res->start, res_len); |
469 | return 0; | 461 | return 0; |
@@ -472,13 +464,13 @@ static int vpif_remove(struct platform_device *pdev) | |||
472 | #ifdef CONFIG_PM | 464 | #ifdef CONFIG_PM |
473 | static int vpif_suspend(struct device *dev) | 465 | static int vpif_suspend(struct device *dev) |
474 | { | 466 | { |
475 | clk_disable_unprepare(vpif_clk); | 467 | pm_runtime_put(dev); |
476 | return 0; | 468 | return 0; |
477 | } | 469 | } |
478 | 470 | ||
479 | static int vpif_resume(struct device *dev) | 471 | static int vpif_resume(struct device *dev) |
480 | { | 472 | { |
481 | clk_prepare_enable(vpif_clk); | 473 | pm_runtime_get(dev); |
482 | return 0; | 474 | return 0; |
483 | } | 475 | } |
484 | 476 | ||
diff --git a/drivers/media/platform/davinci/vpif.h b/drivers/media/platform/davinci/vpif.h index a1ab6a0f4e9e..9956e6788693 100644 --- a/drivers/media/platform/davinci/vpif.h +++ b/drivers/media/platform/davinci/vpif.h | |||
@@ -638,7 +638,7 @@ struct vpif_channel_config_params { | |||
638 | }; | 638 | }; |
639 | 639 | ||
640 | extern const unsigned int vpif_ch_params_count; | 640 | extern const unsigned int vpif_ch_params_count; |
641 | extern const struct vpif_channel_config_params ch_params[]; | 641 | extern const struct vpif_channel_config_params vpif_ch_params[]; |
642 | 642 | ||
643 | struct vpif_video_params; | 643 | struct vpif_video_params; |
644 | struct vpif_params; | 644 | struct vpif_params; |
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 5892d2bc8eee..5f98df1fc8a0 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
@@ -563,7 +563,7 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
563 | vpif_dbg(2, debug, "vpif_update_std_info\n"); | 563 | vpif_dbg(2, debug, "vpif_update_std_info\n"); |
564 | 564 | ||
565 | for (index = 0; index < vpif_ch_params_count; index++) { | 565 | for (index = 0; index < vpif_ch_params_count; index++) { |
566 | config = &ch_params[index]; | 566 | config = &vpif_ch_params[index]; |
567 | if (config->hd_sd == 0) { | 567 | if (config->hd_sd == 0) { |
568 | vpif_dbg(2, debug, "SD format\n"); | 568 | vpif_dbg(2, debug, "SD format\n"); |
569 | if (config->stdid & vid_ch->stdid) { | 569 | if (config->stdid & vid_ch->stdid) { |
@@ -1035,6 +1035,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
1035 | q->ops = &video_qops; | 1035 | q->ops = &video_qops; |
1036 | q->mem_ops = &vb2_dma_contig_memops; | 1036 | q->mem_ops = &vb2_dma_contig_memops; |
1037 | q->buf_struct_size = sizeof(struct vpif_cap_buffer); | 1037 | q->buf_struct_size = sizeof(struct vpif_cap_buffer); |
1038 | q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | ||
1038 | 1039 | ||
1039 | ret = vb2_queue_init(q); | 1040 | ret = vb2_queue_init(q); |
1040 | if (ret) { | 1041 | if (ret) { |
@@ -1394,7 +1395,7 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) | |||
1394 | * @priv: file handle | 1395 | * @priv: file handle |
1395 | * @std_id: ptr to std id | 1396 | * @std_id: ptr to std id |
1396 | */ | 1397 | */ |
1397 | static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | 1398 | static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
1398 | { | 1399 | { |
1399 | struct vpif_fh *fh = priv; | 1400 | struct vpif_fh *fh = priv; |
1400 | struct channel_obj *ch = fh->channel; | 1401 | struct channel_obj *ch = fh->channel; |
@@ -1423,7 +1424,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1423 | fh->initialized = 1; | 1424 | fh->initialized = 1; |
1424 | 1425 | ||
1425 | /* Call encoder subdevice function to set the standard */ | 1426 | /* Call encoder subdevice function to set the standard */ |
1426 | ch->video.stdid = *std_id; | 1427 | ch->video.stdid = std_id; |
1427 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); | 1428 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); |
1428 | 1429 | ||
1429 | /* Get the information about the standard */ | 1430 | /* Get the information about the standard */ |
@@ -1436,7 +1437,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1436 | vpif_config_format(ch); | 1437 | vpif_config_format(ch); |
1437 | 1438 | ||
1438 | /* set standard in the sub device */ | 1439 | /* set standard in the sub device */ |
1439 | ret = v4l2_subdev_call(ch->sd, core, s_std, *std_id); | 1440 | ret = v4l2_subdev_call(ch->sd, core, s_std, std_id); |
1440 | if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) { | 1441 | if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) { |
1441 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); | 1442 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); |
1442 | return ret; | 1443 | return ret; |
@@ -1923,7 +1924,8 @@ static int vpif_dbg_g_register(struct file *file, void *priv, | |||
1923 | * Returns zero or -EINVAL if write operations fails. | 1924 | * Returns zero or -EINVAL if write operations fails. |
1924 | */ | 1925 | */ |
1925 | static int vpif_dbg_s_register(struct file *file, void *priv, | 1926 | static int vpif_dbg_s_register(struct file *file, void *priv, |
1926 | struct v4l2_dbg_register *reg){ | 1927 | const struct v4l2_dbg_register *reg) |
1928 | { | ||
1927 | struct vpif_fh *fh = priv; | 1929 | struct vpif_fh *fh = priv; |
1928 | struct channel_obj *ch = fh->channel; | 1930 | struct channel_obj *ch = fh->channel; |
1929 | 1931 | ||
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index dd249c96126d..1b3fb5ca2ad4 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c | |||
@@ -511,7 +511,7 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
511 | int i; | 511 | int i; |
512 | 512 | ||
513 | for (i = 0; i < vpif_ch_params_count; i++) { | 513 | for (i = 0; i < vpif_ch_params_count; i++) { |
514 | config = &ch_params[i]; | 514 | config = &vpif_ch_params[i]; |
515 | if (config->hd_sd == 0) { | 515 | if (config->hd_sd == 0) { |
516 | vpif_dbg(2, debug, "SD format\n"); | 516 | vpif_dbg(2, debug, "SD format\n"); |
517 | if (config->stdid & vid_ch->stdid) { | 517 | if (config->stdid & vid_ch->stdid) { |
@@ -1001,6 +1001,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
1001 | q->ops = &video_qops; | 1001 | q->ops = &video_qops; |
1002 | q->mem_ops = &vb2_dma_contig_memops; | 1002 | q->mem_ops = &vb2_dma_contig_memops; |
1003 | q->buf_struct_size = sizeof(struct vpif_disp_buffer); | 1003 | q->buf_struct_size = sizeof(struct vpif_disp_buffer); |
1004 | q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | ||
1004 | 1005 | ||
1005 | ret = vb2_queue_init(q); | 1006 | ret = vb2_queue_init(q); |
1006 | if (ret) { | 1007 | if (ret) { |
@@ -1058,14 +1059,14 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
1058 | return vb2_qbuf(&common->buffer_queue, buf); | 1059 | return vb2_qbuf(&common->buffer_queue, buf); |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | 1062 | static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
1062 | { | 1063 | { |
1063 | struct vpif_fh *fh = priv; | 1064 | struct vpif_fh *fh = priv; |
1064 | struct channel_obj *ch = fh->channel; | 1065 | struct channel_obj *ch = fh->channel; |
1065 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 1066 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
1066 | int ret = 0; | 1067 | int ret = 0; |
1067 | 1068 | ||
1068 | if (!(*std_id & VPIF_V4L2_STD)) | 1069 | if (!(std_id & VPIF_V4L2_STD)) |
1069 | return -EINVAL; | 1070 | return -EINVAL; |
1070 | 1071 | ||
1071 | if (common->started) { | 1072 | if (common->started) { |
@@ -1074,7 +1075,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1074 | } | 1075 | } |
1075 | 1076 | ||
1076 | /* Call encoder subdevice function to set the standard */ | 1077 | /* Call encoder subdevice function to set the standard */ |
1077 | ch->video.stdid = *std_id; | 1078 | ch->video.stdid = std_id; |
1078 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); | 1079 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); |
1079 | /* Get the information about the standard */ | 1080 | /* Get the information about the standard */ |
1080 | if (vpif_update_resolution(ch)) | 1081 | if (vpif_update_resolution(ch)) |
@@ -1092,14 +1093,14 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1092 | vpif_config_format(ch); | 1093 | vpif_config_format(ch); |
1093 | 1094 | ||
1094 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video, | 1095 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video, |
1095 | s_std_output, *std_id); | 1096 | s_std_output, std_id); |
1096 | if (ret < 0) { | 1097 | if (ret < 0) { |
1097 | vpif_err("Failed to set output standard\n"); | 1098 | vpif_err("Failed to set output standard\n"); |
1098 | return ret; | 1099 | return ret; |
1099 | } | 1100 | } |
1100 | 1101 | ||
1101 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core, | 1102 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core, |
1102 | s_std, *std_id); | 1103 | s_std, std_id); |
1103 | if (ret < 0) | 1104 | if (ret < 0) |
1104 | vpif_err("Failed to set standard for sub devices\n"); | 1105 | vpif_err("Failed to set standard for sub devices\n"); |
1105 | return ret; | 1106 | return ret; |
@@ -1567,7 +1568,8 @@ static int vpif_dbg_g_register(struct file *file, void *priv, | |||
1567 | * Returns zero or -EINVAL if write operations fails. | 1568 | * Returns zero or -EINVAL if write operations fails. |
1568 | */ | 1569 | */ |
1569 | static int vpif_dbg_s_register(struct file *file, void *priv, | 1570 | static int vpif_dbg_s_register(struct file *file, void *priv, |
1570 | struct v4l2_dbg_register *reg){ | 1571 | const struct v4l2_dbg_register *reg) |
1572 | { | ||
1571 | struct vpif_fh *fh = priv; | 1573 | struct vpif_fh *fh = priv; |
1572 | struct channel_obj *ch = fh->channel; | 1574 | struct channel_obj *ch = fh->channel; |
1573 | 1575 | ||
diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c index a19c552232d1..8a2f01e344ee 100644 --- a/drivers/media/platform/davinci/vpss.c +++ b/drivers/media/platform/davinci/vpss.c | |||
@@ -17,14 +17,11 @@ | |||
17 | * | 17 | * |
18 | * common vpss system module platform driver for all video drivers. | 18 | * common vpss system module platform driver for all video drivers. |
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | 20 | #include <linux/module.h> |
24 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
25 | #include <linux/spinlock.h> | ||
26 | #include <linux/compiler.h> | ||
27 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/pm_runtime.h> | ||
24 | |||
28 | #include <media/davinci/vpss.h> | 25 | #include <media/davinci/vpss.h> |
29 | 26 | ||
30 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
@@ -99,7 +96,7 @@ enum vpss_platform_type { | |||
99 | 96 | ||
100 | /* | 97 | /* |
101 | * vpss operations. Depends on platform. Not all functions are available | 98 | * vpss operations. Depends on platform. Not all functions are available |
102 | * on all platforms. The api, first check if a functio is available before | 99 | * on all platforms. The api, first check if a function is available before |
103 | * invoking it. In the probe, the function ptrs are initialized based on | 100 | * invoking it. In the probe, the function ptrs are initialized based on |
104 | * vpss name. vpss name can be "dm355_vpss", "dm644x_vpss" etc. | 101 | * vpss name. vpss name can be "dm355_vpss", "dm644x_vpss" etc. |
105 | */ | 102 | */ |
@@ -114,7 +111,7 @@ struct vpss_hw_ops { | |||
114 | void (*set_sync_pol)(struct vpss_sync_pol); | 111 | void (*set_sync_pol)(struct vpss_sync_pol); |
115 | /* set the PG_FRAME_SIZE register*/ | 112 | /* set the PG_FRAME_SIZE register*/ |
116 | void (*set_pg_frame_size)(struct vpss_pg_frame_size); | 113 | void (*set_pg_frame_size)(struct vpss_pg_frame_size); |
117 | /* check and clear interrupt if occured */ | 114 | /* check and clear interrupt if occurred */ |
118 | int (*dma_complete_interrupt)(void); | 115 | int (*dma_complete_interrupt)(void); |
119 | }; | 116 | }; |
120 | 117 | ||
@@ -233,7 +230,7 @@ EXPORT_SYMBOL(vpss_clear_wbl_overflow); | |||
233 | 230 | ||
234 | /* | 231 | /* |
235 | * dm355_enable_clock - Enable VPSS Clock | 232 | * dm355_enable_clock - Enable VPSS Clock |
236 | * @clock_sel: CLock to be enabled/disabled | 233 | * @clock_sel: Clock to be enabled/disabled |
237 | * @en: enable/disable flag | 234 | * @en: enable/disable flag |
238 | * | 235 | * |
239 | * This is called to enable or disable a vpss clock | 236 | * This is called to enable or disable a vpss clock |
@@ -490,6 +487,10 @@ static int vpss_probe(struct platform_device *pdev) | |||
490 | } else | 487 | } else |
491 | oper_cfg.hw_ops.clear_wbl_overflow = dm644x_clear_wbl_overflow; | 488 | oper_cfg.hw_ops.clear_wbl_overflow = dm644x_clear_wbl_overflow; |
492 | 489 | ||
490 | pm_runtime_enable(&pdev->dev); | ||
491 | |||
492 | pm_runtime_get(&pdev->dev); | ||
493 | |||
493 | spin_lock_init(&oper_cfg.vpss_lock); | 494 | spin_lock_init(&oper_cfg.vpss_lock); |
494 | dev_info(&pdev->dev, "%s vpss probe success\n", platform_name); | 495 | dev_info(&pdev->dev, "%s vpss probe success\n", platform_name); |
495 | return 0; | 496 | return 0; |
@@ -507,6 +508,7 @@ static int vpss_remove(struct platform_device *pdev) | |||
507 | { | 508 | { |
508 | struct resource *res; | 509 | struct resource *res; |
509 | 510 | ||
511 | pm_runtime_disable(&pdev->dev); | ||
510 | iounmap(oper_cfg.vpss_regs_base0); | 512 | iounmap(oper_cfg.vpss_regs_base0); |
511 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 513 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
512 | release_mem_region(res->start, resource_size(res)); | 514 | release_mem_region(res->start, resource_size(res)); |
@@ -518,10 +520,28 @@ static int vpss_remove(struct platform_device *pdev) | |||
518 | return 0; | 520 | return 0; |
519 | } | 521 | } |
520 | 522 | ||
523 | static int vpss_suspend(struct device *dev) | ||
524 | { | ||
525 | pm_runtime_put(dev); | ||
526 | return 0; | ||
527 | } | ||
528 | |||
529 | static int vpss_resume(struct device *dev) | ||
530 | { | ||
531 | pm_runtime_get(dev); | ||
532 | return 0; | ||
533 | } | ||
534 | |||
535 | static const struct dev_pm_ops vpss_pm_ops = { | ||
536 | .suspend = vpss_suspend, | ||
537 | .resume = vpss_resume, | ||
538 | }; | ||
539 | |||
521 | static struct platform_driver vpss_driver = { | 540 | static struct platform_driver vpss_driver = { |
522 | .driver = { | 541 | .driver = { |
523 | .name = "vpss", | 542 | .name = "vpss", |
524 | .owner = THIS_MODULE, | 543 | .owner = THIS_MODULE, |
544 | .pm = &vpss_pm_ops, | ||
525 | }, | 545 | }, |
526 | .remove = vpss_remove, | 546 | .remove = vpss_remove, |
527 | .probe = vpss_probe, | 547 | .probe = vpss_probe, |