All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes
@ 2014-05-16 13:33 Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe Lad, Prabhakar
                   ` (52 more replies)
  0 siblings, 53 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Hi,

This patch series upgrades the vpif capture & display
driver with the all the helpers provided by v4l, this makes
the driver much simpler and cleaner. This also includes few
checkpatch issues.

Changes for v2:
a> Added a copyright.
b> Dropped buf_init() callback from vb2_ops.
c> Fixed enabling & disabling of interrupts in case of HD formats.

Changes for v3:
a> Fixed review comments pointed by Hans.

Changes for v4: Rebased the patches on media tree.

Changes for v5: Split up the patches

Following is the output of v4l-compliance for capture:
------------------------------------------------------

./v4l2-compliance -d /dev/video0 -i 0 -s -v --expbuf-device=2

Driver Info:
        Driver name   : vpif_capture
        Card type     : DA850/OMAP-L138 Video Capture
        Bus info      : platform:vpif_capture
        Driver version: 3.15.0
        Capabilities  : 0x84000001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04000001
                Video Capture
                Streaming

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: 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_QUERYCTRL/MENU: 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 1 formats for buftype 1
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                fail: v4l2-test-formats.cpp(1003): cap->readbuffers
                test VIDIOC_G/S_PARM: FAIL
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                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
        test read/write: OK (Not Supported)
            Video Capture:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.509130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.549125s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.589148s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.629106s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.669110s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.709102s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.749099s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.789128s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.829116s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.869105s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.909100s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.949098s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.989086s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.029083s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.069083s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.109074s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.149074s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.189100s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.229077s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.269078s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.309075s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.349070s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.389060s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.429052s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.469053s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.509047s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.549045s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.589072s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.629047s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.669051s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.709046s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.749043s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.789033s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.829023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.869025s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.909018s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.949029s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.989046s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.029021s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.069024s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.109019s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.149004s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.189006s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.228998s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.268996s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.308996s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.349004s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.389019s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.429000s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.468999s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.509004s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.548979s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.588982s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.628973s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.668976s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.708968s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.748979s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.788991s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.828972s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.868969s
            Video Capture (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.908969s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.948952s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.988955s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.028946s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.068946s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.108954s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.148955s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.188973s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.228948s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.268943s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.308949s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.348928s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.388927s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.428918s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.468918s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.508923s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.548919s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.588946s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.628923s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.668917s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.708902s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.748899s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.788901s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.828895s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.868892s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.908897s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.948898s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.988920s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.028892s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.068893s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.108876s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.148873s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.188875s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.228867s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.268875s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.308870s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.348870s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.388870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.428891s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.468893s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.508849s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.548845s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.588849s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.628842s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.668855s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.708844s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.748846s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.788868s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.828842s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.868826s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.908823s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.948821s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.988821s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.028817s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.068824s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.108818s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 150.148818s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.188839s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.228808s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.268798s
        test MMAP: OK
                fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
                fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
        test USERPTR: FAIL
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.234735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.268098s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.301503s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.334846s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.368202s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.401594s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.434960s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.468320s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.501709s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.535041s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.568428s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.601811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.635146s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.668514s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.701913s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.735260s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.768617s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.802007s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.835367s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.868732s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.902120s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.935451s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.968837s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.002223s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.035566s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.068923s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.102327s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.135667s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.169023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.202423s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.235785s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.269146s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.302535s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.335862s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.369252s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.402637s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.435978s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.469335s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.502705s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.536087s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.569454s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.602817s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.636177s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.669557s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.702934s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.736280s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.769648s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.803053s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.836396s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.869753s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.903122s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.936499s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.969870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.003251s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.036591s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.069975s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.103363s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.136702s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.170112s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.203462s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.236804s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.270175s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.303533s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.336914s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.370269s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.403661s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.436999s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.470388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.503774s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.537117s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.570511s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.603874s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.637222s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.670603s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.703944s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.737326s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.770694s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.804083s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.837412s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.870809s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.904185s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.937526s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.970900s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.004285s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.037632s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.070993s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.104382s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.137735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.171104s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.204492s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.237822s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.271190s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.304596s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.337941s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.371310s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.404665s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.438046s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.471408s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.504794s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.538130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.571517s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.604904s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.638234s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.671610s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.704984s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.738352s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.771725s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.805080s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.838459s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.871822s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.905165s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.938547s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.971931s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.005319s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.038649s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.072021s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.105420s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.138776s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.172136s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.205492s
        test DMABUF: OK

Total: 41, Succeeded: 40, Failed: 1, Warnings: 0

Following is the output of v4l-compliance for display:
------------------------------------------------------

./v4l2-compliance -d /dev/video2 -o 0 -s -v --expbuf-device=0 

Driver Info:
        Driver name   : vpif_capture
        Card type     : DA850/OMAP-L138 Video Capture
        Bus info      : platform:vpif_capture
        Driver version: 3.15.0
        Capabilities  : 0x84000001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04000001
                Video Capture
                Streaming

Compliance test for device /dev/video2 (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: 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 (Not Supported)
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 0 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
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 2 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 output 0:

        Control ioctls:
                test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                test VIDIOC_G/S_PARM: OK (Not Supported)
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                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)

Test output 1:

        Control ioctls:
                test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                test VIDIOC_G/S_PARM: OK (Not Supported)
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                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 Output
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test read/write: OK (Not Supported)
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.197959s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.231346s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.264708s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.298071s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.331432s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.364827s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.398174s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.431543s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.464898s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.498277s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.531648s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.565008s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.598379s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.631754s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.665121s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.698489s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.731843s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.765230s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.798587s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.831955s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.865314s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.898690s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.932065s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.965425s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.998793s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.032169s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.065534s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.098897s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.132256s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.165643s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.199000s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.232370s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.265725s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.299103s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.332478s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.365837s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.399207s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.432567s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.465951s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.499312s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.532670s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.566036s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.599414s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.632785s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.666143s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.699509s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.732891s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.766253s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.799620s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.832980s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.866362s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.899722s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.933083s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.966449s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.999826s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.033190s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.066552s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.099920s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.133306s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.166665s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.200056s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.233388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.266772s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.300162s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.333497s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.366859s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.400264s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.433608s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.466982s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.500359s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.533717s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.567082s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.600470s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.633800s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.667186s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.700572s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.733906s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.767270s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.800678s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.834022s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.867391s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.900772s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.934129s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.967494s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.000884s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.034215s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.067607s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.100983s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.134329s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.167684s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.201087s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.234435s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.267799s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.301192s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.334523s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.367906s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.401293s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.434627s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.467992s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.501374s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.534744s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.568099s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.601470s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.634852s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.668215s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.701605s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.734935s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.768322s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.801707s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.835041s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.868407s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.901811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.935166s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.968509s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.001907s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.035265s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.068628s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.102016s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.135349s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.168734s
        test MMAP: OK
                fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
                fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
        test USERPTR: FAIL
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.234735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.268098s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.301503s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.334846s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.368202s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.401594s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.434960s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.468320s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.501709s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.535041s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.568428s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.601811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.635146s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.668514s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.701913s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.735260s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.768617s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.802007s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.835367s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.868732s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.902120s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.935451s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.968837s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.002223s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.035566s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.068923s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.102327s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.135667s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.169023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.202423s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.235785s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.269146s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.302535s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.335862s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.369252s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.402637s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.435978s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.469335s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.502705s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.536087s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.569454s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.602817s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.636177s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.669557s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.702934s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.736280s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.769648s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.803053s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.836396s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.869753s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.903122s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.936499s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.969870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.003251s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.036591s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.069975s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.103363s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.136702s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.170112s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.203462s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.236804s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.270175s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.303533s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.336914s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.370269s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.403661s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.436999s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.470388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.503774s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.537117s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.570511s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.603874s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.637222s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.670603s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.703944s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.737326s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.770694s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.804083s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.837412s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.870809s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.904185s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.937526s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.970900s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.004285s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.037632s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.070993s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.104382s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.137735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.171104s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.204492s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.237822s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.271190s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.304596s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.337941s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.371310s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.404665s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.438046s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.471408s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.504794s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.538130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.571517s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.604904s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.638234s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.671610s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.704984s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.738352s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.771725s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.805080s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.838459s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.871822s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.905207s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.938547s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.971931s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.005319s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.038649s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.072021s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.105420s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.138776s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.172136s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.205492s
        test DMABUF: OK

Total: 57, Succeeded: 56, Failed: 1, Warnings: 0



Lad, Prabhakar (49):
  media: davinci: vpif_display: initialize vb2 queue and DMA context
    during probe
  media: davinci: vpif_display: drop buf_init() callback
  media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper
    functions
  media: davinci: vpif_display: release buffers in case
    start_streaming() call back fails
  media: davinci: vpif_display: drop buf_cleanup() callback
  media: davinci: vpif_display: improve vpif_buffer_prepare() callback
  media: davinci: vpif_display: improve vpif_buffer_queue_setup()
    function
  media: davinci: vpif_display: improve start/stop_streaming callbacks
  media: davinci: vpif_display: use vb2_fop_mmap/poll
  media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
  media: davinci: vpif_display: use vb2_ioctl_* helpers
  media: davinci: vpif_display: drop unused member fbuffers
  media: davinci: vpif_display: drop reserving memory for device
  media: davinci: vpif_display: drop unnecessary field memory
  media: davinci: vpif_display: drop numbuffers field from common_obj
  media: davinic: vpif_display: drop started member from struct
    common_obj
  media: davinci: vpif_display: initialize the video device in single
    place
  media: davinci: vpif_display: drop unneeded module params
  media: davinci: vpif_display: drop cropcap
  media: davinci: vpif_display: group v4l2_ioctl_ops
  media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
  media: davinci: vpif_display: return -ENODATA for *dv_timings calls
  media: davinci: vpif_display: return -ENODATA for *std calls
  media: davinci; vpif_display: fix checkpatch error
  media: davinci: vpif_display: fix v4l-complinace issues
  media: davinci: vpif_capture: initalize vb2 queue and DMA context
    during probe
  media: davinci: vpif_capture: drop buf_init() callback
  media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
    functions
  media: davinci: vpif_capture: release buffers in case
    start_streaming() call back fails
  media: davinci: vpif_capture: drop buf_cleanup() callback
  media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
  media: davinci: vpif_capture: improve vpif_buffer_queue_setup()
    function
  media: davinci: vpif_capture: improve start/stop_streaming callbacks
  media: davinci: vpif_capture: use vb2_fop_mmap/poll
  media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
  media: davinci: vpif_capture: use vb2_ioctl_* helpers
  media: davinci: vpif_capture: drop reserving memory for device
  media: davinci: vpif_capture: drop unnecessary field memory
  media: davinic: vpif_capture: drop started member from struct
    common_obj
  media: davinci: vpif_capture: initialize the video device in single
    place
  media: davinci: vpif_capture: drop unneeded module params
  media: davinci: vpif_capture: drop cropcap
  media: davinci: vpif_capture: group v4l2_ioctl_ops
  media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
  media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
  media: davinci: vpif_capture: return -ENODATA for *std calls
  media: davinci: vpif_capture: drop check __KERNEL__
  media: davinci: vpif_capture: fix v4l-complinace issues
  media: davinci: vpif: add Copyright message

 drivers/media/platform/davinci/vpif_capture.c | 1420 +++++++------------------
 drivers/media/platform/davinci/vpif_capture.h |   39 -
 drivers/media/platform/davinci/vpif_display.c | 1196 ++++++---------------
 drivers/media/platform/davinci/vpif_display.h |   44 +-
 4 files changed, 746 insertions(+), 1953 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initialize " Lad, Prabhakar
                   ` (51 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch moves the initalization of vb2 queue and
the DMA context to probe() and clean up in remove()
callback respectively.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   86 ++++++++++++-------------
 1 file changed, 41 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index d03487f..dbd4f0f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -74,12 +74,12 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vb2_queue *q = vb->vb2_queue;
+	struct channel_obj *ch = vb2_get_drv_priv(q);
 	struct common_obj *common;
 	unsigned long addr;
 
-	common = &fh->channel->common[VPIF_VIDEO_INDEX];
+	common = &ch->common[VPIF_VIDEO_INDEX];
 	if (vb->state != VB2_BUF_STATE_ACTIVE &&
 		vb->state != VB2_BUF_STATE_PREPARED) {
 		vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
@@ -112,8 +112,7 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 				unsigned int *nbuffers, unsigned int *nplanes,
 				unsigned int sizes[], void *alloc_ctxs[])
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	unsigned long size;
 
@@ -154,10 +153,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vpif_disp_buffer *buf = container_of(vb,
 				struct vpif_disp_buffer, vb);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -175,10 +173,9 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  */
 static void vpif_buf_cleanup(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vpif_disp_buffer *buf = container_of(vb,
 					struct vpif_disp_buffer, vb);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -192,8 +189,7 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 static void vpif_wait_prepare(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -202,8 +198,7 @@ static void vpif_wait_prepare(struct vb2_queue *vq)
 
 static void vpif_wait_finish(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -226,8 +221,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_display_config *vpif_config_data =
 					vpif_dev->platform_data;
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_params *vpif = &ch->vpifparams;
 	unsigned long addr = 0;
@@ -310,8 +304,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 /* abort streaming and wait for last buffer */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -794,10 +787,6 @@ static int vpif_release(struct file *filep)
 	if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
 		/* Reset io_usrs member of channel object */
 		common->io_usrs = 0;
-		/* Free buffers allocated */
-		vb2_queue_release(&common->buffer_queue);
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-
 		common->numbuffers =
 		    config_params.numbuffers[ch->channel_id];
 	}
@@ -939,9 +928,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	struct channel_obj *ch = fh->channel;
 	struct common_obj *common;
 	enum v4l2_field field;
-	struct vb2_queue *q;
 	u8 index = 0;
-	int ret;
 
 	/* This file handle has not initialized the channel,
 	   It is not allowed to do settings */
@@ -973,35 +960,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	} else {
 		field = V4L2_VBI_INTERLACED;
 	}
-	/* Initialize videobuf2 queue as per the buffer type */
-	common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
-	if (IS_ERR(common->alloc_ctx)) {
-		vpif_err("Failed to get the context\n");
-		return PTR_ERR(common->alloc_ctx);
-	}
-	q = &common->buffer_queue;
-	q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-	q->io_modes = VB2_MMAP | VB2_USERPTR;
-	q->drv_priv = fh;
-	q->ops = &video_qops;
-	q->mem_ops = &vb2_dma_contig_memops;
-	q->buf_struct_size = sizeof(struct vpif_disp_buffer);
-	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
-	q->min_buffers_needed = 1;
-
-	ret = vb2_queue_init(q);
-	if (ret) {
-		vpif_err("vpif_display: vb2_queue_init() failed\n");
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-		return ret;
-	}
 	/* Set io allowed member of file handle to TRUE */
 	fh->io_allowed[index] = 1;
 	/* Increment io usrs member of channel object to 1 */
 	common->io_usrs = 1;
 	/* Store type of memory requested in channel object */
 	common->memory = reqbuf->memory;
-	INIT_LIST_HEAD(&common->dma_queue);
 	/* Allocate buffers */
 	return vb2_reqbufs(&common->buffer_queue, reqbuf);
 }
@@ -1637,6 +1601,7 @@ static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
 	struct channel_obj *ch;
+	struct vb2_queue *q;
 	int j, err, k;
 
 	for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
@@ -1685,6 +1650,32 @@ static int vpif_probe_complete(void)
 		if (err)
 			goto probe_out;
 
+		/* Initialize vb2 queue */
+		q = &common->buffer_queue;
+		q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+		q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
+		q->drv_priv = ch;
+		q->ops = &video_qops;
+		q->mem_ops = &vb2_dma_contig_memops;
+		q->buf_struct_size = sizeof(struct vpif_disp_buffer);
+		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+		q->min_buffers_needed = 1;
+
+		err = vb2_queue_init(q);
+		if (err) {
+			vpif_err("vpif_display: vb2_queue_init() failed\n");
+			goto probe_out;
+		}
+
+		common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
+		if (IS_ERR(common->alloc_ctx)) {
+			vpif_err("Failed to get the context\n");
+			err = PTR_ERR(common->alloc_ctx);
+			goto probe_out;
+		}
+
+		INIT_LIST_HEAD(&common->dma_queue);
+
 		/* register video device */
 		vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
 			 (int)ch, (int)&ch->video_dev);
@@ -1700,6 +1691,8 @@ static int vpif_probe_complete(void)
 probe_out:
 	for (k = 0; k < j; k++) {
 		ch = vpif_obj.dev[k];
+		common = &ch->common[k];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		video_unregister_device(ch->video_dev);
 		video_device_release(ch->video_dev);
 		ch->video_dev = NULL;
@@ -1865,6 +1858,7 @@ vpif_unregister:
  */
 static int vpif_remove(struct platform_device *device)
 {
+	struct common_obj *common;
 	struct channel_obj *ch;
 	int i;
 
@@ -1875,6 +1869,8 @@ static int vpif_remove(struct platform_device *device)
 	for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
+		common = &ch->common[i];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		/* Unregister video device */
 		video_unregister_device(ch->video_dev);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 01/49] media: davinci: vpif_display: initialize vb2 queue and DMA context during probe
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback Lad, Prabhakar
                   ` (50 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch moves the initalization of vb2 queue and
the DMA context to probe() and clean up in remove()
callback respectively.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   86 ++++++++++++-------------
 1 file changed, 41 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index d03487f..dbd4f0f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -74,12 +74,12 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vb2_queue *q = vb->vb2_queue;
+	struct channel_obj *ch = vb2_get_drv_priv(q);
 	struct common_obj *common;
 	unsigned long addr;
 
-	common = &fh->channel->common[VPIF_VIDEO_INDEX];
+	common = &ch->common[VPIF_VIDEO_INDEX];
 	if (vb->state != VB2_BUF_STATE_ACTIVE &&
 		vb->state != VB2_BUF_STATE_PREPARED) {
 		vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
@@ -112,8 +112,7 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 				unsigned int *nbuffers, unsigned int *nplanes,
 				unsigned int sizes[], void *alloc_ctxs[])
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	unsigned long size;
 
@@ -154,10 +153,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vpif_disp_buffer *buf = container_of(vb,
 				struct vpif_disp_buffer, vb);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -175,10 +173,9 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  */
 static void vpif_buf_cleanup(struct vb2_buffer *vb)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vpif_disp_buffer *buf = container_of(vb,
 					struct vpif_disp_buffer, vb);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -192,8 +189,7 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 static void vpif_wait_prepare(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -202,8 +198,7 @@ static void vpif_wait_prepare(struct vb2_queue *vq)
 
 static void vpif_wait_finish(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -226,8 +221,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_display_config *vpif_config_data =
 					vpif_dev->platform_data;
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_params *vpif = &ch->vpifparams;
 	unsigned long addr = 0;
@@ -310,8 +304,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 /* abort streaming and wait for last buffer */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -794,10 +787,6 @@ static int vpif_release(struct file *filep)
 	if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
 		/* Reset io_usrs member of channel object */
 		common->io_usrs = 0;
-		/* Free buffers allocated */
-		vb2_queue_release(&common->buffer_queue);
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-
 		common->numbuffers =
 		    config_params.numbuffers[ch->channel_id];
 	}
@@ -939,9 +928,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	struct channel_obj *ch = fh->channel;
 	struct common_obj *common;
 	enum v4l2_field field;
-	struct vb2_queue *q;
 	u8 index = 0;
-	int ret;
 
 	/* This file handle has not initialized the channel,
 	   It is not allowed to do settings */
@@ -973,35 +960,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	} else {
 		field = V4L2_VBI_INTERLACED;
 	}
-	/* Initialize videobuf2 queue as per the buffer type */
-	common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
-	if (IS_ERR(common->alloc_ctx)) {
-		vpif_err("Failed to get the context\n");
-		return PTR_ERR(common->alloc_ctx);
-	}
-	q = &common->buffer_queue;
-	q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-	q->io_modes = VB2_MMAP | VB2_USERPTR;
-	q->drv_priv = fh;
-	q->ops = &video_qops;
-	q->mem_ops = &vb2_dma_contig_memops;
-	q->buf_struct_size = sizeof(struct vpif_disp_buffer);
-	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
-	q->min_buffers_needed = 1;
-
-	ret = vb2_queue_init(q);
-	if (ret) {
-		vpif_err("vpif_display: vb2_queue_init() failed\n");
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-		return ret;
-	}
 	/* Set io allowed member of file handle to TRUE */
 	fh->io_allowed[index] = 1;
 	/* Increment io usrs member of channel object to 1 */
 	common->io_usrs = 1;
 	/* Store type of memory requested in channel object */
 	common->memory = reqbuf->memory;
-	INIT_LIST_HEAD(&common->dma_queue);
 	/* Allocate buffers */
 	return vb2_reqbufs(&common->buffer_queue, reqbuf);
 }
@@ -1637,6 +1601,7 @@ static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
 	struct channel_obj *ch;
+	struct vb2_queue *q;
 	int j, err, k;
 
 	for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
@@ -1685,6 +1650,32 @@ static int vpif_probe_complete(void)
 		if (err)
 			goto probe_out;
 
+		/* Initialize vb2 queue */
+		q = &common->buffer_queue;
+		q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+		q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
+		q->drv_priv = ch;
+		q->ops = &video_qops;
+		q->mem_ops = &vb2_dma_contig_memops;
+		q->buf_struct_size = sizeof(struct vpif_disp_buffer);
+		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+		q->min_buffers_needed = 1;
+
+		err = vb2_queue_init(q);
+		if (err) {
+			vpif_err("vpif_display: vb2_queue_init() failed\n");
+			goto probe_out;
+		}
+
+		common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
+		if (IS_ERR(common->alloc_ctx)) {
+			vpif_err("Failed to get the context\n");
+			err = PTR_ERR(common->alloc_ctx);
+			goto probe_out;
+		}
+
+		INIT_LIST_HEAD(&common->dma_queue);
+
 		/* register video device */
 		vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
 			 (int)ch, (int)&ch->video_dev);
@@ -1700,6 +1691,8 @@ static int vpif_probe_complete(void)
 probe_out:
 	for (k = 0; k < j; k++) {
 		ch = vpif_obj.dev[k];
+		common = &ch->common[k];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		video_unregister_device(ch->video_dev);
 		video_device_release(ch->video_dev);
 		ch->video_dev = NULL;
@@ -1865,6 +1858,7 @@ vpif_unregister:
  */
 static int vpif_remove(struct platform_device *device)
 {
+	struct common_obj *common;
 	struct channel_obj *ch;
 	int i;
 
@@ -1875,6 +1869,8 @@ static int vpif_remove(struct platform_device *device)
 	for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
+		common = &ch->common[i];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		/* Unregister video device */
 		video_unregister_device(ch->video_dev);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initialize " Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
                   ` (49 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops the buf_init() callback as init
of buf list is not required.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index dbd4f0f..e2102ea 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -205,16 +205,6 @@ static void vpif_wait_finish(struct vb2_queue *vq)
 	mutex_lock(&common->lock);
 }
 
-static int vpif_buffer_init(struct vb2_buffer *vb)
-{
-	struct vpif_disp_buffer *buf = container_of(vb,
-					struct vpif_disp_buffer, vb);
-
-	INIT_LIST_HEAD(&buf->list);
-
-	return 0;
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -351,7 +341,6 @@ static struct vb2_ops video_qops = {
 	.queue_setup		= vpif_buffer_queue_setup,
 	.wait_prepare		= vpif_wait_prepare,
 	.wait_finish		= vpif_wait_finish,
-	.buf_init		= vpif_buffer_init,
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (2 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails Lad, Prabhakar
                   ` (48 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch makes use of vb2_ops_wait_prepare/finish helper functions.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index e2102ea..8bb9f02 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -187,24 +187,6 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 	spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-static void vpif_wait_prepare(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_unlock(&common->lock);
-}
-
-static void vpif_wait_finish(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_lock(&common->lock);
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -339,8 +321,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 
 static struct vb2_ops video_qops = {
 	.queue_setup		= vpif_buffer_queue_setup,
-	.wait_prepare		= vpif_wait_prepare,
-	.wait_finish		= vpif_wait_finish,
+	.wait_prepare		= vb2_ops_wait_prepare,
+	.wait_finish		= vb2_ops_wait_finish,
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
@@ -1649,6 +1631,7 @@ static int vpif_probe_complete(void)
 		q->buf_struct_size = sizeof(struct vpif_disp_buffer);
 		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 		q->min_buffers_needed = 1;
+		q->lock = &common->lock;
 
 		err = vb2_queue_init(q);
 		if (err) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (3 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-23  8:35   ` Hans Verkuil
  2014-05-16 13:33 ` [PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback Lad, Prabhakar
                   ` (47 subsequent siblings)
  52 siblings, 1 reply; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds support to release the buffer by calling
vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
if start_streaming() call back fails.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   42 +++++++++++++++----------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 8bb9f02..1a17a45 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -196,26 +196,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_params *vpif = &ch->vpifparams;
-	unsigned long addr = 0;
-	unsigned long flags;
+	struct vpif_disp_buffer *buf, *tmp;
+	unsigned long addr, flags;
 	int ret;
 
 	spin_lock_irqsave(&common->irqlock, flags);
 
-	/* Get the next frame from the buffer queue */
-	common->next_frm = common->cur_frm =
-			    list_entry(common->dma_queue.next,
-				       struct vpif_disp_buffer, list);
-
-	list_del(&common->cur_frm->list);
-	spin_unlock_irqrestore(&common->irqlock, flags);
-	/* Mark state of the current frame to active */
-	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
-
 	/* Initialize field_id and started member */
 	ch->field_id = 0;
 	common->started = 1;
-	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
+
 	/* Calculate the offset for Y and C data  in the buffer */
 	vpif_calculate_offsets(ch);
 
@@ -225,7 +215,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 		|| (!ch->vpifparams.std_info.frm_fmt
 		&& (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
 		vpif_err("conflict in field format and std format\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 
 	/* clock settings */
@@ -234,17 +225,28 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 		ycmux_mode, ch->vpifparams.std_info.hd_sd);
 		if (ret < 0) {
 			vpif_err("can't set clock\n");
-			return ret;
+			goto err;
 		}
 	}
 
 	/* set the parameters and addresses */
 	ret = vpif_set_video_params(vpif, ch->channel_id + 2);
 	if (ret < 0)
-		return ret;
+		goto err;
 
 	common->started = ret;
 	vpif_config_addr(ch, ret);
+	/* Get the next frame from the buffer queue */
+	common->next_frm = common->cur_frm =
+			    list_entry(common->dma_queue.next,
+				       struct vpif_disp_buffer, list);
+
+	list_del(&common->cur_frm->list);
+	spin_unlock_irqrestore(&common->irqlock, flags);
+	/* Mark state of the current frame to active */
+	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
+
+	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
 	common->set_addr((addr + common->ytop_off),
 			    (addr + common->ybtm_off),
 			    (addr + common->ctop_off),
@@ -271,6 +273,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	}
 
 	return 0;
+
+err:
+	list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
+		list_del(&buf->list);
+		vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+	}
+
+	return ret;
 }
 
 /* abort streaming and wait for last buffer */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (4 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback Lad, Prabhakar
                   ` (46 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops buf_cleanup() callback as this callback
is never called with buffer state active.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1a17a45..9999b9c 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -167,26 +167,6 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
 	spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-/*
- * vpif_buf_cleanup: This function is called from the videobuf2 layer to
- * free memory allocated to the buffers
- */
-static void vpif_buf_cleanup(struct vb2_buffer *vb)
-{
-	struct vpif_disp_buffer *buf = container_of(vb,
-					struct vpif_disp_buffer, vb);
-	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
-	struct common_obj *common;
-	unsigned long flags;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-
-	spin_lock_irqsave(&common->irqlock, flags);
-	if (vb->state == VB2_BUF_STATE_ACTIVE)
-		list_del_init(&buf->list);
-	spin_unlock_irqrestore(&common->irqlock, flags);
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -336,7 +316,6 @@ static struct vb2_ops video_qops = {
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
-	.buf_cleanup		= vpif_buf_cleanup,
 	.buf_queue		= vpif_buffer_queue,
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (5 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function Lad, Prabhakar
                   ` (45 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch improve vpif_buffer_prepare() callback, as buf_prepare()
callback is never called with invalid state and check for
vb2_plane_vaddr(vb, 0) is dropped as payload check should
be done unconditionally.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   47 ++++++++++++-------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 9999b9c..1c518de 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -67,41 +67,40 @@ static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
-/*
- * buffer_prepare: This is the callback function called from vb2_qbuf()
- * function the buffer is prepared and user space virtual address is converted
- * into physical address
+/**
+ * vpif_buffer_prepare :  callback function for buffer prepare
+ * @vb: ptr to vb2_buffer
+ *
+ * This is the callback function for buffer prepare when vb2_qbuf()
+ * function is called. The buffer is prepared and user space virtual address
+ * or user address is converted into  physical address
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
-	struct vb2_queue *q = vb->vb2_queue;
-	struct channel_obj *ch = vb2_get_drv_priv(q);
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
-	unsigned long addr;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
-	if (vb->state != VB2_BUF_STATE_ACTIVE &&
-		vb->state != VB2_BUF_STATE_PREPARED) {
-		vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
-		if (vb2_plane_vaddr(vb, 0) &&
-		vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
-			goto buf_align_exit;
-
-		addr = vb2_dma_contig_plane_dma_addr(vb, 0);
-		if (q->streaming &&
-			(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT != q->type)) {
-			if (!ISALIGNED(addr + common->ytop_off) ||
+
+	vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
+	if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
+		return -EINVAL;
+
+	vb->v4l2_buf.field = common->fmt.fmt.pix.field;
+
+	if (vb->vb2_queue->type != V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
+		unsigned long addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+
+		if (!ISALIGNED(addr + common->ytop_off) ||
 			!ISALIGNED(addr + common->ybtm_off) ||
 			!ISALIGNED(addr + common->ctop_off) ||
-			!ISALIGNED(addr + common->cbtm_off))
-				goto buf_align_exit;
+			!ISALIGNED(addr + common->cbtm_off)) {
+			vpif_err("buffer offset not aligned to 8 bytes\n");
+			return -EINVAL;
 		}
 	}
-	return 0;
 
-buf_align_exit:
-	vpif_err("buffer offset not aligned to 8 bytes\n");
-	return -EINVAL;
+	return 0;
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (6 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks Lad, Prabhakar
                   ` (44 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch sets the sizes[0] of plane according to the fmt passed
or which is being set in the channel, in both MMAP and USERPTR buffer
type.

This patch also move the calculation of offests(vpif_calculate_offsets())
to queue_setup() callback as after queue_setup() callback the
application is no longer allowed to change format, and prepares to
removal of config_params.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   53 ++++++++++---------------
 1 file changed, 21 insertions(+), 32 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1c518de..1b6cbe8 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -103,8 +103,17 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
 	return 0;
 }
 
-/*
- * vpif_buffer_queue_setup: This function allocates memory for the buffers
+/**
+ * vpif_buffer_queue_setup : Callback function for buffer setup.
+ * @vq: vb2_queue ptr
+ * @fmt: v4l2 format
+ * @nbuffers: ptr to number of buffers requested by application
+ * @nplanes:: contains number of distinct video planes needed to hold a frame
+ * @sizes[]: contains the size (in bytes) of each plane.
+ * @alloc_ctxs: ptr to allocation context
+ *
+ * This callback function is called when reqbuf() is called to adjust
+ * the buffer count and buffer size
  */
 static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 				const struct v4l2_format *fmt,
@@ -113,37 +122,20 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 {
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	unsigned long size;
-
-	if (V4L2_MEMORY_MMAP == common->memory) {
-		size = config_params.channel_bufsize[ch->channel_id];
-		/*
-		* Checking if the buffer size exceeds the available buffer
-		* ycmux_mode = 0 means 1 channel mode HD and
-		* ycmux_mode = 1 means 2 channels mode SD
-		*/
-		if (ch->vpifparams.std_info.ycmux_mode == 0) {
-			if (config_params.video_limit[ch->channel_id])
-				while (size * *nbuffers >
-					(config_params.video_limit[0]
-						+ config_params.video_limit[1]))
-					(*nbuffers)--;
-		} else {
-			if (config_params.video_limit[ch->channel_id])
-				while (size * *nbuffers >
-				config_params.video_limit[ch->channel_id])
-					(*nbuffers)--;
-		}
-	} else {
-		size = common->fmt.fmt.pix.sizeimage;
-	}
 
-	if (*nbuffers < config_params.min_numbuffers)
-			*nbuffers = config_params.min_numbuffers;
+	if (fmt && fmt->fmt.pix.sizeimage < common->fmt.fmt.pix.sizeimage)
+		return -EINVAL;
+
+	if (vq->num_buffers + *nbuffers < 3)
+		*nbuffers = 3 - vq->num_buffers;
 
 	*nplanes = 1;
-	sizes[0] = size;
+	sizes[0] = fmt ? fmt->fmt.pix.sizeimage : common->fmt.fmt.pix.sizeimage;
 	alloc_ctxs[0] = common->alloc_ctx;
+
+	/* Calculate the offset for Y and C data  in the buffer */
+	vpif_calculate_offsets(ch);
+
 	return 0;
 }
 
@@ -185,9 +177,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	ch->field_id = 0;
 	common->started = 1;
 
-	/* Calculate the offset for Y and C data  in the buffer */
-	vpif_calculate_offsets(ch);
-
 	if ((ch->vpifparams.std_info.frm_fmt &&
 		((common->fmt.fmt.pix.field != V4L2_FIELD_NONE)
 		&& (common->fmt.fmt.pix.field != V4L2_FIELD_ANY)))
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (7 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll Lad, Prabhakar
                   ` (43 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops unnecessary check from start_streaming() callback
as this is already done in try/s_fmt and some minor code cleanups,
drops check for vb2_is_streaming() as this check is done by vb2
itself before calling this callback.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   59 ++++++++++++++-----------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1b6cbe8..933d28f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,11 +62,18 @@ static struct vpif_config_params config_params = {
 	.channel_bufsize[1]	= 720 * 576 * 2,
 };
 
+static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
+
 static struct vpif_device vpif_obj = { {NULL} };
 static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
+static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
+{
+	return container_of(vb, struct vpif_disp_buffer, vb);
+}
+
 /**
  * vpif_buffer_prepare :  callback function for buffer prepare
  * @vb: ptr to vb2_buffer
@@ -139,13 +146,15 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 	return 0;
 }
 
-/*
- * vpif_buffer_queue: This function adds the buffer to DMA queue
+/**
+ * vpif_buffer_queue : Callback function to add buffer to DMA queue
+ * @vb: ptr to vb2_buffer
+ *
+ * This callback fucntion queues the buffer to DMA engine
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
-	struct vpif_disp_buffer *buf = container_of(vb,
-				struct vpif_disp_buffer, vb);
+	struct vpif_disp_buffer *buf = to_vpif_buffer(vb);
 	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
 	struct common_obj *common;
 	unsigned long flags;
@@ -158,8 +167,11 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
 	spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
-
+/**
+ * vpif_start_streaming : Starts the DMA engine for streaming
+ * @vb: ptr to vb2_buffer
+ * @count: number of buffers
+ */
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_display_config *vpif_config_data =
@@ -177,16 +189,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	ch->field_id = 0;
 	common->started = 1;
 
-	if ((ch->vpifparams.std_info.frm_fmt &&
-		((common->fmt.fmt.pix.field != V4L2_FIELD_NONE)
-		&& (common->fmt.fmt.pix.field != V4L2_FIELD_ANY)))
-		|| (!ch->vpifparams.std_info.frm_fmt
-		&& (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
-		vpif_err("conflict in field format and std format\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
 	/* clock settings */
 	if (vpif_config_data->set_clock) {
 		ret = vpif_config_data->set_clock(ch->vpifparams.std_info.
@@ -220,8 +222,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 			    (addr + common->ctop_off),
 			    (addr + common->cbtm_off));
 
-	/* Set interrupt for both the fields in VPIF
-	    Register enable channel in VPIF register */
+	/*
+	 * Set interrupt for both the fields in VPIF
+	 * Register enable channel in VPIF register
+	 */
 	channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
 	if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
 		channel2_intr_assert();
@@ -231,8 +235,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 			channel2_clipping_enable(1);
 	}
 
-	if ((VPIF_CHANNEL3_VIDEO == ch->channel_id)
-		|| (common->started == 2)) {
+	if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
+		common->started == 2) {
 		channel3_intr_assert();
 		channel3_intr_enable(1);
 		enable_channel3(1);
@@ -251,16 +255,19 @@ err:
 	return ret;
 }
 
-/* abort streaming and wait for last buffer */
+/**
+ * vpif_stop_streaming : Stop the DMA engine
+ * @vq: ptr to vb2_queue
+ *
+ * This callback stops the DMA engine and any remaining buffers
+ * in the DMA queue are released.
+ */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
 
-	if (!vb2_is_streaming(vq))
-		return;
-
 	common = &ch->common[VPIF_VIDEO_INDEX];
 
 	/* Disable channel */
@@ -268,8 +275,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 		enable_channel2(0);
 		channel2_intr_enable(0);
 	}
-	if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
-		(2 == common->started)) {
+	if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
+		2 == common->started) {
 		enable_channel3(0);
 		channel3_intr_enable(0);
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (8 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
                   ` (42 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   49 ++++---------------------
 1 file changed, 7 insertions(+), 42 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 933d28f..cea526b 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -646,44 +646,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /*
- * vpif_mmap: It is used to map kernel space buffers into user spaces
- */
-static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
-	int ret;
-
-	vpif_dbg(2, debug, "vpif_mmap\n");
-
-	if (mutex_lock_interruptible(&common->lock))
-		return -ERESTARTSYS;
-	ret = vb2_mmap(&common->buffer_queue, vma);
-	mutex_unlock(&common->lock);
-	return ret;
-}
-
-/*
- * vpif_poll: It is used for select/poll system call
- */
-static unsigned int vpif_poll(struct file *filep, poll_table *wait)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	unsigned int res = 0;
-
-	if (common->started) {
-		mutex_lock(&common->lock);
-		res = vb2_poll(&common->buffer_queue, filep, wait);
-		mutex_unlock(&common->lock);
-	}
-
-	return res;
-}
-
-/*
  * vpif_open: It creates object of file handle structure and stores it in
  * private_data member of filepointer
  */
@@ -1463,8 +1425,8 @@ static const struct v4l2_file_operations vpif_fops = {
 	.open		= vpif_open,
 	.release	= vpif_release,
 	.unlocked_ioctl	= video_ioctl2,
-	.mmap		= vpif_mmap,
-	.poll		= vpif_poll
+	.mmap		= vb2_fop_mmap,
+	.poll		= vb2_fop_poll
 };
 
 static struct video_device vpif_video_template = {
@@ -1555,6 +1517,7 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier,
 static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
+	struct video_device *vdev;
 	struct channel_obj *ch;
 	struct vb2_queue *q;
 	int j, err, k;
@@ -1636,8 +1599,10 @@ static int vpif_probe_complete(void)
 		vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
 			 (int)ch, (int)&ch->video_dev);
 
-		err = video_register_device(ch->video_dev,
-					  VFL_TYPE_GRABBER, (j ? 3 : 2));
+		vdev = ch->video_dev;
+		vdev->queue = q;
+		err = video_register_device(vdev, VFL_TYPE_GRABBER,
+					    (j ? 3 : 2));
 		if (err < 0)
 			goto probe_out;
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (9 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers Lad, Prabhakar
                   ` (41 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds support to use v4l2_fh_open() and vb2_fop_release,
which allows to drop driver specific struct vpif_fh, as this is handeled
by core. This patch also drops vpif_g/s_priority as this handeled
by core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |  228 +++++--------------------
 drivers/media/platform/davinci/vpif_display.h |   15 --
 2 files changed, 43 insertions(+), 200 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index cea526b..5fc1256 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -645,85 +645,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 	}
 }
 
-/*
- * vpif_open: It creates object of file handle structure and stores it in
- * private_data member of filepointer
- */
-static int vpif_open(struct file *filep)
-{
-	struct video_device *vdev = video_devdata(filep);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct vpif_fh *fh;
-
-	/* Allocate memory for the file handle object */
-	fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL);
-	if (fh == NULL) {
-		vpif_err("unable to allocate memory for file handle object\n");
-		return -ENOMEM;
-	}
-
-	if (mutex_lock_interruptible(&common->lock)) {
-		kfree(fh);
-		return -ERESTARTSYS;
-	}
-	/* store pointer to fh in private_data member of filep */
-	filep->private_data = fh;
-	fh->channel = ch;
-	fh->initialized = 0;
-	if (!ch->initialized) {
-		fh->initialized = 1;
-		ch->initialized = 1;
-		memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
-	}
-
-	/* Increment channel usrs counter */
-	atomic_inc(&ch->usrs);
-	/* Set io_allowed[VPIF_VIDEO_INDEX] member to false */
-	fh->io_allowed[VPIF_VIDEO_INDEX] = 0;
-	/* Initialize priority of this instance to default priority */
-	fh->prio = V4L2_PRIORITY_UNSET;
-	v4l2_prio_open(&ch->prio, &fh->prio);
-	mutex_unlock(&common->lock);
-
-	return 0;
-}
-
-/*
- * vpif_release: This function deletes buffer queue, frees the buffers and
- * the vpif file handle
- */
-static int vpif_release(struct file *filep)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	mutex_lock(&common->lock);
-	/* if this instance is doing IO */
-	if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		/* Reset io_usrs member of channel object */
-		common->io_usrs = 0;
-		common->numbuffers =
-		    config_params.numbuffers[ch->channel_id];
-	}
-
-	/* Decrement channel usrs counter */
-	atomic_dec(&ch->usrs);
-	/* If this file handle has initialize encoder device, reset it */
-	if (fh->initialized)
-		ch->initialized = 0;
-
-	/* Close the priority */
-	v4l2_prio_close(&ch->prio, fh->prio);
-	filep->private_data = NULL;
-	fh->initialized = 0;
-	mutex_unlock(&common->lock);
-	kfree(fh);
-
-	return 0;
-}
-
 /* functions implementing ioctls */
 /**
  * vpif_querycap() - QUERYCAP handler
@@ -765,8 +686,8 @@ static int vpif_enum_fmt_vid_out(struct file *file, void  *priv,
 static int vpif_g_fmt_vid_out(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	/* Check the validity of the buffer type */
@@ -782,26 +703,12 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv,
 static int vpif_s_fmt_vid_out(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct v4l2_pix_format *pixfmt;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
+	struct v4l2_pix_format *pixfmt;
 	int ret = 0;
 
-	if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
-	    || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_dbg(1, debug, "Channel Busy\n");
-			return -EBUSY;
-		}
-
-		/* Check for the priority */
-		ret = v4l2_prio_check(&ch->prio, fh->prio);
-		if (0 != ret)
-			return ret;
-		fh->initialized = 1;
-	}
-
 	if (common->started) {
 		vpif_dbg(1, debug, "Streaming in progress\n");
 		return -EBUSY;
@@ -823,8 +730,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
 static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 	int ret = 0;
@@ -841,22 +748,12 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 static int vpif_reqbufs(struct file *file, void *priv,
 			struct v4l2_requestbuffers *reqbuf)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common;
 	enum v4l2_field field;
 	u8 index = 0;
 
-	/* This file handle has not initialized the channel,
-	   It is not allowed to do settings */
-	if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
-	    || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_err("Channel Busy\n");
-			return -EBUSY;
-		}
-	}
-
 	if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type)
 		return -EINVAL;
 
@@ -877,8 +774,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	} else {
 		field = V4L2_VBI_INTERLACED;
 	}
-	/* Set io allowed member of file handle to TRUE */
-	fh->io_allowed[index] = 1;
 	/* Increment io usrs member of channel object to 1 */
 	common->io_usrs = 1;
 	/* Store type of memory requested in channel object */
@@ -890,8 +785,8 @@ static int vpif_reqbufs(struct file *file, void *priv,
 static int vpif_querybuf(struct file *file, void *priv,
 				struct v4l2_buffer *tbuf)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	if (common->fmt.type != tbuf->type)
@@ -902,15 +797,13 @@ static int vpif_querybuf(struct file *file, void *priv,
 
 static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 {
-	struct vpif_fh *fh = NULL;
-	struct channel_obj *ch = NULL;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = NULL;
 
 	if (!buf || !priv)
 		return -EINVAL;
 
-	fh = priv;
-	ch = fh->channel;
 	if (!ch)
 		return -EINVAL;
 
@@ -918,18 +811,13 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 	if (common->fmt.type != buf->type)
 		return -EINVAL;
 
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_err("fh->io_allowed\n");
-		return -EACCES;
-	}
-
 	return vb2_qbuf(&common->buffer_queue, buf);
 }
 
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	int ret = 0;
 
@@ -975,8 +863,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 
 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 
 	*std = ch->video.stdid;
 	return 0;
@@ -984,8 +872,8 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 
 static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	return vb2_dqbuf(&common->buffer_queue, p,
@@ -995,8 +883,8 @@ static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
 static int vpif_streamon(struct file *file, void *priv,
 				enum v4l2_buf_type buftype)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
 	int ret = 0;
@@ -1006,11 +894,6 @@ static int vpif_streamon(struct file *file, void *priv,
 		return -EINVAL;
 	}
 
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_err("fh->io_allowed\n");
-		return -EACCES;
-	}
-
 	/* If Streaming is already started, return error */
 	if (common->started) {
 		vpif_err("channel->started\n");
@@ -1043,8 +926,8 @@ static int vpif_streamon(struct file *file, void *priv,
 static int vpif_streamoff(struct file *file, void *priv,
 				enum v4l2_buf_type buftype)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_display_config *vpif_config_data =
 					vpif_dev->platform_data;
@@ -1054,11 +937,6 @@ static int vpif_streamoff(struct file *file, void *priv,
 		return -EINVAL;
 	}
 
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_err("fh->io_allowed\n");
-		return -EACCES;
-	}
-
 	if (!common->started) {
 		vpif_err("channel->started\n");
 		return -EINVAL;
@@ -1090,9 +968,10 @@ static int vpif_streamoff(struct file *file, void *priv,
 static int vpif_cropcap(struct file *file, void *priv,
 			struct v4l2_cropcap *crop)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
+
 	if (V4L2_BUF_TYPE_VIDEO_OUTPUT != crop->type)
 		return -EINVAL;
 
@@ -1109,9 +988,9 @@ static int vpif_enum_output(struct file *file, void *fh,
 {
 
 	struct vpif_display_config *config = vpif_dev->platform_data;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_display_chan_config *chan_cfg;
-	struct vpif_fh *vpif_handler = fh;
-	struct channel_obj *ch = vpif_handler->channel;
 
 	chan_cfg = &config->chan_config[ch->channel_id];
 	if (output->index >= chan_cfg->output_count) {
@@ -1205,9 +1084,9 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg,
 static int vpif_s_output(struct file *file, void *priv, unsigned int i)
 {
 	struct vpif_display_config *config = vpif_dev->platform_data;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_display_chan_config *chan_cfg;
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	chan_cfg = &config->chan_config[ch->channel_id];
@@ -1225,32 +1104,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
 
 static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 
 	*i = ch->output_idx;
 
 	return 0;
 }
 
-static int vpif_g_priority(struct file *file, void *priv, enum v4l2_priority *p)
-{
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
-
-	*p = v4l2_prio_max(&ch->prio);
-
-	return 0;
-}
-
-static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
-{
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
-
-	return v4l2_prio_change(&ch->prio, &fh->prio, p);
-}
-
 /**
  * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler
  * @file: file ptr
@@ -1261,8 +1122,8 @@ static int
 vpif_enum_dv_timings(struct file *file, void *priv,
 		     struct v4l2_enum_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	int ret;
 
 	ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
@@ -1280,8 +1141,8 @@ vpif_enum_dv_timings(struct file *file, void *priv,
 static int vpif_s_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_params *vpifparams = &ch->vpifparams;
 	struct vpif_channel_config_params *std_info = &vpifparams->std_info;
 	struct video_obj *vid_ch = &ch->video;
@@ -1369,8 +1230,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
 static int vpif_g_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct video_obj *vid_ch = &ch->video;
 
 	*timings = vid_ch->dv_timings;
@@ -1396,8 +1257,6 @@ static int vpif_log_status(struct file *filep, void *priv)
 /* vpif display ioctl operations */
 static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_querycap        	= vpif_querycap,
-	.vidioc_g_priority		= vpif_g_priority,
-	.vidioc_s_priority		= vpif_s_priority,
 	.vidioc_enum_fmt_vid_out	= vpif_enum_fmt_vid_out,
 	.vidioc_g_fmt_vid_out  		= vpif_g_fmt_vid_out,
 	.vidioc_s_fmt_vid_out   	= vpif_s_fmt_vid_out,
@@ -1422,8 +1281,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 
 static const struct v4l2_file_operations vpif_fops = {
 	.owner		= THIS_MODULE,
-	.open		= vpif_open,
-	.release	= vpif_release,
+	.open		= v4l2_fh_open,
+	.release	= vb2_fop_release,
 	.unlocked_ioctl	= video_ioctl2,
 	.mmap		= vb2_fop_mmap,
 	.poll		= vb2_fop_poll
@@ -1556,12 +1415,8 @@ static int vpif_probe_complete(void)
 
 		memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
 
-		/* Initialize prio member of channel object */
-		v4l2_prio_init(&ch->prio);
 		ch->common[VPIF_VIDEO_INDEX].fmt.type =
 						V4L2_BUF_TYPE_VIDEO_OUTPUT;
-		ch->video_dev->lock = &common->lock;
-		video_set_drvdata(ch->video_dev, ch);
 
 		/* select output 0 */
 		err = vpif_set_output(vpif_obj.config, ch, 0);
@@ -1601,6 +1456,9 @@ static int vpif_probe_complete(void)
 
 		vdev = ch->video_dev;
 		vdev->queue = q;
+		vdev->lock = &common->lock;
+		set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
+		video_set_drvdata(ch->video_dev, ch);
 		err = video_register_device(vdev, VFL_TYPE_GRABBER,
 					    (j ? 3 : 2));
 		if (err < 0)
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 4d0485b..18c7bd5 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -113,8 +113,6 @@ struct channel_obj {
 	/* V4l2 specific parameters */
 	struct video_device *video_dev;	/* Identifies video device for
 					 * this channel */
-	struct v4l2_prio_state prio;	/* Used to keep track of state of
-					 * the priority */
 	atomic_t usrs;			/* number of open instances of
 					 * the channel */
 	u32 field_id;			/* Indicates id of the field
@@ -130,19 +128,6 @@ struct channel_obj {
 	struct video_obj video;
 };
 
-/* File handle structure */
-struct vpif_fh {
-	struct channel_obj *channel;	/* pointer to channel object for
-					 * opened device */
-	u8 io_allowed[VPIF_NUMOBJECTS];	/* Indicates whether this file handle
-					 * is doing IO */
-	enum v4l2_priority prio;	/* Used to keep track priority of
-					 * this instance */
-	u8 initialized;			/* Used to keep track of whether this
-					 * file handle has initialized
-					 * channel or not */
-};
-
 /* vpif device structure */
 struct vpif_device {
 	struct v4l2_device v4l2_dev;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (10 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers Lad, Prabhakar
                   ` (40 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |  180 ++-----------------------
 1 file changed, 10 insertions(+), 170 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 5fc1256..8bd3794 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -745,75 +745,6 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 	return ret;
 }
 
-static int vpif_reqbufs(struct file *file, void *priv,
-			struct v4l2_requestbuffers *reqbuf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common;
-	enum v4l2_field field;
-	u8 index = 0;
-
-	if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type)
-		return -EINVAL;
-
-	index = VPIF_VIDEO_INDEX;
-
-	common = &ch->common[index];
-
-	if (common->fmt.type != reqbuf->type || !vpif_dev)
-		return -EINVAL;
-	if (0 != common->io_usrs)
-		return -EBUSY;
-
-	if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
-		if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY)
-			field = V4L2_FIELD_INTERLACED;
-		else
-			field = common->fmt.fmt.pix.field;
-	} else {
-		field = V4L2_VBI_INTERLACED;
-	}
-	/* Increment io usrs member of channel object to 1 */
-	common->io_usrs = 1;
-	/* Store type of memory requested in channel object */
-	common->memory = reqbuf->memory;
-	/* Allocate buffers */
-	return vb2_reqbufs(&common->buffer_queue, reqbuf);
-}
-
-static int vpif_querybuf(struct file *file, void *priv,
-				struct v4l2_buffer *tbuf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	if (common->fmt.type != tbuf->type)
-		return -EINVAL;
-
-	return vb2_querybuf(&common->buffer_queue, tbuf);
-}
-
-static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = NULL;
-
-	if (!buf || !priv)
-		return -EINVAL;
-
-	if (!ch)
-		return -EINVAL;
-
-	common = &(ch->common[VPIF_VIDEO_INDEX]);
-	if (common->fmt.type != buf->type)
-		return -EINVAL;
-
-	return vb2_qbuf(&common->buffer_queue, buf);
-}
-
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
 	struct video_device *vdev = video_devdata(file);
@@ -870,101 +801,6 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 	return 0;
 }
 
-static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	return vb2_dqbuf(&common->buffer_queue, p,
-					(file->f_flags & O_NONBLOCK));
-}
-
-static int vpif_streamon(struct file *file, void *priv,
-				enum v4l2_buf_type buftype)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
-	int ret = 0;
-
-	if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
-		vpif_err("buffer type not supported\n");
-		return -EINVAL;
-	}
-
-	/* If Streaming is already started, return error */
-	if (common->started) {
-		vpif_err("channel->started\n");
-		return -EBUSY;
-	}
-
-	if ((ch->channel_id == VPIF_CHANNEL2_VIDEO
-		&& oth_ch->common[VPIF_VIDEO_INDEX].started &&
-		ch->vpifparams.std_info.ycmux_mode == 0)
-		|| ((ch->channel_id == VPIF_CHANNEL3_VIDEO)
-		&& (2 == oth_ch->common[VPIF_VIDEO_INDEX].started))) {
-		vpif_err("other channel is using\n");
-		return -EBUSY;
-	}
-
-	ret = vpif_check_format(ch, &common->fmt.fmt.pix);
-	if (ret < 0)
-		return ret;
-
-	/* Call vb2_streamon to start streaming in videobuf2 */
-	ret = vb2_streamon(&common->buffer_queue, buftype);
-	if (ret < 0) {
-		vpif_err("vb2_streamon\n");
-		return ret;
-	}
-
-	return ret;
-}
-
-static int vpif_streamoff(struct file *file, void *priv,
-				enum v4l2_buf_type buftype)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct vpif_display_config *vpif_config_data =
-					vpif_dev->platform_data;
-
-	if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
-		vpif_err("buffer type not supported\n");
-		return -EINVAL;
-	}
-
-	if (!common->started) {
-		vpif_err("channel->started\n");
-		return -EINVAL;
-	}
-
-	if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
-		/* disable channel */
-		if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
-			if (vpif_config_data->
-				chan_config[VPIF_CHANNEL2_VIDEO].clip_en)
-				channel2_clipping_enable(0);
-			enable_channel2(0);
-			channel2_intr_enable(0);
-		}
-		if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
-					(2 == common->started)) {
-			if (vpif_config_data->
-				chan_config[VPIF_CHANNEL3_VIDEO].clip_en)
-				channel3_clipping_enable(0);
-			enable_channel3(0);
-			channel3_intr_enable(0);
-		}
-	}
-
-	common->started = 0;
-	return vb2_streamoff(&common->buffer_queue, buftype);
-}
-
 static int vpif_cropcap(struct file *file, void *priv,
 			struct v4l2_cropcap *crop)
 {
@@ -1261,12 +1097,16 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_g_fmt_vid_out  		= vpif_g_fmt_vid_out,
 	.vidioc_s_fmt_vid_out   	= vpif_s_fmt_vid_out,
 	.vidioc_try_fmt_vid_out 	= vpif_try_fmt_vid_out,
-	.vidioc_reqbufs         	= vpif_reqbufs,
-	.vidioc_querybuf        	= vpif_querybuf,
-	.vidioc_qbuf            	= vpif_qbuf,
-	.vidioc_dqbuf           	= vpif_dqbuf,
-	.vidioc_streamon        	= vpif_streamon,
-	.vidioc_streamoff       	= vpif_streamoff,
+
+	.vidioc_reqbufs			= vb2_ioctl_reqbufs,
+	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
+	.vidioc_querybuf		= vb2_ioctl_querybuf,
+	.vidioc_qbuf			= vb2_ioctl_qbuf,
+	.vidioc_dqbuf			= vb2_ioctl_dqbuf,
+	.vidioc_expbuf			= vb2_ioctl_expbuf,
+	.vidioc_streamon		= vb2_ioctl_streamon,
+	.vidioc_streamoff		= vb2_ioctl_streamoff,
+
 	.vidioc_s_std           	= vpif_s_std,
 	.vidioc_g_std			= vpif_g_std,
 	.vidioc_enum_output		= vpif_enum_output,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (11 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device Lad, Prabhakar
                   ` (39 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 18c7bd5..b22bb33 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -67,9 +67,6 @@ struct vpif_disp_buffer {
 };
 
 struct common_obj {
-	/* Buffer specific parameters */
-	u8 *fbuffers[VIDEO_MAX_FRAME];		/* List of buffer pointers for
-						 * storing frames */
 	u32 numbuffers;				/* number of buffers */
 	struct vpif_disp_buffer *cur_frm;	/* Pointer pointing to current
 						 * vb2_buffer */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (12 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory Lad, Prabhakar
                   ` (38 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops reserving contigiuos memory for the device,
as now with CMA support there is no need of this.
This patch also prepares to removal of config_params.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 8bd3794..bfe1e50 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1338,7 +1338,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 	struct video_device *vfd;
 	struct resource *res;
 	int subdev_count;
-	size_t size;
 
 	vpif_dev = &pdev->dev;
 	err = initialize_vpif();
@@ -1395,23 +1394,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 		ch->video_dev = vfd;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res) {
-		size = resource_size(res);
-		/* The resources are divided into two equal memory and when
-		 * we have HD output we can add them together
-		 */
-		for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
-			ch = vpif_obj.dev[j];
-			ch->channel_id = j;
-
-			/* only enabled if second resource exists */
-			config_params.video_limit[ch->channel_id] = 0;
-			if (size)
-				config_params.video_limit[ch->channel_id] =
-									size/2;
-		}
-	}
 	vpif_obj.config = pdev->dev.platform_data;
 	subdev_count = vpif_obj.config->subdev_count;
 	subdevdata = vpif_obj.config->subdevinfo;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (13 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj Lad, Prabhakar
                   ` (37 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |    5 -----
 drivers/media/platform/davinci/vpif_display.h |    3 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index bfe1e50..ab097ce 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -572,11 +572,6 @@ static void vpif_config_format(struct channel_obj *ch)
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	if (config_params.numbuffers[ch->channel_id] == 0)
-		common->memory = V4L2_MEMORY_USERPTR;
-	else
-		common->memory = V4L2_MEMORY_MMAP;
-
 	common->fmt.fmt.pix.sizeimage =
 			config_params.channel_bufsize[ch->channel_id];
 	common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index b22bb33..06b8d24 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -72,9 +72,6 @@ struct common_obj {
 						 * vb2_buffer */
 	struct vpif_disp_buffer *next_frm;	/* Pointer pointing to next
 						 * vb2_buffer */
-	enum v4l2_memory memory;		/* This field keeps track of
-						 * type of buffer exchange
-						 * method user has selected */
 	struct v4l2_format fmt;			/* Used to store the format */
 	struct vb2_queue buffer_queue;		/* Buffer queue used in
 						 * video-buf */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (14 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj Lad, Prabhakar
                   ` (36 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops numbuffers member from struct common_obj
as this was not required.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |    8 --------
 drivers/media/platform/davinci/vpif_display.h |    1 -
 2 files changed, 9 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index ab097ce..5ea2db8 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1221,13 +1221,11 @@ static int vpif_probe_complete(void)
 		/* Initialize field of the channel objects */
 		atomic_set(&ch->usrs, 0);
 		for (k = 0; k < VPIF_NUMOBJECTS; k++) {
-			ch->common[k].numbuffers = 0;
 			common = &ch->common[k];
 			common->io_usrs = 0;
 			common->started = 0;
 			spin_lock_init(&common->irqlock);
 			mutex_init(&common->lock);
-			common->numbuffers = 0;
 			common->set_addr = NULL;
 			common->ytop_off = 0;
 			common->ybtm_off = 0;
@@ -1236,17 +1234,11 @@ static int vpif_probe_complete(void)
 			common->cur_frm = NULL;
 			common->next_frm = NULL;
 			memset(&common->fmt, 0, sizeof(common->fmt));
-			common->numbuffers = config_params.numbuffers[k];
 		}
 		ch->initialized = 0;
 		if (vpif_obj.config->subdev_count)
 			ch->sd = vpif_obj.sd[0];
 		ch->channel_id = j;
-		if (j < 2)
-			ch->common[VPIF_VIDEO_INDEX].numbuffers =
-			    config_params.numbuffers[ch->channel_id];
-		else
-			ch->common[VPIF_VIDEO_INDEX].numbuffers = 0;
 
 		memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
 
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 06b8d24..e21a343 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -67,7 +67,6 @@ struct vpif_disp_buffer {
 };
 
 struct common_obj {
-	u32 numbuffers;				/* number of buffers */
 	struct vpif_disp_buffer *cur_frm;	/* Pointer pointing to current
 						 * vb2_buffer */
 	struct vpif_disp_buffer *next_frm;	/* Pointer pointing to next
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (15 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place Lad, Prabhakar
                   ` (35 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

the started member was indicating whether streaming was started
or not, this can be determined by vb2 offering, this patch replaces
the started member from struct common_obj with appropriate vb2 calls.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   42 ++++++++++---------------
 drivers/media/platform/davinci/vpif_display.h |    2 --
 2 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 5ea2db8..aa487a6 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,6 +62,10 @@ static struct vpif_config_params config_params = {
 	.channel_bufsize[1]	= 720 * 576 * 2,
 };
 
+
+/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
+static int ycmux_mode;
+
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static struct vpif_device vpif_obj = { {NULL} };
@@ -185,9 +189,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	spin_lock_irqsave(&common->irqlock, flags);
 
-	/* Initialize field_id and started member */
+	/* Initialize field_id */
 	ch->field_id = 0;
-	common->started = 1;
 
 	/* clock settings */
 	if (vpif_config_data->set_clock) {
@@ -204,7 +207,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	if (ret < 0)
 		goto err;
 
-	common->started = ret;
+	ycmux_mode = ret;
 	vpif_config_addr(ch, ret);
 	/* Get the next frame from the buffer queue */
 	common->next_frm = common->cur_frm =
@@ -235,8 +238,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 			channel2_clipping_enable(1);
 	}
 
-	if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
-		common->started == 2) {
+	if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) {
 		channel3_intr_assert();
 		channel3_intr_enable(1);
 		enable_channel3(1);
@@ -275,12 +277,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 		enable_channel2(0);
 		channel2_intr_enable(0);
 	}
-	if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
-		2 == common->started) {
+	if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) {
 		enable_channel3(0);
 		channel3_intr_enable(0);
 	}
-	common->started = 0;
 
 	/* release all active buffers */
 	spin_lock_irqsave(&common->irqlock, flags);
@@ -392,8 +392,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
 	for (i = 0; i < VPIF_NUMOBJECTS; i++) {
 		common = &ch->common[i];
 		/* If streaming is started in this channel */
-		if (0 == common->started)
-			continue;
 
 		if (1 == ch->vpifparams.std_info.frm_fmt) {
 			spin_lock(&common->irqlock);
@@ -704,10 +702,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
 	struct v4l2_pix_format *pixfmt;
 	int ret = 0;
 
-	if (common->started) {
-		vpif_dbg(1, debug, "Streaming in progress\n");
+	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
-	}
 
 	pixfmt = &fmt->fmt.pix;
 	/* Check for valid field format */
@@ -747,13 +743,12 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	int ret = 0;
 
+	if (vb2_is_busy(&common->buffer_queue))
+		return -EBUSY;
+
 	if (!(std_id & VPIF_V4L2_STD))
 		return -EINVAL;
 
-	if (common->started) {
-		vpif_err("streaming in progress\n");
-		return -EBUSY;
-	}
 
 	/* Call encoder subdevice function to set the standard */
 	ch->video.stdid = std_id;
@@ -920,16 +915,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
 	struct vpif_display_chan_config *chan_cfg;
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
+	if (vb2_is_busy(&common->buffer_queue))
+		return -EBUSY;
+
 	chan_cfg = &config->chan_config[ch->channel_id];
 
 	if (i >= chan_cfg->output_count)
 		return -EINVAL;
 
-	if (common->started) {
-		vpif_err("Streaming in progress\n");
-		return -EBUSY;
-	}
-
 	return vpif_set_output(config, ch, i);
 }
 
@@ -1223,7 +1216,6 @@ static int vpif_probe_complete(void)
 		for (k = 0; k < VPIF_NUMOBJECTS; k++) {
 			common = &ch->common[k];
 			common->io_usrs = 0;
-			common->started = 0;
 			spin_lock_init(&common->irqlock);
 			mutex_init(&common->lock);
 			common->set_addr = NULL;
@@ -1488,7 +1480,7 @@ static int vpif_suspend(struct device *dev)
 				channel2_intr_enable(0);
 			}
 			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
-					common->started == 2) {
+				ycmux_mode == 2) {
 				enable_channel3(0);
 				channel3_intr_enable(0);
 			}
@@ -1518,7 +1510,7 @@ static int vpif_resume(struct device *dev)
 				channel2_intr_enable(1);
 			}
 			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
-					common->started == 2) {
+					ycmux_mode == 2) {
 				enable_channel3(1);
 				channel3_intr_enable(1);
 			}
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index e21a343..029e0c5 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -85,8 +85,6 @@ struct common_obj {
 						 * structure */
 	u32 io_usrs;				/* number of users performing
 						 * IO */
-	u8 started;				/* Indicates whether streaming
-						 * started */
 	u32 ytop_off;				/* offset of Y top from the
 						 * starting of the buffer */
 	u32 ybtm_off;				/* offset of Y bottom from the
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (16 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params Lad, Prabhakar
                   ` (34 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch moves the initalization of video device to a
single place and uses macro to define the driver name and
use it appropraitely in required places.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   29 ++++++++++---------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index aa487a6..1e0a162 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,6 +62,7 @@ static struct vpif_config_params config_params = {
 	.channel_bufsize[1]	= 720 * 576 * 2,
 };
 
+#define VPIF_DRIVER_NAME	"vpif_display"
 
 /* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
 static int ycmux_mode;
@@ -652,7 +653,7 @@ static int vpif_querycap(struct file *file, void  *priv,
 
 	cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
-	snprintf(cap->driver, sizeof(cap->driver), "%s", dev_name(vpif_dev));
+	strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
 		 dev_name(vpif_dev));
 	strlcpy(cap->card, config->card_name, sizeof(cap->card));
@@ -1116,12 +1117,6 @@ static const struct v4l2_file_operations vpif_fops = {
 	.poll		= vb2_fop_poll
 };
 
-static struct video_device vpif_video_template = {
-	.name		= "vpif",
-	.fops		= &vpif_fops,
-	.ioctl_ops	= &vpif_ioctl_ops,
-};
-
 /*Configure the channels, buffer sizei, request irq */
 static int initialize_vpif(void)
 {
@@ -1273,7 +1268,14 @@ static int vpif_probe_complete(void)
 		vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
 			 (int)ch, (int)&ch->video_dev);
 
+		/* Initialize the video_device structure */
 		vdev = ch->video_dev;
+		strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
+		vdev->release = video_device_release;
+		vdev->fops = &vpif_fops;
+		vdev->ioctl_ops = &vpif_ioctl_ops;
+		vdev->v4l2_dev = &vpif_obj.v4l2_dev;
+		vdev->vfl_dir = VFL_DIR_TX;
 		vdev->queue = q;
 		vdev->lock = &common->lock;
 		set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
@@ -1334,7 +1336,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 
 	while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
 		err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr,
-					IRQF_SHARED, "VPIF_Display",
+					IRQF_SHARED, VPIF_DRIVER_NAME,
 					(void *)(&vpif_obj.dev[res_idx]->
 					channel_id));
 		if (err) {
@@ -1360,15 +1362,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 			goto vpif_unregister;
 		}
 
-		/* Initialize field of video device */
-		*vfd = vpif_video_template;
-		vfd->v4l2_dev = &vpif_obj.v4l2_dev;
-		vfd->release = video_device_release;
-		vfd->vfl_dir = VFL_DIR_TX;
-		snprintf(vfd->name, sizeof(vfd->name),
-			 "VPIF_Display_DRIVER_V%s",
-			 VPIF_DISPLAY_VERSION);
-
 		/* Set video_dev to the video device */
 		ch->video_dev = vfd;
 	}
@@ -1533,7 +1526,7 @@ static const struct dev_pm_ops vpif_pm = {
 
 static __refdata struct platform_driver vpif_driver = {
 	.driver	= {
-			.name	= "vpif_display",
+			.name	= VPIF_DRIVER_NAME,
 			.owner	= THIS_MODULE,
 			.pm	= vpif_pm_ops,
 	},
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (17 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 19/49] media: davinci: vpif_display: drop cropcap Lad, Prabhakar
                   ` (33 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this pacth drops unneeded module params and vpif_config_params.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   69 +------------------------
 drivers/media/platform/davinci/vpif_display.h |    8 ---
 2 files changed, 1 insertion(+), 76 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1e0a162..fef03be 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -35,32 +35,10 @@ MODULE_VERSION(VPIF_DISPLAY_VERSION);
 		v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
 
 static int debug = 1;
-static u32 ch2_numbuffers = 3;
-static u32 ch3_numbuffers = 3;
-static u32 ch2_bufsize = 1920 * 1080 * 2;
-static u32 ch3_bufsize = 720 * 576 * 2;
 
 module_param(debug, int, 0644);
-module_param(ch2_numbuffers, uint, S_IRUGO);
-module_param(ch3_numbuffers, uint, S_IRUGO);
-module_param(ch2_bufsize, uint, S_IRUGO);
-module_param(ch3_bufsize, uint, S_IRUGO);
 
 MODULE_PARM_DESC(debug, "Debug level 0-1");
-MODULE_PARM_DESC(ch2_numbuffers, "Channel2 buffer count (default:3)");
-MODULE_PARM_DESC(ch3_numbuffers, "Channel3 buffer count (default:3)");
-MODULE_PARM_DESC(ch2_bufsize, "Channel2 buffer size (default:1920 x 1080 x 2)");
-MODULE_PARM_DESC(ch3_bufsize, "Channel3 buffer size (default:720 x 576 x 2)");
-
-static struct vpif_config_params config_params = {
-	.min_numbuffers		= 3,
-	.numbuffers[0]		= 3,
-	.numbuffers[1]		= 3,
-	.min_bufsize[0]		= 720 * 480 * 2,
-	.min_bufsize[1]		= 720 * 480 * 2,
-	.channel_bufsize[0]	= 1920 * 1080 * 2,
-	.channel_bufsize[1]	= 720 * 576 * 2,
-};
 
 #define VPIF_DRIVER_NAME	"vpif_display"
 
@@ -571,8 +549,6 @@ static void vpif_config_format(struct channel_obj *ch)
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	common->fmt.fmt.pix.sizeimage =
-			config_params.channel_bufsize[ch->channel_id];
 	common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
 	common->fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
 }
@@ -758,13 +734,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 	if (vpif_update_resolution(ch))
 		return -EINVAL;
 
-	if ((ch->vpifparams.std_info.width *
-		ch->vpifparams.std_info.height * 2) >
-		config_params.channel_bufsize[ch->channel_id]) {
-		vpif_err("invalid std for this size\n");
-		return -EINVAL;
-	}
-
 	common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width;
 	/* Configure the default format information */
 	vpif_config_format(ch);
@@ -1121,39 +1090,7 @@ static const struct v4l2_file_operations vpif_fops = {
 static int initialize_vpif(void)
 {
 	int free_channel_objects_index;
-	int free_buffer_channel_index;
-	int free_buffer_index;
-	int err = 0, i, j;
-
-	/* Default number of buffers should be 3 */
-	if ((ch2_numbuffers > 0) &&
-	    (ch2_numbuffers < config_params.min_numbuffers))
-		ch2_numbuffers = config_params.min_numbuffers;
-	if ((ch3_numbuffers > 0) &&
-	    (ch3_numbuffers < config_params.min_numbuffers))
-		ch3_numbuffers = config_params.min_numbuffers;
-
-	/* Set buffer size to min buffers size if invalid buffer size is
-	 * given */
-	if (ch2_bufsize < config_params.min_bufsize[VPIF_CHANNEL2_VIDEO])
-		ch2_bufsize =
-		    config_params.min_bufsize[VPIF_CHANNEL2_VIDEO];
-	if (ch3_bufsize < config_params.min_bufsize[VPIF_CHANNEL3_VIDEO])
-		ch3_bufsize =
-		    config_params.min_bufsize[VPIF_CHANNEL3_VIDEO];
-
-	config_params.numbuffers[VPIF_CHANNEL2_VIDEO] = ch2_numbuffers;
-
-	if (ch2_numbuffers) {
-		config_params.channel_bufsize[VPIF_CHANNEL2_VIDEO] =
-							ch2_bufsize;
-	}
-	config_params.numbuffers[VPIF_CHANNEL3_VIDEO] = ch3_numbuffers;
-
-	if (ch3_numbuffers) {
-		config_params.channel_bufsize[VPIF_CHANNEL3_VIDEO] =
-							ch3_bufsize;
-	}
+	int err, i, j;
 
 	/* Allocate memory for six channel objects */
 	for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
@@ -1167,10 +1104,6 @@ static int initialize_vpif(void)
 		}
 	}
 
-	free_channel_objects_index = VPIF_DISPLAY_MAX_DEVICES;
-	free_buffer_channel_index = VPIF_DISPLAY_NUM_CHANNELS;
-	free_buffer_index = config_params.numbuffers[i - 1];
-
 	return 0;
 
 vpif_init_free_channel_objects:
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 029e0c5..089e860 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -128,12 +128,4 @@ struct vpif_device {
 	struct vpif_display_config *config;
 };
 
-struct vpif_config_params {
-	u32 min_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
-	u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
-	u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];
-	u32 video_limit[VPIF_DISPLAY_NUM_CHANNELS];
-	u8 min_numbuffers;
-};
-
 #endif				/* DAVINCIHD_DISPLAY_H */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 19/49] media: davinci: vpif_display: drop cropcap
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (18 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 20/49] media: davinci: vpif_display: group v4l2_ioctl_ops Lad, Prabhakar
                   ` (32 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops cropcap as this driver doesnt support cropping.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index fef03be..9848996 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -761,24 +761,6 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 	return 0;
 }
 
-static int vpif_cropcap(struct file *file, void *priv,
-			struct v4l2_cropcap *crop)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	if (V4L2_BUF_TYPE_VIDEO_OUTPUT != crop->type)
-		return -EINVAL;
-
-	crop->bounds.left = crop->bounds.top = 0;
-	crop->defrect.left = crop->defrect.top = 0;
-	crop->defrect.height = crop->bounds.height = common->height;
-	crop->defrect.width = crop->bounds.width = common->width;
-
-	return 0;
-}
-
 static int vpif_enum_output(struct file *file, void *fh,
 				struct v4l2_output *output)
 {
@@ -1070,7 +1052,6 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_enum_output		= vpif_enum_output,
 	.vidioc_s_output		= vpif_s_output,
 	.vidioc_g_output		= vpif_g_output,
-	.vidioc_cropcap         	= vpif_cropcap,
 	.vidioc_enum_dv_timings         = vpif_enum_dv_timings,
 	.vidioc_s_dv_timings            = vpif_s_dv_timings,
 	.vidioc_g_dv_timings            = vpif_g_dv_timings,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 20/49] media: davinci: vpif_display: group v4l2_ioctl_ops
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (19 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 19/49] media: davinci: vpif_display: drop cropcap Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
                   ` (31 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch gorups the v4l2_ioctl_ops and align them appropriately.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 9848996..401d03a 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1032,11 +1032,11 @@ static int vpif_log_status(struct file *filep, void *priv)
 
 /* vpif display ioctl operations */
 static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
-	.vidioc_querycap        	= vpif_querycap,
+	.vidioc_querycap		= vpif_querycap,
 	.vidioc_enum_fmt_vid_out	= vpif_enum_fmt_vid_out,
-	.vidioc_g_fmt_vid_out  		= vpif_g_fmt_vid_out,
-	.vidioc_s_fmt_vid_out   	= vpif_s_fmt_vid_out,
-	.vidioc_try_fmt_vid_out 	= vpif_try_fmt_vid_out,
+	.vidioc_g_fmt_vid_out		= vpif_g_fmt_vid_out,
+	.vidioc_s_fmt_vid_out		= vpif_s_fmt_vid_out,
+	.vidioc_try_fmt_vid_out		= vpif_try_fmt_vid_out,
 
 	.vidioc_reqbufs			= vb2_ioctl_reqbufs,
 	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
@@ -1047,14 +1047,17 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_streamon		= vb2_ioctl_streamon,
 	.vidioc_streamoff		= vb2_ioctl_streamoff,
 
-	.vidioc_s_std           	= vpif_s_std,
+	.vidioc_s_std			= vpif_s_std,
 	.vidioc_g_std			= vpif_g_std,
+
 	.vidioc_enum_output		= vpif_enum_output,
 	.vidioc_s_output		= vpif_s_output,
 	.vidioc_g_output		= vpif_g_output,
-	.vidioc_enum_dv_timings         = vpif_enum_dv_timings,
-	.vidioc_s_dv_timings            = vpif_s_dv_timings,
-	.vidioc_g_dv_timings            = vpif_g_dv_timings,
+
+	.vidioc_enum_dv_timings		= vpif_enum_dv_timings,
+	.vidioc_s_dv_timings		= vpif_s_dv_timings,
+	.vidioc_g_dv_timings		= vpif_g_dv_timings,
+
 	.vidioc_log_status		= vpif_log_status,
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (20 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 20/49] media: davinci: vpif_display: group v4l2_ioctl_ops Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-23  8:48   ` Hans Verkuil
  2014-05-16 13:33 ` [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls Lad, Prabhakar
                   ` (30 subsequent siblings)
  52 siblings, 1 reply; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch uses SIMPLE_DEV_PM_OPS, and drops unneeded members
from io_usrs, usrs and makes use of vb2 helepers instead.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   64 ++++++++++++-------------
 drivers/media/platform/davinci/vpif_display.h |    4 --
 2 files changed, 30 insertions(+), 38 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 401d03a..81d955a 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1124,10 +1124,8 @@ static int vpif_probe_complete(void)
 	for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
 		ch = vpif_obj.dev[j];
 		/* Initialize field of the channel objects */
-		atomic_set(&ch->usrs, 0);
 		for (k = 0; k < VPIF_NUMOBJECTS; k++) {
 			common = &ch->common[k];
-			common->io_usrs = 0;
 			spin_lock_init(&common->irqlock);
 			mutex_init(&common->lock);
 			common->set_addr = NULL;
@@ -1371,7 +1369,7 @@ static int vpif_remove(struct platform_device *device)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int vpif_suspend(struct device *dev)
 {
 	struct common_obj *common;
@@ -1382,18 +1380,20 @@ static int vpif_suspend(struct device *dev)
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
+
+		if (!vb2_is_streaming(&common->buffer_queue))
+			continue;
+
 		mutex_lock(&common->lock);
-		if (atomic_read(&ch->usrs) && common->io_usrs) {
-			/* Disable channel */
-			if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
-				enable_channel2(0);
-				channel2_intr_enable(0);
-			}
-			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
-				ycmux_mode == 2) {
-				enable_channel3(0);
-				channel3_intr_enable(0);
-			}
+		/* Disable channel */
+		if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
+			enable_channel2(0);
+			channel2_intr_enable(0);
+		}
+		if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
+			ycmux_mode == 2) {
+			enable_channel3(0);
+			channel3_intr_enable(0);
 		}
 		mutex_unlock(&common->lock);
 	}
@@ -1412,18 +1412,20 @@ static int vpif_resume(struct device *dev)
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
+
+		if (!vb2_is_streaming(&common->buffer_queue))
+			continue;
+
 		mutex_lock(&common->lock);
-		if (atomic_read(&ch->usrs) && common->io_usrs) {
-			/* Enable channel */
-			if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
-				enable_channel2(1);
-				channel2_intr_enable(1);
-			}
-			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
-					ycmux_mode == 2) {
-				enable_channel3(1);
-				channel3_intr_enable(1);
-			}
+		/* Enable channel */
+		if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
+			enable_channel2(1);
+			channel2_intr_enable(1);
+		}
+		if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
+				ycmux_mode == 2) {
+			enable_channel3(1);
+			channel3_intr_enable(1);
 		}
 		mutex_unlock(&common->lock);
 	}
@@ -1431,21 +1433,15 @@ static int vpif_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops vpif_pm = {
-	.suspend        = vpif_suspend,
-	.resume         = vpif_resume,
-};
-
-#define vpif_pm_ops (&vpif_pm)
-#else
-#define vpif_pm_ops NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume);
+
 static __refdata struct platform_driver vpif_driver = {
 	.driver	= {
 			.name	= VPIF_DRIVER_NAME,
 			.owner	= THIS_MODULE,
-			.pm	= vpif_pm_ops,
+			.pm	= &vpif_pm_ops,
 	},
 	.probe	= vpif_probe,
 	.remove	= vpif_remove,
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 089e860..18cba9a 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -83,8 +83,6 @@ struct common_obj {
 	/* channel specific parameters */
 	struct mutex lock;			/* lock used to access this
 						 * structure */
-	u32 io_usrs;				/* number of users performing
-						 * IO */
 	u32 ytop_off;				/* offset of Y top from the
 						 * starting of the buffer */
 	u32 ybtm_off;				/* offset of Y bottom from the
@@ -104,8 +102,6 @@ struct channel_obj {
 	/* V4l2 specific parameters */
 	struct video_device *video_dev;	/* Identifies video device for
 					 * this channel */
-	atomic_t usrs;			/* number of open instances of
-					 * the channel */
 	u32 field_id;			/* Indicates id of the field
 					 * which is being displayed */
 	u8 initialized;			/* flag to indicate whether
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (21 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 23/49] media: davinci: vpif_display: return -ENODATA for *std calls Lad, Prabhakar
                   ` (29 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds suppport to return -ENODATA for *dv_timings calls
if the current output does not support it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   40 +++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 81d955a..f51b5be 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -898,10 +898,21 @@ static int
 vpif_enum_dv_timings(struct file *file, void *priv,
 		     struct v4l2_enum_dv_timings *timings)
 {
+	struct vpif_display_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_display_chan_config *chan_cfg;
+	struct v4l2_output output;
 	int ret;
 
+	if (config->chan_config[ch->channel_id].outputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	output = chan_cfg->outputs[ch->output_idx].output;
+	if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS)
+		return -ENODATA;
+
 	ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
 	if (ret == -ENOIOCTLCMD || ret == -ENODEV)
 		return -EINVAL;
@@ -917,14 +928,29 @@ vpif_enum_dv_timings(struct file *file, void *priv,
 static int vpif_s_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
+	struct vpif_display_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_params *vpifparams = &ch->vpifparams;
+	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_channel_config_params *std_info = &vpifparams->std_info;
 	struct video_obj *vid_ch = &ch->video;
 	struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt;
+	struct vpif_display_chan_config *chan_cfg;
+	struct v4l2_output output;
 	int ret;
 
+	if (config->chan_config[ch->channel_id].outputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	output = chan_cfg->outputs[ch->output_idx].output;
+	if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS)
+		return -ENODATA;
+
+	if (vb2_is_busy(&common->buffer_queue))
+		return -EBUSY;
+
 	if (timings->type != V4L2_DV_BT_656_1120) {
 		vpif_dbg(2, debug, "Timing type not defined\n");
 		return -EINVAL;
@@ -1006,13 +1032,27 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
 static int vpif_g_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
+	struct vpif_display_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_display_chan_config *chan_cfg;
 	struct video_obj *vid_ch = &ch->video;
+	struct v4l2_output output;
+
+	if (config->chan_config[ch->channel_id].outputs == NULL)
+		goto error;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	output = chan_cfg->outputs[ch->output_idx].output;
+
+	if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS)
+		goto error;
 
 	*timings = vid_ch->dv_timings;
 
 	return 0;
+error:
+	return -ENODATA;
 }
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 23/49] media: davinci: vpif_display: return -ENODATA for *std calls
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (22 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 24/49] media: davinci; vpif_display: fix checkpatch error Lad, Prabhakar
                   ` (28 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds supports to return -ENODATA to *std calls
if the selected output does not support it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index f51b5be..f581e7a 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -715,14 +715,26 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
+	struct vpif_display_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	int ret = 0;
+	struct vpif_display_chan_config *chan_cfg;
+	struct v4l2_output output;
+	int ret;
+
+	if (config->chan_config[ch->channel_id].outputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	output = chan_cfg->outputs[ch->output_idx].output;
+	if (output.capabilities != V4L2_OUT_CAP_STD)
+		return -ENODATA;
 
 	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
 
+
 	if (!(std_id & VPIF_V4L2_STD))
 		return -EINVAL;
 
@@ -754,8 +766,19 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 
 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
+	struct vpif_display_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_display_chan_config *chan_cfg;
+	struct v4l2_output output;
+
+	if (config->chan_config[ch->channel_id].outputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	output = chan_cfg->outputs[ch->output_idx].output;
+	if (output.capabilities != V4L2_OUT_CAP_STD)
+		return -ENODATA;
 
 	*std = ch->video.stdid;
 	return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 24/49] media: davinci; vpif_display: fix checkpatch error
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (23 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 23/49] media: davinci: vpif_display: return -ENODATA for *std calls Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 25/49] media: davinci: vpif_display: fix v4l-complinace issues Lad, Prabhakar
                   ` (27 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch fixes following checkpatch warning, and alongside
renames the DAVINCIHD_DISPLAY_H to VPIF_DISPLAY_H.

WARNING: Unnecessary space before function pointer arguments

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 18cba9a..7b21a76 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  */
 
-#ifndef DAVINCIHD_DISPLAY_H
-#define DAVINCIHD_DISPLAY_H
+#ifndef VPIF_DISPLAY_H
+#define VPIF_DISPLAY_H
 
 /* Header files */
 #include <media/videobuf2-dma-contig.h>
@@ -92,7 +92,7 @@ struct common_obj {
 	u32 cbtm_off;				/* offset of C bottom from the
 						 * starting of the buffer */
 	/* Function pointer to set the addresses */
-	void (*set_addr) (unsigned long, unsigned long,
+	void (*set_addr)(unsigned long, unsigned long,
 				unsigned long, unsigned long);
 	u32 height;
 	u32 width;
@@ -124,4 +124,4 @@ struct vpif_device {
 	struct vpif_display_config *config;
 };
 
-#endif				/* DAVINCIHD_DISPLAY_H */
+#endif				/* VPIF_DISPLAY_H */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 25/49] media: davinci: vpif_display: fix v4l-complinace issues
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (24 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 24/49] media: davinci; vpif_display: fix checkpatch error Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 26/49] media: davinci: vpif_capture: initalize vb2 queue and DMA context during probe Lad, Prabhakar
                   ` (26 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch does following,
1: sets initial default format during probe.
2: removes spurious messages.
3: optimize vpif_s/try_fmt_vid_out code.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c |  138 +++++++++----------------
 1 file changed, 51 insertions(+), 87 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index f581e7a..cda0851 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -466,6 +466,7 @@ static int vpif_update_resolution(struct channel_obj *ch)
 			return -EINVAL;
 	}
 
+	common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
 	common->fmt.fmt.pix.width = std_info->width;
 	common->fmt.fmt.pix.height = std_info->height;
 	vpif_dbg(1, debug, "Pixel details: Width = %d,Height = %d\n",
@@ -474,6 +475,17 @@ static int vpif_update_resolution(struct channel_obj *ch)
 	/* Set height and width paramateres */
 	common->height = std_info->height;
 	common->width = std_info->width;
+	common->fmt.fmt.pix.sizeimage = common->height * common->width * 2;
+
+	if (vid_ch->stdid)
+		common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+	else
+		common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
+
+	if (ch->vpifparams.std_info.frm_fmt)
+		common->fmt.fmt.pix.field = V4L2_FIELD_NONE;
+	else
+		common->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
 
 	return 0;
 }
@@ -544,63 +556,6 @@ static void vpif_calculate_offsets(struct channel_obj *ch)
 	ch->vpifparams.video_params.stdid = ch->vpifparams.std_info.stdid;
 }
 
-static void vpif_config_format(struct channel_obj *ch)
-{
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
-	common->fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-}
-
-static int vpif_check_format(struct channel_obj *ch,
-			     struct v4l2_pix_format *pixfmt)
-{
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	enum v4l2_field field = pixfmt->field;
-	u32 sizeimage, hpitch, vpitch;
-
-	if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P)
-		goto invalid_fmt_exit;
-
-	if (!(VPIF_VALID_FIELD(field)))
-		goto invalid_fmt_exit;
-
-	if (pixfmt->bytesperline <= 0)
-		goto invalid_pitch_exit;
-
-	sizeimage = pixfmt->sizeimage;
-
-	if (vpif_update_resolution(ch))
-		return -EINVAL;
-
-	hpitch = pixfmt->bytesperline;
-	vpitch = sizeimage / (hpitch * 2);
-
-	/* Check for valid value of pitch */
-	if ((hpitch < ch->vpifparams.std_info.width) ||
-	    (vpitch < ch->vpifparams.std_info.height))
-		goto invalid_pitch_exit;
-
-	/* Check for 8 byte alignment */
-	if (!ISALIGNED(hpitch)) {
-		vpif_err("invalid pitch alignment\n");
-		return -EINVAL;
-	}
-	pixfmt->width = common->fmt.fmt.pix.width;
-	pixfmt->height = common->fmt.fmt.pix.height;
-
-	return 0;
-
-invalid_fmt_exit:
-	vpif_err("invalid field format\n");
-	return -EINVAL;
-
-invalid_pitch_exit:
-	vpif_err("invalid pitch\n");
-	return -EINVAL;
-}
-
 static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 {
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
@@ -640,16 +595,14 @@ static int vpif_querycap(struct file *file, void  *priv,
 static int vpif_enum_fmt_vid_out(struct file *file, void  *priv,
 					struct v4l2_fmtdesc *fmt)
 {
-	if (fmt->index != 0) {
-		vpif_err("Invalid format index\n");
+	if (fmt->index != 0)
 		return -EINVAL;
-	}
 
 	/* Fill in the information about format */
 	fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
 	strcpy(fmt->description, "YCbCr4:2:2 YC Planar");
 	fmt->pixelformat = V4L2_PIX_FMT_YUV422P;
-
+	fmt->flags = 0;
 	return 0;
 }
 
@@ -670,47 +623,57 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv,
 	return 0;
 }
 
-static int vpif_s_fmt_vid_out(struct file *file, void *priv,
+static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct v4l2_pix_format *pixfmt;
-	int ret = 0;
+	struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 
-	if (vb2_is_busy(&common->buffer_queue))
-		return -EBUSY;
+	/*
+	 * to supress v4l-compliance warnings silently correct
+	 * the pixelformat
+	 */
+	if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P)
+		pixfmt->pixelformat = common->fmt.fmt.pix.pixelformat;
 
-	pixfmt = &fmt->fmt.pix;
-	/* Check for valid field format */
-	ret = vpif_check_format(ch, pixfmt);
-	if (ret)
-		return ret;
+	if (vpif_update_resolution(ch))
+		return -EINVAL;
+
+	pixfmt->colorspace = common->fmt.fmt.pix.colorspace;
+	pixfmt->field = common->fmt.fmt.pix.field;
+	pixfmt->bytesperline = common->fmt.fmt.pix.width;
+	pixfmt->width = common->fmt.fmt.pix.width;
+	pixfmt->height = common->fmt.fmt.pix.height;
+	pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height * 2;
+	pixfmt->priv = 0;
 
-	/* store the pix format in the channel object */
-	common->fmt.fmt.pix = *pixfmt;
-	/* store the format in the channel object */
-	common->fmt = *fmt;
 	return 0;
 }
 
-static int vpif_try_fmt_vid_out(struct file *file, void *priv,
+static int vpif_s_fmt_vid_out(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
-	int ret = 0;
+	int ret;
 
-	ret = vpif_check_format(ch, pixfmt);
-	if (ret) {
-		*pixfmt = common->fmt.fmt.pix;
-		pixfmt->sizeimage = pixfmt->width * pixfmt->height * 2;
-	}
+	if (vb2_is_busy(&common->buffer_queue))
+		return -EBUSY;
 
-	return ret;
+	ret = vpif_try_fmt_vid_out(file, priv, fmt);
+	if (ret)
+		return ret;
+
+	/* store the pix format in the channel object */
+	common->fmt.fmt.pix = *pixfmt;
+
+	/* store the format in the channel object */
+	common->fmt = *fmt;
+	return 0;
 }
 
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
@@ -738,7 +701,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 	if (!(std_id & VPIF_V4L2_STD))
 		return -EINVAL;
 
-
 	/* Call encoder subdevice function to set the standard */
 	ch->video.stdid = std_id;
 	memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings));
@@ -747,8 +709,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 		return -EINVAL;
 
 	common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width;
-	/* Configure the default format information */
-	vpif_config_format(ch);
 
 	ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video,
 						s_std_output, std_id);
@@ -1215,6 +1175,11 @@ static int vpif_probe_complete(void)
 		if (err)
 			goto probe_out;
 
+		/* set initial format */
+		ch->video.stdid = V4L2_STD_525_60;
+		memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings));
+		vpif_update_resolution(ch);
+
 		/* Initialize vb2 queue */
 		q = &common->buffer_queue;
 		q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
@@ -1226,7 +1191,6 @@ static int vpif_probe_complete(void)
 		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 		q->min_buffers_needed = 1;
 		q->lock = &common->lock;
-
 		err = vb2_queue_init(q);
 		if (err) {
 			vpif_err("vpif_display: vb2_queue_init() failed\n");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 26/49] media: davinci: vpif_capture: initalize vb2 queue and DMA context during probe
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (25 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 25/49] media: davinci: vpif_display: fix v4l-complinace issues Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 27/49] media: davinci: vpif_capture: drop buf_init() callback Lad, Prabhakar
                   ` (25 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch moves the initalization of vb2 queue and
the DMA context to probe() and clean up in remove()
callback respectively.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |  110 ++++++++++++-------------
 1 file changed, 51 insertions(+), 59 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index d09a27a..b035c88 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -71,6 +71,13 @@ static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
+static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
+
+static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
+{
+	return container_of(vb, struct vpif_cap_buffer, vb);
+}
+
 /**
  * buffer_prepare :  callback function for buffer prepare
  * @vb: ptr to vb2_buffer
@@ -81,10 +88,8 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
-	/* Get the file handle object and channel object */
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
 	struct vb2_queue *q = vb->vb2_queue;
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(q);
 	struct common_obj *common;
 	unsigned long addr;
 
@@ -131,9 +136,7 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 				unsigned int *nbuffers, unsigned int *nplanes,
 				unsigned int sizes[], void *alloc_ctxs[])
 {
-	/* Get the file handle object and channel object */
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long size;
 
@@ -183,11 +186,8 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
-	/* Get the file handle object and channel object */
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
-	struct channel_obj *ch = fh->channel;
-	struct vpif_cap_buffer *buf = container_of(vb,
-				struct vpif_cap_buffer, vb);
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
+	struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -210,11 +210,8 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  */
 static void vpif_buf_cleanup(struct vb2_buffer *vb)
 {
-	/* Get the file handle object and channel object */
-	struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
-	struct vpif_cap_buffer *buf = container_of(vb,
-					struct vpif_cap_buffer, vb);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
+	struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -229,8 +226,7 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 static void vpif_wait_prepare(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -239,8 +235,7 @@ static void vpif_wait_prepare(struct vb2_queue *vq)
 
 static void vpif_wait_finish(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
@@ -249,23 +244,18 @@ static void vpif_wait_finish(struct vb2_queue *vq)
 
 static int vpif_buffer_init(struct vb2_buffer *vb)
 {
-	struct vpif_cap_buffer *buf = container_of(vb,
-					struct vpif_cap_buffer, vb);
+	struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
 
 	INIT_LIST_HEAD(&buf->list);
 
 	return 0;
 }
 
-static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] =
-	{ {1, 1} };
-
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
 					vpif_dev->platform_data;
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_params *vpif = &ch->vpifparams;
 	unsigned long addr = 0;
@@ -348,8 +338,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 /* abort streaming and wait for last buffer */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
-	struct vpif_fh *fh = vb2_get_drv_priv(vq);
-	struct channel_obj *ch = fh->channel;
+	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
 
@@ -951,13 +940,9 @@ static int vpif_release(struct file *filep)
 
 	mutex_lock(&common->lock);
 	/* if this instance is doing IO */
-	if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
+	if (fh->io_allowed[VPIF_VIDEO_INDEX])
 		/* Reset io_usrs member of channel object */
 		common->io_usrs = 0;
-		/* Free buffers allocated */
-		vb2_queue_release(&common->buffer_queue);
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-	}
 
 	/* Decrement channel usrs counter */
 	ch->usrs--;
@@ -987,8 +972,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	struct channel_obj *ch = fh->channel;
 	struct common_obj *common;
 	u8 index = 0;
-	struct vb2_queue *q;
-	int ret;
 
 	vpif_dbg(2, debug, "vpif_reqbufs\n");
 
@@ -1014,35 +997,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	if (0 != common->io_usrs)
 		return -EBUSY;
 
-	/* Initialize videobuf2 queue as per the buffer type */
-	common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
-	if (IS_ERR(common->alloc_ctx)) {
-		vpif_err("Failed to get the context\n");
-		return PTR_ERR(common->alloc_ctx);
-	}
-	q = &common->buffer_queue;
-	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	q->io_modes = VB2_MMAP | VB2_USERPTR;
-	q->drv_priv = fh;
-	q->ops = &video_qops;
-	q->mem_ops = &vb2_dma_contig_memops;
-	q->buf_struct_size = sizeof(struct vpif_cap_buffer);
-	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
-	q->min_buffers_needed = 1;
-
-	ret = vb2_queue_init(q);
-	if (ret) {
-		vpif_err("vpif_capture: vb2_queue_init() failed\n");
-		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-		return ret;
-	}
 	/* Set io allowed member of file handle to TRUE */
 	fh->io_allowed[index] = 1;
 	/* Increment io usrs member of channel object to 1 */
 	common->io_usrs = 1;
 	/* Store type of memory requested in channel object */
 	common->memory = reqbuf->memory;
-	INIT_LIST_HEAD(&common->dma_queue);
 
 	/* Allocate buffers */
 	return vb2_reqbufs(&common->buffer_queue, reqbuf);
@@ -1998,6 +1958,7 @@ static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
 	struct channel_obj *ch;
+	struct vb2_queue *q;
 	int i, j, err, k;
 
 	for (j = 0; j < VPIF_CAPTURE_MAX_DEVICES; j++) {
@@ -2016,6 +1977,32 @@ static int vpif_probe_complete(void)
 		if (err)
 			goto probe_out;
 
+		/* Initialize vb2 queue */
+		q = &common->buffer_queue;
+		q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
+		q->drv_priv = ch;
+		q->ops = &video_qops;
+		q->mem_ops = &vb2_dma_contig_memops;
+		q->buf_struct_size = sizeof(struct vpif_cap_buffer);
+		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+		q->min_buffers_needed = 1;
+
+		err = vb2_queue_init(q);
+		if (err) {
+			vpif_err("vpif_capture: vb2_queue_init() failed\n");
+			goto probe_out;
+		}
+
+		common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
+		if (IS_ERR(common->alloc_ctx)) {
+			vpif_err("Failed to get the context\n");
+			err = PTR_ERR(common->alloc_ctx);
+			goto probe_out;
+		}
+
+		INIT_LIST_HEAD(&common->dma_queue);
+
 		err = video_register_device(ch->video_dev,
 					    VFL_TYPE_GRABBER, (j ? 1 : 0));
 		if (err)
@@ -2029,6 +2016,8 @@ probe_out:
 	for (k = 0; k < j; k++) {
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[k];
+		common = &ch->common[k];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		/* Unregister video device */
 		video_unregister_device(ch->video_dev);
 	}
@@ -2207,6 +2196,7 @@ vpif_unregister:
  */
 static int vpif_remove(struct platform_device *device)
 {
+	struct common_obj *common;
 	struct channel_obj *ch;
 	int i;
 
@@ -2217,6 +2207,8 @@ static int vpif_remove(struct platform_device *device)
 	for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
+		common = &ch->common[i];
+		vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
 		/* Unregister video device */
 		video_unregister_device(ch->video_dev);
 		kfree(vpif_obj.dev[i]);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 27/49] media: davinci: vpif_capture: drop buf_init() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (26 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 26/49] media: davinci: vpif_capture: initalize vb2 queue and DMA context during probe Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
                   ` (24 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops the buf_init() callback as init
of buf list is not required.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index b035c88..484d858 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -242,15 +242,6 @@ static void vpif_wait_finish(struct vb2_queue *vq)
 	mutex_lock(&common->lock);
 }
 
-static int vpif_buffer_init(struct vb2_buffer *vb)
-{
-	struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
-
-	INIT_LIST_HEAD(&buf->list);
-
-	return 0;
-}
-
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
@@ -385,7 +376,6 @@ static struct vb2_ops video_qops = {
 	.queue_setup		= vpif_buffer_queue_setup,
 	.wait_prepare		= vpif_wait_prepare,
 	.wait_finish		= vpif_wait_finish,
-	.buf_init		= vpif_buffer_init,
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 28/49] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper functions
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (27 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 27/49] media: davinci: vpif_capture: drop buf_init() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_display: " Lad, Prabhakar
                   ` (23 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch makes use of vb2_ops_wait_prepare/finish helper functions.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 484d858..8572efe 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -224,24 +224,6 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 }
 
-static void vpif_wait_prepare(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_unlock(&common->lock);
-}
-
-static void vpif_wait_finish(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_lock(&common->lock);
-}
-
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
@@ -374,8 +356,6 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 
 static struct vb2_ops video_qops = {
 	.queue_setup		= vpif_buffer_queue_setup,
-	.wait_prepare		= vpif_wait_prepare,
-	.wait_finish		= vpif_wait_finish,
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
@@ -1977,6 +1957,7 @@ static int vpif_probe_complete(void)
 		q->buf_struct_size = sizeof(struct vpif_cap_buffer);
 		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 		q->min_buffers_needed = 1;
+		q->lock = &common->lock;
 
 		err = vb2_queue_init(q);
 		if (err) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 28/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (28 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 29/49] media: davinci: vpif_capture: release buffers in case start_streaming() call back fails Lad, Prabhakar
                   ` (22 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch makes use of vb2_ops_wait_prepare/finish helper functions.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 484d858..8572efe 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -224,24 +224,6 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 }
 
-static void vpif_wait_prepare(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_unlock(&common->lock);
-}
-
-static void vpif_wait_finish(struct vb2_queue *vq)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vq);
-	struct common_obj *common;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-	mutex_lock(&common->lock);
-}
-
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
@@ -374,8 +356,6 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 
 static struct vb2_ops video_qops = {
 	.queue_setup		= vpif_buffer_queue_setup,
-	.wait_prepare		= vpif_wait_prepare,
-	.wait_finish		= vpif_wait_finish,
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
@@ -1977,6 +1957,7 @@ static int vpif_probe_complete(void)
 		q->buf_struct_size = sizeof(struct vpif_cap_buffer);
 		q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 		q->min_buffers_needed = 1;
+		q->lock = &common->lock;
 
 		err = vb2_queue_init(q);
 		if (err) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 29/49] media: davinci: vpif_capture: release buffers in case start_streaming() call back fails
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (29 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_display: " Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 30/49] media: davinci: vpif_capture: drop buf_cleanup() callback Lad, Prabhakar
                   ` (21 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds support to release the buffer by calling
vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
if start_streaming() call back fails.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   39 ++++++++++++++++---------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 8572efe..fd384d0 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -231,24 +231,15 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct vpif_params *vpif = &ch->vpifparams;
-	unsigned long addr = 0;
-	unsigned long flags;
+	struct vpif_cap_buffer *buf, *tmp;
+	unsigned long addr, flags;
 	int ret;
 
 	spin_lock_irqsave(&common->irqlock, flags);
 
-	/* Get the next frame from the buffer queue */
-	common->cur_frm = common->next_frm = list_entry(common->dma_queue.next,
-				    struct vpif_cap_buffer, list);
-	/* Remove buffer from the buffer queue */
-	list_del(&common->cur_frm->list);
-	spin_unlock_irqrestore(&common->irqlock, flags);
-	/* Mark state of the current frame to active */
-	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
 	/* Initialize field_id and started member */
 	ch->field_id = 0;
 	common->started = 1;
-	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
 
 	/* Calculate the offset for Y and C data in the buffer */
 	vpif_calculate_offsets(ch);
@@ -259,7 +250,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	    (!vpif->std_info.frm_fmt &&
 	     (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
 		vpif_dbg(1, debug, "conflict in field format and std format\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 
 	/* configure 1 or 2 channel mode */
@@ -268,7 +260,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 			setup_input_channel_mode(vpif->std_info.ycmux_mode);
 		if (ret < 0) {
 			vpif_dbg(1, debug, "can't set vpif channel mode\n");
-			return ret;
+			goto err;
 		}
 	}
 
@@ -277,12 +269,23 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	if (ret < 0) {
 		vpif_dbg(1, debug, "can't set video params\n");
-		return ret;
+		goto err;
 	}
 
 	common->started = ret;
 	vpif_config_addr(ch, ret);
 
+	/* Get the next frame from the buffer queue */
+	common->cur_frm = common->next_frm = list_entry(common->dma_queue.next,
+				    struct vpif_cap_buffer, list);
+	/* Remove buffer from the buffer queue */
+	list_del(&common->cur_frm->list);
+	spin_unlock_irqrestore(&common->irqlock, flags);
+	/* Mark state of the current frame to active */
+	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
+
+	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
+
 	common->set_addr(addr + common->ytop_off,
 			 addr + common->ybtm_off,
 			 addr + common->ctop_off,
@@ -306,6 +309,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	}
 
 	return 0;
+
+err:
+	list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
+		list_del(&buf->list);
+		vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+	}
+
+	return ret;
 }
 
 /* abort streaming and wait for last buffer */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 30/49] media: davinci: vpif_capture: drop buf_cleanup() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (30 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 29/49] media: davinci: vpif_capture: release buffers in case start_streaming() call back fails Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 31/49] media: davinci: vpif_capture: improve vpif_buffer_prepare() callback Lad, Prabhakar
                   ` (20 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops buf_cleanup() callback as this callback
is never called with buffer state active.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index fd384d0..6c5ff0f 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -201,29 +201,6 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
 	spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-/**
- * vpif_buf_cleanup : Callback function to free buffer
- * @vb: ptr to vb2_buffer
- *
- * This function is called from the videobuf2 layer to free memory
- * allocated to  the buffers
- */
-static void vpif_buf_cleanup(struct vb2_buffer *vb)
-{
-	struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
-	struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
-	struct common_obj *common;
-	unsigned long flags;
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-
-	spin_lock_irqsave(&common->irqlock, flags);
-	if (vb->state == VB2_BUF_STATE_ACTIVE)
-		list_del_init(&buf->list);
-	spin_unlock_irqrestore(&common->irqlock, flags);
-
-}
-
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
@@ -370,7 +347,6 @@ static struct vb2_ops video_qops = {
 	.buf_prepare		= vpif_buffer_prepare,
 	.start_streaming	= vpif_start_streaming,
 	.stop_streaming		= vpif_stop_streaming,
-	.buf_cleanup		= vpif_buf_cleanup,
 	.buf_queue		= vpif_buffer_queue,
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 31/49] media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (31 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 30/49] media: davinci: vpif_capture: drop buf_cleanup() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 32/49] media: davinci: vpif_capture: improve vpif_buffer_queue_setup() function Lad, Prabhakar
                   ` (19 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch improve vpif_buffer_prepare() callback, as buf_prepare()
callback is never called with invalid state and check for
vb2_plane_vaddr(vb, 0) is dropped as payload check should
be done unconditionally.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   32 +++++++++++--------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 6c5ff0f..025eb24 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -79,7 +79,7 @@ static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
 }
 
 /**
- * buffer_prepare :  callback function for buffer prepare
+ * vpif_buffer_prepare :  callback function for buffer prepare
  * @vb: ptr to vb2_buffer
  *
  * This is the callback function for buffer prepare when vb2_qbuf()
@@ -97,26 +97,22 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
 
-	if (vb->state != VB2_BUF_STATE_ACTIVE &&
-		vb->state != VB2_BUF_STATE_PREPARED) {
-		vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
-		if (vb2_plane_vaddr(vb, 0) &&
-		vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
-			goto exit;
-		addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+	vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
+	if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
+		return -EINVAL;
 
-		if (q->streaming) {
-			if (!IS_ALIGNED((addr + common->ytop_off), 8) ||
-				!IS_ALIGNED((addr + common->ybtm_off), 8) ||
-				!IS_ALIGNED((addr + common->ctop_off), 8) ||
-				!IS_ALIGNED((addr + common->cbtm_off), 8))
-				goto exit;
-		}
+	vb->v4l2_buf.field = common->fmt.fmt.pix.field;
+
+	addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+	if (!IS_ALIGNED((addr + common->ytop_off), 8) ||
+		!IS_ALIGNED((addr + common->ybtm_off), 8) ||
+		!IS_ALIGNED((addr + common->ctop_off), 8) ||
+		!IS_ALIGNED((addr + common->cbtm_off), 8)) {
+		vpif_dbg(1, debug, "offset is not aligned\n");
+		return -EINVAL;
 	}
+
 	return 0;
-exit:
-	vpif_dbg(1, debug, "buffer_prepare:offset is not aligned to 8 bytes\n");
-	return -EINVAL;
 }
 
 /**
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 32/49] media: davinci: vpif_capture: improve vpif_buffer_queue_setup() function
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (32 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 31/49] media: davinci: vpif_capture: improve vpif_buffer_prepare() callback Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks Lad, Prabhakar
                   ` (18 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch sets the sizes[0] of plane according to the fmt passed
or which is being set in the channel, in both MMAP and USERPTR buffer
type.

This patch also move the calculation of offests(vpif_calculate_offsets())
to queue_setup() callback as after queue_setup() callback the
application is no longer allowed to change format, and prepares to
removal of config_params.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   40 +++++--------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 025eb24..c77c176 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -134,45 +134,24 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 {
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
-	unsigned long size;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
 
 	vpif_dbg(2, debug, "vpif_buffer_setup\n");
 
-	/* If memory type is not mmap, return */
-	if (V4L2_MEMORY_MMAP == common->memory) {
-		/* Calculate the size of the buffer */
-		size = config_params.channel_bufsize[ch->channel_id];
-		/*
-		 * Checking if the buffer size exceeds the available buffer
-		 * ycmux_mode = 0 means 1 channel mode HD and
-		 * ycmux_mode = 1 means 2 channels mode SD
-		 */
-		if (ch->vpifparams.std_info.ycmux_mode == 0) {
-			if (config_params.video_limit[ch->channel_id])
-				while (size * *nbuffers >
-					(config_params.video_limit[0]
-						+ config_params.video_limit[1]))
-					(*nbuffers)--;
-		} else {
-			if (config_params.video_limit[ch->channel_id])
-				while (size * *nbuffers >
-				config_params.video_limit[ch->channel_id])
-					(*nbuffers)--;
-		}
-
-	} else {
-		size = common->fmt.fmt.pix.sizeimage;
-	}
+	if (fmt && fmt->fmt.pix.sizeimage < common->fmt.fmt.pix.sizeimage)
+		return -EINVAL;
 
-	if (*nbuffers < config_params.min_numbuffers)
-		*nbuffers = config_params.min_numbuffers;
+	if (vq->num_buffers + *nbuffers < 3)
+		*nbuffers = 3 - vq->num_buffers;
 
 	*nplanes = 1;
-	sizes[0] = size;
+	sizes[0] = fmt ? fmt->fmt.pix.sizeimage : common->fmt.fmt.pix.sizeimage;
 	alloc_ctxs[0] = common->alloc_ctx;
 
+	/* Calculate the offset for Y and C data in the buffer */
+	vpif_calculate_offsets(ch);
+
 	return 0;
 }
 
@@ -214,9 +193,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	ch->field_id = 0;
 	common->started = 1;
 
-	/* Calculate the offset for Y and C data in the buffer */
-	vpif_calculate_offsets(ch);
-
 	if ((vpif->std_info.frm_fmt &&
 	    ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE) &&
 	     (common->fmt.fmt.pix.field != V4L2_FIELD_ANY))) ||
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (33 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 32/49] media: davinci: vpif_capture: improve vpif_buffer_queue_setup() function Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll Lad, Prabhakar
                   ` (17 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops unnecessary check from start_streaming() callback
as this is already done in try/s_fmt and some minor code cleanups,
drops check for vb2_is_streaming() as this check is done by vb2
itself before calling this callback.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   36 ++++++++++++-------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index c77c176..58dddf6 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -176,6 +176,11 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
 	spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
+/**
+ * vpif_start_streaming : Starts the DMA engine for streaming
+ * @vb: ptr to vb2_buffer
+ * @count: number of buffers
+ */
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct vpif_capture_config *vpif_config_data =
@@ -193,16 +198,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	ch->field_id = 0;
 	common->started = 1;
 
-	if ((vpif->std_info.frm_fmt &&
-	    ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE) &&
-	     (common->fmt.fmt.pix.field != V4L2_FIELD_ANY))) ||
-	    (!vpif->std_info.frm_fmt &&
-	     (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
-		vpif_dbg(1, debug, "conflict in field format and std format\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
 	/* configure 1 or 2 channel mode */
 	if (vpif_config_data->setup_input_channel_mode) {
 		ret = vpif_config_data->
@@ -245,13 +240,13 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	 * VPIF register
 	 */
 	channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
-	if ((VPIF_CHANNEL0_VIDEO == ch->channel_id)) {
+	if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
 		channel0_intr_assert();
 		channel0_intr_enable(1);
 		enable_channel0(1);
 	}
-	if ((VPIF_CHANNEL1_VIDEO == ch->channel_id) ||
-	    (common->started == 2)) {
+	if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
+		common->started == 2) {
 		channel1_intr_assert();
 		channel1_intr_enable(1);
 		enable_channel1(1);
@@ -268,16 +263,19 @@ err:
 	return ret;
 }
 
-/* abort streaming and wait for last buffer */
+/**
+ * vpif_stop_streaming : Stop the DMA engine
+ * @vq: ptr to vb2_queue
+ *
+ * This callback stops the DMA engine and any remaining buffers
+ * in the DMA queue are released.
+ */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
 
-	if (!vb2_is_streaming(vq))
-		return;
-
 	common = &ch->common[VPIF_VIDEO_INDEX];
 
 	/* Disable channel as per its device type and channel id */
@@ -285,8 +283,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 		enable_channel0(0);
 		channel0_intr_enable(0);
 	}
-	if ((VPIF_CHANNEL1_VIDEO == ch->channel_id) ||
-		(2 == common->started)) {
+	if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
+		2 == common->started) {
 		enable_channel1(0);
 		channel1_intr_enable(0);
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (34 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 35/49] media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
                   ` (16 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   53 +++----------------------
 1 file changed, 6 insertions(+), 47 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 58dddf6..a50e392 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -751,50 +751,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /**
- * vpif_mmap : It is used to map kernel space buffers into user spaces
- * @filep: file pointer
- * @vma: ptr to vm_area_struct
- */
-static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
-{
-	/* Get the channel object and file handle object */
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
-	int ret;
-
-	vpif_dbg(2, debug, "vpif_mmap\n");
-
-	if (mutex_lock_interruptible(&common->lock))
-		return -ERESTARTSYS;
-	ret = vb2_mmap(&common->buffer_queue, vma);
-	mutex_unlock(&common->lock);
-	return ret;
-}
-
-/**
- * vpif_poll: It is used for select/poll system call
- * @filep: file pointer
- * @wait: poll table to wait
- */
-static unsigned int vpif_poll(struct file *filep, poll_table * wait)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *channel = fh->channel;
-	struct common_obj *common = &(channel->common[VPIF_VIDEO_INDEX]);
-	unsigned int res = 0;
-
-	vpif_dbg(2, debug, "vpif_poll\n");
-
-	if (common->started) {
-		mutex_lock(&common->lock);
-		res = vb2_poll(&common->buffer_queue, filep, wait);
-		mutex_unlock(&common->lock);
-	}
-	return res;
-}
-
-/**
  * vpif_open : vpif open handler
  * @filep: file ptr
  *
@@ -1797,8 +1753,8 @@ static struct v4l2_file_operations vpif_fops = {
 	.open = vpif_open,
 	.release = vpif_release,
 	.unlocked_ioctl = video_ioctl2,
-	.mmap = vpif_mmap,
-	.poll = vpif_poll
+	.mmap = vb2_fop_mmap,
+	.poll = vb2_fop_poll
 };
 
 /* vpif video template */
@@ -1884,6 +1840,7 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier,
 static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
+	struct video_device *vdev;
 	struct channel_obj *ch;
 	struct vb2_queue *q;
 	int i, j, err, k;
@@ -1931,7 +1888,9 @@ static int vpif_probe_complete(void)
 
 		INIT_LIST_HEAD(&common->dma_queue);
 
-		err = video_register_device(ch->video_dev,
+		vdev = ch->video_dev;
+		vdev->queue = q;
+		err = video_register_device(vdev,
 					    VFL_TYPE_GRABBER, (j ? 1 : 0));
 		if (err)
 			goto probe_out;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 35/49] media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (35 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 36/49] media: davinci: vpif_capture: use vb2_ioctl_* helpers Lad, Prabhakar
                   ` (15 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds support to use v4l2_fh_open() and vb2_fop_release,
which allows to drop driver specific struct vpif_fh, as this is handeled
by core. This patch also drops vpif_g/s_priority as this handeled
by core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |  296 ++++---------------------
 drivers/media/platform/davinci/vpif_capture.h |   14 --
 2 files changed, 48 insertions(+), 262 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index a50e392..6ad9e09 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -751,98 +751,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /**
- * vpif_open : vpif open handler
- * @filep: file ptr
- *
- * It creates object of file handle structure and stores it in private_data
- * member of filepointer
- */
-static int vpif_open(struct file *filep)
-{
-	struct video_device *vdev = video_devdata(filep);
-	struct common_obj *common;
-	struct video_obj *vid_ch;
-	struct channel_obj *ch;
-	struct vpif_fh *fh;
-
-	vpif_dbg(2, debug, "vpif_open\n");
-
-	ch = video_get_drvdata(vdev);
-
-	vid_ch = &ch->video;
-	common = &ch->common[VPIF_VIDEO_INDEX];
-
-	/* Allocate memory for the file handle object */
-	fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL);
-	if (NULL == fh) {
-		vpif_err("unable to allocate memory for file handle object\n");
-		return -ENOMEM;
-	}
-
-	if (mutex_lock_interruptible(&common->lock)) {
-		kfree(fh);
-		return -ERESTARTSYS;
-	}
-	/* store pointer to fh in private_data member of filep */
-	filep->private_data = fh;
-	fh->channel = ch;
-	fh->initialized = 0;
-	/* If decoder is not initialized. initialize it */
-	if (!ch->initialized) {
-		fh->initialized = 1;
-		ch->initialized = 1;
-		memset(&(ch->vpifparams), 0, sizeof(struct vpif_params));
-	}
-	/* Increment channel usrs counter */
-	ch->usrs++;
-	/* Set io_allowed member to false */
-	fh->io_allowed[VPIF_VIDEO_INDEX] = 0;
-	/* Initialize priority of this instance to default priority */
-	fh->prio = V4L2_PRIORITY_UNSET;
-	v4l2_prio_open(&ch->prio, &fh->prio);
-	mutex_unlock(&common->lock);
-	return 0;
-}
-
-/**
- * vpif_release : function to clean up file close
- * @filep: file pointer
- *
- * This function deletes buffer queue, frees the buffers and the vpif file
- * handle
- */
-static int vpif_release(struct file *filep)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common;
-
-	vpif_dbg(2, debug, "vpif_release\n");
-
-	common = &ch->common[VPIF_VIDEO_INDEX];
-
-	mutex_lock(&common->lock);
-	/* if this instance is doing IO */
-	if (fh->io_allowed[VPIF_VIDEO_INDEX])
-		/* Reset io_usrs member of channel object */
-		common->io_usrs = 0;
-
-	/* Decrement channel usrs counter */
-	ch->usrs--;
-
-	/* Close the priority */
-	v4l2_prio_close(&ch->prio, fh->prio);
-
-	if (fh->initialized)
-		ch->initialized = 0;
-
-	mutex_unlock(&common->lock);
-	filep->private_data = NULL;
-	kfree(fh);
-	return 0;
-}
-
-/**
  * vpif_reqbufs() - request buffer handler
  * @file: file ptr
  * @priv: file handle
@@ -851,25 +759,13 @@ static int vpif_release(struct file *filep)
 static int vpif_reqbufs(struct file *file, void *priv,
 			struct v4l2_requestbuffers *reqbuf)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common;
 	u8 index = 0;
 
 	vpif_dbg(2, debug, "vpif_reqbufs\n");
 
-	/**
-	 * This file handle has not initialized the channel,
-	 * It is not allowed to do settings
-	 */
-	if ((VPIF_CHANNEL0_VIDEO == ch->channel_id)
-	    || (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_dbg(1, debug, "Channel Busy\n");
-			return -EBUSY;
-		}
-	}
-
 	if (V4L2_BUF_TYPE_VIDEO_CAPTURE != reqbuf->type || !vpif_dev)
 		return -EINVAL;
 
@@ -880,8 +776,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
 	if (0 != common->io_usrs)
 		return -EBUSY;
 
-	/* Set io allowed member of file handle to TRUE */
-	fh->io_allowed[index] = 1;
 	/* Increment io usrs member of channel object to 1 */
 	common->io_usrs = 1;
 	/* Store type of memory requested in channel object */
@@ -900,8 +794,8 @@ static int vpif_reqbufs(struct file *file, void *priv,
 static int vpif_querybuf(struct file *file, void *priv,
 				struct v4l2_buffer *buf)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	vpif_dbg(2, debug, "vpif_querybuf\n");
@@ -926,8 +820,8 @@ static int vpif_querybuf(struct file *file, void *priv,
 static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 {
 
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct v4l2_buffer tbuf = *buf;
 
@@ -938,11 +832,6 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 		return -EINVAL;
 	}
 
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_err("fh io not allowed\n");
-		return -EACCES;
-	}
-
 	return vb2_qbuf(&common->buffer_queue, buf);
 }
 
@@ -954,8 +843,8 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
  */
 static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	vpif_dbg(2, debug, "vpif_dqbuf\n");
@@ -973,9 +862,8 @@ static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 static int vpif_streamon(struct file *file, void *priv,
 				enum v4l2_buf_type buftype)
 {
-
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
 	struct vpif_params *vpif;
@@ -990,12 +878,6 @@ static int vpif_streamon(struct file *file, void *priv,
 		return -EINVAL;
 	}
 
-	/* If file handle is not allowed IO, return error */
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_dbg(1, debug, "io not allowed\n");
-		return -EACCES;
-	}
-
 	/* If Streaming is already started, return error */
 	if (common->started) {
 		vpif_dbg(1, debug, "channel->started\n");
@@ -1043,8 +925,8 @@ static int vpif_streamoff(struct file *file, void *priv,
 				enum v4l2_buf_type buftype)
 {
 
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	int ret;
 
@@ -1055,12 +937,6 @@ static int vpif_streamoff(struct file *file, void *priv,
 		return -EINVAL;
 	}
 
-	/* If io is allowed for this file handle, return error */
-	if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
-		vpif_dbg(1, debug, "io not allowed\n");
-		return -EACCES;
-	}
-
 	/* If streaming is not started, return error */
 	if (!common->started) {
 		vpif_dbg(1, debug, "channel->started\n");
@@ -1189,8 +1065,8 @@ static int vpif_set_input(
  */
 static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	int ret = 0;
 
 	vpif_dbg(2, debug, "vpif_querystd\n");
@@ -1216,8 +1092,8 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
  */
 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 
 	vpif_dbg(2, debug, "vpif_g_std\n");
 
@@ -1233,8 +1109,8 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
  */
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	int ret = 0;
 
@@ -1245,20 +1121,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 		return -EBUSY;
 	}
 
-	if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) ||
-	    (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_dbg(1, debug, "Channel Busy\n");
-			return -EBUSY;
-		}
-	}
-
-	ret = v4l2_prio_check(&ch->prio, fh->prio);
-	if (0 != ret)
-		return ret;
-
-	fh->initialized = 1;
-
 	/* Call encoder subdevice function to set the standard */
 	ch->video.stdid = std_id;
 	memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings));
@@ -1292,9 +1154,9 @@ static int vpif_enum_input(struct file *file, void *priv,
 {
 
 	struct vpif_capture_config *config = vpif_dev->platform_data;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_capture_chan_config *chan_cfg;
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
 
 	chan_cfg = &config->chan_config[ch->channel_id];
 
@@ -1316,8 +1178,8 @@ static int vpif_enum_input(struct file *file, void *priv,
  */
 static int vpif_g_input(struct file *file, void *priv, unsigned int *index)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 
 	*index = ch->input_idx;
 	return 0;
@@ -1332,11 +1194,10 @@ static int vpif_g_input(struct file *file, void *priv, unsigned int *index)
 static int vpif_s_input(struct file *file, void *priv, unsigned int index)
 {
 	struct vpif_capture_config *config = vpif_dev->platform_data;
-	struct vpif_capture_chan_config *chan_cfg;
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	int ret;
+	struct vpif_capture_chan_config *chan_cfg;
 
 	chan_cfg = &config->chan_config[ch->channel_id];
 
@@ -1348,19 +1209,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
 		return -EBUSY;
 	}
 
-	if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) ||
-	    (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_dbg(1, debug, "Channel Busy\n");
-			return -EBUSY;
-		}
-	}
-
-	ret = v4l2_prio_check(&ch->prio, fh->prio);
-	if (0 != ret)
-		return ret;
-
-	fh->initialized = 1;
 	return vpif_set_input(config, ch, index);
 }
 
@@ -1373,8 +1221,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
 static int vpif_enum_fmt_vid_cap(struct file *file, void  *priv,
 					struct v4l2_fmtdesc *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 
 	if (fmt->index != 0) {
 		vpif_dbg(1, debug, "Invalid format index\n");
@@ -1403,8 +1251,8 @@ static int vpif_enum_fmt_vid_cap(struct file *file, void  *priv,
 static int vpif_try_fmt_vid_cap(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 
 	return vpif_check_format(ch, pixfmt, 1);
@@ -1420,8 +1268,8 @@ static int vpif_try_fmt_vid_cap(struct file *file, void *priv,
 static int vpif_g_fmt_vid_cap(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	/* Check the validity of the buffer type */
@@ -1442,8 +1290,8 @@ static int vpif_g_fmt_vid_cap(struct file *file, void *priv,
 static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
 				struct v4l2_format *fmt)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct v4l2_pix_format *pixfmt;
 	int ret = 0;
@@ -1456,20 +1304,6 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
 		return -EBUSY;
 	}
 
-	if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) ||
-	    (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
-		if (!fh->initialized) {
-			vpif_dbg(1, debug, "Channel Busy\n");
-			return -EBUSY;
-		}
-	}
-
-	ret = v4l2_prio_check(&ch->prio, fh->prio);
-	if (0 != ret)
-		return ret;
-
-	fh->initialized = 1;
-
 	pixfmt = &fmt->fmt.pix;
 	/* Check for valid field format */
 	ret = vpif_check_format(ch, pixfmt, 0);
@@ -1503,37 +1337,6 @@ static int vpif_querycap(struct file *file, void  *priv,
 }
 
 /**
- * vpif_g_priority() - get priority handler
- * @file: file ptr
- * @priv: file handle
- * @prio: ptr to v4l2_priority structure
- */
-static int vpif_g_priority(struct file *file, void *priv,
-			   enum v4l2_priority *prio)
-{
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
-
-	*prio = v4l2_prio_max(&ch->prio);
-
-	return 0;
-}
-
-/**
- * vpif_s_priority() - set priority handler
- * @file: file ptr
- * @priv: file handle
- * @prio: ptr to v4l2_priority structure
- */
-static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
-{
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
-
-	return v4l2_prio_change(&ch->prio, &fh->prio, p);
-}
-
-/**
  * vpif_cropcap() - cropcap handler
  * @file: file ptr
  * @priv: file handle
@@ -1542,8 +1345,8 @@ static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
 static int vpif_cropcap(struct file *file, void *priv,
 			struct v4l2_cropcap *crop)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
 	if (V4L2_BUF_TYPE_VIDEO_CAPTURE != crop->type)
@@ -1567,8 +1370,8 @@ static int
 vpif_enum_dv_timings(struct file *file, void *priv,
 		     struct v4l2_enum_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	int ret;
 
 	ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
@@ -1587,8 +1390,8 @@ static int
 vpif_query_dv_timings(struct file *file, void *priv,
 		      struct v4l2_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	int ret;
 
 	ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings);
@@ -1606,8 +1409,8 @@ vpif_query_dv_timings(struct file *file, void *priv,
 static int vpif_s_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_params *vpifparams = &ch->vpifparams;
 	struct vpif_channel_config_params *std_info = &vpifparams->std_info;
 	struct video_obj *vid_ch = &ch->video;
@@ -1694,8 +1497,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
 static int vpif_g_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
-	struct vpif_fh *fh = priv;
-	struct channel_obj *ch = fh->channel;
+	struct video_device *vdev = video_devdata(file);
+	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct video_obj *vid_ch = &ch->video;
 
 	*timings = vid_ch->dv_timings;
@@ -1721,8 +1524,6 @@ static int vpif_log_status(struct file *filep, void *priv)
 /* vpif capture ioctl operations */
 static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_querycap        	= vpif_querycap,
-	.vidioc_g_priority		= vpif_g_priority,
-	.vidioc_s_priority		= vpif_s_priority,
 	.vidioc_enum_fmt_vid_cap	= vpif_enum_fmt_vid_cap,
 	.vidioc_g_fmt_vid_cap  		= vpif_g_fmt_vid_cap,
 	.vidioc_s_fmt_vid_cap		= vpif_s_fmt_vid_cap,
@@ -1750,8 +1551,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 /* vpif file operations */
 static struct v4l2_file_operations vpif_fops = {
 	.owner = THIS_MODULE,
-	.open = vpif_open,
-	.release = vpif_release,
+	.open = v4l2_fh_open,
+	.release = vb2_fop_release,
 	.unlocked_ioctl = video_ioctl2,
 	.mmap = vb2_fop_mmap,
 	.poll = vb2_fop_poll
@@ -1851,10 +1652,6 @@ static int vpif_probe_complete(void)
 		common = &(ch->common[VPIF_VIDEO_INDEX]);
 		spin_lock_init(&common->irqlock);
 		mutex_init(&common->lock);
-		ch->video_dev->lock = &common->lock;
-		/* Initialize prio member of channel object */
-		v4l2_prio_init(&ch->prio);
-		video_set_drvdata(ch->video_dev, ch);
 
 		/* select input 0 */
 		err = vpif_set_input(vpif_obj.config, ch, 0);
@@ -1890,6 +1687,9 @@ static int vpif_probe_complete(void)
 
 		vdev = ch->video_dev;
 		vdev->queue = q;
+		vdev->lock = &common->lock;
+		set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
+		video_set_drvdata(ch->video_dev, ch);
 		err = video_register_device(vdev,
 					    VFL_TYPE_GRABBER, (j ? 1 : 0));
 		if (err)
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 5a29d9a..f600819 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -104,8 +104,6 @@ struct common_obj {
 struct channel_obj {
 	/* Identifies video device for this channel */
 	struct video_device *video_dev;
-	/* Used to keep track of state of the priority */
-	struct v4l2_prio_state prio;
 	/* number of open instances of the channel */
 	int usrs;
 	/* Indicates id of the field which is being displayed */
@@ -126,18 +124,6 @@ struct channel_obj {
 	struct video_obj video;
 };
 
-/* File handle structure */
-struct vpif_fh {
-	/* pointer to channel object for opened device */
-	struct channel_obj *channel;
-	/* Indicates whether this file handle is doing IO */
-	u8 io_allowed[VPIF_NUMBER_OF_OBJECTS];
-	/* Used to keep track priority of this instance */
-	enum v4l2_priority prio;
-	/* Used to indicate channel is initialize or not */
-	u8 initialized;
-};
-
 struct vpif_device {
 	struct v4l2_device v4l2_dev;
 	struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS];
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 36/49] media: davinci: vpif_capture: use vb2_ioctl_* helpers
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (36 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 35/49] media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 37/49] media: davinci: vpif_capture: drop reserving memory for device Lad, Prabhakar
                   ` (14 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |  240 +++----------------------
 1 file changed, 22 insertions(+), 218 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 6ad9e09..75015f4 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -208,6 +208,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 		}
 	}
 
+	ret = v4l2_subdev_call(ch->sd, video, s_stream, 1);
+	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
+		vpif_dbg(1, debug, "stream on failed in subdev\n");
+		goto err;
+	}
+
 	/* Call vpif_set_params function to set the parameters and addresses */
 	ret = vpif_set_video_params(vpif, ch->channel_id);
 
@@ -275,6 +281,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 	struct channel_obj *ch = vb2_get_drv_priv(vq);
 	struct common_obj *common;
 	unsigned long flags;
+	int ret;
 
 	common = &ch->common[VPIF_VIDEO_INDEX];
 
@@ -290,6 +297,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 	}
 	common->started = 0;
 
+	ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
+	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
+		vpif_dbg(1, debug, "stream off failed in subdev\n");
+
 	/* release all active buffers */
 	spin_lock_irqsave(&common->irqlock, flags);
 	if (common->cur_frm == common->next_frm) {
@@ -751,218 +762,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /**
- * vpif_reqbufs() - request buffer handler
- * @file: file ptr
- * @priv: file handle
- * @reqbuf: request buffer structure ptr
- */
-static int vpif_reqbufs(struct file *file, void *priv,
-			struct v4l2_requestbuffers *reqbuf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common;
-	u8 index = 0;
-
-	vpif_dbg(2, debug, "vpif_reqbufs\n");
-
-	if (V4L2_BUF_TYPE_VIDEO_CAPTURE != reqbuf->type || !vpif_dev)
-		return -EINVAL;
-
-	index = VPIF_VIDEO_INDEX;
-
-	common = &ch->common[index];
-
-	if (0 != common->io_usrs)
-		return -EBUSY;
-
-	/* Increment io usrs member of channel object to 1 */
-	common->io_usrs = 1;
-	/* Store type of memory requested in channel object */
-	common->memory = reqbuf->memory;
-
-	/* Allocate buffers */
-	return vb2_reqbufs(&common->buffer_queue, reqbuf);
-}
-
-/**
- * vpif_querybuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_querybuf(struct file *file, void *priv,
-				struct v4l2_buffer *buf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	vpif_dbg(2, debug, "vpif_querybuf\n");
-
-	if (common->fmt.type != buf->type)
-		return -EINVAL;
-
-	if (common->memory != V4L2_MEMORY_MMAP) {
-		vpif_dbg(1, debug, "Invalid memory\n");
-		return -EINVAL;
-	}
-
-	return vb2_querybuf(&common->buffer_queue, buf);
-}
-
-/**
- * vpif_qbuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct v4l2_buffer tbuf = *buf;
-
-	vpif_dbg(2, debug, "vpif_qbuf\n");
-
-	if (common->fmt.type != tbuf.type) {
-		vpif_err("invalid buffer type\n");
-		return -EINVAL;
-	}
-
-	return vb2_qbuf(&common->buffer_queue, buf);
-}
-
-/**
- * vpif_dqbuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	vpif_dbg(2, debug, "vpif_dqbuf\n");
-
-	return vb2_dqbuf(&common->buffer_queue, buf,
-			 (file->f_flags & O_NONBLOCK));
-}
-
-/**
- * vpif_streamon() - streamon handler
- * @file: file ptr
- * @priv: file handle
- * @buftype: v4l2 buffer type
- */
-static int vpif_streamon(struct file *file, void *priv,
-				enum v4l2_buf_type buftype)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
-	struct vpif_params *vpif;
-	int ret = 0;
-
-	vpif_dbg(2, debug, "vpif_streamon\n");
-
-	vpif = &ch->vpifparams;
-
-	if (buftype != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-		vpif_dbg(1, debug, "buffer type not supported\n");
-		return -EINVAL;
-	}
-
-	/* If Streaming is already started, return error */
-	if (common->started) {
-		vpif_dbg(1, debug, "channel->started\n");
-		return -EBUSY;
-	}
-
-	if ((ch->channel_id == VPIF_CHANNEL0_VIDEO &&
-	    oth_ch->common[VPIF_VIDEO_INDEX].started &&
-	    vpif->std_info.ycmux_mode == 0) ||
-	   ((ch->channel_id == VPIF_CHANNEL1_VIDEO) &&
-	    (2 == oth_ch->common[VPIF_VIDEO_INDEX].started))) {
-		vpif_dbg(1, debug, "other channel is being used\n");
-		return -EBUSY;
-	}
-
-	ret = vpif_check_format(ch, &common->fmt.fmt.pix, 0);
-	if (ret)
-		return ret;
-
-	/* Enable streamon on the sub device */
-	ret = v4l2_subdev_call(ch->sd, video, s_stream, 1);
-
-	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
-		vpif_dbg(1, debug, "stream on failed in subdev\n");
-		return ret;
-	}
-
-	/* Call vb2_streamon to start streaming in videobuf2 */
-	ret = vb2_streamon(&common->buffer_queue, buftype);
-	if (ret) {
-		vpif_dbg(1, debug, "vb2_streamon\n");
-		return ret;
-	}
-
-	return ret;
-}
-
-/**
- * vpif_streamoff() - streamoff handler
- * @file: file ptr
- * @priv: file handle
- * @buftype: v4l2 buffer type
- */
-static int vpif_streamoff(struct file *file, void *priv,
-				enum v4l2_buf_type buftype)
-{
-
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	int ret;
-
-	vpif_dbg(2, debug, "vpif_streamoff\n");
-
-	if (buftype != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-		vpif_dbg(1, debug, "buffer type not supported\n");
-		return -EINVAL;
-	}
-
-	/* If streaming is not started, return error */
-	if (!common->started) {
-		vpif_dbg(1, debug, "channel->started\n");
-		return -EINVAL;
-	}
-
-	/* disable channel */
-	if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
-		enable_channel0(0);
-		channel0_intr_enable(0);
-	} else {
-		enable_channel1(0);
-		channel1_intr_enable(0);
-	}
-
-	common->started = 0;
-
-	ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
-
-	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
-		vpif_dbg(1, debug, "stream off failed in subdev\n");
-
-	return vb2_streamoff(&common->buffer_queue, buftype);
-}
-
-/**
  * vpif_input_to_subdev() - Maps input to sub device
  * @vpif_cfg - global config ptr
  * @chan_cfg - channel config ptr
@@ -1531,15 +1330,20 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_enum_input		= vpif_enum_input,
 	.vidioc_s_input			= vpif_s_input,
 	.vidioc_g_input			= vpif_g_input,
-	.vidioc_reqbufs         	= vpif_reqbufs,
-	.vidioc_querybuf        	= vpif_querybuf,
+
+	.vidioc_reqbufs			= vb2_ioctl_reqbufs,
+	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
+	.vidioc_querybuf		= vb2_ioctl_querybuf,
+	.vidioc_qbuf			= vb2_ioctl_qbuf,
+	.vidioc_dqbuf			= vb2_ioctl_dqbuf,
+	.vidioc_expbuf			= vb2_ioctl_expbuf,
+	.vidioc_streamon		= vb2_ioctl_streamon,
+	.vidioc_streamoff		= vb2_ioctl_streamoff,
+
 	.vidioc_querystd		= vpif_querystd,
 	.vidioc_s_std           	= vpif_s_std,
 	.vidioc_g_std			= vpif_g_std,
-	.vidioc_qbuf            	= vpif_qbuf,
-	.vidioc_dqbuf           	= vpif_dqbuf,
-	.vidioc_streamon        	= vpif_streamon,
-	.vidioc_streamoff       	= vpif_streamoff,
+
 	.vidioc_cropcap         	= vpif_cropcap,
 	.vidioc_enum_dv_timings         = vpif_enum_dv_timings,
 	.vidioc_query_dv_timings        = vpif_query_dv_timings,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 37/49] media: davinci: vpif_capture: drop reserving memory for device
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (37 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 36/49] media: davinci: vpif_capture: use vb2_ioctl_* helpers Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 38/49] media: davinci: vpif_capture: drop unnecessary field memory Lad, Prabhakar
                   ` (13 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops reserving contigiuos memory for the device,
as now with CMA support there is no need of this.
This patch also prepares to removal of config_params.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 75015f4..41cd3ff 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1545,7 +1545,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 	struct video_device *vfd;
 	struct resource *res;
 	int subdev_count;
-	size_t size;
 
 	vpif_dev = &pdev->dev;
 
@@ -1598,23 +1597,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 		ch->video_dev = vfd;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res) {
-		size = resource_size(res);
-		/* The resources are divided into two equal memory and when we
-		 * have HD output we can add them together
-		 */
-		for (j = 0; j < VPIF_CAPTURE_MAX_DEVICES; j++) {
-			ch = vpif_obj.dev[j];
-			ch->channel_id = j;
-			/* only enabled if second resource exists */
-			config_params.video_limit[ch->channel_id] = 0;
-			if (size)
-				config_params.video_limit[ch->channel_id] =
-									size/2;
-		}
-	}
-
 	vpif_obj.config = pdev->dev.platform_data;
 
 	subdev_count = vpif_obj.config->subdev_count;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 38/49] media: davinci: vpif_capture: drop unnecessary field memory
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (38 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 37/49] media: davinci: vpif_capture: drop reserving memory for device Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj Lad, Prabhakar
                   ` (12 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |    5 -----
 drivers/media/platform/davinci/vpif_capture.h |    5 -----
 2 files changed, 10 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 41cd3ff..6b66f55 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -608,11 +608,6 @@ static void vpif_config_format(struct channel_obj *ch)
 	vpif_dbg(2, debug, "vpif_config_format\n");
 
 	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	if (config_params.numbuffers[ch->channel_id] == 0)
-		common->memory = V4L2_MEMORY_USERPTR;
-	else
-		common->memory = V4L2_MEMORY_MMAP;
-
 	common->fmt.fmt.pix.sizeimage
 	    = config_params.channel_bufsize[ch->channel_id];
 
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index f600819..9b7dd06 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -63,11 +63,6 @@ struct common_obj {
 	struct vpif_cap_buffer *cur_frm;
 	/* Pointer pointing to current v4l2_buffer */
 	struct vpif_cap_buffer *next_frm;
-	/*
-	 * This field keeps track of type of buffer exchange mechanism
-	 * user has selected
-	 */
-	enum v4l2_memory memory;
 	/* Used to store pixel format */
 	struct v4l2_format fmt;
 	/* Buffer queue used in video-buf */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (39 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 38/49] media: davinci: vpif_capture: drop unnecessary field memory Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place Lad, Prabhakar
                   ` (11 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

the started member was indicating whether streaming was started
or not, this can be determined by vb2 offering, this patch replaces
the started member from struct common_obj with appropriate vb2 calls.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   36 ++++++++++---------------
 drivers/media/platform/davinci/vpif_capture.h |    2 --
 2 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 6b66f55..b898779 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -73,6 +73,9 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
 static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
 
+/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
+static int ycmux_mode;
+
 static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
 {
 	return container_of(vb, struct vpif_cap_buffer, vb);
@@ -194,9 +197,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	spin_lock_irqsave(&common->irqlock, flags);
 
-	/* Initialize field_id and started member */
+	/* Initialize field_id */
 	ch->field_id = 0;
-	common->started = 1;
 
 	/* configure 1 or 2 channel mode */
 	if (vpif_config_data->setup_input_channel_mode) {
@@ -216,13 +218,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	/* Call vpif_set_params function to set the parameters and addresses */
 	ret = vpif_set_video_params(vpif, ch->channel_id);
-
 	if (ret < 0) {
 		vpif_dbg(1, debug, "can't set video params\n");
 		goto err;
 	}
 
-	common->started = ret;
+	ycmux_mode = ret;
 	vpif_config_addr(ch, ret);
 
 	/* Get the next frame from the buffer queue */
@@ -252,7 +253,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 		enable_channel0(1);
 	}
 	if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
-		common->started == 2) {
+		ycmux_mode == 2) {
 		channel1_intr_assert();
 		channel1_intr_enable(1);
 		enable_channel1(1);
@@ -291,11 +292,12 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 		channel0_intr_enable(0);
 	}
 	if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
-		2 == common->started) {
+		ycmux_mode == 2) {
 		enable_channel1(0);
 		channel1_intr_enable(0);
 	}
-	common->started = 0;
+
+	ycmux_mode = 0;
 
 	ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
 	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
@@ -404,9 +406,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
 	for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) {
 		common = &ch->common[i];
 		/* skip If streaming is not started in this channel */
-		if (0 == common->started)
-			continue;
-
 		/* Check the field format */
 		if (1 == ch->vpifparams.std_info.frm_fmt) {
 			/* Progressive mode */
@@ -910,10 +909,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 
 	vpif_dbg(2, debug, "vpif_s_std\n");
 
-	if (common->started) {
-		vpif_err("streaming in progress\n");
+	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
-	}
 
 	/* Call encoder subdevice function to set the standard */
 	ch->video.stdid = std_id;
@@ -998,10 +995,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
 	if (index >= chan_cfg->input_count)
 		return -EINVAL;
 
-	if (common->started) {
-		vpif_err("Streaming in progress\n");
+	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
-	}
 
 	return vpif_set_input(config, ch, index);
 }
@@ -1092,11 +1087,8 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
 
 	vpif_dbg(2, debug, "%s\n", __func__);
 
-	/* If streaming is started, return error */
-	if (common->started) {
-		vpif_dbg(1, debug, "Streaming is started\n");
+	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
-	}
 
 	pixfmt = &fmt->fmt.pix;
 	/* Check for valid field format */
@@ -1707,7 +1699,7 @@ static int vpif_suspend(struct device *dev)
 				channel0_intr_enable(0);
 			}
 			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
-			    common->started == 2) {
+				ycmux_mode == 2) {
 				enable_channel1(0);
 				channel1_intr_enable(0);
 			}
@@ -1739,7 +1731,7 @@ static int vpif_resume(struct device *dev)
 				channel0_intr_enable(1);
 			}
 			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
-			    common->started == 2) {
+				ycmux_mode == 2) {
 				enable_channel1(1);
 				channel1_intr_enable(1);
 			}
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 9b7dd06..4960504 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -77,8 +77,6 @@ struct common_obj {
 	struct mutex lock;
 	/* number of users performing IO */
 	u32 io_usrs;
-	/* Indicates whether streaming started */
-	u8 started;
 	/* Function pointer to set the addresses */
 	void (*set_addr) (unsigned long, unsigned long, unsigned long,
 			  unsigned long);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (40 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params Lad, Prabhakar
                   ` (10 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch moves the initalization of video device to a
single place and uses macro to define the driver name and
use it appropraitely in required places.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   30 ++++++++++---------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index b898779..d452eaf 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -65,6 +65,8 @@ static struct vpif_config_params config_params = {
 	.channel_bufsize[1] = 720 * 576 * 2,
 };
 
+#define VPIF_DRIVER_NAME	"vpif_capture"
+
 /* global variables */
 static struct vpif_device vpif_obj = { {NULL} };
 static struct device *vpif_dev;
@@ -1114,7 +1116,7 @@ static int vpif_querycap(struct file *file, void  *priv,
 
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
-	snprintf(cap->driver, sizeof(cap->driver), "%s", dev_name(vpif_dev));
+	strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
 		 dev_name(vpif_dev));
 	strlcpy(cap->card, config->card_name, sizeof(cap->card));
@@ -1349,14 +1351,6 @@ static struct v4l2_file_operations vpif_fops = {
 	.poll = vb2_fop_poll
 };
 
-/* vpif video template */
-static struct video_device vpif_video_template = {
-	.name		= "vpif",
-	.fops		= &vpif_fops,
-	.minor		= -1,
-	.ioctl_ops	= &vpif_ioctl_ops,
-};
-
 /**
  * initialize_vpif() - Initialize vpif data structures
  *
@@ -1476,7 +1470,14 @@ static int vpif_probe_complete(void)
 
 		INIT_LIST_HEAD(&common->dma_queue);
 
+		/* Initialize the video_device structure */
 		vdev = ch->video_dev;
+		strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
+		vdev->release = video_device_release;
+		vdev->fops = &vpif_fops;
+		vdev->ioctl_ops = &vpif_ioctl_ops;
+		vdev->v4l2_dev = &vpif_obj.v4l2_dev;
+		vdev->vfl_dir = VFL_DIR_RX;
 		vdev->queue = q;
 		vdev->lock = &common->lock;
 		set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
@@ -1549,7 +1550,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 
 	while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
 		err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr,
-					IRQF_SHARED, "VPIF_Capture",
+					IRQF_SHARED, VPIF_DRIVER_NAME,
 					(void *)(&vpif_obj.dev[res_idx]->
 					channel_id));
 		if (err) {
@@ -1573,13 +1574,6 @@ static __init int vpif_probe(struct platform_device *pdev)
 			goto vpif_unregister;
 		}
 
-		/* Initialize field of video device */
-		*vfd = vpif_video_template;
-		vfd->v4l2_dev = &vpif_obj.v4l2_dev;
-		vfd->release = video_device_release;
-		snprintf(vfd->name, sizeof(vfd->name),
-			 "VPIF_Capture_DRIVER_V%s",
-			 VPIF_CAPTURE_VERSION);
 		/* Set video_dev to the video device */
 		ch->video_dev = vfd;
 	}
@@ -1754,7 +1748,7 @@ static const struct dev_pm_ops vpif_dev_pm_ops = {
 
 static __refdata struct platform_driver vpif_driver = {
 	.driver	= {
-		.name	= "vpif_capture",
+		.name	= VPIF_DRIVER_NAME,
 		.owner	= THIS_MODULE,
 		.pm	= vpif_pm_ops,
 	},
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (41 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-23 22:38   ` Mauro Carvalho Chehab
  2014-05-16 13:33 ` [PATCH v5 42/49] media: davinci: vpif_capture: drop cropcap Lad, Prabhakar
                   ` (9 subsequent siblings)
  52 siblings, 1 reply; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   54 +------------------------
 drivers/media/platform/davinci/vpif_capture.h |   11 -----
 2 files changed, 1 insertion(+), 64 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index d452eaf..e967cf7 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -38,32 +38,10 @@ MODULE_VERSION(VPIF_CAPTURE_VERSION);
 		v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
 
 static int debug = 1;
-static u32 ch0_numbuffers = 3;
-static u32 ch1_numbuffers = 3;
-static u32 ch0_bufsize = 1920 * 1080 * 2;
-static u32 ch1_bufsize = 720 * 576 * 2;
 
 module_param(debug, int, 0644);
-module_param(ch0_numbuffers, uint, S_IRUGO);
-module_param(ch1_numbuffers, uint, S_IRUGO);
-module_param(ch0_bufsize, uint, S_IRUGO);
-module_param(ch1_bufsize, uint, S_IRUGO);
 
 MODULE_PARM_DESC(debug, "Debug level 0-1");
-MODULE_PARM_DESC(ch2_numbuffers, "Channel0 buffer count (default:3)");
-MODULE_PARM_DESC(ch3_numbuffers, "Channel1 buffer count (default:3)");
-MODULE_PARM_DESC(ch2_bufsize, "Channel0 buffer size (default:1920 x 1080 x 2)");
-MODULE_PARM_DESC(ch3_bufsize, "Channel1 buffer size (default:720 x 576 x 2)");
-
-static struct vpif_config_params config_params = {
-	.min_numbuffers = 3,
-	.numbuffers[0] = 3,
-	.numbuffers[1] = 3,
-	.min_bufsize[0] = 720 * 480 * 2,
-	.min_bufsize[1] = 720 * 480 * 2,
-	.channel_bufsize[0] = 1920 * 1080 * 2,
-	.channel_bufsize[1] = 720 * 576 * 2,
-};
 
 #define VPIF_DRIVER_NAME	"vpif_capture"
 
@@ -609,9 +587,6 @@ static void vpif_config_format(struct channel_obj *ch)
 	vpif_dbg(2, debug, "vpif_config_format\n");
 
 	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	common->fmt.fmt.pix.sizeimage
-	    = config_params.channel_bufsize[ch->channel_id];
-
 	if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
 		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
 	else
@@ -1358,36 +1333,9 @@ static struct v4l2_file_operations vpif_fops = {
  */
 static int initialize_vpif(void)
 {
-	int err = 0, i, j;
+	int err, i, j;
 	int free_channel_objects_index;
 
-	/* Default number of buffers should be 3 */
-	if ((ch0_numbuffers > 0) &&
-	    (ch0_numbuffers < config_params.min_numbuffers))
-		ch0_numbuffers = config_params.min_numbuffers;
-	if ((ch1_numbuffers > 0) &&
-	    (ch1_numbuffers < config_params.min_numbuffers))
-		ch1_numbuffers = config_params.min_numbuffers;
-
-	/* Set buffer size to min buffers size if it is invalid */
-	if (ch0_bufsize < config_params.min_bufsize[VPIF_CHANNEL0_VIDEO])
-		ch0_bufsize =
-		    config_params.min_bufsize[VPIF_CHANNEL0_VIDEO];
-	if (ch1_bufsize < config_params.min_bufsize[VPIF_CHANNEL1_VIDEO])
-		ch1_bufsize =
-		    config_params.min_bufsize[VPIF_CHANNEL1_VIDEO];
-
-	config_params.numbuffers[VPIF_CHANNEL0_VIDEO] = ch0_numbuffers;
-	config_params.numbuffers[VPIF_CHANNEL1_VIDEO] = ch1_numbuffers;
-	if (ch0_numbuffers) {
-		config_params.channel_bufsize[VPIF_CHANNEL0_VIDEO]
-		    = ch0_bufsize;
-	}
-	if (ch1_numbuffers) {
-		config_params.channel_bufsize[VPIF_CHANNEL1_VIDEO]
-		    = ch1_bufsize;
-	}
-
 	/* Allocate memory for six channel objects */
 	for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
 		vpif_obj.dev[i] =
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 4960504..537076a 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -125,16 +125,5 @@ struct vpif_device {
 	struct vpif_capture_config *config;
 };
 
-struct vpif_config_params {
-	u8 min_numbuffers;
-	u8 numbuffers[VPIF_CAPTURE_NUM_CHANNELS];
-	s8 device_type;
-	u32 min_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
-	u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
-	u8 default_device[VPIF_CAPTURE_NUM_CHANNELS];
-	u32 video_limit[VPIF_CAPTURE_NUM_CHANNELS];
-	u8 max_device_type;
-};
-
 #endif				/* End of __KERNEL__ */
 #endif				/* VPIF_CAPTURE_H */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 42/49] media: davinci: vpif_capture: drop cropcap
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (42 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 43/49] media: davinci: vpif_capture: group v4l2_ioctl_ops Lad, Prabhakar
                   ` (8 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch drops cropcap as this driver doesnt support cropping.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index e967cf7..113d333 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1100,30 +1100,6 @@ static int vpif_querycap(struct file *file, void  *priv,
 }
 
 /**
- * vpif_cropcap() - cropcap handler
- * @file: file ptr
- * @priv: file handle
- * @crop: ptr to v4l2_cropcap structure
- */
-static int vpif_cropcap(struct file *file, void *priv,
-			struct v4l2_cropcap *crop)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct channel_obj *ch = video_get_drvdata(vdev);
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	if (V4L2_BUF_TYPE_VIDEO_CAPTURE != crop->type)
-		return -EINVAL;
-
-	crop->bounds.left = 0;
-	crop->bounds.top = 0;
-	crop->bounds.height = common->height;
-	crop->bounds.width = common->width;
-	crop->defrect = crop->bounds;
-	return 0;
-}
-
-/**
  * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler
  * @file: file ptr
  * @priv: file handle
@@ -1308,7 +1284,6 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_s_std           	= vpif_s_std,
 	.vidioc_g_std			= vpif_g_std,
 
-	.vidioc_cropcap         	= vpif_cropcap,
 	.vidioc_enum_dv_timings         = vpif_enum_dv_timings,
 	.vidioc_query_dv_timings        = vpif_query_dv_timings,
 	.vidioc_s_dv_timings            = vpif_s_dv_timings,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 43/49] media: davinci: vpif_capture: group v4l2_ioctl_ops
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (43 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 42/49] media: davinci: vpif_capture: drop cropcap Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 44/49] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
                   ` (7 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch gorups the v4l2_ioctl_ops and align them appropriately.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 113d333..9b41465 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1262,11 +1262,12 @@ static int vpif_log_status(struct file *filep, void *priv)
 
 /* vpif capture ioctl operations */
 static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
-	.vidioc_querycap        	= vpif_querycap,
+	.vidioc_querycap		= vpif_querycap,
 	.vidioc_enum_fmt_vid_cap	= vpif_enum_fmt_vid_cap,
-	.vidioc_g_fmt_vid_cap  		= vpif_g_fmt_vid_cap,
+	.vidioc_g_fmt_vid_cap		= vpif_g_fmt_vid_cap,
 	.vidioc_s_fmt_vid_cap		= vpif_s_fmt_vid_cap,
 	.vidioc_try_fmt_vid_cap		= vpif_try_fmt_vid_cap,
+
 	.vidioc_enum_input		= vpif_enum_input,
 	.vidioc_s_input			= vpif_s_input,
 	.vidioc_g_input			= vpif_g_input,
@@ -1281,13 +1282,14 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 	.vidioc_streamoff		= vb2_ioctl_streamoff,
 
 	.vidioc_querystd		= vpif_querystd,
-	.vidioc_s_std           	= vpif_s_std,
+	.vidioc_s_std			= vpif_s_std,
 	.vidioc_g_std			= vpif_g_std,
 
-	.vidioc_enum_dv_timings         = vpif_enum_dv_timings,
-	.vidioc_query_dv_timings        = vpif_query_dv_timings,
-	.vidioc_s_dv_timings            = vpif_s_dv_timings,
-	.vidioc_g_dv_timings            = vpif_g_dv_timings,
+	.vidioc_enum_dv_timings		= vpif_enum_dv_timings,
+	.vidioc_query_dv_timings	= vpif_query_dv_timings,
+	.vidioc_s_dv_timings		= vpif_s_dv_timings,
+	.vidioc_g_dv_timings		= vpif_g_dv_timings,
+
 	.vidioc_log_status		= vpif_log_status,
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 44/49] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (44 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 43/49] media: davinci: vpif_capture: group v4l2_ioctl_ops Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 45/49] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls Lad, Prabhakar
                   ` (6 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch uses SIMPLE_DEV_PM_OPS, and drops unneeded members
from io_usrs, usrs and makes use of vb2 helepers instead.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   63 ++++++++++++-------------
 drivers/media/platform/davinci/vpif_capture.h |    4 --
 2 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 9b41465..f4cf24c 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1595,7 +1595,7 @@ static int vpif_remove(struct platform_device *device)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /**
  * vpif_suspend: vpif device suspend
  */
@@ -1610,18 +1610,20 @@ static int vpif_suspend(struct device *dev)
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
+
+		if (!vb2_is_streaming(&common->buffer_queue))
+			continue;
+
 		mutex_lock(&common->lock);
-		if (ch->usrs && common->io_usrs) {
-			/* Disable channel */
-			if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
-				enable_channel0(0);
-				channel0_intr_enable(0);
-			}
-			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
-				ycmux_mode == 2) {
-				enable_channel1(0);
-				channel1_intr_enable(0);
-			}
+		/* Disable channel */
+		if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
+			enable_channel0(0);
+			channel0_intr_enable(0);
+		}
+		if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
+			ycmux_mode == 2) {
+			enable_channel1(0);
+			channel1_intr_enable(0);
 		}
 		mutex_unlock(&common->lock);
 	}
@@ -1642,40 +1644,35 @@ static int vpif_resume(struct device *dev)
 		/* Get the pointer to the channel object */
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
+
+		if (!vb2_is_streaming(&common->buffer_queue))
+			continue;
+
 		mutex_lock(&common->lock);
-		if (ch->usrs && common->io_usrs) {
-			/* Disable channel */
-			if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
-				enable_channel0(1);
-				channel0_intr_enable(1);
-			}
-			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
-				ycmux_mode == 2) {
-				enable_channel1(1);
-				channel1_intr_enable(1);
-			}
+		/* Enable channel */
+		if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
+			enable_channel0(1);
+			channel0_intr_enable(1);
+		}
+		if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
+			ycmux_mode == 2) {
+			enable_channel1(1);
+			channel1_intr_enable(1);
 		}
 		mutex_unlock(&common->lock);
 	}
 
 	return 0;
 }
-
-static const struct dev_pm_ops vpif_dev_pm_ops = {
-	.suspend = vpif_suspend,
-	.resume = vpif_resume,
-};
-
-#define vpif_pm_ops (&vpif_dev_pm_ops)
-#else
-#define vpif_pm_ops NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume);
+
 static __refdata struct platform_driver vpif_driver = {
 	.driver	= {
 		.name	= VPIF_DRIVER_NAME,
 		.owner	= THIS_MODULE,
-		.pm	= vpif_pm_ops,
+		.pm	= &vpif_pm_ops,
 	},
 	.probe = vpif_probe,
 	.remove = vpif_remove,
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 537076a..3b5ea30 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -75,8 +75,6 @@ struct common_obj {
 	spinlock_t irqlock;
 	/* lock used to access this structure */
 	struct mutex lock;
-	/* number of users performing IO */
-	u32 io_usrs;
 	/* Function pointer to set the addresses */
 	void (*set_addr) (unsigned long, unsigned long, unsigned long,
 			  unsigned long);
@@ -97,8 +95,6 @@ struct common_obj {
 struct channel_obj {
 	/* Identifies video device for this channel */
 	struct video_device *video_dev;
-	/* number of open instances of the channel */
-	int usrs;
 	/* Indicates id of the field which is being displayed */
 	u32 field_id;
 	/* flag to indicate whether decoder is initialized */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 45/49] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (45 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 44/49] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls Lad, Prabhakar
                   ` (5 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds suppport to return -ENODATA for *dv_timings calls
if the current output does not support it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   50 +++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index f4cf24c..0b97023 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1109,13 +1109,25 @@ static int
 vpif_enum_dv_timings(struct file *file, void *priv,
 		     struct v4l2_enum_dv_timings *timings)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
 	int ret;
 
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
+		return -ENODATA;
+
 	ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
 	if (ret == -ENOIOCTLCMD || ret == -ENODEV)
 		return -EINVAL;
+
 	return ret;
 }
 
@@ -1129,13 +1141,25 @@ static int
 vpif_query_dv_timings(struct file *file, void *priv,
 		      struct v4l2_dv_timings *timings)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
 	int ret;
 
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
+		return -ENODATA;
+
 	ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings);
 	if (ret == -ENOIOCTLCMD || ret == -ENODEV)
 		return -ENODATA;
+
 	return ret;
 }
 
@@ -1148,19 +1172,34 @@ vpif_query_dv_timings(struct file *file, void *priv,
 static int vpif_s_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct vpif_params *vpifparams = &ch->vpifparams;
 	struct vpif_channel_config_params *std_info = &vpifparams->std_info;
+	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 	struct video_obj *vid_ch = &ch->video;
 	struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt;
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
 	int ret;
 
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
+		return -ENODATA;
+
 	if (timings->type != V4L2_DV_BT_656_1120) {
 		vpif_dbg(2, debug, "Timing type not defined\n");
 		return -EINVAL;
 	}
 
+	if (vb2_is_busy(&common->buffer_queue))
+		return -EBUSY;
+
 	/* Configure subdevice timings, if any */
 	ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings);
 	if (ret == -ENOIOCTLCMD || ret == -ENODEV)
@@ -1236,9 +1275,20 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
 static int vpif_g_dv_timings(struct file *file, void *priv,
 		struct v4l2_dv_timings *timings)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct video_obj *vid_ch = &ch->video;
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
+
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
+		return -ENODATA;
 
 	*timings = vid_ch->dv_timings;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (46 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 45/49] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 47/49] media: davinci: vpif_capture: drop check __KERNEL__ Lad, Prabhakar
                   ` (4 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch adds supports to return -ENODATA to *std calls
if the selected output does not support it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 0b97023..8d7ada2 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -862,11 +862,22 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
  */
 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
 
 	vpif_dbg(2, debug, "vpif_g_std\n");
 
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_STD)
+		return -ENODATA;
+
 	*std = ch->video.stdid;
 	return 0;
 }
@@ -879,13 +890,24 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
  */
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
+	struct vpif_capture_config *config = vpif_dev->platform_data;
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	int ret = 0;
+	struct vpif_capture_chan_config *chan_cfg;
+	struct v4l2_input input;
+	int ret;
 
 	vpif_dbg(2, debug, "vpif_s_std\n");
 
+	if (config->chan_config[ch->channel_id].inputs == NULL)
+		return -ENODATA;
+
+	chan_cfg = &config->chan_config[ch->channel_id];
+	input = chan_cfg->inputs[ch->input_idx].input;
+	if (input.capabilities != V4L2_IN_CAP_STD)
+		return -ENODATA;
+
 	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 47/49] media: davinci: vpif_capture: drop check __KERNEL__
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (47 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 48/49] media: davinci: vpif_capture: fix v4l-complinace issues Lad, Prabhakar
                   ` (3 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this drops check for #ifdef __KERNEL__

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 3b5ea30..f65d28d 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -19,8 +19,6 @@
 #ifndef VPIF_CAPTURE_H
 #define VPIF_CAPTURE_H
 
-#ifdef __KERNEL__
-
 /* Header files */
 #include <media/videobuf2-dma-contig.h>
 #include <media/v4l2-device.h>
@@ -121,5 +119,4 @@ struct vpif_device {
 	struct vpif_capture_config *config;
 };
 
-#endif				/* End of __KERNEL__ */
 #endif				/* VPIF_CAPTURE_H */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 48/49] media: davinci: vpif_capture: fix v4l-complinace issues
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (48 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 47/49] media: davinci: vpif_capture: drop check __KERNEL__ Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-16 13:33 ` [PATCH v5 49/49] media: davinci: vpif: add Copyright message Lad, Prabhakar
                   ` (2 subsequent siblings)
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

this patch does following,
1: sets initial default format during probe.
2: removes spurious messages.
3: optimize vpif_s/try_fmt_vid_out code.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |  191 +++++++------------------
 1 file changed, 54 insertions(+), 137 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 8d7ada2..5226798 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -497,10 +497,28 @@ static int vpif_update_std_info(struct channel_obj *ch)
 	common->width = std_info->width;
 	common->fmt.fmt.pix.height = std_info->height;
 	common->height = std_info->height;
+	common->fmt.fmt.pix.sizeimage = common->height * common->width * 2;
 	common->fmt.fmt.pix.bytesperline = std_info->width;
 	vpifparams->video_params.hpitch = std_info->width;
 	vpifparams->video_params.storage_mode = std_info->frm_fmt;
 
+	if (vid_ch->stdid)
+		common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+	else
+		common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
+
+	if (ch->vpifparams.std_info.frm_fmt)
+		common->fmt.fmt.pix.field = V4L2_FIELD_NONE;
+	else
+		common->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
+
+	if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
+		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
+	else
+		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
+
+	common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
 	return 0;
 }
 
@@ -577,24 +595,6 @@ static void vpif_calculate_offsets(struct channel_obj *ch)
 }
 
 /**
- * vpif_config_format: configure default frame format in the device
- * ch : ptr to channel object
- */
-static void vpif_config_format(struct channel_obj *ch)
-{
-	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
-	vpif_dbg(2, debug, "vpif_config_format\n");
-
-	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
-	if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
-		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
-	else
-		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
-	common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-}
-
-/**
  * vpif_get_default_field() - Get default field type based on interface
  * @vpif_params - ptr to vpif params
  */
@@ -606,112 +606,6 @@ static inline enum v4l2_field vpif_get_default_field(
 }
 
 /**
- * vpif_check_format()  - check given pixel format for compatibility
- * @ch - channel  ptr
- * @pixfmt - Given pixel format
- * @update - update the values as per hardware requirement
- *
- * Check the application pixel format for S_FMT and update the input
- * values as per hardware limits for TRY_FMT. The default pixel and
- * field format is selected based on interface type.
- */
-static int vpif_check_format(struct channel_obj *ch,
-			     struct v4l2_pix_format *pixfmt,
-			     int update)
-{
-	struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
-	struct vpif_params *vpif_params = &ch->vpifparams;
-	enum v4l2_field field = pixfmt->field;
-	u32 sizeimage, hpitch, vpitch;
-	int ret = -EINVAL;
-
-	vpif_dbg(2, debug, "vpif_check_format\n");
-	/**
-	 * first check for the pixel format. If if_type is Raw bayer,
-	 * only V4L2_PIX_FMT_SBGGR8 format is supported. Otherwise only
-	 * V4L2_PIX_FMT_YUV422P is supported
-	 */
-	if (vpif_params->iface.if_type == VPIF_IF_RAW_BAYER) {
-		if (pixfmt->pixelformat != V4L2_PIX_FMT_SBGGR8) {
-			if (!update) {
-				vpif_dbg(2, debug, "invalid pix format\n");
-				goto exit;
-			}
-			pixfmt->pixelformat = V4L2_PIX_FMT_SBGGR8;
-		}
-	} else {
-		if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P) {
-			if (!update) {
-				vpif_dbg(2, debug, "invalid pixel format\n");
-				goto exit;
-			}
-			pixfmt->pixelformat = V4L2_PIX_FMT_YUV422P;
-		}
-	}
-
-	if (!(VPIF_VALID_FIELD(field))) {
-		if (!update) {
-			vpif_dbg(2, debug, "invalid field format\n");
-			goto exit;
-		}
-		/**
-		 * By default use FIELD_NONE for RAW Bayer capture
-		 * and FIELD_INTERLACED for other interfaces
-		 */
-		field = vpif_get_default_field(&vpif_params->iface);
-	} else if (field == V4L2_FIELD_ANY)
-		/* unsupported field. Use default */
-		field = vpif_get_default_field(&vpif_params->iface);
-
-	/* validate the hpitch */
-	hpitch = pixfmt->bytesperline;
-	if (hpitch < vpif_params->std_info.width) {
-		if (!update) {
-			vpif_dbg(2, debug, "invalid hpitch\n");
-			goto exit;
-		}
-		hpitch = vpif_params->std_info.width;
-	}
-
-	sizeimage = pixfmt->sizeimage;
-
-	vpitch = sizeimage / (hpitch * 2);
-
-	/* validate the vpitch */
-	if (vpitch < vpif_params->std_info.height) {
-		if (!update) {
-			vpif_dbg(2, debug, "Invalid vpitch\n");
-			goto exit;
-		}
-		vpitch = vpif_params->std_info.height;
-	}
-
-	/* Check for 8 byte alignment */
-	if (!ALIGN(hpitch, 8)) {
-		if (!update) {
-			vpif_dbg(2, debug, "invalid pitch alignment\n");
-			goto exit;
-		}
-		/* adjust to next 8 byte boundary */
-		hpitch = (((hpitch + 7) / 8) * 8);
-	}
-	/* if update is set, modify the bytesperline and sizeimage */
-	if (update) {
-		pixfmt->bytesperline = hpitch;
-		pixfmt->sizeimage = hpitch * vpitch * 2;
-	}
-	/**
-	 * Image width and height is always based on current standard width and
-	 * height
-	 */
-	pixfmt->width = common->fmt.fmt.pix.width;
-	pixfmt->height = common->fmt.fmt.pix.height;
-	return 0;
-exit:
-	return ret;
-}
-
-/**
  * vpif_config_addr() - function to configure buffer address in vpif
  * @ch - channel ptr
  * @muxmode - channel mux mode
@@ -921,9 +815,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 		return -EINVAL;
 	}
 
-	/* Configure the default format information */
-	vpif_config_format(ch);
-
 	/* set standard in the sub device */
 	ret = v4l2_subdev_call(ch->sd, core, s_std, std_id);
 	if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
@@ -950,10 +841,8 @@ static int vpif_enum_input(struct file *file, void *priv,
 
 	chan_cfg = &config->chan_config[ch->channel_id];
 
-	if (input->index >= chan_cfg->input_count) {
-		vpif_dbg(1, debug, "Invalid input index\n");
+	if (input->index >= chan_cfg->input_count)
 		return -EINVAL;
-	}
 
 	memcpy(input, &chan_cfg->inputs[input->index].input,
 		sizeof(*input));
@@ -1042,8 +931,34 @@ static int vpif_try_fmt_vid_cap(struct file *file, void *priv,
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
+	struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
+	struct vpif_params *vpif_params = &ch->vpifparams;
+
+	/*
+	 * to supress v4l-compliance warnings silently correct
+	 * the pixelformat
+	 */
+	if (vpif_params->iface.if_type == VPIF_IF_RAW_BAYER) {
+		if (pixfmt->pixelformat != V4L2_PIX_FMT_SBGGR8)
+			pixfmt->pixelformat = V4L2_PIX_FMT_SBGGR8;
+	} else {
+		if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P)
+			pixfmt->pixelformat = V4L2_PIX_FMT_YUV422P;
+	}
+
+	common->fmt.fmt.pix.pixelformat = pixfmt->pixelformat;
 
-	return vpif_check_format(ch, pixfmt, 1);
+	vpif_update_std_info(ch);
+
+	pixfmt->field = common->fmt.fmt.pix.field;
+	pixfmt->colorspace = common->fmt.fmt.pix.colorspace;
+	pixfmt->bytesperline = common->fmt.fmt.pix.width;
+	pixfmt->width = common->fmt.fmt.pix.width;
+	pixfmt->height = common->fmt.fmt.pix.height;
+	pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height * 2;
+	pixfmt->priv = 0;
+
+	return 0;
 }
 
 
@@ -1081,20 +996,17 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
 	struct video_device *vdev = video_devdata(file);
 	struct channel_obj *ch = video_get_drvdata(vdev);
 	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-	struct v4l2_pix_format *pixfmt;
-	int ret = 0;
+	int ret;
 
 	vpif_dbg(2, debug, "%s\n", __func__);
 
 	if (vb2_is_busy(&common->buffer_queue))
 		return -EBUSY;
 
-	pixfmt = &fmt->fmt.pix;
-	/* Check for valid field format */
-	ret = vpif_check_format(ch, pixfmt, 0);
-
+	ret = vpif_try_fmt_vid_cap(file, priv, fmt);
 	if (ret)
 		return ret;
+
 	/* store the format in the channel object */
 	common->fmt = *fmt;
 	return 0;
@@ -1440,6 +1352,11 @@ static int vpif_probe_complete(void)
 		if (err)
 			goto probe_out;
 
+		/* set initial format */
+		ch->video.stdid = V4L2_STD_525_60;
+		memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings));
+		vpif_update_std_info(ch);
+
 		/* Initialize vb2 queue */
 		q = &common->buffer_queue;
 		q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v5 49/49] media: davinci: vpif: add Copyright message
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (49 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 48/49] media: davinci: vpif_capture: fix v4l-complinace issues Lad, Prabhakar
@ 2014-05-16 13:33 ` Lad, Prabhakar
  2014-05-23  8:30 ` [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Hans Verkuil
  2014-05-23  9:05 ` Hans Verkuil
  52 siblings, 0 replies; 60+ messages in thread
From: Lad, Prabhakar @ 2014-05-16 13:33 UTC (permalink / raw)
  To: LMML, Hans Verkuil; +Cc: DLOS, LKML, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c |    1 +
 drivers/media/platform/davinci/vpif_display.c |    1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 5226798..12c26e3 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Texas Instruments Inc
+ * Copyright (C) 2014 Lad, Prabhakar <prabhakar.csengg@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index cda0851..d611045 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -3,6 +3,7 @@
  * Display driver for TI DaVinci VPIF
  *
  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2014 Lad, Prabhakar <prabhakar.csengg@gmail.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (50 preceding siblings ...)
  2014-05-16 13:33 ` [PATCH v5 49/49] media: davinci: vpif: add Copyright message Lad, Prabhakar
@ 2014-05-23  8:30 ` Hans Verkuil
  2014-05-24  4:09   ` Prabhakar Lad
  2014-05-23  9:05 ` Hans Verkuil
  52 siblings, 1 reply; 60+ messages in thread
From: Hans Verkuil @ 2014-05-23  8:30 UTC (permalink / raw)
  To: Lad, Prabhakar, LMML, Hans Verkuil; +Cc: DLOS, LKML

Hi Prabhakar,

Thanks for this patch series, it looks good to me and I'll make a pull
request for this.

I did find a few issues, but they are all pre-existing problems, so they
can be fixed in follow-up patches.

I'll comment on those in the relevant patches. Since display and capture are
so similar I will only comment on the display patches, but it's valid for
both.

Regards,

	Hans

On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> Hi,
> 
> This patch series upgrades the vpif capture & display
> driver with the all the helpers provided by v4l, this makes
> the driver much simpler and cleaner. This also includes few
> checkpatch issues.
> 
> Changes for v2:
> a> Added a copyright.
> b> Dropped buf_init() callback from vb2_ops.
> c> Fixed enabling & disabling of interrupts in case of HD formats.
> 
> Changes for v3:
> a> Fixed review comments pointed by Hans.
> 
> Changes for v4: Rebased the patches on media tree.
> 
> Changes for v5: Split up the patches
> 
> Following is the output of v4l-compliance for capture:
> ------------------------------------------------------
> 
> ./v4l2-compliance -d /dev/video0 -i 0 -s -v --expbuf-device=2
> 
> Driver Info:
>         Driver name   : vpif_capture
>         Card type     : DA850/OMAP-L138 Video Capture
>         Bus info      : platform:vpif_capture
>         Driver version: 3.15.0
>         Capabilities  : 0x84000001
>                 Video Capture
>                 Streaming
>                 Device Capabilities
>         Device Caps   : 0x04000001
>                 Video Capture
>                 Streaming
> 
> 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: 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_QUERYCTRL/MENU: 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 1 formats for buftype 1
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 fail: v4l2-test-formats.cpp(1003): cap->readbuffers
>                 test VIDIOC_G/S_PARM: FAIL
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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
>         test read/write: OK (Not Supported)
>             Video Capture:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.509130s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.549125s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.589148s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.629106s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.669110s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.709102s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.749099s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.789128s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.829116s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.869105s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.909100s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.949098s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.989086s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.029083s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.069083s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.109074s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.149074s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.189100s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.229077s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.269078s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.309075s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.349070s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.389060s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.429052s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.469053s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.509047s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.549045s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.589072s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.629047s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.669051s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.709046s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.749043s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.789033s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.829023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.869025s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.909018s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.949029s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.989046s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.029021s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.069024s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.109019s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.149004s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.189006s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.228998s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.268996s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.308996s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.349004s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.389019s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.429000s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.468999s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.509004s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.548979s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.588982s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.628973s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.668976s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.708968s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.748979s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.788991s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.828972s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.868969s
>             Video Capture (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.908969s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.948952s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.988955s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.028946s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.068946s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.108954s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.148955s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.188973s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.228948s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.268943s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.308949s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.348928s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.388927s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.428918s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.468918s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.508923s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.548919s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.588946s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.628923s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.668917s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.708902s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.748899s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.788901s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.828895s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.868892s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.908897s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.948898s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.988920s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.028892s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.068893s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.108876s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.148873s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.188875s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.228867s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.268875s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.308870s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.348870s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.388870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.428891s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.468893s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.508849s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.548845s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.588849s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.628842s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.668855s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.708844s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.748846s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.788868s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.828842s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.868826s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.908823s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.948821s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.988821s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.028817s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.068824s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.108818s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 150.148818s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.188839s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.228808s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.268798s
>         test MMAP: OK
>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>         test USERPTR: FAIL
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.234735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.268098s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.301503s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.334846s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.368202s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.401594s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.434960s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.468320s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.501709s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.535041s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.568428s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.601811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.635146s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.668514s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.701913s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.735260s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.768617s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.802007s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.835367s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.868732s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.902120s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.935451s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.968837s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.002223s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.035566s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.068923s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.102327s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.135667s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.169023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.202423s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.235785s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.269146s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.302535s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.335862s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.369252s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.402637s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.435978s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.469335s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.502705s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.536087s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.569454s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.602817s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.636177s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.669557s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.702934s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.736280s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.769648s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.803053s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.836396s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.869753s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.903122s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.936499s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.969870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.003251s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.036591s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.069975s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.103363s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.136702s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.170112s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.203462s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.236804s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.270175s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.303533s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.336914s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.370269s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.403661s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.436999s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.470388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.503774s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.537117s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.570511s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.603874s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.637222s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.670603s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.703944s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.737326s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.770694s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.804083s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.837412s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.870809s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.904185s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.937526s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.970900s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.004285s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.037632s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.070993s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.104382s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.137735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.171104s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.204492s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.237822s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.271190s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.304596s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.337941s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.371310s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.404665s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.438046s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.471408s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.504794s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.538130s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.571517s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.604904s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.638234s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.671610s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.704984s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.738352s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.771725s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.805080s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.838459s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.871822s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.905165s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.938547s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.971931s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.005319s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.038649s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.072021s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.105420s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.138776s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.172136s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.205492s
>         test DMABUF: OK
> 
> Total: 41, Succeeded: 40, Failed: 1, Warnings: 0
> 
> Following is the output of v4l-compliance for display:
> ------------------------------------------------------
> 
> ./v4l2-compliance -d /dev/video2 -o 0 -s -v --expbuf-device=0 
> 
> Driver Info:
>         Driver name   : vpif_capture
>         Card type     : DA850/OMAP-L138 Video Capture
>         Bus info      : platform:vpif_capture
>         Driver version: 3.15.0
>         Capabilities  : 0x84000001
>                 Video Capture
>                 Streaming
>                 Device Capabilities
>         Device Caps   : 0x04000001
>                 Video Capture
>                 Streaming
> 
> Compliance test for device /dev/video2 (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: 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 (Not Supported)
>         test VIDIOC_G/S_AUDIO: OK (Not Supported)
>         Inputs: 0 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
>         test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>         Outputs: 2 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 output 0:
> 
>         Control ioctls:
>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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)
> 
> Test output 1:
> 
>         Control ioctls:
>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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 Output
>         test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
>         test VIDIOC_EXPBUF: OK
>         test read/write: OK (Not Supported)
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.197959s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.231346s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.264708s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.298071s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.331432s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.364827s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.398174s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.431543s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.464898s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.498277s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.531648s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.565008s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.598379s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.631754s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.665121s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.698489s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.731843s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.765230s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.798587s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.831955s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.865314s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.898690s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.932065s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.965425s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.998793s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.032169s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.065534s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.098897s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.132256s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.165643s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.199000s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.232370s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.265725s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.299103s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.332478s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.365837s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.399207s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.432567s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.465951s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.499312s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.532670s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.566036s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.599414s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.632785s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.666143s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.699509s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.732891s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.766253s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.799620s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.832980s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.866362s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.899722s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.933083s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.966449s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.999826s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.033190s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.066552s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.099920s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.133306s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.166665s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.200056s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.233388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.266772s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.300162s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.333497s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.366859s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.400264s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.433608s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.466982s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.500359s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.533717s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.567082s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.600470s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.633800s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.667186s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.700572s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.733906s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.767270s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.800678s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.834022s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.867391s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.900772s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.934129s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.967494s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.000884s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.034215s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.067607s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.100983s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.134329s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.167684s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.201087s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.234435s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.267799s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.301192s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.334523s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.367906s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.401293s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.434627s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.467992s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.501374s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.534744s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.568099s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.601470s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.634852s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.668215s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.701605s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.734935s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.768322s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.801707s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.835041s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.868407s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.901811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.935166s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.968509s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.001907s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.035265s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.068628s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.102016s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.135349s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.168734s
>         test MMAP: OK
>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>         test USERPTR: FAIL
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.234735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.268098s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.301503s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.334846s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.368202s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.401594s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.434960s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.468320s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.501709s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.535041s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.568428s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.601811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.635146s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.668514s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.701913s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.735260s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.768617s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.802007s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.835367s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.868732s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.902120s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.935451s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.968837s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.002223s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.035566s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.068923s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.102327s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.135667s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.169023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.202423s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.235785s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.269146s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.302535s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.335862s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.369252s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.402637s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.435978s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.469335s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.502705s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.536087s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.569454s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.602817s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.636177s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.669557s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.702934s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.736280s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.769648s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.803053s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.836396s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.869753s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.903122s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.936499s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.969870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.003251s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.036591s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.069975s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.103363s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.136702s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.170112s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.203462s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.236804s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.270175s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.303533s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.336914s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.370269s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.403661s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.436999s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.470388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.503774s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.537117s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.570511s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.603874s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.637222s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.670603s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.703944s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.737326s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.770694s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.804083s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.837412s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.870809s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.904185s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.937526s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.970900s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.004285s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.037632s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.070993s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.104382s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.137735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.171104s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.204492s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.237822s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.271190s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.304596s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.337941s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.371310s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.404665s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.438046s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.471408s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.504794s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.538130s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.571517s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.604904s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.638234s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.671610s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.704984s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.738352s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.771725s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.805080s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.838459s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.871822s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.905207s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.938547s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.971931s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.005319s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.038649s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.072021s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.105420s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.138776s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.172136s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.205492s
>         test DMABUF: OK
> 
> Total: 57, Succeeded: 56, Failed: 1, Warnings: 0
> 
> 
> 
> Lad, Prabhakar (49):
>   media: davinci: vpif_display: initialize vb2 queue and DMA context
>     during probe
>   media: davinci: vpif_display: drop buf_init() callback
>   media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper
>     functions
>   media: davinci: vpif_display: release buffers in case
>     start_streaming() call back fails
>   media: davinci: vpif_display: drop buf_cleanup() callback
>   media: davinci: vpif_display: improve vpif_buffer_prepare() callback
>   media: davinci: vpif_display: improve vpif_buffer_queue_setup()
>     function
>   media: davinci: vpif_display: improve start/stop_streaming callbacks
>   media: davinci: vpif_display: use vb2_fop_mmap/poll
>   media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
>   media: davinci: vpif_display: use vb2_ioctl_* helpers
>   media: davinci: vpif_display: drop unused member fbuffers
>   media: davinci: vpif_display: drop reserving memory for device
>   media: davinci: vpif_display: drop unnecessary field memory
>   media: davinci: vpif_display: drop numbuffers field from common_obj
>   media: davinic: vpif_display: drop started member from struct
>     common_obj
>   media: davinci: vpif_display: initialize the video device in single
>     place
>   media: davinci: vpif_display: drop unneeded module params
>   media: davinci: vpif_display: drop cropcap
>   media: davinci: vpif_display: group v4l2_ioctl_ops
>   media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
>   media: davinci: vpif_display: return -ENODATA for *dv_timings calls
>   media: davinci: vpif_display: return -ENODATA for *std calls
>   media: davinci; vpif_display: fix checkpatch error
>   media: davinci: vpif_display: fix v4l-complinace issues
>   media: davinci: vpif_capture: initalize vb2 queue and DMA context
>     during probe
>   media: davinci: vpif_capture: drop buf_init() callback
>   media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
>     functions
>   media: davinci: vpif_capture: release buffers in case
>     start_streaming() call back fails
>   media: davinci: vpif_capture: drop buf_cleanup() callback
>   media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
>   media: davinci: vpif_capture: improve vpif_buffer_queue_setup()
>     function
>   media: davinci: vpif_capture: improve start/stop_streaming callbacks
>   media: davinci: vpif_capture: use vb2_fop_mmap/poll
>   media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
>   media: davinci: vpif_capture: use vb2_ioctl_* helpers
>   media: davinci: vpif_capture: drop reserving memory for device
>   media: davinci: vpif_capture: drop unnecessary field memory
>   media: davinic: vpif_capture: drop started member from struct
>     common_obj
>   media: davinci: vpif_capture: initialize the video device in single
>     place
>   media: davinci: vpif_capture: drop unneeded module params
>   media: davinci: vpif_capture: drop cropcap
>   media: davinci: vpif_capture: group v4l2_ioctl_ops
>   media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
>   media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
>   media: davinci: vpif_capture: return -ENODATA for *std calls
>   media: davinci: vpif_capture: drop check __KERNEL__
>   media: davinci: vpif_capture: fix v4l-complinace issues
>   media: davinci: vpif: add Copyright message
> 
>  drivers/media/platform/davinci/vpif_capture.c | 1420 +++++++------------------
>  drivers/media/platform/davinci/vpif_capture.h |   39 -
>  drivers/media/platform/davinci/vpif_display.c | 1196 ++++++---------------
>  drivers/media/platform/davinci/vpif_display.h |   44 +-
>  4 files changed, 746 insertions(+), 1953 deletions(-)
> 


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails
  2014-05-16 13:33 ` [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails Lad, Prabhakar
@ 2014-05-23  8:35   ` Hans Verkuil
  2014-05-24  4:02     ` Prabhakar Lad
  0 siblings, 1 reply; 60+ messages in thread
From: Hans Verkuil @ 2014-05-23  8:35 UTC (permalink / raw)
  To: Lad, Prabhakar, LMML, Hans Verkuil; +Cc: DLOS, LKML

On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> this patch adds support to release the buffer by calling
> vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
> if start_streaming() call back fails.
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
>  drivers/media/platform/davinci/vpif_display.c |   42 +++++++++++++++----------
>  1 file changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
> index 8bb9f02..1a17a45 100644
> --- a/drivers/media/platform/davinci/vpif_display.c
> +++ b/drivers/media/platform/davinci/vpif_display.c
> @@ -196,26 +196,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>  	struct channel_obj *ch = vb2_get_drv_priv(vq);
>  	struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
>  	struct vpif_params *vpif = &ch->vpifparams;
> -	unsigned long addr = 0;
> -	unsigned long flags;
> +	struct vpif_disp_buffer *buf, *tmp;
> +	unsigned long addr, flags;
>  	int ret;
>  
>  	spin_lock_irqsave(&common->irqlock, flags);
>  
> -	/* Get the next frame from the buffer queue */
> -	common->next_frm = common->cur_frm =
> -			    list_entry(common->dma_queue.next,
> -				       struct vpif_disp_buffer, list);
> -
> -	list_del(&common->cur_frm->list);
> -	spin_unlock_irqrestore(&common->irqlock, flags);
> -	/* Mark state of the current frame to active */
> -	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
> -
>  	/* Initialize field_id and started member */
>  	ch->field_id = 0;
>  	common->started = 1;
> -	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
> +
>  	/* Calculate the offset for Y and C data  in the buffer */
>  	vpif_calculate_offsets(ch);
>  
> @@ -225,7 +215,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>  		|| (!ch->vpifparams.std_info.frm_fmt
>  		&& (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
>  		vpif_err("conflict in field format and std format\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto err;
>  	}
>  
>  	/* clock settings */
> @@ -234,17 +225,28 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>  		ycmux_mode, ch->vpifparams.std_info.hd_sd);
>  		if (ret < 0) {
>  			vpif_err("can't set clock\n");
> -			return ret;
> +			goto err;
>  		}
>  	}
>  
>  	/* set the parameters and addresses */
>  	ret = vpif_set_video_params(vpif, ch->channel_id + 2);
>  	if (ret < 0)
> -		return ret;
> +		goto err;
>  
>  	common->started = ret;
>  	vpif_config_addr(ch, ret);
> +	/* Get the next frame from the buffer queue */
> +	common->next_frm = common->cur_frm =
> +			    list_entry(common->dma_queue.next,
> +				       struct vpif_disp_buffer, list);
> +
> +	list_del(&common->cur_frm->list);
> +	spin_unlock_irqrestore(&common->irqlock, flags);
> +	/* Mark state of the current frame to active */
> +	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;

There is no need to set this, all buffers queued to the driver are always in state
ACTIVE. The vb2 core sets that for you. In general drivers never need to change the
state manually.

It happens twice in this driver and in both cases the assignment can be removed.

Regards,

	Hans

> +
> +	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
>  	common->set_addr((addr + common->ytop_off),
>  			    (addr + common->ybtm_off),
>  			    (addr + common->ctop_off),
> @@ -271,6 +273,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>  	}
>  
>  	return 0;
> +
> +err:
> +	list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
> +		list_del(&buf->list);
> +		vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
> +	}
> +
> +	return ret;
>  }
>  
>  /* abort streaming and wait for last buffer */
> 


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
  2014-05-16 13:33 ` [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
@ 2014-05-23  8:48   ` Hans Verkuil
  0 siblings, 0 replies; 60+ messages in thread
From: Hans Verkuil @ 2014-05-23  8:48 UTC (permalink / raw)
  To: Lad, Prabhakar, LMML, Hans Verkuil; +Cc: DLOS, LKML

On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> this patch uses SIMPLE_DEV_PM_OPS, and drops unneeded members
> from io_usrs, usrs and makes use of vb2 helepers instead.
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
>  drivers/media/platform/davinci/vpif_display.c |   64 ++++++++++++-------------
>  drivers/media/platform/davinci/vpif_display.h |    4 --
>  2 files changed, 30 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
> index 401d03a..81d955a 100644
> --- a/drivers/media/platform/davinci/vpif_display.c
> +++ b/drivers/media/platform/davinci/vpif_display.c
> @@ -1124,10 +1124,8 @@ static int vpif_probe_complete(void)
>  	for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
>  		ch = vpif_obj.dev[j];
>  		/* Initialize field of the channel objects */
> -		atomic_set(&ch->usrs, 0);
>  		for (k = 0; k < VPIF_NUMOBJECTS; k++) {
>  			common = &ch->common[k];
> -			common->io_usrs = 0;
>  			spin_lock_init(&common->irqlock);
>  			mutex_init(&common->lock);
>  			common->set_addr = NULL;
> @@ -1371,7 +1369,7 @@ static int vpif_remove(struct platform_device *device)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> +#ifdef CONFIG_PM_SLEEP
>  static int vpif_suspend(struct device *dev)
>  {
>  	struct common_obj *common;
> @@ -1382,18 +1380,20 @@ static int vpif_suspend(struct device *dev)
>  		/* Get the pointer to the channel object */
>  		ch = vpif_obj.dev[i];
>  		common = &ch->common[VPIF_VIDEO_INDEX];
> +
> +		if (!vb2_is_streaming(&common->buffer_queue))
> +			continue;

The use of vb2_is_streaming here is not correct. It is possible to call STREAMON
without having any buffers queued. So vb2_is_streaming() can return true without
start_streaming() having been called. Only after at least one buffer has been
queued will start_streaming be called.

So this code will fail if you call STREAMON without any buffers queued and
then suspend and resume. The resume callback will start the DMA without having
proper DMA pointers set up. Probably not a good idea.

The fix is to check the vb2_queue->start_streaming_called flag. I think we
need a vb2_start_streaming_called() inline function as that's a bit cleaner
than checking that flag directly.

Regards,

	Hans

> +
>  		mutex_lock(&common->lock);
> -		if (atomic_read(&ch->usrs) && common->io_usrs) {
> -			/* Disable channel */
> -			if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
> -				enable_channel2(0);
> -				channel2_intr_enable(0);
> -			}
> -			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
> -				ycmux_mode == 2) {
> -				enable_channel3(0);
> -				channel3_intr_enable(0);
> -			}
> +		/* Disable channel */
> +		if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
> +			enable_channel2(0);
> +			channel2_intr_enable(0);
> +		}
> +		if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
> +			ycmux_mode == 2) {
> +			enable_channel3(0);
> +			channel3_intr_enable(0);
>  		}
>  		mutex_unlock(&common->lock);
>  	}
> @@ -1412,18 +1412,20 @@ static int vpif_resume(struct device *dev)
>  		/* Get the pointer to the channel object */
>  		ch = vpif_obj.dev[i];
>  		common = &ch->common[VPIF_VIDEO_INDEX];
> +
> +		if (!vb2_is_streaming(&common->buffer_queue))
> +			continue;
> +
>  		mutex_lock(&common->lock);
> -		if (atomic_read(&ch->usrs) && common->io_usrs) {
> -			/* Enable channel */
> -			if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
> -				enable_channel2(1);
> -				channel2_intr_enable(1);
> -			}
> -			if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
> -					ycmux_mode == 2) {
> -				enable_channel3(1);
> -				channel3_intr_enable(1);
> -			}
> +		/* Enable channel */
> +		if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
> +			enable_channel2(1);
> +			channel2_intr_enable(1);
> +		}
> +		if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
> +				ycmux_mode == 2) {
> +			enable_channel3(1);
> +			channel3_intr_enable(1);
>  		}
>  		mutex_unlock(&common->lock);
>  	}
> @@ -1431,21 +1433,15 @@ static int vpif_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops vpif_pm = {
> -	.suspend        = vpif_suspend,
> -	.resume         = vpif_resume,
> -};
> -
> -#define vpif_pm_ops (&vpif_pm)
> -#else
> -#define vpif_pm_ops NULL
>  #endif
>  
> +static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume);
> +
>  static __refdata struct platform_driver vpif_driver = {
>  	.driver	= {
>  			.name	= VPIF_DRIVER_NAME,
>  			.owner	= THIS_MODULE,
> -			.pm	= vpif_pm_ops,
> +			.pm	= &vpif_pm_ops,
>  	},
>  	.probe	= vpif_probe,
>  	.remove	= vpif_remove,
> diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
> index 089e860..18cba9a 100644
> --- a/drivers/media/platform/davinci/vpif_display.h
> +++ b/drivers/media/platform/davinci/vpif_display.h
> @@ -83,8 +83,6 @@ struct common_obj {
>  	/* channel specific parameters */
>  	struct mutex lock;			/* lock used to access this
>  						 * structure */
> -	u32 io_usrs;				/* number of users performing
> -						 * IO */
>  	u32 ytop_off;				/* offset of Y top from the
>  						 * starting of the buffer */
>  	u32 ybtm_off;				/* offset of Y bottom from the
> @@ -104,8 +102,6 @@ struct channel_obj {
>  	/* V4l2 specific parameters */
>  	struct video_device *video_dev;	/* Identifies video device for
>  					 * this channel */
> -	atomic_t usrs;			/* number of open instances of
> -					 * the channel */
>  	u32 field_id;			/* Indicates id of the field
>  					 * which is being displayed */
>  	u8 initialized;			/* flag to indicate whether
> 


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes
  2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
                   ` (51 preceding siblings ...)
  2014-05-23  8:30 ` [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Hans Verkuil
@ 2014-05-23  9:05 ` Hans Verkuil
  52 siblings, 0 replies; 60+ messages in thread
From: Hans Verkuil @ 2014-05-23  9:05 UTC (permalink / raw)
  To: Lad, Prabhakar, LMML, Hans Verkuil; +Cc: DLOS, LKML

On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> Hi,
> 
> This patch series upgrades the vpif capture & display
> driver with the all the helpers provided by v4l, this makes
> the driver much simpler and cleaner. This also includes few
> checkpatch issues.
> 
> Changes for v2:
> a> Added a copyright.
> b> Dropped buf_init() callback from vb2_ops.
> c> Fixed enabling & disabling of interrupts in case of HD formats.
> 
> Changes for v3:
> a> Fixed review comments pointed by Hans.
> 
> Changes for v4: Rebased the patches on media tree.
> 
> Changes for v5: Split up the patches
> 
> Following is the output of v4l-compliance for capture:
> ------------------------------------------------------
> 
> ./v4l2-compliance -d /dev/video0 -i 0 -s -v --expbuf-device=2
> 
> Driver Info:
>         Driver name   : vpif_capture
>         Card type     : DA850/OMAP-L138 Video Capture
>         Bus info      : platform:vpif_capture
>         Driver version: 3.15.0
>         Capabilities  : 0x84000001
>                 Video Capture
>                 Streaming
>                 Device Capabilities
>         Device Caps   : 0x04000001
>                 Video Capture
>                 Streaming
> 
> 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: 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_QUERYCTRL/MENU: 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 1 formats for buftype 1
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 fail: v4l2-test-formats.cpp(1003): cap->readbuffers

Just set readbuffers to 3, which is what queue_setup uses as well as the
minimum number of buffers.

>                 test VIDIOC_G/S_PARM: FAIL
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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
>         test read/write: OK (Not Supported)
>             Video Capture:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.509130s

This is strange: the sequence number is not updated for each field, but why doesn't
v4l2-compliance fail on that? If I hack vivi to always return sequence 0 the
compliance tool immediately fails on that.

Can you find out why v4l2-compliance doesn't fail here? The check happens in
v4l2-test-buffers.cpp, line 321.

>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.549125s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.589148s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.629106s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.669110s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.709102s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.749099s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.789128s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.829116s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.869105s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.909100s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.949098s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.989086s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.029083s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.069083s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.109074s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.149074s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.189100s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.229077s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.269078s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.309075s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.349070s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.389060s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.429052s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.469053s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.509047s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.549045s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.589072s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.629047s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.669051s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.709046s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.749043s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.789033s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.829023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.869025s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.909018s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.949029s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.989046s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.029021s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.069024s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.109019s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.149004s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.189006s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.228998s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.268996s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.308996s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.349004s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.389019s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.429000s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.468999s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.509004s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.548979s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.588982s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.628973s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.668976s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.708968s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.748979s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.788991s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.828972s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.868969s
>             Video Capture (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.908969s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.948952s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.988955s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.028946s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.068946s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.108954s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.148955s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.188973s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.228948s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.268943s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.308949s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.348928s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.388927s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.428918s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.468918s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.508923s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.548919s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.588946s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.628923s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.668917s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.708902s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.748899s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.788901s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.828895s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.868892s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.908897s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.948898s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.988920s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.028892s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.068893s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.108876s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.148873s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.188875s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.228867s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.268875s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.308870s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.348870s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.388870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.428891s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.468893s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.508849s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.548845s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.588849s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.628842s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.668855s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.708844s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.748846s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.788868s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.828842s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.868826s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.908823s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.948821s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.988821s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.028817s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.068824s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.108818s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 150.148818s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.188839s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.228808s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.268798s
>         test MMAP: OK
>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>         test USERPTR: FAIL
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.234735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.268098s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.301503s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.334846s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.368202s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.401594s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.434960s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.468320s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.501709s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.535041s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.568428s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.601811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.635146s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.668514s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.701913s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.735260s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.768617s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.802007s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.835367s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.868732s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.902120s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.935451s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.968837s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.002223s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.035566s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.068923s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.102327s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.135667s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.169023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.202423s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.235785s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.269146s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.302535s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.335862s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.369252s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.402637s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.435978s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.469335s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.502705s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.536087s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.569454s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.602817s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.636177s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.669557s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.702934s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.736280s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.769648s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.803053s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.836396s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.869753s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.903122s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.936499s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.969870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.003251s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.036591s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.069975s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.103363s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.136702s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.170112s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.203462s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.236804s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.270175s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.303533s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.336914s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.370269s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.403661s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.436999s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.470388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.503774s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.537117s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.570511s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.603874s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.637222s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.670603s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.703944s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.737326s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.770694s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.804083s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.837412s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.870809s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.904185s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.937526s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.970900s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.004285s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.037632s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.070993s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.104382s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.137735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.171104s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.204492s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.237822s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.271190s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.304596s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.337941s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.371310s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.404665s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.438046s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.471408s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.504794s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.538130s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.571517s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.604904s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.638234s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.671610s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.704984s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.738352s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.771725s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.805080s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.838459s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.871822s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.905165s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.938547s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.971931s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.005319s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.038649s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.072021s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.105420s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.138776s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.172136s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.205492s
>         test DMABUF: OK
> 
> Total: 41, Succeeded: 40, Failed: 1, Warnings: 0
> 
> Following is the output of v4l-compliance for display:
> ------------------------------------------------------
> 
> ./v4l2-compliance -d /dev/video2 -o 0 -s -v --expbuf-device=0 
> 
> Driver Info:
>         Driver name   : vpif_capture
>         Card type     : DA850/OMAP-L138 Video Capture
>         Bus info      : platform:vpif_capture
>         Driver version: 3.15.0
>         Capabilities  : 0x84000001
>                 Video Capture
>                 Streaming
>                 Device Capabilities
>         Device Caps   : 0x04000001
>                 Video Capture
>                 Streaming
> 
> Compliance test for device /dev/video2 (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: 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 (Not Supported)
>         test VIDIOC_G/S_AUDIO: OK (Not Supported)
>         Inputs: 0 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
>         test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>         Outputs: 2 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 output 0:
> 
>         Control ioctls:
>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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)
> 
> Test output 1:
> 
>         Control ioctls:
>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>                 test VIDIOC_G_FBUF: OK (Not Supported)
>                 test VIDIOC_G_FMT: OK
>                 test VIDIOC_TRY_FMT: OK
>                 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 Output
>         test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
>         test VIDIOC_EXPBUF: OK
>         test read/write: OK (Not Supported)
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.197959s

Same problem here: the sequence number is not updated, but v4l2-compliance doesn't
fail on that error.

Weird.

Regards,

	Hans

>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.231346s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.264708s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.298071s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.331432s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.364827s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.398174s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.431543s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.464898s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.498277s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.531648s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.565008s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.598379s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.631754s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.665121s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.698489s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.731843s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.765230s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.798587s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.831955s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.865314s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.898690s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.932065s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.965425s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.998793s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.032169s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.065534s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.098897s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.132256s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.165643s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.199000s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.232370s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.265725s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.299103s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.332478s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.365837s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.399207s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.432567s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.465951s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.499312s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.532670s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.566036s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.599414s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.632785s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.666143s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.699509s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.732891s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.766253s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.799620s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.832980s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.866362s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.899722s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.933083s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.966449s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.999826s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.033190s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.066552s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.099920s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.133306s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.166665s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.200056s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.233388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.266772s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.300162s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.333497s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.366859s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.400264s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.433608s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.466982s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.500359s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.533717s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.567082s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.600470s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.633800s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.667186s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.700572s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.733906s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.767270s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.800678s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.834022s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.867391s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.900772s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.934129s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.967494s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.000884s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.034215s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.067607s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.100983s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.134329s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.167684s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.201087s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.234435s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.267799s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.301192s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.334523s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.367906s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.401293s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.434627s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.467992s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.501374s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.534744s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.568099s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.601470s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.634852s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.668215s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.701605s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.734935s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.768322s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.801707s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.835041s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.868407s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.901811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.935166s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.968509s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.001907s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.035265s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.068628s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.102016s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.135349s
>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.168734s
>         test MMAP: OK
>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>         test USERPTR: FAIL
>             Video Output:
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.234735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.268098s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.301503s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.334846s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.368202s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.401594s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.434960s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.468320s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.501709s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.535041s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.568428s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.601811s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.635146s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.668514s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.701913s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.735260s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.768617s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.802007s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.835367s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.868732s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.902120s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.935451s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.968837s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.002223s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.035566s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.068923s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.102327s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.135667s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.169023s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.202423s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.235785s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.269146s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.302535s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.335862s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.369252s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.402637s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.435978s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.469335s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.502705s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.536087s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.569454s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.602817s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.636177s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.669557s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.702934s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.736280s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.769648s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.803053s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.836396s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.869753s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.903122s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.936499s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.969870s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.003251s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.036591s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.069975s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.103363s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.136702s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.170112s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.203462s
>             Video Output (polling):
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.236804s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.270175s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.303533s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.336914s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.370269s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.403661s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.436999s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.470388s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.503774s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.537117s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.570511s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.603874s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.637222s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.670603s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.703944s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.737326s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.770694s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.804083s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.837412s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.870809s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.904185s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.937526s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.970900s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.004285s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.037632s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.070993s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.104382s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.137735s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.171104s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.204492s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.237822s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.271190s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.304596s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.337941s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.371310s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.404665s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.438046s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.471408s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.504794s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.538130s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.571517s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.604904s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.638234s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.671610s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.704984s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.738352s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.771725s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.805080s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.838459s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.871822s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.905207s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.938547s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.971931s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.005319s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.038649s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.072021s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.105420s
>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.138776s
>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.172136s
>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.205492s
>         test DMABUF: OK
> 
> Total: 57, Succeeded: 56, Failed: 1, Warnings: 0
> 
> 
> 
> Lad, Prabhakar (49):
>   media: davinci: vpif_display: initialize vb2 queue and DMA context
>     during probe
>   media: davinci: vpif_display: drop buf_init() callback
>   media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper
>     functions
>   media: davinci: vpif_display: release buffers in case
>     start_streaming() call back fails
>   media: davinci: vpif_display: drop buf_cleanup() callback
>   media: davinci: vpif_display: improve vpif_buffer_prepare() callback
>   media: davinci: vpif_display: improve vpif_buffer_queue_setup()
>     function
>   media: davinci: vpif_display: improve start/stop_streaming callbacks
>   media: davinci: vpif_display: use vb2_fop_mmap/poll
>   media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
>   media: davinci: vpif_display: use vb2_ioctl_* helpers
>   media: davinci: vpif_display: drop unused member fbuffers
>   media: davinci: vpif_display: drop reserving memory for device
>   media: davinci: vpif_display: drop unnecessary field memory
>   media: davinci: vpif_display: drop numbuffers field from common_obj
>   media: davinic: vpif_display: drop started member from struct
>     common_obj
>   media: davinci: vpif_display: initialize the video device in single
>     place
>   media: davinci: vpif_display: drop unneeded module params
>   media: davinci: vpif_display: drop cropcap
>   media: davinci: vpif_display: group v4l2_ioctl_ops
>   media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
>   media: davinci: vpif_display: return -ENODATA for *dv_timings calls
>   media: davinci: vpif_display: return -ENODATA for *std calls
>   media: davinci; vpif_display: fix checkpatch error
>   media: davinci: vpif_display: fix v4l-complinace issues
>   media: davinci: vpif_capture: initalize vb2 queue and DMA context
>     during probe
>   media: davinci: vpif_capture: drop buf_init() callback
>   media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
>     functions
>   media: davinci: vpif_capture: release buffers in case
>     start_streaming() call back fails
>   media: davinci: vpif_capture: drop buf_cleanup() callback
>   media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
>   media: davinci: vpif_capture: improve vpif_buffer_queue_setup()
>     function
>   media: davinci: vpif_capture: improve start/stop_streaming callbacks
>   media: davinci: vpif_capture: use vb2_fop_mmap/poll
>   media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
>   media: davinci: vpif_capture: use vb2_ioctl_* helpers
>   media: davinci: vpif_capture: drop reserving memory for device
>   media: davinci: vpif_capture: drop unnecessary field memory
>   media: davinic: vpif_capture: drop started member from struct
>     common_obj
>   media: davinci: vpif_capture: initialize the video device in single
>     place
>   media: davinci: vpif_capture: drop unneeded module params
>   media: davinci: vpif_capture: drop cropcap
>   media: davinci: vpif_capture: group v4l2_ioctl_ops
>   media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
>   media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
>   media: davinci: vpif_capture: return -ENODATA for *std calls
>   media: davinci: vpif_capture: drop check __KERNEL__
>   media: davinci: vpif_capture: fix v4l-complinace issues
>   media: davinci: vpif: add Copyright message
> 
>  drivers/media/platform/davinci/vpif_capture.c | 1420 +++++++------------------
>  drivers/media/platform/davinci/vpif_capture.h |   39 -
>  drivers/media/platform/davinci/vpif_display.c | 1196 ++++++---------------
>  drivers/media/platform/davinci/vpif_display.h |   44 +-
>  4 files changed, 746 insertions(+), 1953 deletions(-)
> 


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params
  2014-05-16 13:33 ` [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params Lad, Prabhakar
@ 2014-05-23 22:38   ` Mauro Carvalho Chehab
  2014-05-24  4:27     ` Prabhakar Lad
  0 siblings, 1 reply; 60+ messages in thread
From: Mauro Carvalho Chehab @ 2014-05-23 22:38 UTC (permalink / raw)
  To: Lad, Prabhakar; +Cc: LMML, Hans Verkuil, DLOS, LKML

Em Fri, 16 May 2014 19:03:47 +0530
"Lad, Prabhakar" <prabhakar.csengg@gmail.com> escreveu:

> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

-ENOPATCHDESCRIPTION!!!!

Why to remove those parameters? Please _ALWAYS_ describe your patches.

My crystal ball is malfunctioning today, so I was unable to scry the
reasons for this patch.

Thanks,
Mauro

> ---
>  drivers/media/platform/davinci/vpif_capture.c |   54 +------------------------
>  drivers/media/platform/davinci/vpif_capture.h |   11 -----
>  2 files changed, 1 insertion(+), 64 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
> index d452eaf..e967cf7 100644
> --- a/drivers/media/platform/davinci/vpif_capture.c
> +++ b/drivers/media/platform/davinci/vpif_capture.c
> @@ -38,32 +38,10 @@ MODULE_VERSION(VPIF_CAPTURE_VERSION);
>  		v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
>  
>  static int debug = 1;
> -static u32 ch0_numbuffers = 3;
> -static u32 ch1_numbuffers = 3;
> -static u32 ch0_bufsize = 1920 * 1080 * 2;
> -static u32 ch1_bufsize = 720 * 576 * 2;
>  
>  module_param(debug, int, 0644);
> -module_param(ch0_numbuffers, uint, S_IRUGO);
> -module_param(ch1_numbuffers, uint, S_IRUGO);
> -module_param(ch0_bufsize, uint, S_IRUGO);
> -module_param(ch1_bufsize, uint, S_IRUGO);
>  
>  MODULE_PARM_DESC(debug, "Debug level 0-1");
> -MODULE_PARM_DESC(ch2_numbuffers, "Channel0 buffer count (default:3)");
> -MODULE_PARM_DESC(ch3_numbuffers, "Channel1 buffer count (default:3)");
> -MODULE_PARM_DESC(ch2_bufsize, "Channel0 buffer size (default:1920 x 1080 x 2)");
> -MODULE_PARM_DESC(ch3_bufsize, "Channel1 buffer size (default:720 x 576 x 2)");
> -
> -static struct vpif_config_params config_params = {
> -	.min_numbuffers = 3,
> -	.numbuffers[0] = 3,
> -	.numbuffers[1] = 3,
> -	.min_bufsize[0] = 720 * 480 * 2,
> -	.min_bufsize[1] = 720 * 480 * 2,
> -	.channel_bufsize[0] = 1920 * 1080 * 2,
> -	.channel_bufsize[1] = 720 * 576 * 2,
> -};
>  
>  #define VPIF_DRIVER_NAME	"vpif_capture"
>  
> @@ -609,9 +587,6 @@ static void vpif_config_format(struct channel_obj *ch)
>  	vpif_dbg(2, debug, "vpif_config_format\n");
>  
>  	common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
> -	common->fmt.fmt.pix.sizeimage
> -	    = config_params.channel_bufsize[ch->channel_id];
> -
>  	if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
>  		common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
>  	else
> @@ -1358,36 +1333,9 @@ static struct v4l2_file_operations vpif_fops = {
>   */
>  static int initialize_vpif(void)
>  {
> -	int err = 0, i, j;
> +	int err, i, j;
>  	int free_channel_objects_index;
>  
> -	/* Default number of buffers should be 3 */
> -	if ((ch0_numbuffers > 0) &&
> -	    (ch0_numbuffers < config_params.min_numbuffers))
> -		ch0_numbuffers = config_params.min_numbuffers;
> -	if ((ch1_numbuffers > 0) &&
> -	    (ch1_numbuffers < config_params.min_numbuffers))
> -		ch1_numbuffers = config_params.min_numbuffers;
> -
> -	/* Set buffer size to min buffers size if it is invalid */
> -	if (ch0_bufsize < config_params.min_bufsize[VPIF_CHANNEL0_VIDEO])
> -		ch0_bufsize =
> -		    config_params.min_bufsize[VPIF_CHANNEL0_VIDEO];
> -	if (ch1_bufsize < config_params.min_bufsize[VPIF_CHANNEL1_VIDEO])
> -		ch1_bufsize =
> -		    config_params.min_bufsize[VPIF_CHANNEL1_VIDEO];
> -
> -	config_params.numbuffers[VPIF_CHANNEL0_VIDEO] = ch0_numbuffers;
> -	config_params.numbuffers[VPIF_CHANNEL1_VIDEO] = ch1_numbuffers;
> -	if (ch0_numbuffers) {
> -		config_params.channel_bufsize[VPIF_CHANNEL0_VIDEO]
> -		    = ch0_bufsize;
> -	}
> -	if (ch1_numbuffers) {
> -		config_params.channel_bufsize[VPIF_CHANNEL1_VIDEO]
> -		    = ch1_bufsize;
> -	}
> -
>  	/* Allocate memory for six channel objects */
>  	for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
>  		vpif_obj.dev[i] =
> diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
> index 4960504..537076a 100644
> --- a/drivers/media/platform/davinci/vpif_capture.h
> +++ b/drivers/media/platform/davinci/vpif_capture.h
> @@ -125,16 +125,5 @@ struct vpif_device {
>  	struct vpif_capture_config *config;
>  };
>  
> -struct vpif_config_params {
> -	u8 min_numbuffers;
> -	u8 numbuffers[VPIF_CAPTURE_NUM_CHANNELS];
> -	s8 device_type;
> -	u32 min_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
> -	u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
> -	u8 default_device[VPIF_CAPTURE_NUM_CHANNELS];
> -	u32 video_limit[VPIF_CAPTURE_NUM_CHANNELS];
> -	u8 max_device_type;
> -};
> -
>  #endif				/* End of __KERNEL__ */
>  #endif				/* VPIF_CAPTURE_H */

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails
  2014-05-23  8:35   ` Hans Verkuil
@ 2014-05-24  4:02     ` Prabhakar Lad
  0 siblings, 0 replies; 60+ messages in thread
From: Prabhakar Lad @ 2014-05-24  4:02 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: LMML, Hans Verkuil, DLOS, LKML

Hi Hans,

Thanks for the review.

On Fri, May 23, 2014 at 2:05 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>
>> this patch adds support to release the buffer by calling
>> vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
>> if start_streaming() call back fails.
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>> ---
>>  drivers/media/platform/davinci/vpif_display.c |   42 +++++++++++++++----------
>>  1 file changed, 26 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
>> index 8bb9f02..1a17a45 100644
>> --- a/drivers/media/platform/davinci/vpif_display.c
>> +++ b/drivers/media/platform/davinci/vpif_display.c
>> @@ -196,26 +196,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>>       struct channel_obj *ch = vb2_get_drv_priv(vq);
>>       struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
>>       struct vpif_params *vpif = &ch->vpifparams;
>> -     unsigned long addr = 0;
>> -     unsigned long flags;
>> +     struct vpif_disp_buffer *buf, *tmp;
>> +     unsigned long addr, flags;
>>       int ret;
>>
>>       spin_lock_irqsave(&common->irqlock, flags);
>>
>> -     /* Get the next frame from the buffer queue */
>> -     common->next_frm = common->cur_frm =
>> -                         list_entry(common->dma_queue.next,
>> -                                    struct vpif_disp_buffer, list);
>> -
>> -     list_del(&common->cur_frm->list);
>> -     spin_unlock_irqrestore(&common->irqlock, flags);
>> -     /* Mark state of the current frame to active */
>> -     common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
>> -
>>       /* Initialize field_id and started member */
>>       ch->field_id = 0;
>>       common->started = 1;
>> -     addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
>> +
>>       /* Calculate the offset for Y and C data  in the buffer */
>>       vpif_calculate_offsets(ch);
>>
>> @@ -225,7 +215,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>>               || (!ch->vpifparams.std_info.frm_fmt
>>               && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
>>               vpif_err("conflict in field format and std format\n");
>> -             return -EINVAL;
>> +             ret = -EINVAL;
>> +             goto err;
>>       }
>>
>>       /* clock settings */
>> @@ -234,17 +225,28 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
>>               ycmux_mode, ch->vpifparams.std_info.hd_sd);
>>               if (ret < 0) {
>>                       vpif_err("can't set clock\n");
>> -                     return ret;
>> +                     goto err;
>>               }
>>       }
>>
>>       /* set the parameters and addresses */
>>       ret = vpif_set_video_params(vpif, ch->channel_id + 2);
>>       if (ret < 0)
>> -             return ret;
>> +             goto err;
>>
>>       common->started = ret;
>>       vpif_config_addr(ch, ret);
>> +     /* Get the next frame from the buffer queue */
>> +     common->next_frm = common->cur_frm =
>> +                         list_entry(common->dma_queue.next,
>> +                                    struct vpif_disp_buffer, list);
>> +
>> +     list_del(&common->cur_frm->list);
>> +     spin_unlock_irqrestore(&common->irqlock, flags);
>> +     /* Mark state of the current frame to active */
>> +     common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
>
> There is no need to set this, all buffers queued to the driver are always in state
> ACTIVE. The vb2 core sets that for you. In general drivers never need to change the
> state manually.
>
> It happens twice in this driver and in both cases the assignment can be removed.
>
OK, will drop this.

Regards,
--Prabhakar Lad

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes
  2014-05-23  8:30 ` [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Hans Verkuil
@ 2014-05-24  4:09   ` Prabhakar Lad
  0 siblings, 0 replies; 60+ messages in thread
From: Prabhakar Lad @ 2014-05-24  4:09 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: LMML, Hans Verkuil, DLOS, LKML

Hi Hans,

Thanks for the review from 2 patches to 50 :)

On Fri, May 23, 2014 at 2:00 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> Hi Prabhakar,
>
> Thanks for this patch series, it looks good to me and I'll make a pull
> request for this.
>
Thanks.

> I did find a few issues, but they are all pre-existing problems, so they
> can be fixed in follow-up patches.
>
> I'll comment on those in the relevant patches. Since display and capture are
> so similar I will only comment on the display patches, but it's valid for
> both.
>
Ok will fix them up soon I am relocating next week so will take me at-least
2-3 weeks for me to get back the boards and get in action.

Regards,
--Prabhakar Lad

> Regards,
>
>         Hans
>
> On 05/16/2014 03:33 PM, Lad, Prabhakar wrote:
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>
>> Hi,
>>
>> This patch series upgrades the vpif capture & display
>> driver with the all the helpers provided by v4l, this makes
>> the driver much simpler and cleaner. This also includes few
>> checkpatch issues.
>>
>> Changes for v2:
>> a> Added a copyright.
>> b> Dropped buf_init() callback from vb2_ops.
>> c> Fixed enabling & disabling of interrupts in case of HD formats.
>>
>> Changes for v3:
>> a> Fixed review comments pointed by Hans.
>>
>> Changes for v4: Rebased the patches on media tree.
>>
>> Changes for v5: Split up the patches
>>
>> Following is the output of v4l-compliance for capture:
>> ------------------------------------------------------
>>
>> ./v4l2-compliance -d /dev/video0 -i 0 -s -v --expbuf-device=2
>>
>> Driver Info:
>>         Driver name   : vpif_capture
>>         Card type     : DA850/OMAP-L138 Video Capture
>>         Bus info      : platform:vpif_capture
>>         Driver version: 3.15.0
>>         Capabilities  : 0x84000001
>>                 Video Capture
>>                 Streaming
>>                 Device Capabilities
>>         Device Caps   : 0x04000001
>>                 Video Capture
>>                 Streaming
>>
>> 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: 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_QUERYCTRL/MENU: 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 1 formats for buftype 1
>>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>>                 fail: v4l2-test-formats.cpp(1003): cap->readbuffers
>>                 test VIDIOC_G/S_PARM: FAIL
>>                 test VIDIOC_G_FBUF: OK (Not Supported)
>>                 test VIDIOC_G_FMT: OK
>>                 test VIDIOC_TRY_FMT: OK
>>                 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
>>         test read/write: OK (Not Supported)
>>             Video Capture:
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.509130s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.549125s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.589148s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.629106s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.669110s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.709102s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.749099s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.789128s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.829116s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.869105s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.909100s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.949098s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.989086s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.029083s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.069083s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.109074s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.149074s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.189100s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.229077s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.269078s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.309075s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.349070s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.389060s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.429052s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.469053s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.509047s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.549045s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.589072s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.629047s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.669051s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.709046s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.749043s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.789033s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.829023s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.869025s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.909018s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.949029s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.989046s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.029021s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.069024s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.109019s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.149004s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.189006s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.228998s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.268996s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.308996s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.349004s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.389019s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.429000s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.468999s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.509004s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.548979s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.588982s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.628973s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.668976s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.708968s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.748979s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.788991s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.828972s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.868969s
>>             Video Capture (polling):
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.908969s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.948952s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.988955s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.028946s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.068946s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.108954s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.148955s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.188973s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.228948s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.268943s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.308949s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.348928s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.388927s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.428918s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.468918s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.508923s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.548919s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.588946s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.628923s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.668917s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.708902s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.748899s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.788901s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.828895s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.868892s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.908897s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.948898s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.988920s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.028892s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.068893s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.108876s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.148873s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.188875s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.228867s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.268875s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.308870s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.348870s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.388870s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.428891s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.468893s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.508849s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.548845s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.588849s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.628842s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.668855s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.708844s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.748846s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.788868s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.828842s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.868826s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.908823s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.948821s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.988821s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.028817s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.068824s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.108818s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 150.148818s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.188839s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.228808s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.268798s
>>         test MMAP: OK
>>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>>         test USERPTR: FAIL
>>             Video Output:
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.234735s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.268098s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.301503s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.334846s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.368202s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.401594s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.434960s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.468320s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.501709s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.535041s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.568428s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.601811s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.635146s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.668514s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.701913s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.735260s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.768617s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.802007s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.835367s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.868732s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.902120s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.935451s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.968837s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.002223s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.035566s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.068923s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.102327s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.135667s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.169023s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.202423s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.235785s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.269146s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.302535s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.335862s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.369252s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.402637s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.435978s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.469335s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.502705s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.536087s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.569454s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.602817s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.636177s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.669557s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.702934s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.736280s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.769648s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.803053s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.836396s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.869753s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.903122s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.936499s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.969870s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.003251s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.036591s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.069975s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.103363s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.136702s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.170112s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.203462s
>>             Video Output (polling):
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.236804s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.270175s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.303533s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.336914s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.370269s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.403661s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.436999s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.470388s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.503774s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.537117s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.570511s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.603874s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.637222s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.670603s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.703944s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.737326s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.770694s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.804083s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.837412s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.870809s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.904185s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.937526s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.970900s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.004285s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.037632s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.070993s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.104382s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.137735s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.171104s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.204492s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.237822s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.271190s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.304596s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.337941s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.371310s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.404665s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.438046s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.471408s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.504794s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.538130s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.571517s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.604904s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.638234s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.671610s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.704984s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.738352s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.771725s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.805080s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.838459s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.871822s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.905165s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.938547s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.971931s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.005319s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.038649s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.072021s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.105420s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.138776s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.172136s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.205492s
>>         test DMABUF: OK
>>
>> Total: 41, Succeeded: 40, Failed: 1, Warnings: 0
>>
>> Following is the output of v4l-compliance for display:
>> ------------------------------------------------------
>>
>> ./v4l2-compliance -d /dev/video2 -o 0 -s -v --expbuf-device=0
>>
>> Driver Info:
>>         Driver name   : vpif_capture
>>         Card type     : DA850/OMAP-L138 Video Capture
>>         Bus info      : platform:vpif_capture
>>         Driver version: 3.15.0
>>         Capabilities  : 0x84000001
>>                 Video Capture
>>                 Streaming
>>                 Device Capabilities
>>         Device Caps   : 0x04000001
>>                 Video Capture
>>                 Streaming
>>
>> Compliance test for device /dev/video2 (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: 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 (Not Supported)
>>         test VIDIOC_G/S_AUDIO: OK (Not Supported)
>>         Inputs: 0 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
>>         test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>>         Outputs: 2 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 output 0:
>>
>>         Control ioctls:
>>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>>                 test VIDIOC_G_FBUF: OK (Not Supported)
>>                 test VIDIOC_G_FMT: OK
>>                 test VIDIOC_TRY_FMT: OK
>>                 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)
>>
>> Test output 1:
>>
>>         Control ioctls:
>>                 test VIDIOC_QUERYCTRL/MENU: 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 1 formats for buftype 2
>>                 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>>                 test VIDIOC_G/S_PARM: OK (Not Supported)
>>                 test VIDIOC_G_FBUF: OK (Not Supported)
>>                 test VIDIOC_G_FMT: OK
>>                 test VIDIOC_TRY_FMT: OK
>>                 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 Output
>>         test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
>>         test VIDIOC_EXPBUF: OK
>>         test read/write: OK (Not Supported)
>>             Video Output:
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.197959s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.231346s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.264708s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.298071s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.331432s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.364827s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.398174s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.431543s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.464898s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.498277s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.531648s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.565008s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.598379s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.631754s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.665121s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.698489s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.731843s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.765230s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.798587s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.831955s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.865314s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.898690s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.932065s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.965425s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.998793s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.032169s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.065534s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.098897s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.132256s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.165643s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.199000s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.232370s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.265725s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.299103s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.332478s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.365837s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.399207s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.432567s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.465951s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.499312s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.532670s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.566036s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.599414s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.632785s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.666143s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.699509s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.732891s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.766253s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.799620s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.832980s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.866362s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.899722s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.933083s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.966449s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.999826s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.033190s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.066552s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.099920s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.133306s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.166665s
>>             Video Output (polling):
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.200056s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.233388s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.266772s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.300162s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.333497s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.366859s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.400264s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.433608s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.466982s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.500359s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.533717s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.567082s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.600470s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.633800s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.667186s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.700572s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.733906s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.767270s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.800678s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.834022s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.867391s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.900772s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.934129s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.967494s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.000884s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.034215s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.067607s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.100983s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.134329s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.167684s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.201087s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.234435s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.267799s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.301192s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.334523s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.367906s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.401293s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.434627s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.467992s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.501374s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.534744s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.568099s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.601470s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.634852s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.668215s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.701605s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.734935s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.768322s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.801707s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.835041s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.868407s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.901811s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.935166s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.968509s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.001907s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.035265s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.068628s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.102016s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.135349s
>>                 Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.168734s
>>         test MMAP: OK
>>                 fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
>>                 fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
>>         test USERPTR: FAIL
>>             Video Output:
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.234735s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.268098s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.301503s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.334846s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.368202s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.401594s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.434960s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.468320s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.501709s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.535041s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.568428s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.601811s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.635146s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.668514s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.701913s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.735260s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.768617s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.802007s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.835367s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.868732s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.902120s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.935451s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.968837s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.002223s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.035566s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.068923s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.102327s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.135667s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.169023s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.202423s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.235785s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.269146s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.302535s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.335862s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.369252s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.402637s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.435978s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.469335s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.502705s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.536087s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.569454s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.602817s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.636177s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.669557s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.702934s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.736280s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.769648s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.803053s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.836396s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.869753s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.903122s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.936499s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.969870s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.003251s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.036591s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.069975s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.103363s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.136702s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.170112s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.203462s
>>             Video Output (polling):
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.236804s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.270175s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.303533s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.336914s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.370269s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.403661s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.436999s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.470388s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.503774s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.537117s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.570511s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.603874s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.637222s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.670603s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.703944s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.737326s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.770694s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.804083s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.837412s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.870809s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.904185s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.937526s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.970900s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.004285s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.037632s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.070993s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.104382s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.137735s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.171104s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.204492s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.237822s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.271190s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.304596s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.337941s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.371310s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.404665s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.438046s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.471408s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.504794s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.538130s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.571517s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.604904s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.638234s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.671610s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.704984s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.738352s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.771725s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.805080s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.838459s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.871822s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.905207s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.938547s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.971931s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.005319s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.038649s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.072021s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.105420s
>>                 Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.138776s
>>                 Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.172136s
>>                 Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.205492s
>>         test DMABUF: OK
>>
>> Total: 57, Succeeded: 56, Failed: 1, Warnings: 0
>>
>>
>>
>> Lad, Prabhakar (49):
>>   media: davinci: vpif_display: initialize vb2 queue and DMA context
>>     during probe
>>   media: davinci: vpif_display: drop buf_init() callback
>>   media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper
>>     functions
>>   media: davinci: vpif_display: release buffers in case
>>     start_streaming() call back fails
>>   media: davinci: vpif_display: drop buf_cleanup() callback
>>   media: davinci: vpif_display: improve vpif_buffer_prepare() callback
>>   media: davinci: vpif_display: improve vpif_buffer_queue_setup()
>>     function
>>   media: davinci: vpif_display: improve start/stop_streaming callbacks
>>   media: davinci: vpif_display: use vb2_fop_mmap/poll
>>   media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
>>   media: davinci: vpif_display: use vb2_ioctl_* helpers
>>   media: davinci: vpif_display: drop unused member fbuffers
>>   media: davinci: vpif_display: drop reserving memory for device
>>   media: davinci: vpif_display: drop unnecessary field memory
>>   media: davinci: vpif_display: drop numbuffers field from common_obj
>>   media: davinic: vpif_display: drop started member from struct
>>     common_obj
>>   media: davinci: vpif_display: initialize the video device in single
>>     place
>>   media: davinci: vpif_display: drop unneeded module params
>>   media: davinci: vpif_display: drop cropcap
>>   media: davinci: vpif_display: group v4l2_ioctl_ops
>>   media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
>>   media: davinci: vpif_display: return -ENODATA for *dv_timings calls
>>   media: davinci: vpif_display: return -ENODATA for *std calls
>>   media: davinci; vpif_display: fix checkpatch error
>>   media: davinci: vpif_display: fix v4l-complinace issues
>>   media: davinci: vpif_capture: initalize vb2 queue and DMA context
>>     during probe
>>   media: davinci: vpif_capture: drop buf_init() callback
>>   media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
>>     functions
>>   media: davinci: vpif_capture: release buffers in case
>>     start_streaming() call back fails
>>   media: davinci: vpif_capture: drop buf_cleanup() callback
>>   media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
>>   media: davinci: vpif_capture: improve vpif_buffer_queue_setup()
>>     function
>>   media: davinci: vpif_capture: improve start/stop_streaming callbacks
>>   media: davinci: vpif_capture: use vb2_fop_mmap/poll
>>   media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
>>   media: davinci: vpif_capture: use vb2_ioctl_* helpers
>>   media: davinci: vpif_capture: drop reserving memory for device
>>   media: davinci: vpif_capture: drop unnecessary field memory
>>   media: davinic: vpif_capture: drop started member from struct
>>     common_obj
>>   media: davinci: vpif_capture: initialize the video device in single
>>     place
>>   media: davinci: vpif_capture: drop unneeded module params
>>   media: davinci: vpif_capture: drop cropcap
>>   media: davinci: vpif_capture: group v4l2_ioctl_ops
>>   media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
>>   media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
>>   media: davinci: vpif_capture: return -ENODATA for *std calls
>>   media: davinci: vpif_capture: drop check __KERNEL__
>>   media: davinci: vpif_capture: fix v4l-complinace issues
>>   media: davinci: vpif: add Copyright message
>>
>>  drivers/media/platform/davinci/vpif_capture.c | 1420 +++++++------------------
>>  drivers/media/platform/davinci/vpif_capture.h |   39 -
>>  drivers/media/platform/davinci/vpif_display.c | 1196 ++++++---------------
>>  drivers/media/platform/davinci/vpif_display.h |   44 +-
>>  4 files changed, 746 insertions(+), 1953 deletions(-)
>>
>

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params
  2014-05-23 22:38   ` Mauro Carvalho Chehab
@ 2014-05-24  4:27     ` Prabhakar Lad
  0 siblings, 0 replies; 60+ messages in thread
From: Prabhakar Lad @ 2014-05-24  4:27 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: LMML, Hans Verkuil, DLOS, LKML

Hi Mauro,

On Sat, May 24, 2014 at 4:08 AM, Mauro Carvalho Chehab
<m.chehab@samsung.com> wrote:
> Em Fri, 16 May 2014 19:03:47 +0530
> "Lad, Prabhakar" <prabhakar.csengg@gmail.com> escreveu:
>
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>
> -ENOPATCHDESCRIPTION!!!!
>
> Why to remove those parameters? Please _ALWAYS_ describe your patches.
>
My bad! will take care next time.

Thanks,
--Prabhakar Lad

> My crystal ball is malfunctioning today, so I was unable to scry the
> reasons for this patch.
>
> Thanks,
> Mauro
>
>> ---
>>  drivers/media/platform/davinci/vpif_capture.c |   54 +------------------------
>>  drivers/media/platform/davinci/vpif_capture.h |   11 -----
>>  2 files changed, 1 insertion(+), 64 deletions(-)
>>
>> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
>> index d452eaf..e967cf7 100644
>> --- a/drivers/media/platform/davinci/vpif_capture.c
>> +++ b/drivers/media/platform/davinci/vpif_capture.c
>> @@ -38,32 +38,10 @@ MODULE_VERSION(VPIF_CAPTURE_VERSION);
>>               v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
>>
>>  static int debug = 1;
>> -static u32 ch0_numbuffers = 3;
>> -static u32 ch1_numbuffers = 3;
>> -static u32 ch0_bufsize = 1920 * 1080 * 2;
>> -static u32 ch1_bufsize = 720 * 576 * 2;
>>
>>  module_param(debug, int, 0644);
>> -module_param(ch0_numbuffers, uint, S_IRUGO);
>> -module_param(ch1_numbuffers, uint, S_IRUGO);
>> -module_param(ch0_bufsize, uint, S_IRUGO);
>> -module_param(ch1_bufsize, uint, S_IRUGO);
>>
>>  MODULE_PARM_DESC(debug, "Debug level 0-1");
>> -MODULE_PARM_DESC(ch2_numbuffers, "Channel0 buffer count (default:3)");
>> -MODULE_PARM_DESC(ch3_numbuffers, "Channel1 buffer count (default:3)");
>> -MODULE_PARM_DESC(ch2_bufsize, "Channel0 buffer size (default:1920 x 1080 x 2)");
>> -MODULE_PARM_DESC(ch3_bufsize, "Channel1 buffer size (default:720 x 576 x 2)");
>> -
>> -static struct vpif_config_params config_params = {
>> -     .min_numbuffers = 3,
>> -     .numbuffers[0] = 3,
>> -     .numbuffers[1] = 3,
>> -     .min_bufsize[0] = 720 * 480 * 2,
>> -     .min_bufsize[1] = 720 * 480 * 2,
>> -     .channel_bufsize[0] = 1920 * 1080 * 2,
>> -     .channel_bufsize[1] = 720 * 576 * 2,
>> -};
>>
>>  #define VPIF_DRIVER_NAME     "vpif_capture"
>>
>> @@ -609,9 +587,6 @@ static void vpif_config_format(struct channel_obj *ch)
>>       vpif_dbg(2, debug, "vpif_config_format\n");
>>
>>       common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
>> -     common->fmt.fmt.pix.sizeimage
>> -         = config_params.channel_bufsize[ch->channel_id];
>> -
>>       if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
>>               common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
>>       else
>> @@ -1358,36 +1333,9 @@ static struct v4l2_file_operations vpif_fops = {
>>   */
>>  static int initialize_vpif(void)
>>  {
>> -     int err = 0, i, j;
>> +     int err, i, j;
>>       int free_channel_objects_index;
>>
>> -     /* Default number of buffers should be 3 */
>> -     if ((ch0_numbuffers > 0) &&
>> -         (ch0_numbuffers < config_params.min_numbuffers))
>> -             ch0_numbuffers = config_params.min_numbuffers;
>> -     if ((ch1_numbuffers > 0) &&
>> -         (ch1_numbuffers < config_params.min_numbuffers))
>> -             ch1_numbuffers = config_params.min_numbuffers;
>> -
>> -     /* Set buffer size to min buffers size if it is invalid */
>> -     if (ch0_bufsize < config_params.min_bufsize[VPIF_CHANNEL0_VIDEO])
>> -             ch0_bufsize =
>> -                 config_params.min_bufsize[VPIF_CHANNEL0_VIDEO];
>> -     if (ch1_bufsize < config_params.min_bufsize[VPIF_CHANNEL1_VIDEO])
>> -             ch1_bufsize =
>> -                 config_params.min_bufsize[VPIF_CHANNEL1_VIDEO];
>> -
>> -     config_params.numbuffers[VPIF_CHANNEL0_VIDEO] = ch0_numbuffers;
>> -     config_params.numbuffers[VPIF_CHANNEL1_VIDEO] = ch1_numbuffers;
>> -     if (ch0_numbuffers) {
>> -             config_params.channel_bufsize[VPIF_CHANNEL0_VIDEO]
>> -                 = ch0_bufsize;
>> -     }
>> -     if (ch1_numbuffers) {
>> -             config_params.channel_bufsize[VPIF_CHANNEL1_VIDEO]
>> -                 = ch1_bufsize;
>> -     }
>> -
>>       /* Allocate memory for six channel objects */
>>       for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
>>               vpif_obj.dev[i] =
>> diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
>> index 4960504..537076a 100644
>> --- a/drivers/media/platform/davinci/vpif_capture.h
>> +++ b/drivers/media/platform/davinci/vpif_capture.h
>> @@ -125,16 +125,5 @@ struct vpif_device {
>>       struct vpif_capture_config *config;
>>  };
>>
>> -struct vpif_config_params {
>> -     u8 min_numbuffers;
>> -     u8 numbuffers[VPIF_CAPTURE_NUM_CHANNELS];
>> -     s8 device_type;
>> -     u32 min_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
>> -     u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
>> -     u8 default_device[VPIF_CAPTURE_NUM_CHANNELS];
>> -     u32 video_limit[VPIF_CAPTURE_NUM_CHANNELS];
>> -     u8 max_device_type;
>> -};
>> -
>>  #endif                               /* End of __KERNEL__ */
>>  #endif                               /* VPIF_CAPTURE_H */

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2014-05-24  4:27 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initialize " Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails Lad, Prabhakar
2014-05-23  8:35   ` Hans Verkuil
2014-05-24  4:02     ` Prabhakar Lad
2014-05-16 13:33 ` [PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 19/49] media: davinci: vpif_display: drop cropcap Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 20/49] media: davinci: vpif_display: group v4l2_ioctl_ops Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
2014-05-23  8:48   ` Hans Verkuil
2014-05-16 13:33 ` [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 23/49] media: davinci: vpif_display: return -ENODATA for *std calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 24/49] media: davinci; vpif_display: fix checkpatch error Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 25/49] media: davinci: vpif_display: fix v4l-complinace issues Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 26/49] media: davinci: vpif_capture: initalize vb2 queue and DMA context during probe Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 27/49] media: davinci: vpif_capture: drop buf_init() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_display: " Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 29/49] media: davinci: vpif_capture: release buffers in case start_streaming() call back fails Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 30/49] media: davinci: vpif_capture: drop buf_cleanup() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 31/49] media: davinci: vpif_capture: improve vpif_buffer_prepare() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 32/49] media: davinci: vpif_capture: improve vpif_buffer_queue_setup() function Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 35/49] media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 36/49] media: davinci: vpif_capture: use vb2_ioctl_* helpers Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 37/49] media: davinci: vpif_capture: drop reserving memory for device Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 38/49] media: davinci: vpif_capture: drop unnecessary field memory Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params Lad, Prabhakar
2014-05-23 22:38   ` Mauro Carvalho Chehab
2014-05-24  4:27     ` Prabhakar Lad
2014-05-16 13:33 ` [PATCH v5 42/49] media: davinci: vpif_capture: drop cropcap Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 43/49] media: davinci: vpif_capture: group v4l2_ioctl_ops Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 44/49] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 45/49] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 47/49] media: davinci: vpif_capture: drop check __KERNEL__ Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 48/49] media: davinci: vpif_capture: fix v4l-complinace issues Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 49/49] media: davinci: vpif: add Copyright message Lad, Prabhakar
2014-05-23  8:30 ` [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Hans Verkuil
2014-05-24  4:09   ` Prabhakar Lad
2014-05-23  9:05 ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.