20 Sep, 2016

2 commits

  • Check for vb2_ops structures that are only stored in the ops field of a
    vb2_queue structure. That field is declared const, so vb2_ops structures
    that have this property can be declared as const also.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct vb2_ops i@p = { ... };

    @ok@
    identifier r.i;
    struct vb2_queue e;
    position p;
    @@
    e.ops = &i@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    struct vb2_ops e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct vb2_ops i = { ... };
    //

    Signed-off-by: Julia Lawall
    Acked-by: Andrey Utkin
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Julia Lawall
     
  • Check for snd_pcm_ops structures that are only stored in the ops field of a
    snd_soc_platform_driver structure or passed as the third argument to
    snd_pcm_set_ops. The corresponding field or parameter is declared const,
    so snd_pcm_ops structures that have this property can be declared as const
    also.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct snd_pcm_ops i@p = { ... };

    @ok1@
    identifier r.i;
    struct snd_soc_platform_driver e;
    position p;
    @@
    e.ops = &i@p;

    @ok2@
    identifier r.i;
    expression e1, e2;
    position p;
    @@
    snd_pcm_set_ops(e1, e2, &i@p)

    @bad@
    position p != {r.p,ok1.p,ok2.p};
    identifier r.i;
    struct snd_pcm_ops e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct snd_pcm_ops i = { ... };
    //

    Signed-off-by: Julia Lawall
    Acked-by: Andrey Utkin
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Julia Lawall
     

07 Sep, 2016

1 commit


24 Aug, 2016

2 commits


14 Jul, 2016

2 commits

  • Now that the frame rate can be properly set, this commit adds support
    for S_PARM and G_PARM.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Instead of using two tables to estimate the temporal decimation
    factor, use a formula. This allows to get the closest fps, which
    sounds better than the current tables.

    Also, the current code doesn't store the real framerate.

    This patch fixes the above issues.

    [Ezequiel:
    - introduce a TW686X_MAX_FPS macro for max_fps.
    - use hweight_long instead of open coding the set bits count.]

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

09 Jul, 2016

3 commits


28 Jun, 2016

7 commits

  • Users won't know what to put in this module option if it isn't
    described.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Audio hw params are shared across all DMA channels,
    so if the user changes any of these while any DMA channel is
    enabled, it will impact the enabled channels, potentially causing
    serious instability issues.

    This commit avoids such situation, by preventing any hw param
    change (on any DMA channel) if any other DMA audio channel is capturing.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Currently, the driver has a fixed period size of 4096 bytes
    (2048 frames). Since this hardware can configure the audio
    capture size, this commit allows a period size range of [512-4096].

    This is very useful to reduce the audio latency.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Now that we've introduced the dma_mode parameter to pick the
    DMA operation, let's use it to also select the audio DMA
    operation.

    When dma_mode != memcpy, the driver will avoid using memcpy
    in the audio capture path, and the DMA hardware operation
    will act directly on the ALSA buffers.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Now that the driver has the infrastructure to support more
    DMA modes, let's add the DMA scatter-gather mode.

    In this mode, the device delivers sequential top-bottom
    frames. The scatter-gather logic is based on staging's
    tw686x-kh driver (by Krzysztof Ha?asa).

    Tested-by: Tim Harvey
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Now that the driver has the infrastructure to support more
    DMA modes, let's add the DMA contiguous interlaced frame mode.

    In this mode, the DMA P and B buffers are programmed with
    the user-provided buffers. When a P (or B) frame is ready,
    a new buffer is dequeued into P (or B).

    In addition to interlaced fields, the device can also be
    programmed to deliver alternate fields. Only interlaced
    mode is supported for now.

    Tested-by: Tim Harvey
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Let's set the corner stone to support all the DMA modes
    available on this device.

    For stability reasons, the driver is currently setting DMA frame
    mode, and using single DMA buffers to get the P and B buffers.
    Each frame is then memcpy'ed into the user buffer.

    However, other platforms might be interested in avoiding this
    memcpy, or in taking advantage of the chip's DMA scatter-gather
    capabilities.

    To achieve this, this commit introduces a "dma_mode" module parameter,
    and a tw686x_dma_ops struct. This will allow to define functions to
    alloc/free DMA buffers, and to return the frames to userspace.

    The memcpy-based method described above is named as dma_mode="memcpy".
    Current alloc/free functions are renamed as tw686x_memcpy_xxx,
    and are now used through a memcpy_dma_ops.

    Tested-by: Tim Harvey
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     

26 Apr, 2016

1 commit


25 Apr, 2016

2 commits

  • Depending on the compiler version, currently it produces the
    following warnings:
    tw686x-video.c: In function 'tw686x_video_init':
    tw686x-video.c:65:543: warning: array subscript is above array bounds [-Warray-bounds]

    This is actually bogus with the current code, as it currently
    hardcodes the framerate to 30 frames/sec, however a potential
    use after the array size could happen when the driver adds support
    for setting the framerate. So, fix it.

    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • When determining if the standard is 50 or 60 Hz it is standard
    practice to test for 60 Hz instead of 50 Hz.

    This doesn't matter normally, except if the user specifies both
    60 and 50 Hz standards.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

21 Apr, 2016

3 commits

  • Set vb2_queue.gfp_flags to GFP_DMA32. Otherwise it will start to
    create bounce buffers which is something you want to avoid since
    those are in limited supply.

    Without this patch, DMA scatter-gather may not work because
    machines can ran out of buffers easily.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • This commit introduces the support for the Techwell TW686x video
    capture IC. This hardware supports a few DMA modes, including
    scatter-gather and frame (contiguous).

    This commit makes little use of the DMA engine and instead has
    a memcpy based implementation. DMA frame and scatter-gather modes
    support may be added in the future.

    Currently supported chips:
    - TW6864 (4 video channels),
    - TW6865 (4 video channels, not tested, second generation chip),
    - TW6868 (8 video channels but only 4 first channels using
    built-in video decoder are supported, not tested),
    - TW6869 (8 video channels, second generation chip).

    [mchehab@osg.samsung.com: make checkpatch happy by using "unsigned int"
    instead of just "unsigned"]
    Cc: Krzysztof Halasa
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Tested-by: Hans Verkuil

    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia