Re: [PATCH v2] media: platform: add VPFE capture driver support for AM437X

2014-12-03 Thread Hans Verkuil
On 12/03/14 01:29, Lad, Prabhakar wrote:
 From: Benoit Parrot bpar...@ti.com
 
 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 bpar...@ti.com
 Signed-off-by: Darren Etheridge detheri...@ti.com
 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  Changes for v2:
  a Fixed review comments pointed by Hans.
  
  .../devicetree/bindings/media/ti-am437x-vpfe.txt   |   61 +
  MAINTAINERS|9 +
  drivers/media/platform/Kconfig |1 +
  drivers/media/platform/Makefile|2 +
  drivers/media/platform/am437x/Kconfig  |   11 +
  drivers/media/platform/am437x/Makefile |2 +
  drivers/media/platform/am437x/am437x-vpfe.c| 2785 
 
  drivers/media/platform/am437x/am437x-vpfe.h|  287 ++
  drivers/media/platform/am437x/am437x-vpfe_regs.h   |  140 +
  include/uapi/linux/Kbuild  |1 +
  include/uapi/linux/am437x-vpfe.h   |  122 +
  11 files changed, 3421 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
  create mode 100644 drivers/media/platform/am437x/Kconfig
  create mode 100644 drivers/media/platform/am437x/Makefile
  create mode 100644 drivers/media/platform/am437x/am437x-vpfe.c
  create mode 100644 drivers/media/platform/am437x/am437x-vpfe.h
  create mode 100644 drivers/media/platform/am437x/am437x-vpfe_regs.h
  create mode 100644 include/uapi/linux/am437x-vpfe.h
 
 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 000..3932e76
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
 @@ -0,0 +1,61 @@
 +Texas Instruments AM437x CAMERA (VPFE)
 +--
 +
 +The Video Processing Front End (VPFE) is a key component for image capture
 +applications. The capture module provides the system interface and the
 +processing capability to connect RAW image-sensor modules and video decoders
 +to the AM437x device.
 +
 +Required properties:
 +- compatible: must be ti,am437x-vpfe
 +- reg: physical base address and length of the registers set for the device;
 +- interrupts: should contain IRQ line for the VPFE;
 +- ti,am437x-vpfe-interface: can be one of the following,
 + 0 - Raw Bayer Interface.
 + 1 - 8 Bit BT656 Interface.
 + 2 - 10 Bit BT656 Interface.
 + 3 - YCbCr 8 Bit Interface.
 + 4 - YCbCr 16 Bit Interface.
 +
 +VPFE supports a single port node with parallel bus. It should contain one
 +'port' child node with child 'endpoint' node. Please refer to the bindings
 +defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
 +
 +Example:
 + vpfe: vpfe@f0034000 {
 + compatible = ti,am437x-vpfe;
 + reg = 0x48328000 0x2000;
 + interrupts = GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH;
 +
 + pinctrl-names = default, sleep;
 + pinctrl-0 = vpfe_pins_default;
 + pinctrl-1 = vpfe_pins_sleep;
 +
 + port {
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + vpfe0_ep: endpoint {
 + remote-endpoint = ov2659_1;
 + ti,am437x-vpfe-interface = 0;
 + bus-width = 8;
 + hsync-active = 0;
 + vsync-active = 0;
 + };
 + };
 + };
 +
 + i2c1: i2c@4802a000 {
 +
 + ov2659@30 {
 + compatible = ti,ov2659;
 + reg = 0x30;
 +
 + port {
 + ov2659_1: endpoint {
 + remote-endpoint = vpfe0_ep;
 + bus-width = 8;
 + mclk-frequency = 1200;
 + };
 + };
 + };
 diff --git a/MAINTAINERS b/MAINTAINERS
 index a6288ca..a42d367 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -8537,6 +8537,15 @@ S: Maintained
  F:   drivers/media/platform/davinci/
  F:   include/media/davinci/
  
 +TI AM437X VPFE DRIVER
 +M:   Lad, Prabhakar prabhakar.cse...@gmail.com
 +L:   linux-media@vger.kernel.org
 +W:   http://linuxtv.org/
 +Q:   http://patchwork.linuxtv.org/project/linux-media/list/
 +T:   git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
 +S:   Maintained
 +F:   drivers/media/platform/am437x/
 +
  SIS 190 ETHERNET DRIVER
  M:   Francois Romieu rom...@fr.zoreil.com
  L:   net...@vger.kernel.org
 diff --git 

[PATCH v2] media: platform: add VPFE capture driver support for AM437X

2014-12-02 Thread Lad, Prabhakar
From: Benoit Parrot bpar...@ti.com

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 bpar...@ti.com
Signed-off-by: Darren Etheridge detheri...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 Changes for v2:
 a Fixed review comments pointed by Hans.
 
 .../devicetree/bindings/media/ti-am437x-vpfe.txt   |   61 +
 MAINTAINERS|9 +
 drivers/media/platform/Kconfig |1 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/am437x/Kconfig  |   11 +
 drivers/media/platform/am437x/Makefile |2 +
 drivers/media/platform/am437x/am437x-vpfe.c| 2785 
 drivers/media/platform/am437x/am437x-vpfe.h|  287 ++
 drivers/media/platform/am437x/am437x-vpfe_regs.h   |  140 +
 include/uapi/linux/Kbuild  |1 +
 include/uapi/linux/am437x-vpfe.h   |  122 +
 11 files changed, 3421 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
 create mode 100644 drivers/media/platform/am437x/Kconfig
 create mode 100644 drivers/media/platform/am437x/Makefile
 create mode 100644 drivers/media/platform/am437x/am437x-vpfe.c
 create mode 100644 drivers/media/platform/am437x/am437x-vpfe.h
 create mode 100644 drivers/media/platform/am437x/am437x-vpfe_regs.h
 create mode 100644 include/uapi/linux/am437x-vpfe.h

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 000..3932e76
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
@@ -0,0 +1,61 @@
+Texas Instruments AM437x CAMERA (VPFE)
+--
+
+The Video Processing Front End (VPFE) is a key component for image capture
+applications. The capture module provides the system interface and the
+processing capability to connect RAW image-sensor modules and video decoders
+to the AM437x device.
+
+Required properties:
+- compatible: must be ti,am437x-vpfe
+- reg: physical base address and length of the registers set for the device;
+- interrupts: should contain IRQ line for the VPFE;
+- ti,am437x-vpfe-interface: can be one of the following,
+   0 - Raw Bayer Interface.
+   1 - 8 Bit BT656 Interface.
+   2 - 10 Bit BT656 Interface.
+   3 - YCbCr 8 Bit Interface.
+   4 - YCbCr 16 Bit Interface.
+
+VPFE supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+   vpfe: vpfe@f0034000 {
+   compatible = ti,am437x-vpfe;
+   reg = 0x48328000 0x2000;
+   interrupts = GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH;
+
+   pinctrl-names = default, sleep;
+   pinctrl-0 = vpfe_pins_default;
+   pinctrl-1 = vpfe_pins_sleep;
+
+   port {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   vpfe0_ep: endpoint {
+   remote-endpoint = ov2659_1;
+   ti,am437x-vpfe-interface = 0;
+   bus-width = 8;
+   hsync-active = 0;
+   vsync-active = 0;
+   };
+   };
+   };
+
+   i2c1: i2c@4802a000 {
+
+   ov2659@30 {
+   compatible = ti,ov2659;
+   reg = 0x30;
+
+   port {
+   ov2659_1: endpoint {
+   remote-endpoint = vpfe0_ep;
+   bus-width = 8;
+   mclk-frequency = 1200;
+   };
+   };
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index a6288ca..a42d367 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8537,6 +8537,15 @@ S:   Maintained
 F: drivers/media/platform/davinci/
 F: include/media/davinci/
 
+TI AM437X VPFE DRIVER
+M: Lad, Prabhakar prabhakar.cse...@gmail.com
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
+S: Maintained
+F: drivers/media/platform/am437x/
+
 SIS 190 ETHERNET DRIVER
 M: Francois Romieu rom...@fr.zoreil.com
 L: net...@vger.kernel.org
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 0c61155..6d94045 100644
--- 

Re: [PATCH v2] media: platform: add VPFE capture driver support for AM437X

2014-12-02 Thread Prabhakar Lad
On Wed, Dec 3, 2014 at 12:29 AM, Lad, Prabhakar
prabhakar.cse...@gmail.com wrote:
 From: Benoit Parrot bpar...@ti.com

 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


v4l2-complicance op:


root@am437x-evm:~# ./v4l2-compliance -s -i 0 -v
Driver Info:
Driver name   : vpfe
[   69.212320] vpfe 48326000.vpfe: =  START STATUS
=

Bus info  : platform:vpfe 48326000.vpfe
[   69.224520] vpfe 48326000.vpfe: ==  END
STATUS  ==
Driver version: 3.18.0
Capabilities  : 0x85200[   69.237663] vpfe 48326000.vpfe:
invalid input index: 1
001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x0521
Video Capture
Read/Write
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0

Format ioctls:
info: found 7 framesizes for pixel format 56595559
info: found 7 framesizes for pixel format 59565955
info: found 7 framesizes for pixel format 52424752
info: found 7 framesizes for pixel format 31384142
info: found 4 formats for buftype 1
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
info: Could not perform global format test
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
info: test buftype Video Capture
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK

Streaming ioctls:
test read/write: OK
Video Capture:
Buffer: 0 Sequence: 0 Field: None Timestamp: 73.805968s
Buffer: 1 Sequence: 1 Field: None Timestamp: 73.828843s
Buffer: 2 Sequence: 2 Field: None Timestamp: 73.851723s
Buffer: 3 Sequence: 3 Field: None Timestamp: 74.057647s
Buffer: 0 Sequence: 4 Field: None Timestamp: 74.080531s
Buffer: 1 Sequence: 5 Field: None Timestamp: 74.103409s
Buffer: 2 Sequence: 6 Field: None Timestamp: 74.126289s
Buffer: 3 Sequence: 7 Field: None Timestamp: 74.149169s
Buffer: 0 Sequence: 8 Field: None Timestamp: 74.172051s
Buffer: 1 Sequence: 9 Field: None Timestamp: 74.194930s
Buffer: 2 Sequence: 10 Field: None Timestamp: 74.217811s
Buffer: 3 Sequence: 11 Field: None Timestamp: