diff options
| author | Benoit Parrot <bparrot@ti.com> | 2014-12-09 14:43:44 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-12-23 09:09:58 -0500 |
| commit | 417d2e507edcb5cf15eb344f86bd3dd28737f24e (patch) | |
| tree | c4f5d7079f63144c28aa5ceb6d7a94d7c62ae8cc | |
| parent | 3b1635e02e524e2cc7bded4b998d35074b68065e (diff) | |
[media] media: platform: add VPFE capture driver support for AM437X
This patch adds Video Processing Front End (VPFE) driver for
AM437X family of devices
Driver supports the following:
- V4L2 API using MMAP buffer access based on videobuf2 api
- Asynchronous sensor/decoder sub device registration
- DT support
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
[hans.verkuil@cisco.com: swapped two lines to fix vpfe_release() & add pinctrl include]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
| -rw-r--r-- | Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt | 61 | ||||
| -rw-r--r-- | MAINTAINERS | 9 | ||||
| -rw-r--r-- | drivers/media/platform/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/media/platform/Makefile | 2 | ||||
| -rw-r--r-- | drivers/media/platform/am437x/Kconfig | 11 | ||||
| -rw-r--r-- | drivers/media/platform/am437x/Makefile | 3 | ||||
| -rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe.c | 2778 | ||||
| -rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe.h | 283 | ||||
| -rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe_regs.h | 140 | ||||
| -rw-r--r-- | include/uapi/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/uapi/linux/am437x-vpfe.h | 122 |
11 files changed, 3411 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt new file mode 100644 index 000000000000..3932e766553a --- /dev/null +++ b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | Texas Instruments AM437x CAMERA (VPFE) | ||
| 2 | -------------------------------------- | ||
| 3 | |||
| 4 | The Video Processing Front End (VPFE) is a key component for image capture | ||
| 5 | applications. The capture module provides the system interface and the | ||
| 6 | processing capability to connect RAW image-sensor modules and video decoders | ||
| 7 | to the AM437x device. | ||
| 8 | |||
| 9 | Required properties: | ||
| 10 | - compatible: must be "ti,am437x-vpfe" | ||
| 11 | - reg: physical base address and length of the registers set for the device; | ||
| 12 | - interrupts: should contain IRQ line for the VPFE; | ||
| 13 | - ti,am437x-vpfe-interface: can be one of the following, | ||
| 14 | 0 - Raw Bayer Interface. | ||
| 15 | 1 - 8 Bit BT656 Interface. | ||
| 16 | 2 - 10 Bit BT656 Interface. | ||
| 17 | 3 - YCbCr 8 Bit Interface. | ||
| 18 | 4 - YCbCr 16 Bit Interface. | ||
| 19 | |||
| 20 | VPFE supports a single port node with parallel bus. It should contain one | ||
| 21 | 'port' child node with child 'endpoint' node. Please refer to the bindings | ||
| 22 | defined in Documentation/devicetree/bindings/media/video-interfaces.txt. | ||
| 23 | |||
| 24 | Example: | ||
| 25 | vpfe: vpfe@f0034000 { | ||
| 26 | compatible = "ti,am437x-vpfe"; | ||
| 27 | reg = <0x48328000 0x2000>; | ||
| 28 | interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>; | ||
| 29 | |||
| 30 | pinctrl-names = "default", "sleep"; | ||
| 31 | pinctrl-0 = <&vpfe_pins_default>; | ||
| 32 | pinctrl-1 = <&vpfe_pins_sleep>; | ||
| 33 | |||
| 34 | port { | ||
| 35 | #address-cells = <1>; | ||
| 36 | #size-cells = <0>; | ||
| 37 | |||
| 38 | vpfe0_ep: endpoint { | ||
| 39 | remote-endpoint = <&ov2659_1>; | ||
| 40 | ti,am437x-vpfe-interface = <0>; | ||
| 41 | bus-width = <8>; | ||
| 42 | hsync-active = <0>; | ||
| 43 | vsync-active = <0>; | ||
| 44 | }; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | |||
| 48 | i2c1: i2c@4802a000 { | ||
| 49 | |||
| 50 | ov2659@30 { | ||
| 51 | compatible = "ti,ov2659"; | ||
| 52 | reg = <0x30>; | ||
| 53 | |||
| 54 | port { | ||
| 55 | ov2659_1: endpoint { | ||
| 56 | remote-endpoint = <&vpfe0_ep>; | ||
| 57 | bus-width = <8>; | ||
| 58 | mclk-frequency = <12000000>; | ||
| 59 | }; | ||
| 60 | }; | ||
| 61 | }; | ||
diff --git a/MAINTAINERS b/MAINTAINERS index dc2d91252d8b..4318f348dbd8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -8745,6 +8745,15 @@ S: Maintained | |||
| 8745 | F: drivers/media/platform/davinci/ | 8745 | F: drivers/media/platform/davinci/ |
| 8746 | F: include/media/davinci/ | 8746 | F: include/media/davinci/ |
| 8747 | 8747 | ||
| 8748 | TI AM437X VPFE DRIVER | ||
| 8749 | M: Lad, Prabhakar <prabhakar.csengg@gmail.com> | ||
| 8750 | L: linux-media@vger.kernel.org | ||
| 8751 | W: http://linuxtv.org/ | ||
| 8752 | Q: http://patchwork.linuxtv.org/project/linux-media/list/ | ||
| 8753 | T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git | ||
| 8754 | S: Maintained | ||
| 8755 | F: drivers/media/platform/am437x/ | ||
| 8756 | |||
| 8748 | SIS 190 ETHERNET DRIVER | 8757 | SIS 190 ETHERNET DRIVER |
| 8749 | M: Francois Romieu <romieu@fr.zoreil.com> | 8758 | M: Francois Romieu <romieu@fr.zoreil.com> |
| 8750 | L: netdev@vger.kernel.org | 8759 | L: netdev@vger.kernel.org |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 480a174832a6..71e8873ceb94 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
| @@ -118,6 +118,7 @@ config VIDEO_S3C_CAMIF | |||
| 118 | source "drivers/media/platform/soc_camera/Kconfig" | 118 | source "drivers/media/platform/soc_camera/Kconfig" |
| 119 | source "drivers/media/platform/exynos4-is/Kconfig" | 119 | source "drivers/media/platform/exynos4-is/Kconfig" |
| 120 | source "drivers/media/platform/s5p-tv/Kconfig" | 120 | source "drivers/media/platform/s5p-tv/Kconfig" |
| 121 | source "drivers/media/platform/am437x/Kconfig" | ||
| 121 | 122 | ||
| 122 | endif # V4L_PLATFORM_DRIVERS | 123 | endif # V4L_PLATFORM_DRIVERS |
| 123 | 124 | ||
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index a49936b8ce8a..3ec154742083 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile | |||
| @@ -46,4 +46,6 @@ obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1/ | |||
| 46 | 46 | ||
| 47 | obj-y += omap/ | 47 | obj-y += omap/ |
| 48 | 48 | ||
| 49 | obj-$(CONFIG_VIDEO_AM437X_VPFE) += am437x/ | ||
| 50 | |||
| 49 | ccflags-y += -I$(srctree)/drivers/media/i2c | 51 | ccflags-y += -I$(srctree)/drivers/media/i2c |
diff --git a/drivers/media/platform/am437x/Kconfig b/drivers/media/platform/am437x/Kconfig new file mode 100644 index 000000000000..7b023a76e32e --- /dev/null +++ b/drivers/media/platform/am437x/Kconfig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | config VIDEO_AM437X_VPFE | ||
| 2 | tristate "TI AM437x VPFE video capture driver" | ||
| 3 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API | ||
| 4 | depends on SOC_AM43XX || COMPILE_TEST | ||
| 5 | select VIDEOBUF2_DMA_CONTIG | ||
| 6 | help | ||
| 7 | Support for AM437x Video Processing Front End based Video | ||
| 8 | Capture Driver. | ||
| 9 | |||
| 10 | To compile this driver as a module, choose M here. The module | ||
| 11 | will be called am437x-vpfe. | ||
diff --git a/drivers/media/platform/am437x/Makefile b/drivers/media/platform/am437x/Makefile new file mode 100644 index 000000000000..d11fff16f260 --- /dev/null +++ b/drivers/media/platform/am437x/Makefile | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Makefile for AM437x VPFE driver | ||
| 2 | |||
| 3 | obj-$(CONFIG_VIDEO_AM437X_VPFE) += am437x-vpfe.o | ||
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c new file mode 100644 index 000000000000..e01ac22d6244 --- /dev/null +++ b/drivers/media/platform/am437x/am437x-vpfe.c | |||
| @@ -0,0 +1,2778 @@ | |||
| 1 | /* | ||
| 2 | * TI VPFE capture Driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2013 - 2014 Texas Instruments, Inc. | ||
| 5 | * | ||
| 6 | * Benoit Parrot <bparrot@ti.com> | ||
| 7 | * Lad, Prabhakar <prabhakar.csengg@gmail.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you may redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; version 2 of the License. | ||
| 12 | * | ||
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 14 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 15 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 16 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 17 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 18 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 19 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 20 | * SOFTWARE. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include <linux/delay.h> | ||
| 24 | #include <linux/err.h> | ||
| 25 | #include <linux/init.h> | ||
| 26 | #include <linux/interrupt.h> | ||
| 27 | #include <linux/io.h> | ||
| 28 | #include <linux/module.h> | ||
| 29 | #include <linux/pinctrl/consumer.h> | ||
| 30 | #include <linux/platform_device.h> | ||
| 31 | #include <linux/pm_runtime.h> | ||
| 32 | #include <linux/slab.h> | ||
| 33 | #include <linux/uaccess.h> | ||
| 34 | #include <linux/videodev2.h> | ||
| 35 | |||
| 36 | #include <media/v4l2-common.h> | ||
| 37 | #include <media/v4l2-ctrls.h> | ||
| 38 | #include <media/v4l2-event.h> | ||
| 39 | #include <media/v4l2-of.h> | ||
| 40 | |||
| 41 | #include "am437x-vpfe.h" | ||
| 42 | |||
