Merge remote-tracking branch 'v4l-dvb/master'
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 00:38:12 +0000 (11:38 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 00:38:12 +0000 (11:38 +1100)
262 files changed:
Documentation/DocBook/device-drivers.tmpl
Documentation/DocBook/media/dvb/dvbapi.xml
Documentation/DocBook/media/dvb/kdapi.xml [deleted file]
Documentation/DocBook/media/v4l/biblio.xml
Documentation/DocBook/media/v4l/compat.xml
Documentation/DocBook/media/v4l/controls.xml
Documentation/DocBook/media/v4l/dev-sdr.xml
Documentation/DocBook/media/v4l/io.xml
Documentation/DocBook/media/v4l/pixfmt.xml
Documentation/DocBook/media/v4l/v4l2.xml
Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
Documentation/DocBook/media/v4l/vidioc-querycap.xml
Documentation/DocBook/media/v4l/vidioc-queryctrl.xml
Documentation/DocBook/media_api.tmpl
Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
Documentation/video4linux/CARDLIST.saa7134
Documentation/video4linux/v4l2-pci-skeleton.c
MAINTAINERS
drivers/input/touchscreen/sur40.c
drivers/media/dvb-core/demux.h
drivers/media/dvb-core/dmxdev.c
drivers/media/dvb-core/dvb-usb-ids.h
drivers/media/dvb-core/dvb_ca_en50221.h
drivers/media/dvb-core/dvb_demux.c
drivers/media/dvb-core/dvb_net.c
drivers/media/dvb-core/dvbdev.h
drivers/media/dvb-frontends/drxd_hard.c
drivers/media/dvb-frontends/rtl2832_sdr.c
drivers/media/i2c/ml86v7667.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/i2c/s5c73m3/s5c73m3-spi.c
drivers/media/i2c/smiapp/smiapp-core.c
drivers/media/i2c/tvp5150.c
drivers/media/media-entity.c
drivers/media/pci/bt8xx/bttv-driver.c
drivers/media/pci/cobalt/Kconfig
drivers/media/pci/cobalt/cobalt-cpld.c
drivers/media/pci/cobalt/cobalt-driver.h
drivers/media/pci/cobalt/cobalt-irq.c
drivers/media/pci/cobalt/cobalt-v4l2.c
drivers/media/pci/cx18/cx18-mailbox.c
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/cx23885/cx23885-core.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-vbi.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx23885/cx23885.h
drivers/media/pci/cx25821/cx25821-alsa.c
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/pci/cx25821/cx25821.h
drivers/media/pci/cx88/cx88-alsa.c
drivers/media/pci/cx88/cx88-blackbird.c
drivers/media/pci/cx88/cx88-core.c
drivers/media/pci/cx88/cx88-dvb.c
drivers/media/pci/cx88/cx88-mpeg.c
drivers/media/pci/cx88/cx88-vbi.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/cx88/cx88.h
drivers/media/pci/dt3155/dt3155.c
drivers/media/pci/dt3155/dt3155.h
drivers/media/pci/ivtv/ivtv-alsa-main.c
drivers/media/pci/ivtv/ivtv-yuv.c
drivers/media/pci/netup_unidvb/netup_unidvb.h
drivers/media/pci/netup_unidvb/netup_unidvb_ci.c
drivers/media/pci/netup_unidvb/netup_unidvb_core.c
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
drivers/media/pci/saa7134/saa7134-cards.c
drivers/media/pci/saa7134/saa7134-core.c
drivers/media/pci/saa7134/saa7134-input.c
drivers/media/pci/saa7134/saa7134-ts.c
drivers/media/pci/saa7134/saa7134-vbi.c
drivers/media/pci/saa7134/saa7134-video.c
drivers/media/pci/saa7134/saa7134.h
drivers/media/pci/saa7164/Kconfig
drivers/media/pci/saa7164/saa7164-encoder.c
drivers/media/pci/saa7164/saa7164-vbi.c
drivers/media/pci/saa7164/saa7164.h
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
drivers/media/pci/solo6x10/solo6x10-v4l2.c
drivers/media/pci/solo6x10/solo6x10.h
drivers/media/pci/sta2x11/sta2x11_vip.c
drivers/media/pci/ttpci/av7110.c
drivers/media/pci/ttpci/av7110_av.c
drivers/media/pci/tw68/tw68-video.c
drivers/media/pci/tw68/tw68.h
drivers/media/platform/Kconfig
drivers/media/platform/am437x/am437x-vpfe.c
drivers/media/platform/am437x/am437x-vpfe.h
drivers/media/platform/blackfin/bfin_capture.c
drivers/media/platform/coda/coda-bit.c
drivers/media/platform/coda/coda-common.c
drivers/media/platform/coda/coda-jpeg.c
drivers/media/platform/coda/coda.h
drivers/media/platform/coda/trace.h
drivers/media/platform/davinci/vpbe_display.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_capture.h
drivers/media/platform/davinci/vpif_display.c
drivers/media/platform/davinci/vpif_display.h
drivers/media/platform/exynos-gsc/gsc-core.h
drivers/media/platform/exynos-gsc/gsc-m2m.c
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-core.c
drivers/media/platform/exynos4-is/fimc-core.h
drivers/media/platform/exynos4-is/fimc-is.h
drivers/media/platform/exynos4-is/fimc-isp-video.c
drivers/media/platform/exynos4-is/fimc-isp-video.h
drivers/media/platform/exynos4-is/fimc-isp.h
drivers/media/platform/exynos4-is/fimc-lite.c
drivers/media/platform/exynos4-is/fimc-lite.h
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/exynos4-is/mipi-csis.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/platform/marvell-ccic/mcam-core.h
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/omap3isp/ispstat.c
drivers/media/platform/omap3isp/ispstat.h
drivers/media/platform/omap3isp/ispvideo.c
drivers/media/platform/omap3isp/ispvideo.h
drivers/media/platform/rcar_jpu.c
drivers/media/platform/s3c-camif/camif-capture.c
drivers/media/platform/s3c-camif/camif-core.c
drivers/media/platform/s3c-camif/camif-core.h
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/s5p-jpeg/jpeg-core.h
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h
drivers/media/platform/s5p-jpeg/jpeg-regs.h
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
drivers/media/platform/s5p-tv/mixer.h
drivers/media/platform/s5p-tv/mixer_grp_layer.c
drivers/media/platform/s5p-tv/mixer_reg.c
drivers/media/platform/s5p-tv/mixer_video.c
drivers/media/platform/s5p-tv/mixer_vp_layer.c
drivers/media/platform/sh_veu.c
drivers/media/platform/sh_vou.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/atmel-isi.h [moved from include/media/atmel-isi.h with 95% similarity]
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/rcar_vin.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/soc_camera/soc_camera.c
drivers/media/platform/sti/bdisp/bdisp-v4l2.c
drivers/media/platform/sti/c8sectpfe/Kconfig
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
drivers/media/platform/ti-vpe/vpe.c
drivers/media/platform/vim2m.c
drivers/media/platform/vivid/Kconfig
drivers/media/platform/vivid/vivid-core.c
drivers/media/platform/vivid/vivid-core.h
drivers/media/platform/vivid/vivid-ctrls.c
drivers/media/platform/vivid/vivid-kthread-cap.c
drivers/media/platform/vivid/vivid-kthread-out.c
drivers/media/platform/vivid/vivid-osd.c
drivers/media/platform/vivid/vivid-sdr-cap.c
drivers/media/platform/vivid/vivid-tpg-colors.c
drivers/media/platform/vivid/vivid-tpg-colors.h
drivers/media/platform/vivid/vivid-tpg.c
drivers/media/platform/vivid/vivid-vbi-cap.c
drivers/media/platform/vivid/vivid-vbi-out.c
drivers/media/platform/vivid/vivid-vid-cap.c
drivers/media/platform/vivid/vivid-vid-common.c
drivers/media/platform/vivid/vivid-vid-out.c
drivers/media/platform/vsp1/vsp1_rpf.c
drivers/media/platform/vsp1/vsp1_video.c
drivers/media/platform/vsp1/vsp1_video.h
drivers/media/platform/vsp1/vsp1_wpf.c
drivers/media/platform/xilinx/xilinx-dma.c
drivers/media/platform/xilinx/xilinx-dma.h
drivers/media/usb/airspy/airspy.c
drivers/media/usb/au0828/au0828-vbi.c
drivers/media/usb/au0828/au0828-video.c
drivers/media/usb/au0828/au0828.h
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/dvb-usb-v2/dvbsky.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
drivers/media/usb/em28xx/em28xx-vbi.c
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/em28xx/em28xx.h
drivers/media/usb/go7007/go7007-driver.c
drivers/media/usb/go7007/go7007-fw.c
drivers/media/usb/go7007/go7007-priv.h
drivers/media/usb/go7007/go7007-v4l2.c
drivers/media/usb/gspca/gspca.c
drivers/media/usb/hackrf/hackrf.c
drivers/media/usb/msi2500/msi2500.c
drivers/media/usb/pwc/pwc-if.c
drivers/media/usb/pwc/pwc-uncompress.c
drivers/media/usb/pwc/pwc.h
drivers/media/usb/s2255/s2255drv.c
drivers/media/usb/stk1160/stk1160-v4l.c
drivers/media/usb/stk1160/stk1160-video.c
drivers/media/usb/stk1160/stk1160.h
drivers/media/usb/tm6000/tm6000-alsa.c
drivers/media/usb/ttusb-dec/ttusb_dec.c
drivers/media/usb/usbtv/usbtv-video.c
drivers/media/usb/usbtv/usbtv.h
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvc_queue.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h
drivers/media/v4l2-core/Makefile
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/media/v4l2-core/v4l2-dev.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/media/v4l2-core/v4l2-trace.c
drivers/media/v4l2-core/vb2-trace.c [new file with mode: 0644]
drivers/media/v4l2-core/videobuf-core.c
drivers/media/v4l2-core/videobuf2-core.c
drivers/media/v4l2-core/videobuf2-dma-contig.c
drivers/media/v4l2-core/videobuf2-dma-sg.c
drivers/media/v4l2-core/videobuf2-internal.h [new file with mode: 0644]
drivers/media/v4l2-core/videobuf2-memops.c
drivers/media/v4l2-core/videobuf2-v4l2.c [new file with mode: 0644]
drivers/media/v4l2-core/videobuf2-vmalloc.c
drivers/staging/media/bcm2048/radio-bcm2048.c
drivers/staging/media/davinci_vpfe/vpfe_video.c
drivers/staging/media/davinci_vpfe/vpfe_video.h
drivers/staging/media/lirc/lirc_sasem.c
drivers/staging/media/lirc/lirc_serial.c
drivers/staging/media/omap4iss/iss.c
drivers/staging/media/omap4iss/iss_video.c
drivers/staging/media/omap4iss/iss_video.h
drivers/usb/gadget/function/uvc_queue.c
drivers/usb/gadget/function/uvc_queue.h
include/media/davinci/vpbe_display.h
include/media/lirc_dev.h
include/media/media-entity.h
include/media/soc_camera.h
include/media/tuner-types.h
include/media/tuner.h
include/media/tveeprom.h
include/media/v4l2-dv-timings.h
include/media/v4l2-ioctl.h
include/media/v4l2-mem2mem.h
include/media/videobuf2-core.h
include/media/videobuf2-dma-contig.h
include/media/videobuf2-dma-sg.h
include/media/videobuf2-dvb.h
include/media/videobuf2-memops.h
include/media/videobuf2-v4l2.h [new file with mode: 0644]
include/media/videobuf2-vmalloc.h
include/trace/events/v4l2.h
include/trace/events/vb2.h [new file with mode: 0644]
include/uapi/linux/v4l2-controls.h
include/uapi/linux/videodev2.h
scripts/kernel-doc

index 1d6008d..42a2d85 100644 (file)
@@ -221,6 +221,9 @@ X!Isound/sound_firmware.c
      <title>Media Devices</title>
 
      <sect1><title>Video2Linux devices</title>
+!Iinclude/media/tuner.h
+!Iinclude/media/tuner-types.h
+!Iinclude/media/tveeprom.h
 !Iinclude/media/v4l2-async.h
 !Iinclude/media/v4l2-ctrls.h
 !Iinclude/media/v4l2-dv-timings.h
@@ -231,6 +234,7 @@ X!Isound/sound_firmware.c
 !Iinclude/media/v4l2-of.h
 !Iinclude/media/v4l2-subdev.h
 !Iinclude/media/videobuf2-core.h
+!Iinclude/media/videobuf2-v4l2.h
 !Iinclude/media/videobuf2-memops.h
      </sect1>
      <sect1><title>Digital TV (DVB) devices</title>
@@ -239,15 +243,82 @@ X!Isound/sound_firmware.c
 !Idrivers/media/dvb-core/dvb_math.h
 !Idrivers/media/dvb-core/dvb_ringbuffer.h
 !Idrivers/media/dvb-core/dvbdev.h
-     </sect1>
-     <sect1><title>Remote Controller devices</title>
+       <sect1><title>Digital TV Demux API</title>
+           <para>The kernel demux API defines a driver-internal interface for
+           registering low-level, hardware specific driver to a hardware
+           independent demux layer. It is only of interest for Digital TV
+           device driver writers. The header file for this API is named
+           <constant>demux.h</constant> and located in
+           <constant>drivers/media/dvb-core</constant>.</para>
+
+       <para>The demux API should be implemented for each demux in the
+       system. It is used to select the TS source of a demux and to manage
+       the demux resources. When the demux client allocates a resource via
+       the demux API, it receives a pointer to the API of that
+       resource.</para>
+       <para>Each demux receives its TS input from a DVB front-end or from
+       memory, as set via this demux API. In a system with more than one
+       front-end, the API can be used to select one of the DVB front-ends
+       as a TS source for a demux, unless this is fixed in the HW platform.
+       The demux API only controls front-ends regarding to their connections
+       with demuxes; the APIs used to set the other front-end parameters,
+       such as tuning, are not defined in this document.</para>
+       <para>The functions that implement the abstract interface demux should
+       be defined static or module private and registered to the Demux
+       core for external access. It is not necessary to implement every
+       function in the struct <constant>dmx_demux</constant>. For example,
+       a demux interface might support Section filtering, but not PES
+       filtering. The API client is expected to check the value of any
+       function pointer before calling the function: the value of NULL means
+       that the &#8220;function is not available&#8221;.</para>
+       <para>Whenever the functions of the demux API modify shared data,
+       the possibilities of lost update and race condition problems should
+       be addressed, e.g. by protecting parts of code with mutexes.</para>
+       <para>Note that functions called from a bottom half context must not
+       sleep. Even a simple memory allocation without using GFP_ATOMIC can
+       result in a kernel thread being put to sleep if swapping is needed.
+       For example, the Linux kernel calls the functions of a network device
+       interface from a bottom half context. Thus, if a demux API function
+       is called from network device code, the function must not sleep.
+       </para>
+    </sect1>
+
+    <section id="demux_callback_api">
+       <title>Demux Callback API</title>
+       <para>This kernel-space API comprises the callback functions that
+       deliver filtered data to the demux client. Unlike the other DVB
+       kABIs, these functions are provided by the client and called from
+       the demux code.</para>
+       <para>The function pointers of this abstract interface are not
+       packed into a structure as in the other demux APIs, because the
+       callback functions are registered and used independent of each
+       other. As an example, it is possible for the API client to provide
+       several callback functions for receiving TS packets and no
+       callbacks for PES packets or sections.</para>
+       <para>The functions that implement the callback API need not be
+       re-entrant: when a demux driver calls one of these functions,
+       the driver is not allowed to call the function again before
+       the original call returns. If a callback is triggered by a
+       hardware interrupt, it is recommended to use the Linux
+       &#8220;bottom half&#8221; mechanism or start a tasklet instead of
+       making the callback function call directly from a hardware
+       interrupt.</para>
+       <para>This mechanism is implemented by
+       <link linkend='API-dmx-ts-cb'>dmx_ts_cb()</link> and
+       <link linkend='API-dmx-section-cb'>dmx_section_cb()</link>.</para>
+    </section>
+
+!Idrivers/media/dvb-core/demux.h
+    </sect1>
+    <sect1><title>Remote Controller devices</title>
 !Iinclude/media/rc-core.h
-     </sect1>
-     <sect1><title>Media Controller devices</title>
+!Iinclude/media/lirc_dev.h
+    </sect1>
+    <sect1><title>Media Controller devices</title>
 !Iinclude/media/media-device.h
 !Iinclude/media/media-devnode.h
 !Iinclude/media/media-entity.h
-     </sect1>
+    </sect1>
 
   </chapter>
 
index 858fd7d..8576481 100644 (file)
@@ -125,9 +125,6 @@ Added ISDB-T test originally written by Patrick Boettcher
        &sub-audio;
     </section>
   </chapter>
-  <chapter id="dvb_kdapi">
-    &sub-kdapi;
-  </chapter>
   <chapter id="dvb_examples">
     &sub-examples;
   </chapter>
diff --git a/Documentation/DocBook/media/dvb/kdapi.xml b/Documentation/DocBook/media/dvb/kdapi.xml
deleted file mode 100644 (file)
index 68bcd33..0000000
+++ /dev/null
@@ -1,2309 +0,0 @@
-<title>Kernel Demux API</title>
-<para>The kernel demux API defines a driver-internal interface for registering low-level,
-hardware specific driver to a hardware independent demux layer. It is only of interest for
-DVB device driver writers. The header file for this API is named <constant>demux.h</constant> and located in
-<constant>">drivers/media/dvb-core</constant>.
-</para>
-<para>Maintainer note: This section must be reviewed. It is probably out of date.
-</para>
-
-<section id="kernel_demux_data_types">
-<title>Kernel Demux Data Types</title>
-
-
-<section id="dmx_success_t">
-<title>dmx_success_t</title>
- <programlisting>
- typedef enum {
-   DMX_OK = 0, /&#x22C6; Received Ok &#x22C6;/
-   DMX_LENGTH_ERROR, /&#x22C6; Incorrect length &#x22C6;/
-   DMX_OVERRUN_ERROR, /&#x22C6; Receiver ring buffer overrun &#x22C6;/
-   DMX_CRC_ERROR, /&#x22C6; Incorrect CRC &#x22C6;/
-   DMX_FRAME_ERROR, /&#x22C6; Frame alignment error &#x22C6;/
-   DMX_FIFO_ERROR, /&#x22C6; Receiver FIFO overrun &#x22C6;/
-   DMX_MISSED_ERROR /&#x22C6; Receiver missed packet &#x22C6;/
- } dmx_success_t;
-</programlisting>
-
-</section>
-<section id="ts_filter_types">
-<title>TS filter types</title>
- <programlisting>
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
- /&#x22C6; TS packet reception &#x22C6;/
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
-
- /&#x22C6; TS filter type for set_type() &#x22C6;/
-
- #define TS_PACKET       1   /&#x22C6; send TS packets (188 bytes) to callback (default) &#x22C6;/
- #define TS_PAYLOAD_ONLY 2   /&#x22C6; in case TS_PACKET is set, only send the TS
-                               payload (&#x003C;=184 bytes per packet) to callback &#x22C6;/
- #define TS_DECODER      4   /&#x22C6; send stream to built-in decoder (if present) &#x22C6;/
-</programlisting>
-
-</section>
-<section id="dmx_ts_pes_t">
-<title>dmx_ts_pes_t</title>
-<para>The structure
-</para>
-<programlisting>
- typedef enum
- {
-        DMX_TS_PES_AUDIO,   /&#x22C6; also send packets to audio decoder (if it exists) &#x22C6;/
-        DMX_TS_PES_VIDEO,   /&#x22C6; ... &#x22C6;/
-        DMX_TS_PES_TELETEXT,
-        DMX_TS_PES_SUBTITLE,
-        DMX_TS_PES_PCR,
-        DMX_TS_PES_OTHER,
- } dmx_ts_pes_t;
-</programlisting>
-<para>describes the PES type for filters which write to a built-in decoder. The correspond (and
-should be kept identical) to the types in the demux device.
-</para>
-<programlisting>
- struct dmx_ts_feed_s {
-        int is_filtering; /&#x22C6; Set to non-zero when filtering in progress &#x22C6;/
-        struct dmx_demux_s&#x22C6; parent; /&#x22C6; Back-pointer &#x22C6;/
-        void&#x22C6; priv; /&#x22C6; Pointer to private data of the API client &#x22C6;/
-        int (&#x22C6;set) (struct dmx_ts_feed_s&#x22C6; feed,
-                    __u16 pid,
-                    size_t callback_length,
-                    size_t circular_buffer_size,
-                    int descramble,
-                    struct timespec timeout);
-        int (&#x22C6;start_filtering) (struct dmx_ts_feed_s&#x22C6; feed);
-        int (&#x22C6;stop_filtering) (struct dmx_ts_feed_s&#x22C6; feed);
-        int (&#x22C6;set_type) (struct dmx_ts_feed_s&#x22C6; feed,
-                         int type,
-                         dmx_ts_pes_t pes_type);
- };
-
- typedef struct dmx_ts_feed_s dmx_ts_feed_t;
-</programlisting>
- <programlisting>
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
- /&#x22C6; PES packet reception (not supported yet) &#x22C6;/
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
-
- typedef struct dmx_pes_filter_s {
-        struct dmx_pes_s&#x22C6; parent; /&#x22C6; Back-pointer &#x22C6;/
-        void&#x22C6; priv; /&#x22C6; Pointer to private data of the API client &#x22C6;/
- } dmx_pes_filter_t;
-</programlisting>
- <programlisting>
- typedef struct dmx_pes_feed_s {
-        int is_filtering; /&#x22C6; Set to non-zero when filtering in progress &#x22C6;/
-        struct dmx_demux_s&#x22C6; parent; /&#x22C6; Back-pointer &#x22C6;/
-        void&#x22C6; priv; /&#x22C6; Pointer to private data of the API client &#x22C6;/
-        int (&#x22C6;set) (struct dmx_pes_feed_s&#x22C6; feed,
-                    __u16 pid,
-                    size_t circular_buffer_size,
-                    int descramble,
-                    struct timespec timeout);
-        int (&#x22C6;start_filtering) (struct dmx_pes_feed_s&#x22C6; feed);
-        int (&#x22C6;stop_filtering) (struct dmx_pes_feed_s&#x22C6; feed);
-        int (&#x22C6;allocate_filter) (struct dmx_pes_feed_s&#x22C6; feed,
-                                dmx_pes_filter_t&#x22C6;&#x22C6; filter);
-        int (&#x22C6;release_filter) (struct dmx_pes_feed_s&#x22C6; feed,
-                               dmx_pes_filter_t&#x22C6; filter);
- } dmx_pes_feed_t;
-</programlisting>
- <programlisting>
- typedef struct {
-        __u8 filter_value [DMX_MAX_FILTER_SIZE];
-        __u8 filter_mask [DMX_MAX_FILTER_SIZE];
-        struct dmx_section_feed_s&#x22C6; parent; /&#x22C6; Back-pointer &#x22C6;/
-        void&#x22C6; priv; /&#x22C6; Pointer to private data of the API client &#x22C6;/
- } dmx_section_filter_t;
-</programlisting>
- <programlisting>
- struct dmx_section_feed_s {
-        int is_filtering; /&#x22C6; Set to non-zero when filtering in progress &#x22C6;/
-        struct dmx_demux_s&#x22C6; parent; /&#x22C6; Back-pointer &#x22C6;/
-        void&#x22C6; priv; /&#x22C6; Pointer to private data of the API client &#x22C6;/
-        int (&#x22C6;set) (struct dmx_section_feed_s&#x22C6; feed,
-                    __u16 pid,
-                    size_t circular_buffer_size,
-                    int descramble,
-                    int check_crc);
-        int (&#x22C6;allocate_filter) (struct dmx_section_feed_s&#x22C6; feed,
-                                dmx_section_filter_t&#x22C6;&#x22C6; filter);
-        int (&#x22C6;release_filter) (struct dmx_section_feed_s&#x22C6; feed,
-                               dmx_section_filter_t&#x22C6; filter);
-        int (&#x22C6;start_filtering) (struct dmx_section_feed_s&#x22C6; feed);
-        int (&#x22C6;stop_filtering) (struct dmx_section_feed_s&#x22C6; feed);
- };
- typedef struct dmx_section_feed_s dmx_section_feed_t;
-
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
- /&#x22C6; Callback functions &#x22C6;/
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
-
- typedef int (&#x22C6;dmx_ts_cb) ( __u8 &#x22C6; buffer1,
-                           size_t buffer1_length,
-                           __u8 &#x22C6; buffer2,
-                           size_t buffer2_length,
-                           dmx_ts_feed_t&#x22C6; source,
-                           dmx_success_t success);
-
- typedef int (&#x22C6;dmx_section_cb) ( __u8 &#x22C6; buffer1,
-                                size_t buffer1_len,
-                                __u8 &#x22C6; buffer2,
-                                size_t buffer2_len,
-                                dmx_section_filter_t &#x22C6; source,
-                                dmx_success_t success);
-
- typedef int (&#x22C6;dmx_pes_cb) ( __u8 &#x22C6; buffer1,
-                            size_t buffer1_len,
-                            __u8 &#x22C6; buffer2,
-                            size_t buffer2_len,
-                            dmx_pes_filter_t&#x22C6; source,
-                            dmx_success_t success);
-
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
- /&#x22C6; DVB Front-End &#x22C6;/
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
-
- typedef enum {
-        DMX_OTHER_FE = 0,
-        DMX_SATELLITE_FE,
-        DMX_CABLE_FE,
-        DMX_TERRESTRIAL_FE,
-        DMX_LVDS_FE,
-        DMX_ASI_FE, /&#x22C6; DVB-ASI interface &#x22C6;/
-        DMX_MEMORY_FE
- } dmx_frontend_source_t;
-
- typedef struct {
-        /&#x22C6; The following char&#x22C6; fields point to NULL terminated strings &#x22C6;/
-        char&#x22C6; id;                    /&#x22C6; Unique front-end identifier &#x22C6;/
-        char&#x22C6; vendor;                /&#x22C6; Name of the front-end vendor &#x22C6;/
-        char&#x22C6; model;                 /&#x22C6; Name of the front-end model &#x22C6;/
-        struct list_head connectivity_list; /&#x22C6; List of front-ends that can
-                                               be connected to a particular
-                                               demux &#x22C6;/
-        void&#x22C6; priv;     /&#x22C6; Pointer to private data of the API client &#x22C6;/
-        dmx_frontend_source_t source;
- } dmx_frontend_t;
-
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
- /&#x22C6; MPEG-2 TS Demux &#x22C6;/
- /&#x22C6;--------------------------------------------------------------------------&#x22C6;/
-
- /&#x22C6;
-  &#x22C6; Flags OR'ed in the capabilites field of struct dmx_demux_s.
-  &#x22C6;/
-
- #define DMX_TS_FILTERING                        1
- #define DMX_PES_FILTERING                       2
- #define DMX_SECTION_FILTERING                   4
- #define DMX_MEMORY_BASED_FILTERING              8    /&#x22C6; write() available &#x22C6;/
- #define DMX_CRC_CHECKING                        16
- #define DMX_TS_DESCRAMBLING                     32
- #define DMX_SECTION_PAYLOAD_DESCRAMBLING        64
- #define DMX_MAC_ADDRESS_DESCRAMBLING            128
-</programlisting>
-
-</section>
-<section id="demux_demux_t">
-<title>demux_demux_t</title>
- <programlisting>
- /&#x22C6;
-  &#x22C6; DMX_FE_ENTRY(): Casts elements in the list of registered
-  &#x22C6; front-ends from the generic type struct list_head
-  &#x22C6; to the type &#x22C6; dmx_frontend_t
-  &#x22C6;.
- &#x22C6;/
-
- #define DMX_FE_ENTRY(list) list_entry(list, dmx_frontend_t, connectivity_list)
-
- struct dmx_demux_s {
-        /&#x22C6; The following char&#x22C6; fields point to NULL terminated strings &#x22C6;/
-        char&#x22C6; id;                    /&#x22C6; Unique demux identifier &#x22C6;/
-        char&#x22C6; vendor;                /&#x22C6; Name of the demux vendor &#x22C6;/
-        char&#x22C6; model;                 /&#x22C6; Name of the demux model &#x22C6;/
-        __u32 capabilities;          /&#x22C6; Bitfield of capability flags &#x22C6;/
-        dmx_frontend_t&#x22C6; frontend;    /&#x22C6; Front-end connected to the demux &#x22C6;/
-        struct list_head reg_list;   /&#x22C6; List of registered demuxes &#x22C6;/
-        void&#x22C6; priv;                  /&#x22C6; Pointer to private data of the API client &#x22C6;/
-        int users;                   /&#x22C6; Number of users &#x22C6;/
-        int (&#x22C6;open) (struct dmx_demux_s&#x22C6; demux);
-        int (&#x22C6;close) (struct dmx_demux_s&#x22C6; demux);
-        int (&#x22C6;write) (struct dmx_demux_s&#x22C6; demux, const char&#x22C6; buf, size_t count);
-        int (&#x22C6;allocate_ts_feed) (struct dmx_demux_s&#x22C6; demux,
-                                 dmx_ts_feed_t&#x22C6;&#x22C6; feed,
-                                 dmx_ts_cb callback);
-        int (&#x22C6;release_ts_feed) (struct dmx_demux_s&#x22C6; demux,
-                                dmx_ts_feed_t&#x22C6; feed);
-        int (&#x22C6;allocate_pes_feed) (struct dmx_demux_s&#x22C6; demux,
-                                  dmx_pes_feed_t&#x22C6;&#x22C6; feed,
-                                  dmx_pes_cb callback);
-        int (&#x22C6;release_pes_feed) (struct dmx_demux_s&#x22C6; demux,
-                                 dmx_pes_feed_t&#x22C6; feed);
-        int (&#x22C6;allocate_section_feed) (struct dmx_demux_s&#x22C6; demux,
-                                      dmx_section_feed_t&#x22C6;&#x22C6; feed,
-                                      dmx_section_cb callback);
-        int (&#x22C6;release_section_feed) (struct dmx_demux_s&#x22C6; demux,
-                                     dmx_section_feed_t&#x22C6; feed);
-        int (&#x22C6;descramble_mac_address) (struct dmx_demux_s&#x22C6; demux,
-                                       __u8&#x22C6; buffer1,
-                                       size_t buffer1_length,
-                                       __u8&#x22C6; buffer2,
-                                       size_t buffer2_length,
-                                       __u16 pid);
-        int (&#x22C6;descramble_section_payload) (struct dmx_demux_s&#x22C6; demux,
-                                           __u8&#x22C6; buffer1,
-                                           size_t buffer1_length,
-                                           __u8&#x22C6; buffer2, size_t buffer2_length,
-                                           __u16 pid);
-        int (&#x22C6;add_frontend) (struct dmx_demux_s&#x22C6; demux,
-                             dmx_frontend_t&#x22C6; frontend);
-        int (&#x22C6;remove_frontend) (struct dmx_demux_s&#x22C6; demux,
-                                dmx_frontend_t&#x22C6; frontend);
-        struct list_head&#x22C6; (&#x22C6;get_frontends) (struct dmx_demux_s&#x22C6; demux);
-        int (&#x22C6;connect_frontend) (struct dmx_demux_s&#x22C6; demux,
-                                 dmx_frontend_t&#x22C6; frontend);
-        int (&#x22C6;disconnect_frontend) (struct dmx_demux_s&#x22C6; demux);
-
-
-        /&#x22C6; added because js cannot keep track of these himself &#x22C6;/
-        int (&#x22C6;get_pes_pids) (struct dmx_demux_s&#x22C6; demux, __u16 &#x22C6;pids);
- };
- typedef struct dmx_demux_s dmx_demux_t;
-</programlisting>
-
-</section>
-<section id="demux_directory">
-<title>Demux directory</title>
- <programlisting>
- /&#x22C6;
-  &#x22C6; DMX_DIR_ENTRY(): Casts elements in the list of registered
-  &#x22C6; demuxes from the generic type struct list_head&#x22C6; to the type dmx_demux_t
-  &#x22C6;.
-  &#x22C6;/
-
- #define DMX_DIR_ENTRY(list) list_entry(list, dmx_demux_t, reg_list)
-
- int dmx_register_demux (dmx_demux_t&#x22C6; demux);
- int dmx_unregister_demux (dmx_demux_t&#x22C6; demux);
- struct list_head&#x22C6; dmx_get_demuxes (void);
-</programlisting>
- </section></section>
-<section id="demux_directory_api">
-<title>Demux Directory API</title>
-<para>The demux directory is a Linux kernel-wide facility for registering and accessing the
-MPEG-2 TS demuxes in the system. Run-time registering and unregistering of demux drivers
-is possible using this API.
-</para>
-<para>All demux drivers in the directory implement the abstract interface dmx_demux_t.
-</para>
-
-<section
-role="subsection"><title>dmx_register_demux()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function makes a demux driver interface available to the Linux kernel. It is
- usually called by the init_module() function of the kernel module that contains
- the demux driver. The caller of this function is responsible for allocating
- dynamic or static memory for the demux structure and for initializing its fields
- before calling this function. The memory allocated for the demux structure
- must not be freed before calling dmx_unregister_demux(),</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int dmx_register_demux ( dmx_demux_t &#x22C6;demux )</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux structure.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EEXIST</para>
-</entry><entry
- align="char">
-<para>A demux with the same value of the id field already stored
- in the directory.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSPC</para>
-</entry><entry
- align="char">
-<para>No space left in the directory.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>dmx_unregister_demux()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function is called to indicate that the given demux interface is no
- longer available. The caller of this function is responsible for freeing the
- memory of the demux structure, if it was dynamically allocated before calling
- dmx_register_demux(). The cleanup_module() function of the kernel module
- that contains the demux driver should call this function. Note that this function
- fails if the demux is currently in use, i.e., release_demux() has not been called
- for the interface.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int dmx_unregister_demux ( dmx_demux_t &#x22C6;demux )</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux structure which is to be
- unregistered.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>ENODEV</para>
-</entry><entry
- align="char">
-<para>The specified demux is not registered in the demux
- directory.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>EBUSY</para>
-</entry><entry
- align="char">
-<para>The specified demux is currently in use.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>dmx_get_demuxes()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Provides the caller with the list of registered demux interfaces, using the
- standard list structure defined in the include file linux/list.h. The include file
- demux.h defines the macro DMX_DIR_ENTRY() for converting an element of
- the generic type struct list_head* to the type dmx_demux_t*. The caller must
- not free the memory of any of the elements obtained via this function call.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>struct list_head &#x22C6;dmx_get_demuxes ()</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>none</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>struct list_head *</para>
-</entry><entry
- align="char">
-<para>A list of demux interfaces, or NULL in the case of an
- empty list.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
- </section></section>
-<section id="demux_api">
-<title>Demux API</title>
-<para>The demux API should be implemented for each demux in the system. It is used to select
-the TS source of a demux and to manage the demux resources. When the demux
-client allocates a resource via the demux API, it receives a pointer to the API of that
-resource.
-</para>
-<para>Each demux receives its TS input from a DVB front-end or from memory, as set via the
-demux API. In a system with more than one front-end, the API can be used to select one of
-the DVB front-ends as a TS source for a demux, unless this is fixed in the HW platform. The
-demux API only controls front-ends regarding their connections with demuxes; the APIs
-used to set the other front-end parameters, such as tuning, are not defined in this
-document.
-</para>
-<para>The functions that implement the abstract interface demux should be defined static or
-module private and registered to the Demux Directory for external access. It is not necessary
-to implement every function in the demux_t struct, however (for example, a demux interface
-might support Section filtering, but not TS or PES filtering). The API client is expected to
-check the value of any function pointer before calling the function: the value of NULL means
-&#8220;function not available&#8221;.
-</para>
-<para>Whenever the functions of the demux API modify shared data, the possibilities of lost
-update and race condition problems should be addressed, e.g. by protecting parts of code with
-mutexes. This is especially important on multi-processor hosts.
-</para>
-<para>Note that functions called from a bottom half context must not sleep, at least in the 2.2.x
-kernels. Even a simple memory allocation can result in a kernel thread being put to sleep if
-swapping is needed. For example, the Linux kernel calls the functions of a network device
-interface from a bottom half context. Thus, if a demux API function is called from network
-device code, the function must not sleep.
-</para>
-
-
-<section id="kdapi_fopen">
-<title>open()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function reserves the demux for use by the caller and, if necessary,
- initializes the demux. When the demux is no longer needed, the function close()
- should be called. It should be possible for multiple clients to access the demux
- at the same time. Thus, the function implementation should increment the
- demux usage count when open() is called and decrement it when close() is
- called.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int open ( demux_t&#x22C6; demux );</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t* demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EUSERS</para>
-</entry><entry
- align="char">
-<para>Maximum usage count reached.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section>
-<section id="kdapi_fclose">
-<title>close()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function reserves the demux for use by the caller and, if necessary,
- initializes the demux. When the demux is no longer needed, the function close()
- should be called. It should be possible for multiple clients to access the demux
- at the same time. Thus, the function implementation should increment the
- demux usage count when open() is called and decrement it when close() is
- called.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int close(demux_t&#x22C6; demux);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t* demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENODEV</para>
-</entry><entry
- align="char">
-<para>The demux was not in use.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section>
-<section id="kdapi_fwrite">
-<title>write()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function provides the demux driver with a memory buffer containing TS
- packets. Instead of receiving TS packets from the DVB front-end, the demux
- driver software will read packets from memory. Any clients of this demux
- with active TS, PES or Section filters will receive filtered data via the Demux
- callback API (see 0). The function returns when all the data in the buffer has
- been consumed by the demux. Demux hardware typically cannot read TS from
- memory. If this is the case, memory-based filtering has to be implemented
- entirely in software.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int write(demux_t&#x22C6; demux, const char&#x22C6; buf, size_t
- count);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t* demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>const char* buf</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS data in kernel-space memory.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t length</para>
-</entry><entry
- align="char">
-<para>Length of the TS data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>The command is not implemented.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>allocate_ts_feed()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Allocates a new TS feed, which is used to filter the TS packets carrying a
- certain PID. The TS feed normally corresponds to a hardware PID filter on the
- demux chip.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int allocate_ts_feed(dmx_demux_t&#x22C6; demux,
- dmx_ts_feed_t&#x22C6;&#x22C6; feed, dmx_ts_cb callback);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t* demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_ts_feed_t**
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_ts_cb callback</para>
-</entry><entry
- align="char">
-<para>Pointer to the callback function for passing received TS
- packet</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EBUSY</para>
-</entry><entry
- align="char">
-<para>No more TS feeds available.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>The command is not implemented.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>release_ts_feed()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Releases the resources allocated with allocate_ts_feed(). Any filtering in
- progress on the TS feed should be stopped before calling this function.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int release_ts_feed(dmx_demux_t&#x22C6; demux,
- dmx_ts_feed_t&#x22C6; feed);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t* demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_ts_feed_t* feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>allocate_section_feed()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Allocates a new section feed, i.e. a demux resource for filtering and receiving
- sections. On platforms with hardware support for section filtering, a section
- feed is directly mapped to the demux HW. On other platforms, TS packets are
- first PID filtered in hardware and a hardware section filter then emulated in
- software. The caller obtains an API pointer of type dmx_section_feed_t as an
- out parameter. Using this API the caller can set filtering parameters and start
- receiving sections.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int allocate_section_feed(dmx_demux_t&#x22C6; demux,
- dmx_section_feed_t &#x22C6;&#x22C6;feed, dmx_section_cb callback);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t *demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_feed_t
- **feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_cb
- callback</para>
-</entry><entry
- align="char">
-<para>Pointer to the callback function for passing received
- sections.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EBUSY</para>
-</entry><entry
- align="char">
-<para>No more section feeds available.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>The command is not implemented.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>release_section_feed()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Releases the resources allocated with allocate_section_feed(), including
- allocated filters. Any filtering in progress on the section feed should be stopped
- before calling this function.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int release_section_feed(dmx_demux_t&#x22C6; demux,
- dmx_section_feed_t &#x22C6;feed);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>demux_t *demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_feed_t
- *feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>descramble_mac_address()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function runs a descrambling algorithm on the destination MAC
- address field of a DVB Datagram Section, replacing the original address
- with its un-encrypted version. Otherwise, the description on the function
- descramble_section_payload() applies also to this function.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int descramble_mac_address(dmx_demux_t&#x22C6; demux, __u8
- &#x22C6;buffer1, size_t buffer1_length, __u8 &#x22C6;buffer2,
- size_t buffer2_length, __u16 pid);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t
- *demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8 *buffer1</para>
-</entry><entry
- align="char">
-<para>Pointer to the first byte of the section.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer1_length</para>
-</entry><entry
- align="char">
-<para>Length of the section data, including headers and CRC,
- in buffer1.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8* buffer2</para>
-</entry><entry
- align="char">
-<para>Pointer to the tail of the section data, or NULL. The
- pointer has a non-NULL value if the section wraps past
- the end of a circular buffer.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer2_length</para>
-</entry><entry
- align="char">
-<para>Length of the section data, including headers and CRC,
- in buffer2.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u16 pid</para>
-</entry><entry
- align="char">
-<para>The PID on which the section was received. Useful
- for obtaining the descrambling key, e.g. from a DVB
- Common Access facility.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>No descrambling facility available.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>descramble_section_payload()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function runs a descrambling algorithm on the payload of a DVB
- Datagram Section, replacing the original payload with its un-encrypted
- version. The function will be called from the demux API implementation;
- the API client need not call this function directly. Section-level scrambling
- algorithms are currently standardized only for DVB-RCC (return channel
- over 2-directional cable TV network) systems. For all other DVB networks,
- encryption schemes are likely to be proprietary to each data broadcaster. Thus,
- it is expected that this function pointer will have the value of NULL (i.e.,
- function not available) in most demux API implementations. Nevertheless, it
- should be possible to use the function pointer as a hook for dynamically adding
- a &#8220;plug-in&#8221; descrambling facility to a demux driver.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>While this function is not needed with hardware-based section descrambling,
- the descramble_section_payload function pointer can be used to override the
- default hardware-based descrambling algorithm: if the function pointer has a
- non-NULL value, the corresponding function should be used instead of any
- descrambling hardware.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int descramble_section_payload(dmx_demux_t&#x22C6; demux,
- __u8 &#x22C6;buffer1, size_t buffer1_length, __u8 &#x22C6;buffer2,
- size_t buffer2_length, __u16 pid);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t
- *demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8 *buffer1</para>
-</entry><entry
- align="char">
-<para>Pointer to the first byte of the section.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer1_length</para>
-</entry><entry
- align="char">
-<para>Length of the section data, including headers and CRC,
- in buffer1.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8 *buffer2</para>
-</entry><entry
- align="char">
-<para>Pointer to the tail of the section data, or NULL. The
- pointer has a non-NULL value if the section wraps past
- the end of a circular buffer.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer2_length</para>
-</entry><entry
- align="char">
-<para>Length of the section data, including headers and CRC,
- in buffer2.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u16 pid</para>
-</entry><entry
- align="char">
-<para>The PID on which the section was received. Useful
- for obtaining the descrambling key, e.g. from a DVB
- Common Access facility.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>No descrambling facility available.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>add_frontend()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Registers a connectivity between a demux and a front-end, i.e., indicates that
- the demux can be connected via a call to connect_frontend() to use the given
- front-end as a TS source. The client of this function has to allocate dynamic or
- static memory for the frontend structure and initialize its fields before calling
- this function. This function is normally called during the driver initialization.
- The caller must not free the memory of the frontend struct before successfully
- calling remove_frontend().</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int add_frontend(dmx_demux_t &#x22C6;demux, dmx_frontend_t
- &#x22C6;frontend);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_frontend_t*
- frontend</para>
-</entry><entry
- align="char">
-<para>Pointer to the front-end instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EEXIST</para>
-</entry><entry
- align="char">
-<para>A front-end with the same value of the id field already
- registered.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINUSE</para>
-</entry><entry
- align="char">
-<para>The demux is in use.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOMEM</para>
-</entry><entry
- align="char">
-<para>No more front-ends can be added.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>remove_frontend()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Indicates that the given front-end, registered by a call to add_frontend(), can
- no longer be connected as a TS source by this demux. The function should be
- called when a front-end driver or a demux driver is removed from the system.
- If the front-end is in use, the function fails with the return value of -EBUSY.
- After successfully calling this function, the caller can free the memory of
- the frontend struct if it was dynamically allocated before the add_frontend()
- operation.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int remove_frontend(dmx_demux_t&#x22C6; demux,
- dmx_frontend_t&#x22C6; frontend);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_frontend_t*
- frontend</para>
-</entry><entry
- align="char">
-<para>Pointer to the front-end instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EBUSY</para>
-</entry><entry
- align="char">
-<para>The front-end is in use, i.e. a call to connect_frontend()
- has not been followed by a call to disconnect_frontend().</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>get_frontends()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Provides the APIs of the front-ends that have been registered for this demux.
- Any of the front-ends obtained with this call can be used as a parameter for
- connect_frontend().</para>
-</entry>
- </row><row><entry
- align="char">
-<para>The include file demux.h contains the macro DMX_FE_ENTRY() for
- converting an element of the generic type struct list_head* to the type
- dmx_frontend_t*. The caller must not free the memory of any of the elements
- obtained via this function call.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>struct list_head&#x22C6; get_frontends(dmx_demux_t&#x22C6; demux);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*</para>
-</entry><entry
- align="char">
-<para>A list of front-end interfaces, or NULL in the case of an
- empty list.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>connect_frontend()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Connects the TS output of the front-end to the input of the demux. A demux
- can only be connected to a front-end registered to the demux with the function
- add_frontend().</para>
-</entry>
- </row><row><entry
- align="char">
-<para>It may or may not be possible to connect multiple demuxes to the same
- front-end, depending on the capabilities of the HW platform. When not used,
- the front-end should be released by calling disconnect_frontend().</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int connect_frontend(dmx_demux_t&#x22C6; demux,
- dmx_frontend_t&#x22C6; frontend);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_frontend_t*
- frontend</para>
-</entry><entry
- align="char">
-<para>Pointer to the front-end instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EBUSY</para>
-</entry><entry
- align="char">
-<para>The front-end is in use.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>disconnect_frontend()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Disconnects the demux and a front-end previously connected by a
- connect_frontend() call.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int disconnect_frontend(dmx_demux_t&#x22C6; demux);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_demux_t*
- demux</para>
-</entry><entry
- align="char">
-<para>Pointer to the demux API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
- </section></section>
-<section id="demux_callback_api">
-<title>Demux Callback API</title>
-<para>This kernel-space API comprises the callback functions that deliver filtered data to the
-demux client. Unlike the other APIs, these API functions are provided by the client and called
-from the demux code.
-</para>
-<para>The function pointers of this abstract interface are not packed into a structure as in the
-other demux APIs, because the callback functions are registered and used independent
-of each other. As an example, it is possible for the API client to provide several
-callback functions for receiving TS packets and no callbacks for PES packets or
-sections.
-</para>
-<para>The functions that implement the callback API need not be re-entrant: when a demux
-driver calls one of these functions, the driver is not allowed to call the function again before
-the original call returns. If a callback is triggered by a hardware interrupt, it is recommended
-to use the Linux &#8220;bottom half&#8221; mechanism or start a tasklet instead of making the callback
-function call directly from a hardware interrupt.
-</para>
-
-<section
-role="subsection"><title>dmx_ts_cb()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function, provided by the client of the demux API, is called from the
- demux code. The function is only called when filtering on this TS feed has
- been enabled using the start_filtering() function.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>Any TS packets that match the filter settings are copied to a circular buffer. The
- filtered TS packets are delivered to the client using this callback function. The
- size of the circular buffer is controlled by the circular_buffer_size parameter
- of the set() function in the TS Feed API. It is expected that the buffer1 and
- buffer2 callback parameters point to addresses within the circular buffer, but
- other implementations are also possible. Note that the called party should not
- try to free the memory the buffer1 and buffer2 parameters point to.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>When this function is called, the buffer1 parameter typically points to the
- start of the first undelivered TS packet within a circular buffer. The buffer2
- buffer parameter is normally NULL, except when the received TS packets have
- crossed the last address of the circular buffer and &#8221;wrapped&#8221; to the beginning
- of the buffer. In the latter case the buffer1 parameter would contain an address
- within the circular buffer, while the buffer2 parameter would contain the first
- address of the circular buffer.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>The number of bytes delivered with this function (i.e. buffer1_length +
- buffer2_length) is usually equal to the value of callback_length parameter
- given in the set() function, with one exception: if a timeout occurs before
- receiving callback_length bytes of TS data, any undelivered packets are
- immediately delivered to the client by calling this function. The timeout
- duration is controlled by the set() function in the TS Feed API.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>If a TS packet is received with errors that could not be fixed by the TS-level
- forward error correction (FEC), the Transport_error_indicator flag of the TS
- packet header should be set. The TS packet should not be discarded, as
- the error can possibly be corrected by a higher layer protocol. If the called
- party is slow in processing the callback, it is possible that the circular buffer
- eventually fills up. If this happens, the demux driver should discard any TS
- packets received while the buffer is full. The error should be indicated to the
- client on the next callback by setting the success parameter to the value of
- DMX_OVERRUN_ERROR.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>The type of data returned to the callback can be selected by the new
- function int (*set_type) (struct dmx_ts_feed_s* feed, int type, dmx_ts_pes_t
- pes_type) which is part of the dmx_ts_feed_s struct (also cf. to the
- include file ost/demux.h) The type parameter decides if the raw TS packet
- (TS_PACKET) or just the payload (TS_PACKET&#8212;TS_PAYLOAD_ONLY)
- should be returned. If additionally the TS_DECODER bit is set the stream
- will also be sent to the hardware MPEG decoder. In this case, the second
- flag decides as what kind of data the stream should be interpreted. The
- possible choices are one of DMX_TS_PES_AUDIO, DMX_TS_PES_VIDEO,
- DMX_TS_PES_TELETEXT, DMX_TS_PES_SUBTITLE,
- DMX_TS_PES_PCR, or DMX_TS_PES_OTHER.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int dmx_ts_cb(__u8&#x22C6; buffer1, size_t buffer1_length,
- __u8&#x22C6; buffer2, size_t buffer2_length, dmx_ts_feed_t&#x22C6;
- source, dmx_success_t success);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>__u8* buffer1</para>
-</entry><entry
- align="char">
-<para>Pointer to the start of the filtered TS packets.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer1_length</para>
-</entry><entry
- align="char">
-<para>Length of the TS data in buffer1.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8* buffer2</para>
-</entry><entry
- align="char">
-<para>Pointer to the tail of the filtered TS packets, or NULL.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer2_length</para>
-</entry><entry
- align="char">
-<para>Length of the TS data in buffer2.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_ts_feed_t*
- source</para>
-</entry><entry
- align="char">
-<para>Indicates which TS feed is the source of the callback.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_success_t
- success</para>
-</entry><entry
- align="char">
-<para>Indicates if there was an error in TS reception.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>Continue filtering.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-1</para>
-</entry><entry
- align="char">
-<para>Stop filtering - has the same effect as a call to
- stop_filtering() on the TS Feed API.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>dmx_section_cb()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function, provided by the client of the demux API, is called from the
- demux code. The function is only called when filtering of sections has been
- enabled using the function start_filtering() of the section feed API. When the
- demux driver has received a complete section that matches at least one section
- filter, the client is notified via this callback function. Normally this function is
- called for each received section; however, it is also possible to deliver multiple
- sections with one callback, for example when the system load is high. If an
- error occurs while receiving a section, this function should be called with
- the corresponding error type set in the success field, whether or not there is
- data to deliver. The Section Feed implementation should maintain a circular
- buffer for received sections. However, this is not necessary if the Section Feed
- API is implemented as a client of the TS Feed API, because the TS Feed
- implementation then buffers the received data. The size of the circular buffer
- can be configured using the set() function in the Section Feed API. If there
- is no room in the circular buffer when a new section is received, the section
- must be discarded. If this happens, the value of the success parameter should
- be DMX_OVERRUN_ERROR on the next callback.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int dmx_section_cb(__u8&#x22C6; buffer1, size_t
- buffer1_length, __u8&#x22C6; buffer2, size_t
- buffer2_length, dmx_section_filter_t&#x22C6; source,
- dmx_success_t success);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>__u8* buffer1</para>
-</entry><entry
- align="char">
-<para>Pointer to the start of the filtered section, e.g. within the
- circular buffer of the demux driver.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer1_length</para>
-</entry><entry
- align="char">
-<para>Length of the filtered section data in buffer1, including
- headers and CRC.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u8* buffer2</para>
-</entry><entry
- align="char">
-<para>Pointer to the tail of the filtered section data, or NULL.
- Useful to handle the wrapping of a circular buffer.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t buffer2_length</para>
-</entry><entry
- align="char">
-<para>Length of the filtered section data in buffer2, including
- headers and CRC.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_filter_t*
- filter</para>
-</entry><entry
- align="char">
-<para>Indicates the filter that triggered the callback.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_success_t
- success</para>
-</entry><entry
- align="char">
-<para>Indicates if there was an error in section reception.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>Continue filtering.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-1</para>
-</entry><entry
- align="char">
-<para>Stop filtering - has the same effect as a call to
- stop_filtering() on the Section Feed API.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
- </section></section>
-<section id="ts_feed_api">
-<title>TS Feed API</title>
-<para>A TS feed is typically mapped to a hardware PID filter on the demux chip.
-Using this API, the client can set the filtering properties to start/stop filtering TS
-packets on a particular TS feed. The API is defined as an abstract interface of the type
-dmx_ts_feed_t.
-</para>
-<para>The functions that implement the interface should be defined static or module private. The
-client can get the handle of a TS feed API by calling the function allocate_ts_feed() in the
-demux API.
-</para>
-
-<section
-role="subsection"><title>set()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function sets the parameters of a TS feed. Any filtering in progress on the
- TS feed must be stopped before calling this function.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int set ( dmx_ts_feed_t&#x22C6; feed, __u16 pid, size_t
- callback_length, size_t circular_buffer_size, int
- descramble, struct timespec timeout);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_ts_feed_t* feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u16 pid</para>
-</entry><entry
- align="char">
-<para>PID value to filter. Only the TS packets carrying the
- specified PID will be passed to the API client.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t
- callback_length</para>
-</entry><entry
- align="char">
-<para>Number of bytes to deliver with each call to the
- dmx_ts_cb() callback function. The value of this
- parameter should be a multiple of 188.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t
- circular_buffer_size</para>
-</entry><entry
- align="char">
-<para>Size of the circular buffer for the filtered TS packets.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>int descramble</para>
-</entry><entry
- align="char">
-<para>If non-zero, descramble the filtered TS packets.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>struct timespec
- timeout</para>
-</entry><entry
- align="char">
-<para>Maximum time to wait before delivering received TS
- packets to the client.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOMEM</para>
-</entry><entry
- align="char">
-<para>Not enough memory for the requested buffer size.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>No descrambling facility available for TS.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>start_filtering()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Starts filtering TS packets on this TS feed, according to its settings. The PID
- value to filter can be set by the API client. All matching TS packets are
- delivered asynchronously to the client, using the callback function registered
- with allocate_ts_feed().</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int start_filtering(dmx_ts_feed_t&#x22C6; feed);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_ts_feed_t* feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>stop_filtering()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Stops filtering TS packets on this TS feed.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int stop_filtering(dmx_ts_feed_t&#x22C6; feed);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_ts_feed_t* feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the TS feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
- </section></section>
-<section id="section_feed_api">
-<title>Section Feed API</title>
-<para>A section feed is a resource consisting of a PID filter and a set of section filters. Using this
-API, the client can set the properties of a section feed and to start/stop filtering. The API is
-defined as an abstract interface of the type dmx_section_feed_t. The functions that implement
-the interface should be defined static or module private. The client can get the handle of
-a section feed API by calling the function allocate_section_feed() in the demux
-API.
-</para>
-<para>On demux platforms that provide section filtering in hardware, the Section Feed API
-implementation provides a software wrapper for the demux hardware. Other platforms may
-support only PID filtering in hardware, requiring that TS packets are converted to sections in
-software. In the latter case the Section Feed API implementation can be a client of the TS
-Feed API.
-</para>
-
-</section>
-<section id="kdapi_set">
-<title>set()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function sets the parameters of a section feed. Any filtering in progress on
- the section feed must be stopped before calling this function. If descrambling
- is enabled, the payload_scrambling_control and address_scrambling_control
- fields of received DVB datagram sections should be observed. If either one is
- non-zero, the section should be descrambled either in hardware or using the
- functions descramble_mac_address() and descramble_section_payload() of the
- demux API. Note that according to the MPEG-2 Systems specification, only
- the payloads of private sections can be scrambled while the rest of the section
- data must be sent in the clear.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int set(dmx_section_feed_t&#x22C6; feed, __u16 pid, size_t
- circular_buffer_size, int descramble, int
- check_crc);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_section_feed_t*
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>__u16 pid</para>
-</entry><entry
- align="char">
-<para>PID value to filter; only the TS packets carrying the
- specified PID will be accepted.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>size_t
- circular_buffer_size</para>
-</entry><entry
- align="char">
-<para>Size of the circular buffer for filtered sections.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>int descramble</para>
-</entry><entry
- align="char">
-<para>If non-zero, descramble any sections that are scrambled.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>int check_crc</para>
-</entry><entry
- align="char">
-<para>If non-zero, check the CRC values of filtered sections.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOMEM</para>
-</entry><entry
- align="char">
-<para>Not enough memory for the requested buffer size.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSYS</para>
-</entry><entry
- align="char">
-<para>No descrambling facility available for sections.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameters.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>allocate_filter()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function is used to allocate a section filter on the demux. It should only be
- called when no filtering is in progress on this section feed. If a filter cannot be
- allocated, the function fails with -ENOSPC. See in section ?? for the format of
- the section filter.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>The bitfields filter_mask and filter_value should only be modified when no
- filtering is in progress on this section feed. filter_mask controls which bits of
- filter_value are compared with the section headers/payload. On a binary value
- of 1 in filter_mask, the corresponding bits are compared. The filter only accepts
- sections that are equal to filter_value in all the tested bit positions. Any changes
- to the values of filter_mask and filter_value are guaranteed to take effect only
- when the start_filtering() function is called next time. The parent pointer in
- the struct is initialized by the API implementation to the value of the feed
- parameter. The priv pointer is not used by the API implementation, and can
- thus be freely utilized by the caller of this function. Any data pointed to by the
- priv pointer is available to the recipient of the dmx_section_cb() function call.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>While the maximum section filter length (DMX_MAX_FILTER_SIZE) is
- currently set at 16 bytes, hardware filters of that size are not available on all
- platforms. Therefore, section filtering will often take place first in hardware,
- followed by filtering in software for the header bytes that were not covered
- by a hardware filter. The filter_mask field can be checked to determine how
- many bytes of the section filter are actually used, and if the hardware filter will
- suffice. Additionally, software-only section filters can optionally be allocated
- to clients when all hardware section filters are in use. Note that on most demux
- hardware it is not possible to filter on the section_length field of the section
- header &#8211; thus this field is ignored, even though it is included in filter_value and
- filter_mask fields.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int allocate_filter(dmx_section_feed_t&#x22C6; feed,
- dmx_section_filter_t&#x22C6;&#x22C6; filter);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_section_feed_t*
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_filter_t**
- filter</para>
-</entry><entry
- align="char">
-<para>Pointer to the allocated filter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENOSPC</para>
-</entry><entry
- align="char">
-<para>No filters of given type and length available.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameters.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>release_filter()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>This function releases all the resources of a previously allocated section filter.
- The function should not be called while filtering is in progress on this section
- feed. After calling this function, the caller should not try to dereference the
- filter pointer.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int release_filter ( dmx_section_feed_t&#x22C6; feed,
- dmx_section_filter_t&#x22C6; filter);</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_section_feed_t*
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>dmx_section_filter_t*
- filter</para>
-</entry><entry
- align="char">
-<para>I/O Pointer to the instance data of a section filter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-ENODEV</para>
-</entry><entry
- align="char">
-<para>No such filter allocated.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>start_filtering()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Starts filtering sections on this section feed, according to its settings. Sections
- are first filtered based on their PID and then matched with the section
- filters allocated for this feed. If the section matches the PID filter and
- at least one section filter, it is delivered to the API client. The section
- is delivered asynchronously using the callback function registered with
- allocate_section_feed().</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int start_filtering ( dmx_section_feed_t&#x22C6; feed );</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_section_feed_t*
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section><section
-role="subsection"><title>stop_filtering()</title>
-<para>DESCRIPTION
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>Stops filtering sections on this section feed. Note that any changes to the
- filtering parameters (filter_value, filter_mask, etc.) should only be made when
- filtering is stopped.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>SYNOPSIS
-</para>
-<informaltable><tgroup cols="1"><tbody><row><entry
- align="char">
-<para>int stop_filtering ( dmx_section_feed_t&#x22C6; feed );</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>PARAMETERS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>dmx_section_feed_t*
- feed</para>
-</entry><entry
- align="char">
-<para>Pointer to the section feed API and instance data.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-<para>RETURNS
-</para>
-<informaltable><tgroup cols="2"><tbody><row><entry
- align="char">
-<para>0</para>
-</entry><entry
- align="char">
-<para>The function was completed without errors.</para>
-</entry>
- </row><row><entry
- align="char">
-<para>-EINVAL</para>
-</entry><entry
- align="char">
-<para>Bad parameter.</para>
-</entry>
- </row></tbody></tgroup></informaltable>
-
-</section>
index fdee6b3..9beb30f 100644 (file)
@@ -177,6 +177,24 @@ Signal - NTSC for Studio Applications"</title>
 1125-Line High-Definition Production"</title>
     </biblioentry>
 
+    <biblioentry id="smpte431">
+      <abbrev>SMPTE&nbsp;RP&nbsp;431-2</abbrev>
+      <authorgroup>
+       <corpauthor>Society of Motion Picture and Television Engineers
+(<ulink url="http://www.smpte.org">http://www.smpte.org</ulink>)</corpauthor>
+      </authorgroup>
+      <title>SMPTE RP 431-2:2011 "D-Cinema Quality - Reference Projector and Environment"</title>
+    </biblioentry>
+
+    <biblioentry id="smpte2084">
+      <abbrev>SMPTE&nbsp;ST&nbsp;2084</abbrev>
+      <authorgroup>
+       <corpauthor>Society of Motion Picture and Television Engineers
+(<ulink url="http://www.smpte.org">http://www.smpte.org</ulink>)</corpauthor>
+      </authorgroup>
+      <title>SMPTE ST 2084:2014 "High Dynamic Range Electro-Optical Transfer Function of Master Reference Displays"</title>
+    </biblioentry>
+
     <biblioentry id="srgb">
       <abbrev>sRGB</abbrev>
       <authorgroup>
index a0aef85..5701a08 100644 (file)
@@ -2591,6 +2591,26 @@ and &v4l2-mbus-framefmt;.
       </orderedlist>
     </section>
 
+    <section>
+      <title>V4L2 in Linux 4.4</title>
+      <orderedlist>
+       <listitem>
+         <para>Renamed <constant>V4L2_TUNER_ADC</constant> to
+<constant>V4L2_TUNER_SDR</constant>. The use of
+<constant>V4L2_TUNER_ADC</constant> is deprecated now.
+         </para>
+       </listitem>
+       <listitem>
+         <para>Added <constant>V4L2_CID_RF_TUNER_RF_GAIN</constant>
+RF Tuner control.</para>
+       </listitem>
+       <listitem>
+         <para>Added transmitter support for Software Defined Radio (SDR)
+Interface.</para>
+       </listitem>
+      </orderedlist>
+    </section>
+
     <section id="other">
       <title>Relation of V4L2 to other Linux multimedia APIs</title>
 
index 33aece5..f13a429 100644 (file)
@@ -5417,6 +5417,18 @@ set. Unit is in Hz. The range and step are driver-specific.</entry>
             <row>
               <entry spanname="descr">Enables/disables IF automatic gain control (AGC)</entry>
             </row>
+            <row>
+              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_RF_GAIN</constant>&nbsp;</entry>
+              <entry>integer</entry>
+            </row>
+            <row>
+              <entry spanname="descr">The RF amplifier is the very first
+amplifier on the receiver signal path, just right after the antenna input.
+The difference between the LNA gain and the RF gain in this document is that
+the LNA gain is integrated in the tuner chip while the RF gain is a separate
+chip. There may be both RF and LNA gain controls in the same device.
+The range and step are driver-specific.</entry>
+            </row>
             <row>
               <entry spanname="id"><constant>V4L2_CID_RF_TUNER_LNA_GAIN</constant>&nbsp;</entry>
               <entry>integer</entry>
@@ -5425,6 +5437,8 @@ set. Unit is in Hz. The range and step are driver-specific.</entry>
               <entry spanname="descr">LNA (low noise amplifier) gain is first
 gain stage on the RF tuner signal path. It is located very close to tuner
 antenna input. Used when <constant>V4L2_CID_RF_TUNER_LNA_GAIN_AUTO</constant> is not set.
+See <constant>V4L2_CID_RF_TUNER_RF_GAIN</constant> to understand how RF gain
+and LNA gain differs from the each others.
 The range and step are driver-specific.</entry>
             </row>
             <row>
index f890356..a659771 100644 (file)
@@ -28,6 +28,16 @@ Devices supporting the SDR receiver interface set the
 <structfield>capabilities</structfield> field of &v4l2-capability;
 returned by the &VIDIOC-QUERYCAP; ioctl. That flag means the device has an
 Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver.
+    </para>
+    <para>
+Devices supporting the SDR transmitter interface set the
+<constant>V4L2_CAP_SDR_OUTPUT</constant> and
+<constant>V4L2_CAP_MODULATOR</constant> flag in the
+<structfield>capabilities</structfield> field of &v4l2-capability;
+returned by the &VIDIOC-QUERYCAP; ioctl. That flag means the device has an
+Digital to Analog Converter (DAC), which is a mandatory element for the SDR transmitter.
+    </para>
+    <para>
 At least one of the read/write, streaming or asynchronous I/O methods must
 be supported.
     </para>
@@ -39,15 +49,16 @@ be supported.
     <para>
 SDR devices can support <link linkend="control">controls</link>, and must
 support the <link linkend="tuner">tuner</link> ioctls. Tuner ioctls are used
-for setting the ADC sampling rate (sampling frequency) and the possible RF tuner
-frequency.
+for setting the ADC/DAC sampling rate (sampling frequency) and the possible
+radio frequency (RF).
     </para>
 
     <para>
-The <constant>V4L2_TUNER_ADC</constant> tuner type is used for ADC tuners, and
-the <constant>V4L2_TUNER_RF</constant> tuner type is used for RF tuners. The
-tuner index of the RF tuner (if any) must always follow the ADC tuner index.
-Normally the ADC tuner is #0 and the RF tuner is #1.
+The <constant>V4L2_TUNER_SDR</constant> tuner type is used for setting SDR
+device ADC/DAC frequency, and the <constant>V4L2_TUNER_RF</constant>
+tuner type is used for setting radio frequency.
+The tuner index of the RF tuner (if any) must always follow the SDR tuner index.
+Normally the SDR tuner is #0 and the RF tuner is #1.
     </para>
 
     <para>
@@ -59,9 +70,9 @@ The &VIDIOC-S-HW-FREQ-SEEK; ioctl is not supported.
     <title>Data Format Negotiation</title>
 
     <para>
-The SDR capture device uses the <link linkend="format">format</link> ioctls to
-select the capture format. Both the sampling resolution and the data streaming
-format are bound to that selectable format. In addition to the basic
+The SDR device uses the <link linkend="format">format</link> ioctls to
+select the capture and output format. Both the sampling resolution and the data
+streaming format are bound to that selectable format. In addition to the basic
 <link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl
 must be supported as well.
     </para>
@@ -69,7 +80,8 @@ must be supported as well.
     <para>
 To use the <link linkend="format">format</link> ioctls applications set the
 <structfield>type</structfield> field of a &v4l2-format; to
-<constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant> and use the &v4l2-sdr-format;
+<constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant> or
+<constant>V4L2_BUF_TYPE_SDR_OUTPUT</constant> and use the &v4l2-sdr-format;
 <structfield>sdr</structfield> member of the <structfield>fmt</structfield>
 union as needed per the desired operation.
 Currently there is two fields, <structfield>pixelformat</structfield> and
index 7bbc2a4..da65403 100644 (file)
@@ -1006,8 +1006,14 @@ must set this to 0.</entry>
          <row>
            <entry><constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant></entry>
            <entry>11</entry>
-           <entry>Buffer for Software Defined Radio (SDR), see <xref
-               linkend="sdr" />.</entry>
+           <entry>Buffer for Software Defined Radio (SDR) capture stream, see
+               <xref linkend="sdr" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_SDR_OUTPUT</constant></entry>
+           <entry>12</entry>
+           <entry>Buffer for Software Defined Radio (SDR) output stream, see
+               <xref linkend="sdr" />.</entry>
          </row>
        </tbody>
       </tgroup>
index 965ea91..d871245 100644 (file)
@@ -539,6 +539,10 @@ colorspaces except for BT.2020 which uses limited range R'G'B' quantization.</pa
            <entry><constant>V4L2_COLORSPACE_BT2020</constant></entry>
            <entry>See <xref linkend="col-bt2020" />.</entry>
          </row>
+         <row>
+           <entry><constant>V4L2_COLORSPACE_DCI_P3</constant></entry>
+           <entry>See <xref linkend="col-dcip3" />.</entry>
+         </row>
          <row>
            <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
            <entry>See <xref linkend="col-smpte-240m" />.</entry>
@@ -601,6 +605,14 @@ colorspaces except for BT.2020 which uses limited range R'G'B' quantization.</pa
            <entry><constant>V4L2_XFER_FUNC_NONE</constant></entry>
            <entry>Do not use a transfer function (i.e. use linear RGB values).</entry>
          </row>
+         <row>
+           <entry><constant>V4L2_XFER_FUNC_DCI_P3</constant></entry>
+           <entry>Use the DCI-P3 transfer function.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_XFER_FUNC_SMPTE2084</constant></entry>
+           <entry>Use the SMPTE 2084 transfer function.</entry>
+         </row>
        </tbody>
       </tgroup>
     </table>
@@ -1154,6 +1166,68 @@ clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range
 clamped to the range [-0.5&hellip;0.5]. The Yc'CbcCrc quantization is limited range.</para>
     </section>
 
+    <section id="col-dcip3">
+      <title>Colorspace DCI-P3 (<constant>V4L2_COLORSPACE_DCI_P3</constant>)</title>
+      <para>The <xref linkend="smpte431" /> standard defines the colorspace used by cinema
+projectors that use the DCI-P3 colorspace.
+The default transfer function is <constant>V4L2_XFER_FUNC_DCI_P3</constant>.
+The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_709</constant>. Note that this
+colorspace does not specify a Y'CbCr encoding since it is not meant to be encoded
+to Y'CbCr. So this default Y'CbCr encoding was picked because it is the HDTV
+encoding. The default Y'CbCr quantization is limited range. The chromaticities of
+the primary colors and the white reference are:</para>
+      <table frame="none">
+        <title>DCI-P3 Chromaticities</title>
+        <tgroup cols="3" align="left">
+          &cs-str;
+       <thead>
+         <row>
+           <entry>Color</entry>
+           <entry>x</entry>
+           <entry>y</entry>
+         </row>
+       </thead>
+          <tbody valign="top">
+            <row>
+              <entry>Red</entry>
+              <entry>0.6800</entry>
+              <entry>0.3200</entry>
+            </row>
+            <row>
+              <entry>Green</entry>
+              <entry>0.2650</entry>
+              <entry>0.6900</entry>
+            </row>
+            <row>
+              <entry>Blue</entry>
+              <entry>0.1500</entry>
+              <entry>0.0600</entry>
+            </row>
+            <row>
+              <entry>White Reference</entry>
+              <entry>0.3140</entry>
+              <entry>0.3510</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <variablelist>
+       <varlistentry>
+          <term>Transfer function:</term>
+         <listitem>
+            <para>L' = L<superscript>1/2.6</superscript></para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+          <term>Inverse Transfer function:</term>
+         <listitem>
+            <para>L = L'<superscript>2.6</superscript></para>
+         </listitem>
+       </varlistentry>
+      </variablelist>
+      <para>Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.</para>
+    </section>
+
     <section id="col-smpte-240m">
       <title>Colorspace SMPTE 240M (<constant>V4L2_COLORSPACE_SMPTE240M</constant>)</title>
       <para>The <xref linkend="smpte240m" /> standard was an interim standard used during
@@ -1402,6 +1476,41 @@ and <constant>V4L2_QUANTIZATION_FULL_RANGE</constant>.</para>
 
   </section>
 
+  <section>
+    <title>Detailed Transfer Function Descriptions</title>
+    <section id="xf-smpte-2084">
+      <title>Transfer Function SMPTE 2084 (<constant>V4L2_XFER_FUNC_SMPTE2084</constant>)</title>
+      <para>The <xref linkend="smpte2084" /> standard defines the transfer function used by
+High Dynamic Range content.</para>
+      <variablelist>
+       <varlistentry>
+          <term>Constants:</term>
+         <listitem>
+            <para>m1 = (2610 / 4096) / 4</para>
+            <para>m2 = (2523 / 4096) * 128</para>
+            <para>c1 = 3424 / 4096</para>
+            <para>c2 = (2413 / 4096) * 32</para>
+            <para>c3 = (2392 / 4096) * 32</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+          <term>Transfer function:</term>
+         <listitem>
+            <para>L' = ((c1 + c2 * L<superscript>m1</superscript>) / (1 + c3 * L<superscript>m1</superscript>))<superscript>m2</superscript></para>
+         </listitem>
+       </varlistentry>
+      </variablelist>
+      <variablelist>
+       <varlistentry>
+          <term>Inverse Transfer function:</term>
+         <listitem>
+            <para>L = (max(L'<superscript>1/m2</superscript> - c1, 0) / (c2 - c3 * L'<superscript>1/m2</superscript>))<superscript>1/m1</superscript></para>
+         </listitem>
+       </varlistentry>
+      </variablelist>
+    </section>
+  </section>
+
   <section id="pixfmt-indexed">
     <title>Indexed Format</title>
 
@@ -1623,7 +1732,7 @@ extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see
   <section id="sdr-formats">
     <title>SDR Formats</title>
 
-    <para>These formats are used for <link linkend="sdr">SDR Capture</link>
+    <para>These formats are used for <link linkend="sdr">SDR</link>
 interface only.</para>
 
     &sub-sdr-cu08;
index e98caa1..7e61643 100644 (file)
@@ -151,9 +151,18 @@ Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab,
 structs, ioctls) must be noted in more detail in the history chapter
 (compat.xml), along with the possible impact on existing drivers and
 applications. -->
+      <revision>
+       <revnumber>4.4</revnumber>
+       <date>2015-05-26</date>
+       <authorinitials>ap</authorinitials>
+       <revremark>Renamed V4L2_TUNER_ADC to V4L2_TUNER_SDR.
+Added V4L2_CID_RF_TUNER_RF_GAIN control.
+Added transmitter support for Software Defined Radio (SDR) Interface.
+       </revremark>
+      </revision>
 
       <revision>
-       <revnumber>3.21</revnumber>
+       <revnumber>4.1</revnumber>
        <date>2015-02-13</date>
        <authorinitials>mcc</authorinitials>
        <revremark>Fix documentation for media controller device nodes and add support for DVB device nodes.
@@ -557,7 +566,7 @@ and discussions on the V4L mailing list.</revremark>
 </partinfo>
 
 <title>Video for Linux Two API Specification</title>
- <subtitle>Revision 3.19</subtitle>
+ <subtitle>Revision 4.4</subtitle>
 
   <chapter id="common">
     &sub-common;
index fc1d462..70a4a08 100644 (file)
@@ -130,7 +130,7 @@ encoding will continue until the end of the current <wordasword>Group
 Of Pictures</wordasword>, otherwise encoding will stop immediately.
 When the encoder is already stopped, this command does
 nothing. mem2mem encoders will send a <constant>V4L2_EVENT_EOS</constant> event
-when the last frame has been decoded and all frames are ready to be dequeued and
+when the last frame has been encoded and all frames are ready to be dequeued and
 will set the <constant>V4L2_BUF_FLAG_LAST</constant> buffer flag on the last
 buffer of the capture queue to indicate there will be no new buffers produced to
 dequeue. This buffer may be empty, indicated by the driver setting the
index c5bdbfc..842536a 100644 (file)
@@ -197,6 +197,13 @@ Valid if this control is of type <constant>V4L2_CTRL_TYPE_U8</constant>.</entry>
            <entry><structfield>p_u16</structfield></entry>
            <entry>A pointer to a matrix control of unsigned 16-bit values.
 Valid if this control is of type <constant>V4L2_CTRL_TYPE_U16</constant>.</entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>__u32 *</entry>
+           <entry><structfield>p_u32</structfield></entry>
+           <entry>A pointer to a matrix control of unsigned 32-bit values.
+Valid if this control is of type <constant>V4L2_CTRL_TYPE_U32</constant>.</entry>
          </row>
          <row>
            <entry></entry>
index 4fe19a7..ffcb448 100644 (file)
@@ -175,7 +175,7 @@ capture and output devices.</entry>
            <entry>&v4l2-sdr-format;</entry>
            <entry><structfield>sdr</structfield></entry>
            <entry>Definition of a data format, see
-<xref linkend="pixfmt" />, used by SDR capture devices.</entry>
+<xref linkend="pixfmt" />, used by SDR capture and output devices.</entry>
          </row>
          <row>
            <entry></entry>
index 7068b59..96e17b3 100644 (file)
@@ -78,6 +78,12 @@ different audio modulation if the request cannot be satisfied. However
 this is a write-only ioctl, it does not return the actual audio
 modulation selected.</para>
 
+    <para><link linkend="sdr">SDR</link> specific modulator types are
+<constant>V4L2_TUNER_SDR</constant> and <constant>V4L2_TUNER_RF</constant>.
+For SDR devices <structfield>txsubchans</structfield> field must be
+initialized to zero.
+The term 'modulator' means SDR transmitter in this context.</para>
+
     <para>To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl
 is available.</para>
 
@@ -140,7 +146,13 @@ indicator, for example a stereo pilot tone.</entry>
          </row>
          <row>
            <entry>__u32</entry>
-           <entry><structfield>reserved</structfield>[4]</entry>
+           <entry><structfield>type</structfield></entry>
+           <entry spanname="hspan">Type of the modulator, see <xref
+               linkend="v4l2-tuner-type" />.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>reserved</structfield>[3]</entry>
            <entry>Reserved for future extensions. Drivers and
 applications must set the array to zero.</entry>
          </row>
index b0d8659..459b7e5 100644 (file)
@@ -80,6 +80,12 @@ if the requested mode is invalid or unsupported. Since this is a
 <!-- FIXME -->write-only ioctl, it does not return the actually
 selected audio mode.</para>
 
+    <para><link linkend="sdr">SDR</link> specific tuner types are
+<constant>V4L2_TUNER_SDR</constant> and <constant>V4L2_TUNER_RF</constant>.
+For SDR devices <structfield>audmode</structfield> field must be
+initialized to zero.
+The term 'tuner' means SDR receiver in this context.</para>
+
     <para>To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl
 is available.</para>
 
@@ -261,6 +267,16 @@ applications must set the array to zero.</entry>
            <entry>2</entry>
            <entry></entry>
          </row>
+         <row>
+           <entry><constant>V4L2_TUNER_SDR</constant></entry>
+           <entry>4</entry>
+           <entry></entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_TUNER_RF</constant></entry>
+           <entry>5</entry>
+           <entry></entry>
+         </row>
        </tbody>
       </tgroup>
     </table>
index 20fda75..cd82148 100644 (file)
@@ -306,6 +306,12 @@ modulator programming see
            <entry>0x00200000</entry>
            <entry>The device supports the &v4l2-pix-format; extended
 fields.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_CAP_SDR_OUTPUT</constant></entry>
+           <entry>0x00400000</entry>
+           <entry>The device supports the
+<link linkend="sdr">SDR Output</link> interface.</entry>
          </row>
          <row>
            <entry><constant>V4L2_CAP_READWRITE</constant></entry>
index 6ec39c6..55b7582 100644 (file)
@@ -101,8 +101,9 @@ prematurely end the enumeration).</para></footnote></para>
 next supported non-compound control, or <errorcode>EINVAL</errorcode>
 if there is none. In addition, the <constant>V4L2_CTRL_FLAG_NEXT_COMPOUND</constant>
 flag can be specified to enumerate all compound controls (i.e. controls
-with type &ge; <constant>V4L2_CTRL_COMPOUND_TYPES</constant>). Specify both
-<constant>V4L2_CTRL_FLAG_NEXT_CTRL</constant> and
+with type &ge; <constant>V4L2_CTRL_COMPOUND_TYPES</constant> and/or array
+control, in other words controls that contain more than one value).
+Specify both <constant>V4L2_CTRL_FLAG_NEXT_CTRL</constant> and
 <constant>V4L2_CTRL_FLAG_NEXT_COMPOUND</constant> in order to enumerate
 all controls, compound or not. Drivers which do not support these flags yet
 always return <errorcode>EINVAL</errorcode>.</para>
@@ -422,7 +423,7 @@ the array to zero.</entry>
            <entry>any</entry>
            <entry>An integer-valued control ranging from minimum to
 maximum inclusive. The step value indicates the increment between
-values which are actually different on the hardware.</entry>
+values.</entry>
          </row>
          <row>
            <entry><constant>V4L2_CTRL_TYPE_BOOLEAN</constant></entry>
@@ -518,7 +519,7 @@ Older drivers which do not support this feature return an
            <entry>any</entry>
            <entry>An unsigned 8-bit valued control ranging from minimum to
 maximum inclusive. The step value indicates the increment between
-values which are actually different on the hardware.
+values.
 </entry>
          </row>
          <row>
@@ -528,7 +529,17 @@ values which are actually different on the hardware.
            <entry>any</entry>
            <entry>An unsigned 16-bit valued control ranging from minimum to
 maximum inclusive. The step value indicates the increment between
-values which are actually different on the hardware.
+values.
+</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_CTRL_TYPE_U32</constant></entry>
+           <entry>any</entry>
+           <entry>any</entry>
+           <entry>any</entry>
+           <entry>An unsigned 32-bit valued control ranging from minimum to
+maximum inclusive. The step value indicates the increment between
+values.
 </entry>
          </row>
        </tbody>
index f3f5fe5..9203703 100644 (file)
@@ -38,7 +38,7 @@
        <title>LINUX MEDIA INFRASTRUCTURE API</title>
 
        <copyright>
-               <year>2009-2014</year>
+               <year>2009-2015</year>
                <holder>LinuxTV Developers</holder>
        </copyright>
 
index 4ef4563..38941db 100644 (file)
@@ -4,7 +4,8 @@ Required properties:
 
 - compatible   : should be one of:
                  "samsung,s5pv210-jpeg", "samsung,exynos4210-jpeg",
-                 "samsung,exynos3250-jpeg", "samsung,exynos5420-jpeg";
+                 "samsung,exynos3250-jpeg", "samsung,exynos5420-jpeg",
+                 "samsung,exynos5433-jpeg";
 - reg          : address and length of the JPEG codec IP register set;
 - interrupts   : specifies the JPEG codec IP interrupt;
 - clock-names   : should contain:
index f4b395b..2821020 100644 (file)
 192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
 193 -> WIS Voyager or compatible                [1905:7007]
 194 -> AverMedia AverTV/505                     [1461:a10a]
+195 -> Leadtek Winfast TV2100 FM                [107d:6f3a]
index 9c80c09..95ae828 100644 (file)
@@ -37,6 +37,7 @@
 #include <media/v4l2-dv-timings.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-event.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-contig.h>
 
 MODULE_DESCRIPTION("V4L2 PCI Skeleton Driver");
@@ -162,10 +163,11 @@ static irqreturn_t skeleton_irq(int irq, void *dev_id)
  * minimum number: many DMA engines need a minimum of 2 buffers in the
  * queue and you need to have another available for userspace processing.
  */
-static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *vq, const void *parg,
                       unsigned int *nbuffers, unsigned int *nplanes,
                       unsigned int sizes[], void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct skeleton *skel = vb2_get_drv_priv(vq);
 
        skel->field = skel->format.field;
index 1e1c3f8..ec70660 100644 (file)
@@ -1499,6 +1499,14 @@ L:       linux-media@vger.kernel.org
 S:     Maintained
 F:     drivers/media/platform/s5p-tv/
 
+ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT
+M:     Andrzej Pietrasiewicz <andrzej.p@samsung.com>
+M:     Jacek Anaszewski <j.anaszewski@samsung.com>
+L:     linux-arm-kernel@lists.infradead.org
+L:     linux-media@vger.kernel.org
+S:     Maintained
+F:     drivers/media/platform/s5p-jpeg/
+
 ARM/SHMOBILE ARM ARCHITECTURE
 M:     Simon Horman <horms@verge.net.au>
 M:     Magnus Damm <magnus.damm@gmail.com>
index 3f11763..d214f22 100644 (file)
@@ -38,6 +38,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 /* read 512 bytes from endpoint 0x86 -> get header + blobs */
@@ -163,7 +164,7 @@ struct sur40_state {
 };
 
 struct sur40_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
@@ -420,7 +421,7 @@ static void sur40_process_video(struct sur40_state *sur40)
 
        dev_dbg(sur40->dev, "header acquired\n");
 
-       sgt = vb2_dma_sg_plane_desc(&new_buf->vb, 0);
+       sgt = vb2_dma_sg_plane_desc(&new_buf->vb.vb2_buf, 0);
 
        result = usb_sg_init(&sgr, sur40->usbdev,
                usb_rcvbulkpipe(sur40->usbdev, VIDEO_ENDPOINT), 0,
@@ -443,15 +444,15 @@ static void sur40_process_video(struct sur40_state *sur40)
                goto err_poll;
 
        /* mark as finished */
-       v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp);
-       new_buf->vb.v4l2_buf.sequence = sur40->sequence++;
-       new_buf->vb.v4l2_buf.field = V4L2_FIELD_NONE;
-       vb2_buffer_done(&new_buf->vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&new_buf->vb.timestamp);
+       new_buf->vb.sequence = sur40->sequence++;
+       new_buf->vb.field = V4L2_FIELD_NONE;
+       vb2_buffer_done(&new_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        dev_dbg(sur40->dev, "buffer marked done\n");
        return;
 
 err_poll:
-       vb2_buffer_done(&new_buf->vb, VB2_BUF_STATE_ERROR);
+       vb2_buffer_done(&new_buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
 }
 
 /* Initialize input device parameters. */
@@ -643,10 +644,11 @@ static void sur40_disconnect(struct usb_interface *interface)
  * minimum number: many DMA engines need a minimum of 2 buffers in the
  * queue and you need to have another available for userspace processing.
  */
-static int sur40_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int sur40_queue_setup(struct vb2_queue *q, const void *parg,
                       unsigned int *nbuffers, unsigned int *nplanes,
                       unsigned int sizes[], void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct sur40_state *sur40 = vb2_get_drv_priv(q);
 
        if (q->num_buffers + *nbuffers < 3)
@@ -701,7 +703,7 @@ static void return_all_buffers(struct sur40_state *sur40,
 
        spin_lock(&sur40->qlock);
        list_for_each_entry_safe(buf, node, &sur40->buf_list, list) {
-               vb2_buffer_done(&buf->vb, state);
+               vb2_buffer_done(&buf->vb.vb2_buf, state);
                list_del(&buf->list);
        }
        spin_unlock(&sur40->qlock);
index 833191b..ccc1f43 100644 (file)
@@ -32,9 +32,9 @@
 #include <linux/time.h>
 #include <linux/dvb/dmx.h>
 
-/*--------------------------------------------------------------------------*/
-/* Common definitions */
-/*--------------------------------------------------------------------------*/
+/*
+ * Common definitions
+ */
 
 /*
  * DMX_MAX_FILTER_SIZE: Maximum length (in bytes) of a section/PES filter.
@@ -45,7 +45,8 @@
 #endif
 
 /*
- * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter.
+ * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed
+ * filter.
  */
 
 #ifndef DMX_MAX_SECTION_SIZE
 #define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
 #endif
 
-
 /*
- * enum dmx_success: Success codes for the Demux Callback API.
+ * TS packet reception
  */
 
-enum dmx_success {
-  DMX_OK = 0, /* Received Ok */
-  DMX_LENGTH_ERROR, /* Incorrect length */
-  DMX_OVERRUN_ERROR, /* Receiver ring buffer overrun */
-  DMX_CRC_ERROR, /* Incorrect CRC */
-  DMX_FRAME_ERROR, /* Frame alignment error */
-  DMX_FIFO_ERROR, /* Receiver FIFO overrun */
-  DMX_MISSED_ERROR /* Receiver missed packet */
-} ;
-
-/*--------------------------------------------------------------------------*/
-/* TS packet reception */
-/*--------------------------------------------------------------------------*/
-
-/* TS filter type for set() */
-
-#define TS_PACKET       1   /* send TS packets (188 bytes) to callback (default) */
-#define        TS_PAYLOAD_ONLY 2   /* in case TS_PACKET is set, only send the TS
-                              payload (<=184 bytes per packet) to callback */
-#define TS_DECODER      4   /* send stream to built-in decoder (if present) */
-#define TS_DEMUX        8   /* in case TS_PACKET is set, send the TS to
-                              the demux device, not to the dvr device */
+/**
+ * enum ts_filter_type - filter type bitmap for dmx_ts_feed.set()
+ *
+ * @TS_PACKET:         Send TS packets (188 bytes) to callback (default).
+ * @TS_PAYLOAD_ONLY:   In case TS_PACKET is set, only send the TS payload
+ *                     (<=184 bytes per packet) to callback
+ * @TS_DECODER:                Send stream to built-in decoder (if present).
+ * @TS_DEMUX:          In case TS_PACKET is set, send the TS to the demux
+ *                     device, not to the dvr device
+ */
+enum ts_filter_type {
+       TS_PACKET = 1,
+       TS_PAYLOAD_ONLY = 2,
+       TS_DECODER = 4,
+       TS_DEMUX = 8,
+};
 
+/**
+ * struct dmx_ts_feed - Structure that contains a TS feed filter
+ *
+ * @is_filtering:      Set to non-zero when filtering in progress
+ * @parent:            pointer to struct dmx_demux
+ * @priv:              pointer to private data of the API client
+ * @set:               sets the TS filter
+ * @start_filtering:   starts TS filtering
+ * @stop_filtering:    stops TS filtering
+ *
+ * A TS feed is typically mapped to a hardware PID filter on the demux chip.
+ * Using this API, the client can set the filtering properties to start/stop
+ * filtering TS packets on a particular TS feed.
+ */
 struct dmx_ts_feed {
-       int is_filtering; /* Set to non-zero when filtering in progress */
-       struct dmx_demux *parent; /* Back-pointer */
-       void *priv; /* Pointer to private data of the API client */
-       int (*set) (struct dmx_ts_feed *feed,
-                   u16 pid,
-                   int type,
-                   enum dmx_ts_pes pes_type,
-                   size_t circular_buffer_size,
-                   struct timespec timeout);
-       int (*start_filtering) (struct dmx_ts_feed* feed);
-       int (*stop_filtering) (struct dmx_ts_feed* feed);
+       int is_filtering;
+       struct dmx_demux *parent;
+       void *priv;
+       int (*set)(struct dmx_ts_feed *feed,
+                  u16 pid,
+                  int type,
+                  enum dmx_ts_pes pes_type,
+                  size_t circular_buffer_size,
+                  struct timespec timeout);
+       int (*start_filtering)(struct dmx_ts_feed *feed);
+       int (*stop_filtering)(struct dmx_ts_feed *feed);
 };
 
-/*--------------------------------------------------------------------------*/
-/* Section reception */
-/*--------------------------------------------------------------------------*/
+/*
+ * Section reception
+ */
 
+/**
+ * struct dmx_section_filter - Structure that describes a section filter
+ *
+ * @filter_value: Contains up to 16 bytes (128 bits) of the TS section header
+ *               that will be matched by the section filter
+ * @filter_mask:  Contains a 16 bytes (128 bits) filter mask with the bits
+ *               specified by @filter_value that will be used on the filter
+ *               match logic.
+ * @filter_mode:  Contains a 16 bytes (128 bits) filter mode.
+ * @parent:      Pointer to struct dmx_section_feed.
+ * @priv:        Pointer to private data of the API client.
+ *
+ *
+ * The @filter_mask controls which bits of @filter_value are compared with
+ * the section headers/payload. On a binary value of 1 in filter_mask, the
+ * corresponding bits are compared. The filter only accepts sections that are
+ * equal to filter_value in all the tested bit positions.
+ */
 struct dmx_section_filter {
-       u8 filter_value [DMX_MAX_FILTER_SIZE];
-       u8 filter_mask [DMX_MAX_FILTER_SIZE];
-       u8 filter_mode [DMX_MAX_FILTER_SIZE];
-       struct dmx_section_feedparent; /* Back-pointer */
-       voidpriv; /* Pointer to private data of the API client */
+       u8 filter_value[DMX_MAX_FILTER_SIZE];
+       u8 filter_mask[DMX_MAX_FILTER_SIZE];
+       u8 filter_mode[DMX_MAX_FILTER_SIZE];
+       struct dmx_section_feed *parent; /* Back-pointer */
+       void *priv; /* Pointer to private data of the API client */
 };
 
+/**
+ * struct dmx_section_feed - Structure that contains a section feed filter
+ *
+ * @is_filtering:      Set to non-zero when filtering in progress
+ * @parent:            pointer to struct dmx_demux
+ * @priv:              pointer to private data of the API client
+ * @check_crc:         If non-zero, check the CRC values of filtered sections.
+ * @set:               sets the section filter
+ * @allocate_filter:   This function is used to allocate a section filter on
+ *                     the demux. It should only be called when no filtering
+ *                     is in progress on this section feed. If a filter cannot
+ *                     be allocated, the function fails with -ENOSPC.
+ * @release_filter:    This function releases all the resources of a
+ *                     previously allocated section filter. The function
+ *                     should not be called while filtering is in progress
+ *                     on this section feed. After calling this function,
+ *                     the caller should not try to dereference the filter
+ *                     pointer.
+ * @start_filtering:   starts section filtering
+ * @stop_filtering:    stops section filtering
+ *
+ * A TS feed is typically mapped to a hardware PID filter on the demux chip.
+ * Using this API, the client can set the filtering properties to start/stop
+ * filtering TS packets on a particular TS feed.
+ */
 struct dmx_section_feed {
-       int is_filtering; /* Set to non-zero when filtering in progress */
-       struct dmx_demux* parent; /* Back-pointer */
-       void* priv; /* Pointer to private data of the API client */
+       int is_filtering;
+       struct dmx_demux *parent;
+       void *priv;
 
        int check_crc;
+
+       /* private: Used internally at dvb_demux.c */
        u32 crc_val;
 
        u8 *secbuf;
        u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
        u16 secbufp, seclen, tsfeedp;
 
-       int (*set) (struct dmx_section_feed* feed,
-                   u16 pid,
-                   size_t circular_buffer_size,
-                   int check_crc);
-       int (*allocate_filter) (struct dmx_section_feed* feed,
-                               struct dmx_section_filter** filter);
-       int (*release_filter) (struct dmx_section_feed* feed,
-                              struct dmx_section_filter* filter);
-       int (*start_filtering) (struct dmx_section_feed* feed);
-       int (*stop_filtering) (struct dmx_section_feed* feed);
+       /* public: */
+       int (*set)(struct dmx_section_feed *feed,
+                  u16 pid,
+                  size_t circular_buffer_size,
+                  int check_crc);
+       int (*allocate_filter)(struct dmx_section_feed *feed,
+                              struct dmx_section_filter **filter);
+       int (*release_filter)(struct dmx_section_feed *feed,
+                             struct dmx_section_filter *filter);
+       int (*start_filtering)(struct dmx_section_feed *feed);
+       int (*stop_filtering)(struct dmx_section_feed *feed);
 };
 
-/*--------------------------------------------------------------------------*/
-/* Callback functions */
-/*--------------------------------------------------------------------------*/
-
-typedef int (*dmx_ts_cb) ( const u8 * buffer1,
-                          size_t buffer1_length,
-                          const u8 * buffer2,
-                          size_t buffer2_length,
-                          struct dmx_ts_feed* source,
-                          enum dmx_success success);
+/*
+ * Callback functions
+ */
 
-typedef int (*dmx_section_cb) (        const u8 * buffer1,
-                               size_t buffer1_len,
-                               const u8 * buffer2,
-                               size_t buffer2_len,
-                               struct dmx_section_filter * source,
-                               enum dmx_success success);
+/**
+ * typedef dmx_ts_cb - DVB demux TS filter callback function prototype
+ *
+ * @buffer1:           Pointer to the start of the filtered TS packets.
+ * @buffer1_length:    Length of the TS data in buffer1.
+ * @buffer2:           Pointer to the tail of the filtered TS packets, or NULL.
+ * @buffer2_length:    Length of the TS data in buffer2.
+ * @source:            Indicates which TS feed is the source of the callback.
+ *
+ * This function callback prototype, provided by the client of the demux API,
+ * is called from the demux code. The function is only called when filtering
+ * on ae TS feed has been enabled using the start_filtering() function at
+ * the &dmx_demux.
+ * Any TS packets that match the filter settings are copied to a circular
+ * buffer. The filtered TS packets are delivered to the client using this
+ * callback function. The size of the circular buffer is controlled by the
+ * circular_buffer_size parameter of the &dmx_ts_feed.@set function.
+ * It is expected that the @buffer1 and @buffer2 callback parameters point to
+ * addresses within the circular buffer, but other implementations are also
+ * possible. Note that the called party should not try to free the memory
+ * the @buffer1 and @buffer2 parameters point to.
+ *
+ * When this function is called, the @buffer1 parameter typically points to
+ * the start of the first undelivered TS packet within a circular buffer.
+ * The @buffer2 buffer parameter is normally NULL, except when the received
+ * TS packets have crossed the last address of the circular buffer and
+ * ”wrapped” to the beginning of the buffer. In the latter case the @buffer1
+ * parameter would contain an address within the circular buffer, while the
+ * @buffer2 parameter would contain the first address of the circular buffer.
+ * The number of bytes delivered with this function (i.e. @buffer1_length +
+ * @buffer2_length) is usually equal to the value of callback_length parameter
+ * given in the set() function, with one exception: if a timeout occurs before
+ * receiving callback_length bytes of TS data, any undelivered packets are
+ * immediately delivered to the client by calling this function. The timeout
+ * duration is controlled by the set() function in the TS Feed API.
+ *
+ * If a TS packet is received with errors that could not be fixed by the
+ * TS-level forward error correction (FEC), the Transport_error_indicator
+ * flag of the TS packet header should be set. The TS packet should not be
+ * discarded, as the error can possibly be corrected by a higher layer
+ * protocol. If the called party is slow in processing the callback, it
+ * is possible that the circular buffer eventually fills up. If this happens,
+ * the demux driver should discard any TS packets received while the buffer
+ * is full and return -EOVERFLOW.
+ *
+ * The type of data returned to the callback can be selected by the
+ * &dmx_ts_feed.@set function. The type parameter decides if the raw
+ * TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY)
+ * should be returned. If additionally the TS_DECODER bit is set the stream
+ * will also be sent to the hardware MPEG decoder.
+ *
+ * Return:
+ *     0, on success;
+ *     -EOVERFLOW, on buffer overflow.
+ */
+typedef int (*dmx_ts_cb)(const u8 *buffer1,
+                        size_t buffer1_length,
+                        const u8 *buffer2,
+                        size_t buffer2_length,
+                        struct dmx_ts_feed *source);
+
+/**
+ * typedef dmx_section_cb - DVB demux TS filter callback function prototype
+ *
+ * @buffer1:           Pointer to the start of the filtered section, e.g.
+ *                     within the circular buffer of the demux driver.
+ * @buffer1_len:       Length of the filtered section data in @buffer1,
+ *                     including headers and CRC.
+ * @buffer2:           Pointer to the tail of the filtered section data,
+ *                     or NULL. Useful to handle the wrapping of a
+ *                     circular buffer.
+ * @buffer2_len:       Length of the filtered section data in @buffer2,
+ *                     including headers and CRC.
+ * @source:            Indicates which section feed is the source of the
+ *                     callback.
+ *
+ * This function callback prototype, provided by the client of the demux API,
+ * is called from the demux code. The function is only called when
+ * filtering of sections has been enabled using the function
+ * &dmx_ts_feed.@start_filtering. When the demux driver has received a
+ * complete section that matches at least one section filter, the client
+ * is notified via this callback function. Normally this function is called
+ * for each received section; however, it is also possible to deliver
+ * multiple sections with one callback, for example when the system load
+ * is high. If an error occurs while receiving a section, this
+ * function should be called with the corresponding error type set in the
+ * success field, whether or not there is data to deliver. The Section Feed
+ * implementation should maintain a circular buffer for received sections.
+ * However, this is not necessary if the Section Feed API is implemented as
+ * a client of the TS Feed API, because the TS Feed implementation then
+ * buffers the received data. The size of the circular buffer can be
+ * configured using the &dmx_ts_feed.@set function in the Section Feed API.
+ * If there is no room in the circular buffer when a new section is received,
+ * the section must be discarded. If this happens, the value of the success
+ * parameter should be DMX_OVERRUN_ERROR on the next callback.
+ */
+typedef int (*dmx_section_cb)(const u8 *buffer1,
+                             size_t buffer1_len,
+                             const u8 *buffer2,
+                             size_t buffer2_len,
+                             struct dmx_section_filter *source);
 
 /*--------------------------------------------------------------------------*/
 /* DVB Front-End */
 /*--------------------------------------------------------------------------*/
 
+/**
+ * enum dmx_frontend_source - Used to identify the type of frontend
+ *
+ * @DMX_MEMORY_FE:     The source of the demux is memory. It means that
+ *                     the MPEG-TS to be filtered comes from userspace,
+ *                     via write() syscall.
+ *
+ * @DMX_FRONTEND_0:    The source of the demux is a frontend connected
+ *                     to the demux.
+ */
 enum dmx_frontend_source {
        DMX_MEMORY_FE,
        DMX_FRONTEND_0,
-       DMX_FRONTEND_1,
-       DMX_FRONTEND_2,
-       DMX_FRONTEND_3,
-       DMX_STREAM_0,    /* external stream input, e.g. LVDS */
-       DMX_STREAM_1,
-       DMX_STREAM_2,
-       DMX_STREAM_3
 };
 
+/**
+ * struct dmx_frontend - Structure that lists the frontends associated with
+ *                      a demux
+ *
+ * @connectivity_list: List of front-ends that can be connected to a
+ *                     particular demux;
+ * @source:            Type of the frontend.
+ *
+ * FIXME: this structure should likely be replaced soon by some
+ *     media-controller based logic.
+ */
 struct dmx_frontend {
-       struct list_head connectivity_list; /* List of front-ends that can
-                                              be connected to a particular
-                                              demux */
+       struct list_head connectivity_list;
        enum dmx_frontend_source source;
 };
 
-/*--------------------------------------------------------------------------*/
-/* MPEG-2 TS Demux */
-/*--------------------------------------------------------------------------*/
-
 /*
- * Flags OR'ed in the capabilities field of struct dmx_demux.
+ * MPEG-2 TS Demux
  */
 
-#define DMX_TS_FILTERING                        1
-#define DMX_PES_FILTERING                       2
-#define DMX_SECTION_FILTERING                   4
-#define DMX_MEMORY_BASED_FILTERING              8    /* write() available */
-#define DMX_CRC_CHECKING                        16
-#define DMX_TS_DESCRAMBLING                     32
+/**
+ * enum dmx_demux_caps - MPEG-2 TS Demux capabilities bitmap
+ *
+ * @DMX_TS_FILTERING:          set if TS filtering is supported;
+ * @DMX_SECTION_FILTERING:     set if section filtering is supported;
+ * @DMX_MEMORY_BASED_FILTERING:        set if write() available.
+ *
+ * Those flags are OR'ed in the &dmx_demux.&capabilities field
+ */
+enum dmx_demux_caps {
+       DMX_TS_FILTERING = 1,
+       DMX_SECTION_FILTERING = 4,
+       DMX_MEMORY_BASED_FILTERING = 8,
+};
 
 /*
  * Demux resource type identifier.
@@ -200,42 +358,241 @@ struct dmx_frontend {
  *.
 */
 
-#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list)
+#define DMX_FE_ENTRY(list) \
+       list_entry(list, struct dmx_frontend, connectivity_list)
+
+/**
+ * struct dmx_demux - Structure that contains the demux capabilities and
+ *                   callbacks.
+ *
+ * @capabilities: Bitfield of capability flags.
+ *
+ * @frontend: Front-end connected to the demux
+ *
+ * @priv: Pointer to private data of the API client
+ *
+ * @open: This function reserves the demux for use by the caller and, if
+ *     necessary, initializes the demux. When the demux is no longer needed,
+ *     the function @close should be called. It should be possible for
+ *     multiple clients to access the demux at the same time. Thus, the
+ *     function implementation should increment the demux usage count when
+ *     @open is called and decrement it when @close is called.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EUSERS, if maximum usage count was reached;
+ *             -EINVAL, on bad parameter.
+ *
+ * @close: This function reserves the demux for use by the caller and, if
+ *     necessary, initializes the demux. When the demux is no longer needed,
+ *     the function @close should be called. It should be possible for
+ *     multiple clients to access the demux at the same time. Thus, the
+ *     function implementation should increment the demux usage count when
+ *     @open is called and decrement it when @close is called.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -ENODEV, if demux was not in use (e. g. no users);
+ *             -EINVAL, on bad parameter.
+ *
+ * @write: This function provides the demux driver with a memory buffer
+ *     containing TS packets. Instead of receiving TS packets from the DVB
+ *     front-end, the demux driver software will read packets from memory.
+ *     Any clients of this demux with active TS, PES or Section filters will
+ *     receive filtered data via the Demux callback API (see 0). The function
+ *     returns when all the data in the buffer has been consumed by the demux.
+ *     Demux hardware typically cannot read TS from memory. If this is the
+ *     case, memory-based filtering has to be implemented entirely in software.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @buf function parameter contains a pointer to the TS data in
+ *     kernel-space memory.
+ *     The @count function parameter contains the length of the TS data.
+ *     It returns
+ *             0 on success;
+ *             -ERESTARTSYS, if mutex lock was interrupted;
+ *             -EINTR, if a signal handling is pending;
+ *             -ENODEV, if demux was removed;
+ *             -EINVAL, on bad parameter.
+ *
+ * @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS
+ *     packets carrying a certain PID. The TS feed normally corresponds to a
+ *     hardware PID filter on the demux chip.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @feed function parameter contains a pointer to the TS feed API and
+ *     instance data.
+ *     The @callback function parameter contains a pointer to the callback
+ *     function for passing received TS packet.
+ *     It returns
+ *             0 on success;
+ *             -ERESTARTSYS, if mutex lock was interrupted;
+ *             -EBUSY, if no more TS feeds is available;
+ *             -EINVAL, on bad parameter.
+ *
+ * @release_ts_feed: Releases the resources allocated with @allocate_ts_feed.
+ *     Any filtering in progress on the TS feed should be stopped before
+ *     calling this function.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @feed function parameter contains a pointer to the TS feed API and
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL on bad parameter.
+ *
+ * @allocate_section_feed: Allocates a new section feed, i.e. a demux resource
+ *     for filtering and receiving sections. On platforms with hardware
+ *     support for section filtering, a section feed is directly mapped to
+ *     the demux HW. On other platforms, TS packets are first PID filtered in
+ *     hardware and a hardware section filter then emulated in software. The
+ *     caller obtains an API pointer of type dmx_section_feed_t as an out
+ *     parameter. Using this API the caller can set filtering parameters and
+ *     start receiving sections.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @feed function parameter contains a pointer to the TS feed API and
+ *     instance data.
+ *     The @callback function parameter contains a pointer to the callback
+ *     function for passing received TS packet.
+ *     It returns
+ *             0 on success;
+ *             -EBUSY, if no more TS feeds is available;
+ *             -EINVAL, on bad parameter.
+ *
+ * @release_section_feed: Releases the resources allocated with
+ *     @allocate_section_feed, including allocated filters. Any filtering in
+ *     progress on the section feed should be stopped before calling this
+ *     function.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @feed function parameter contains a pointer to the TS feed API and
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL, on bad parameter.
+ *
+ * @add_frontend: Registers a connectivity between a demux and a front-end,
+ *     i.e., indicates that the demux can be connected via a call to
+ *     @connect_frontend to use the given front-end as a TS source. The
+ *     client of this function has to allocate dynamic or static memory for
+ *     the frontend structure and initialize its fields before calling this
+ *     function. This function is normally called during the driver
+ *     initialization. The caller must not free the memory of the frontend
+ *     struct before successfully calling @remove_frontend.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @frontend function parameter contains a pointer to the front-end
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL, on bad parameter.
+ *
+ * @remove_frontend: Indicates that the given front-end, registered by a call
+ *     to @add_frontend, can no longer be connected as a TS source by this
+ *     demux. The function should be called when a front-end driver or a demux
+ *     driver is removed from the system. If the front-end is in use, the
+ *     function fails with the return value of -EBUSY. After successfully
+ *     calling this function, the caller can free the memory of the frontend
+ *     struct if it was dynamically allocated before the @add_frontend
+ *     operation.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @frontend function parameter contains a pointer to the front-end
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -ENODEV, if the front-end was not found,
+ *             -EINVAL, on bad parameter.
+ *
+ * @get_frontends: Provides the APIs of the front-ends that have been
+ *     registered for this demux. Any of the front-ends obtained with this
+ *     call can be used as a parameter for @connect_frontend. The include
+ *     file demux.h contains the macro DMX_FE_ENTRY() for converting an
+ *     element of the generic type struct &list_head * to the type
+ *     struct &dmx_frontend *. The caller must not free the memory of any of
+ *     the elements obtained via this function call.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     It returns a struct list_head pointer to the list of front-end
+ *     interfaces, or NULL in the case of an empty list.
+ *
+ * @connect_frontend: Connects the TS output of the front-end to the input of
+ *     the demux. A demux can only be connected to a front-end registered to
+ *     the demux with the function @add_frontend. It may or may not be
+ *     possible to connect multiple demuxes to the same front-end, depending
+ *     on the capabilities of the HW platform. When not used, the front-end
+ *     should be released by calling @disconnect_frontend.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @frontend function parameter contains a pointer to the front-end
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL, on bad parameter.
+ *
+ * @disconnect_frontend: Disconnects the demux and a front-end previously
+ *     connected by a @connect_frontend call.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL on bad parameter.
+ *
+ * @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
+ *     DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
+ *     The @demux function parameter contains a pointer to the demux API and
+ *     instance data.
+ *     The @pids function parameter contains an array with five u16 elements
+ *     where the PIDs will be stored.
+ *     It returns
+ *             0 on success;
+ *             -EINVAL on bad parameter.
+ */
 
 struct dmx_demux {
-       u32 capabilities;            /* Bitfield of capability flags */
-       struct dmx_frontend* frontend;    /* Front-end connected to the demux */
-       void* priv;                  /* Pointer to private data of the API client */
-       int (*open) (struct dmx_demux* demux);
-       int (*close) (struct dmx_demux* demux);
-       int (*write) (struct dmx_demux* demux, const char __user *buf, size_t count);
-       int (*allocate_ts_feed) (struct dmx_demux* demux,
-                                struct dmx_ts_feed** feed,
-                                dmx_ts_cb callback);
-       int (*release_ts_feed) (struct dmx_demux* demux,
-                               struct dmx_ts_feed* feed);
-       int (*allocate_section_feed) (struct dmx_demux* demux,
-                                     struct dmx_section_feed** feed,
-                                     dmx_section_cb callback);
-       int (*release_section_feed) (struct dmx_demux* demux,
-                                    struct dmx_section_feed* feed);
-       int (*add_frontend) (struct dmx_demux* demux,
-                            struct dmx_frontend* frontend);
-       int (*remove_frontend) (struct dmx_demux* demux,
-                               struct dmx_frontend* frontend);
-       struct list_head* (*get_frontends) (struct dmx_demux* demux);
-       int (*connect_frontend) (struct dmx_demux* demux,
-                                struct dmx_frontend* frontend);
-       int (*disconnect_frontend) (struct dmx_demux* demux);
-
-       int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids);
-
-       int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps);
-
-       int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src);
-
-       int (*get_stc) (struct dmx_demux* demux, unsigned int num,
-                       u64 *stc, unsigned int *base);
+       enum dmx_demux_caps capabilities;
+       struct dmx_frontend *frontend;
+       void *priv;
+       int (*open)(struct dmx_demux *demux);
+       int (*close)(struct dmx_demux *demux);
+       int (*write)(struct dmx_demux *demux, const char __user *buf,
+                    size_t count);
+       int (*allocate_ts_feed)(struct dmx_demux *demux,
+                               struct dmx_ts_feed **feed,
+                               dmx_ts_cb callback);
+       int (*release_ts_feed)(struct dmx_demux *demux,
+                              struct dmx_ts_feed *feed);
+       int (*allocate_section_feed)(struct dmx_demux *demux,
+                                    struct dmx_section_feed **feed,
+                                    dmx_section_cb callback);
+       int (*release_section_feed)(struct dmx_demux *demux,
+                                   struct dmx_section_feed *feed);
+       int (*add_frontend)(struct dmx_demux *demux,
+                           struct dmx_frontend *frontend);
+       int (*remove_frontend)(struct dmx_demux *demux,
+                              struct dmx_frontend *frontend);
+       struct list_head *(*get_frontends)(struct dmx_demux *demux);
+       int (*connect_frontend)(struct dmx_demux *demux,
+                               struct dmx_frontend *frontend);
+       int (*disconnect_frontend)(struct dmx_demux *demux);
+
+       int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids);
+
+       /* private: Not used upstream and never documented */
+#if 0
+       int (*get_caps)(struct dmx_demux *demux, struct dmx_caps *caps);
+       int (*set_source)(struct dmx_demux *demux, const dmx_source_t *src);
+#endif
+       /*
+        * private: Only used at av7110, to read some data from firmware.
+        *      As this was never documented, we have no clue about what's
+        *      there, and its usage on other drivers aren't encouraged.
+        */
+       int (*get_stc)(struct dmx_demux *demux, unsigned int num,
+                      u64 *stc, unsigned int *base);
 };
 
 #endif /* #ifndef __DEMUX_H */
index d0e3f9d..ea9abde 100644 (file)
@@ -352,8 +352,7 @@ static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter)
 
 static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
                                       const u8 *buffer2, size_t buffer2_len,
-                                      struct dmx_section_filter *filter,
-                                      enum dmx_success success)
+                                      struct dmx_section_filter *filter)
 {
        struct dmxdev_filter *dmxdevfilter = filter->priv;
        int ret;
@@ -386,8 +385,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
 
 static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
                                  const u8 *buffer2, size_t buffer2_len,
-                                 struct dmx_ts_feed *feed,
-                                 enum dmx_success success)
+                                 struct dmx_ts_feed *feed)
 {
        struct dmxdev_filter *dmxdevfilter = feed->priv;
        struct dvb_ringbuffer *buffer;
@@ -1023,6 +1021,9 @@ static int dvb_demux_do_ioctl(struct file *file,
                dmxdev->demux->get_pes_pids(dmxdev->demux, parg);
                break;
 
+#if 0
+       /* Not used upstream and never documented */
+
        case DMX_GET_CAPS:
                if (!dmxdev->demux->get_caps) {
                        ret = -EINVAL;
@@ -1038,6 +1039,7 @@ static int dvb_demux_do_ioctl(struct file *file,
                }
                ret = dmxdev->demux->set_source(dmxdev->demux, parg);
                break;
+#endif
 
        case DMX_GET_STC:
                if (!dmxdev->demux->get_stc) {
index c117fb3..0a46580 100644 (file)
 #define USB_PID_TERRATEC_CINERGY_T_XXS_2               0x00ab
 #define USB_PID_TERRATEC_H7                            0x10b4
 #define USB_PID_TERRATEC_H7_2                          0x10a3
+#define USB_PID_TERRATEC_H7_3                          0x10a5
 #define USB_PID_TERRATEC_T3                            0x10a0
 #define USB_PID_TERRATEC_T5                            0x10a1
 #define USB_PID_NOXON_DAB_STICK                                0x00b3
index aba3b4f..1e4bbbd 100644 (file)
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
 #ifndef _DVB_CA_EN50221_H_
 #define DVB_CA_EN50221_CAMCHANGE_REMOVED               0
 #define DVB_CA_EN50221_CAMCHANGE_INSERTED              1
 
-
-
-/* Structure describing a CA interface */
+/**
+ * struct dvb_ca_en50221- Structure describing a CA interface
+ *
+ * @owner:             the module owning this structure
+ * @read_attribute_mem:        function for reading attribute memory on the CAM
+ * @write_attribute_mem: function for writing attribute memory on the CAM
+ * @read_cam_control:  function for reading the control interface on the CAM
+ * @write_cam_control: function for reading the control interface on the CAM
+ * @slot_reset:                function to reset the CAM slot
+ * @slot_shutdown:     function to shutdown a CAM slot
+ * @slot_ts_enable:    function to enable the Transport Stream on a CAM slot
+ * @poll_slot_status:  function to poll slot status. Only necessary if
+ *                     DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.
+ * @data:              private data, used by caller.
+ * @private:           Opaque data used by the dvb_ca core. Do not modify!
+ *
+ * NOTE: the read_*, write_* and poll_slot_status functions will be
+ * called for different slots concurrently and need to use locks where
+ * and if appropriate. There will be no concurrent access to one slot.
+ */
 struct dvb_ca_en50221 {
+       struct module *owner;
 
-       /* the module owning this structure */
-       struct module* owner;
-
-       /* NOTE: the read_*, write_* and poll_slot_status functions will be
-        * called for different slots concurrently and need to use locks where
-        * and if appropriate. There will be no concurrent access to one slot.
-        */
+       int (*read_attribute_mem)(struct dvb_ca_en50221 *ca,
+                                 int slot, int address);
+       int (*write_attribute_mem)(struct dvb_ca_en50221 *ca,
+                                  int slot, int address, u8 value);
 
-       /* functions for accessing attribute memory on the CAM */
-       int (*read_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address);
-       int (*write_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address, u8 value);
+       int (*read_cam_control)(struct dvb_ca_en50221 *ca,
+                               int slot, u8 address);
+       int (*write_cam_control)(struct dvb_ca_en50221 *ca,
+                                int slot, u8 address, u8 value);
 
-       /* functions for accessing the control interface on the CAM */
-       int (*read_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address);
-       int (*write_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address, u8 value);
+       int (*slot_reset)(struct dvb_ca_en50221 *ca, int slot);
+       int (*slot_shutdown)(struct dvb_ca_en50221 *ca, int slot);
+       int (*slot_ts_enable)(struct dvb_ca_en50221 *ca, int slot);
 
-       /* Functions for controlling slots */
-       int (*slot_reset)(struct dvb_ca_en50221* ca, int slot);
-       int (*slot_shutdown)(struct dvb_ca_en50221* ca, int slot);
-       int (*slot_ts_enable)(struct dvb_ca_en50221* ca, int slot);
+       int (*poll_slot_status)(struct dvb_ca_en50221 *ca, int slot, int open);
 
-       /*
-       * Poll slot status.
-       * Only necessary if DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set
-       */
-       int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot, int open);
+       void *data;
 
-       /* private data, used by caller */
-       void* data;
-
-       /* Opaque data used by the dvb_ca core. Do not modify! */
-       void* private;
+       void *private;
 };
 
-
-
-
-/* ******************************************************************************** */
-/* Functions for reporting IRQ events */
+/*
+ * Functions for reporting IRQ events
+ */
 
 /**
  * dvb_ca_en50221_camchange_irq - A CAMCHANGE IRQ has occurred.
@@ -89,7 +88,8 @@ struct dvb_ca_en50221 {
  * @slot: Slot concerned.
  * @change_type: One of the DVB_CA_CAMCHANGE_* values
  */
-void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221* pubca, int slot, int change_type);
+void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221 *pubca, int slot,
+                                 int change_type);
 
 /**
  * dvb_ca_en50221_camready_irq - A CAMREADY IRQ has occurred.
@@ -97,7 +97,7 @@ void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221* pubca, int slot, int ch
  * @pubca: CA instance.
  * @slot: Slot concerned.
  */
-void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221pubca, int slot);
+void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221 *pubca, int slot);
 
 /**
  * dvb_ca_en50221_frda_irq - An FR or a DA IRQ has occurred.
@@ -105,12 +105,11 @@ void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221* pubca, int slot);
  * @ca: CA instance.
  * @slot: Slot concerned.
  */
-void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221* ca, int slot);
-
+void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *ca, int slot);
 
-
-/* ******************************************************************************** */
-/* Initialisation/shutdown functions */
+/*
+ * Initialisation/shutdown functions
+ */
 
 /**
  * dvb_ca_en50221_init - Initialise a new DVB CA device.
@@ -122,15 +121,15 @@ void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221* ca, int slot);
  *
  * @return 0 on success, nonzero on failure
  */
-extern int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221* ca, int flags, int slot_count);
+extern int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
+                              struct dvb_ca_en50221 *ca, int flags,
+                              int slot_count);
 
 /**
  * dvb_ca_en50221_release - Release a DVB CA device.
  *
  * @ca: The associated dvb_ca instance.
  */
-extern void dvb_ca_en50221_release(struct dvb_ca_en50221* ca);
-
-
+extern void dvb_ca_en50221_release(struct dvb_ca_en50221 *ca);
 
 #endif
index 6c7ff0c..0cc5e93 100644 (file)
@@ -130,7 +130,7 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
 
        feed->peslen += count;
 
-       return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK);
+       return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts);
 }
 
 static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed,
@@ -152,7 +152,7 @@ static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed,
                return 0;
 
        return feed->cb.sec(feed->feed.sec.secbuf, feed->feed.sec.seclen,
-                           NULL, 0, &f->filter, DMX_OK);
+                           NULL, 0, &f->filter);
 }
 
 static inline int dvb_dmx_swfilter_section_feed(struct dvb_demux_feed *feed)
@@ -367,8 +367,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed,
                        if (feed->ts_type & TS_PAYLOAD_ONLY)
                                dvb_dmx_swfilter_payload(feed, buf);
                        else
-                               feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts,
-                                           DMX_OK);
+                               feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts);
                }
                if (feed->ts_type & TS_DECODER)
                        if (feed->demux->write_to_decoder)
@@ -469,7 +468,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
                if (feed->pid == pid)
                        dvb_dmx_swfilter_packet_type(feed, buf);
                else if (feed->pid == 0x2000)
-                       feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
+                       feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts);
        }
 }
 
@@ -588,7 +587,7 @@ void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count)
 
        spin_lock_irqsave(&demux->lock, flags);
 
-       demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, DMX_OK);
+       demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts);
 
        spin_unlock_irqrestore(&demux->lock, flags);
 }
index b81e026..ce4332e 100644 (file)
@@ -761,7 +761,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
 
 static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
                               const u8 *buffer2, size_t buffer2_len,
-                              struct dmx_ts_feed *feed, enum dmx_success success)
+                              struct dmx_ts_feed *feed)
 {
        struct net_device *dev = feed->priv;
 
@@ -870,8 +870,7 @@ static void dvb_net_sec(struct net_device *dev,
 
 static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
                 const u8 *buffer2, size_t buffer2_len,
-                struct dmx_section_filter *filter,
-                enum dmx_success success)
+                struct dmx_section_filter *filter)
 {
        struct net_device *dev = filter->priv;
 
index c61a4f0..1069a77 100644 (file)
@@ -184,10 +184,6 @@ int dvb_unregister_adapter(struct dvb_adapter *adap);
  * @pdvbdev:   pointer to the place where the new struct dvb_device will be
  *             stored
  * @template:  Template used to create &pdvbdev;
- * @device:    pointer to struct device that corresponds to the device driver
- * @adapter_nums: Array with a list of the numbers for @dvb_register_adapter;
- *             to select among them. Typically, initialized with:
- *             DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums)
  * @priv:      private data
  * @type:      type of the device: DVB_DEVICE_SEC, DVB_DEVICE_FRONTEND,
  *             DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_CA, DVB_DEVICE_NET
index 34b9441..445a15c 100644 (file)
@@ -2950,10 +2950,9 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config,
 {
        struct drxd_state *state = NULL;
 
-       state = kmalloc(sizeof(struct drxd_state), GFP_KERNEL);
+       state = kzalloc(sizeof(*state), GFP_KERNEL);
        if (!state)
                return NULL;
-       memset(state, 0, sizeof(*state));
 
        state->ops = drxd_ops;
        state->dev = dev;
index d5b994f..dcd8d94 100644 (file)
@@ -29,6 +29,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-event.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-vmalloc.h>
 
 #include <linux/platform_device.h>
@@ -107,7 +108,8 @@ static const unsigned int NUM_FORMATS = ARRAY_SIZE(formats);
 
 /* intermediate buffers with raw data from the USB device */
 struct rtl2832_sdr_frame_buf {
-       struct vb2_buffer vb;   /* common v4l buffer stuff -- must be first */
+       /* common v4l buffer stuff -- must be first */
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
@@ -304,13 +306,13 @@ static void rtl2832_sdr_urb_complete(struct urb *urb)
                }
 
                /* fill framebuffer */
-               ptr = vb2_plane_vaddr(&fbuf->vb, 0);
+               ptr = vb2_plane_vaddr(&fbuf->vb.vb2_buf, 0);
                len = rtl2832_sdr_convert_stream(dev, ptr, urb->transfer_buffer,
                                urb->actual_length);
-               vb2_set_plane_payload(&fbuf->vb, 0, len);
-               v4l2_get_timestamp(&fbuf->vb.v4l2_buf.timestamp);
-               fbuf->vb.v4l2_buf.sequence = dev->sequence++;
-               vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE);
+               vb2_set_plane_payload(&fbuf->vb.vb2_buf, 0, len);
+               v4l2_get_timestamp(&fbuf->vb.timestamp);
+               fbuf->vb.sequence = dev->sequence++;
+               vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        }
 skip:
        usb_submit_urb(urb, GFP_ATOMIC);
@@ -464,7 +466,7 @@ static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_dev *dev)
                buf = list_entry(dev->queued_bufs.next,
                                struct rtl2832_sdr_frame_buf, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->queued_bufs_lock, flags);
 }
@@ -488,7 +490,7 @@ static int rtl2832_sdr_querycap(struct file *file, void *fh,
 
 /* Videobuf2 operations */
 static int rtl2832_sdr_queue_setup(struct vb2_queue *vq,
-               const struct v4l2_format *fmt, unsigned int *nbuffers,
+               const void *parg, unsigned int *nbuffers,
                unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[])
 {
        struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vq);
@@ -518,14 +520,15 @@ static int rtl2832_sdr_buf_prepare(struct vb2_buffer *vb)
 
 static void rtl2832_sdr_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
        struct rtl2832_sdr_frame_buf *buf =
-                       container_of(vb, struct rtl2832_sdr_frame_buf, vb);
+                       container_of(vbuf, struct rtl2832_sdr_frame_buf, vb);
        unsigned long flags;
 
        /* Check the device has not disconnected between prep and queuing */
        if (!dev->udev) {
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                return;
        }
 
index af5eaf2..38a20fe 100644 (file)
@@ -233,6 +233,15 @@ static int ml86v7667_g_mbus_config(struct v4l2_subdev *sd,
        return 0;
 }
 
+static int ml86v7667_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
+{
+       struct ml86v7667_priv *priv = to_ml86v7667(sd);
+
+       *std = priv->std;
+
+       return 0;
+}
+
 static int ml86v7667_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
 {
        struct ml86v7667_priv *priv = to_ml86v7667(sd);
@@ -282,6 +291,7 @@ static const struct v4l2_ctrl_ops ml86v7667_ctrl_ops = {
 };
 
 static struct v4l2_subdev_video_ops ml86v7667_subdev_video_ops = {
+       .g_std = ml86v7667_g_std,
        .s_std = ml86v7667_s_std,
        .querystd = ml86v7667_querystd,
        .g_input_status = ml86v7667_g_input_status,
@@ -427,7 +437,6 @@ MODULE_DEVICE_TABLE(i2c, ml86v7667_id);
 static struct i2c_driver ml86v7667_i2c_driver = {
        .driver = {
                .name   = DRV_NAME,
-               .owner  = THIS_MODULE,
        },
        .probe          = ml86v7667_probe,
        .remove         = ml86v7667_remove,
index 53c5ea8..51b2601 100644 (file)
@@ -167,7 +167,7 @@ static int s5c73m3_i2c_read(struct i2c_client *client, u16 addr, u16 *data)
         */
        ret = i2c_transfer(client->adapter, msg, 2);
        if (ret == 2) {
-               *data = be16_to_cpup((u16 *)rbuf);
+               *data = be16_to_cpup((__be16 *)rbuf);
                v4l2_dbg(4, s5c73m3_dbg, client,
                         "%s: addr: 0x%04x, data: 0x%04x\n",
                         __func__, addr, *data);
index fa4a5eb..17ac441 100644 (file)
@@ -31,6 +31,7 @@ static const struct of_device_id s5c73m3_spi_ids[] = {
        { .compatible = "samsung,s5c73m3" },
        { }
 };
+MODULE_DEVICE_TABLE(of, s5c73m3_spi_ids);
 
 enum spi_direction {
        SPI_DIR_RX,
index 636ebd6..fb39dfd 100644 (file)
@@ -3131,6 +3131,7 @@ static const struct of_device_id smiapp_of_table[] = {
        { .compatible = "nokia,smia" },
        { },
 };
+MODULE_DEVICE_TABLE(of, smiapp_of_table);
 
 static const struct i2c_device_id smiapp_id_table[] = {
        { SMIAPP_NAME, 0 },
index 522a865..3c5fb25 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/videodev2.h>
 #include <linux/delay.h>
 #include <linux/module.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/tvp5150.h>
 #include <media/v4l2-ctrls.h>
@@ -1172,8 +1173,7 @@ static int tvp5150_probe(struct i2c_client *c,
        sd->ctrl_handler = &core->hdl;
        if (core->hdl.error) {
                res = core->hdl.error;
-               v4l2_ctrl_handler_free(&core->hdl);
-               return res;
+               goto err;
        }
        v4l2_ctrl_handler_setup(&core->hdl);
 
@@ -1186,9 +1186,17 @@ static int tvp5150_probe(struct i2c_client *c,
        core->rect.left = 0;
        core->rect.width = TVP5150_H_MAX;
 
+       res = v4l2_async_register_subdev(sd);
+       if (res < 0)
+               goto err;
+
        if (debug > 1)
                tvp5150_log_status(sd);
        return 0;
+
+err:
+       v4l2_ctrl_handler_free(&core->hdl);
+       return res;
 }
 
 static int tvp5150_remove(struct i2c_client *c)
@@ -1200,7 +1208,7 @@ static int tvp5150_remove(struct i2c_client *c)
                "tvp5150.c: removing tvp5150 adapter on address 0x%x\n",
                c->addr << 1);
 
-       v4l2_device_unregister_subdev(sd);
+       v4l2_async_unregister_subdev(sd);
        v4l2_ctrl_handler_free(&decoder->hdl);
        return 0;
 }
index 153a464..767fe55 100644 (file)
@@ -235,8 +235,8 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
        media_entity_graph_walk_start(&graph, entity);
 
        while ((entity = media_entity_graph_walk_next(&graph))) {
-               DECLARE_BITMAP(active, entity->num_pads);
-               DECLARE_BITMAP(has_no_links, entity->num_pads);
+               DECLARE_BITMAP(active, MEDIA_ENTITY_MAX_PADS);
+               DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS);
                unsigned int i;
 
                entity->stream_count++;
index 3632958..15a4ebc 100644 (file)
@@ -3625,13 +3625,10 @@ static void
 bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup,
                    unsigned int state)
 {
-       struct timeval ts;
-
        if (NULL == wakeup)
                return;
 
-       v4l2_get_timestamp(&ts);
-       wakeup->vb.ts = ts;
+       v4l2_get_timestamp(&wakeup->vb.ts);
        wakeup->vb.field_count = btv->field_count;
        wakeup->vb.state = state;
        wake_up(&wakeup->vb.done);
index 1f88ccc..a01f0cc 100644 (file)
@@ -1,6 +1,6 @@
 config VIDEO_COBALT
        tristate "Cisco Cobalt support"
-       depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER
+       depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
        depends on PCI_MSI && MTD_COMPLEX_MAPPINGS
        depends on GPIOLIB || COMPILE_TEST
        depends on SND
index e83f5c9..23c875f 100644 (file)
@@ -290,8 +290,8 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
           0x01, 0xc7, 0xfc, 0x7f, 0x53, 0x62).
         */
 
-       cobalt_dbg(1, "%u: %02x %02x %02x %02x %02x %02x\n", f_out,
-                       regs[0], regs[1], regs[2], regs[3], regs[4], regs[5]);
+       cobalt_dbg(1, "%u: %6ph\n", f_out, regs);
+
        while (retries--) {
                u8 read_regs[6];
 
@@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
 
                if (!memcmp(read_regs, regs, sizeof(read_regs)))
                        break;
-               cobalt_dbg(1, "retry: %02x %02x %02x %02x %02x %02x\n",
-                       read_regs[0], read_regs[1], read_regs[2],
-                       read_regs[3], read_regs[4], read_regs[5]);
+               cobalt_dbg(1, "retry: %6ph\n", read_regs);
        }
        if (2 - retries)
                cobalt_info("Needed %d retries\n", 2 - retries);
index c206df9..b2f08e4 100644 (file)
@@ -35,6 +35,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-fh.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 #include "m00233_video_measure_memmap_package.h"
@@ -206,11 +207,12 @@ struct sg_dma_desc_info {
 #define COBALT_STREAM_FL_ADV_IRQ               1
 
 struct cobalt_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
-static inline struct cobalt_buffer *to_cobalt_buffer(struct vb2_buffer *vb2)
+static inline
+struct cobalt_buffer *to_cobalt_buffer(struct vb2_v4l2_buffer *vb2)
 {
        return container_of(vb2, struct cobalt_buffer, vb);
 }
index d1f5898..3de26d0 100644 (file)
@@ -134,11 +134,12 @@ done:
                skip = true;
                s->skip_first_frames--;
        }
-       v4l2_get_timestamp(&cb->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&cb->vb.timestamp);
        /* TODO: the sequence number should be read from the FPGA so we
           also know about dropped frames. */
-       cb->vb.v4l2_buf.sequence = s->sequence++;
-       vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ?
+       cb->vb.sequence = s->sequence++;
+       vb2_buffer_done(&cb->vb.vb2_buf,
+                       (skip || s->unstable_frame) ?
                        VB2_BUF_STATE_REQUEUEING : VB2_BUF_STATE_DONE);
 }
 
index 9756fd3..ff46e42 100644 (file)
@@ -43,11 +43,11 @@ static const struct v4l2_dv_timings cea1080p60 = V4L2_DV_BT_CEA_1920X1080P60;
 
 /* vb2 DMA streaming ops */
 
-static int cobalt_queue_setup(struct vb2_queue *q,
-                       const struct v4l2_format *fmt,
+static int cobalt_queue_setup(struct vb2_queue *q, const void *parg,
                        unsigned int *num_buffers, unsigned int *num_planes,
                        unsigned int sizes[], void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct cobalt_stream *s = q->drv_priv;
        unsigned size = s->stride * s->height;
 
@@ -75,7 +75,7 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
        const size_t bytes =
                COBALT_MAX_HEIGHT * max_pages_per_line * 0x20;
        const size_t audio_bytes = ((1920 * 4) / PAGE_SIZE + 1) * 0x20;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        struct sg_table *sg_desc = vb2_dma_sg_plane_desc(vb, 0);
        unsigned size;
        int ret;
@@ -105,17 +105,18 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
 static void cobalt_buf_cleanup(struct vb2_buffer *vb)
 {
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
 
        descriptor_list_free(desc);
 }
 
 static int cobalt_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
 
        vb2_set_plane_payload(vb, 0, s->stride * s->height);
-       vb->v4l2_buf.field = V4L2_FIELD_NONE;
+       vbuf->field = V4L2_FIELD_NONE;
        return 0;
 }
 
@@ -128,7 +129,7 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc[i] = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc[i] = &s->dma_desc_info[cb->vb.vb2_buf.index];
                if (i > 0)
                        descriptor_list_chain(desc[i-1], desc[i]);
                i++;
@@ -137,10 +138,11 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
 static void cobalt_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *q = vb->vb2_queue;
        struct cobalt_stream *s = q->drv_priv;
-       struct cobalt_buffer *cb = to_cobalt_buffer(vb);
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct cobalt_buffer *cb = to_cobalt_buffer(vbuf);
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        unsigned long flags;
 
        /* Prepare new buffer */
@@ -284,7 +286,7 @@ static void cobalt_dma_start_streaming(struct cobalt_stream *s)
                          &vo->control);
        }
        cb = list_first_entry(&s->bufs, struct cobalt_buffer, list);
-       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.v4l2_buf.index]);
+       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.vb2_buf.index]);
        spin_unlock_irqrestore(&s->irqlock, flags);
 }
 
@@ -381,7 +383,7 @@ static void cobalt_dma_stop_streaming(struct cobalt_stream *s)
        spin_lock_irqsave(&s->irqlock, flags);
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc = &s->dma_desc_info[cb->vb.vb2_buf.index];
                /* Stop DMA after this descriptor chain */
                descriptor_list_end_of_chain(desc);
        }
@@ -416,7 +418,7 @@ static void cobalt_stop_streaming(struct vb2_queue *q)
        list_for_each_safe(p, safe, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
                list_del(&cb->list);
-               vb2_buffer_done(&cb->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&cb->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&s->irqlock, flags);
 
index eabf00c..1f8aa9a 100644 (file)
@@ -202,7 +202,7 @@ static void cx18_mdl_send_to_videobuf(struct cx18_stream *s,
        }
 
        if (dispatch) {
-               vb_buf->vb.ts = ktime_to_timeval(ktime_get());
+               v4l2_get_timestamp(&vb_buf->vb.ts);
                list_del(&vb_buf->vb.queue);
                vb_buf->vb.state = VIDEOBUF_DONE;
                wake_up(&vb_buf->vb.done);
index 63c0ee5..88a3afb 100644 (file)
@@ -1138,7 +1138,7 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder)
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -1155,17 +1155,19 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
 
        return cx23885_buf_prepare(buf, &dev->ts1);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(dev, buf);
@@ -1173,8 +1175,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_buf_queue(&dev->ts1, buf);
@@ -1201,7 +1204,7 @@ static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
        return ret;
index 7aee76a..bc1c960 100644 (file)
@@ -427,12 +427,13 @@ static void cx23885_wakeup(struct cx23885_tsport *port,
        buf = list_entry(q->active.next,
                         struct cx23885_buffer, queue);
 
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       buf->vb.v4l2_buf.sequence = q->count++;
-       dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       buf->vb.sequence = q->count++;
+       dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
+               buf->vb.vb2_buf.index,
                count, q->count);
        list_del(&buf->queue);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 int cx23885_sram_channel_setup(struct cx23885_dev *dev,
@@ -1453,12 +1454,12 @@ int cx23885_buf_prepare(struct cx23885_buffer *buf, struct cx23885_tsport *port)
 {
        struct cx23885_dev *dev = port->dev;
        int size = port->ts_packet_size * port->ts_packet_count;
-       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
 
        dprintk(1, "%s: %p\n", __func__, buf);
-       if (vb2_plane_size(&buf->vb, 0) < size)
+       if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
                return -EINVAL;
-       vb2_set_plane_payload(&buf->vb, 0, size);
+       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
 
        cx23885_risc_databuffer(dev->pci, &buf->risc,
                                sgt->sgl,
@@ -1503,7 +1504,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
        if (list_empty(&cx88q->active)) {
                list_add_tail(&buf->queue, &cx88q->active);
                dprintk(1, "[%p/%d] %s - first active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(cx88q->active.prev, struct cx23885_buffer,
@@ -1511,7 +1512,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
                list_add_tail(&buf->queue, &cx88q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(1, "[%p/%d] %s - append to active\n",
-                        buf, buf->vb.v4l2_buf.index, __func__);
+                        buf, buf->vb.vb2_buf.index, __func__);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
@@ -1530,9 +1531,10 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason)
                buf = list_entry(q->active.next, struct cx23885_buffer,
                                 queue);
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                dprintk(1, "[%p/%d] %s - dma=0x%08lx\n",
-                       buf, buf->vb.v4l2_buf.index, reason, (unsigned long)buf->risc.dma);
+                       buf, buf->vb.vb2_buf.index, reason,
+                       (unsigned long)buf->risc.dma);
        }
        spin_unlock_irqrestore(&port->slock, flags);
 }
index 6e8c24c..c4307ad 100644 (file)
@@ -92,7 +92,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -110,18 +110,20 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
 
        return cx23885_buf_prepare(buf, port);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
        struct cx23885_dev *dev = port->dev;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(dev, buf);
@@ -129,8 +131,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_buf_queue(port, buf);
index d362d38..cf3cb13 100644 (file)
@@ -121,7 +121,7 @@ static int cx23885_start_vbi_dma(struct cx23885_dev    *dev,
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -138,8 +138,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        unsigned lines = VBI_PAL_LINE_COUNT;
@@ -161,7 +162,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
-       struct cx23885_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
@@ -190,8 +192,10 @@ static void buffer_finish(struct vb2_buffer *vb)
  */
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
+                       struct cx23885_buffer, vb);
        struct cx23885_buffer *prev;
        struct cx23885_dmaqueue *q = &dev->vbiq;
        unsigned long flags;
@@ -206,7 +210,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->queue, &q->active);
                spin_unlock_irqrestore(&dev->slock, flags);
                dprintk(2, "[%p/%d] vbi_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -217,7 +221,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                spin_unlock_irqrestore(&dev->slock, flags);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -245,7 +249,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index ec76470..71a80e2 100644 (file)
@@ -104,12 +104,12 @@ void cx23885_video_wakeup(struct cx23885_dev *dev,
        buf = list_entry(q->active.next,
                        struct cx23885_buffer, queue);
 
-       buf->vb.v4l2_buf.sequence = q->count++;
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
-                       count, q->count);
+       buf->vb.sequence = q->count++;
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
+                       buf->vb.vb2_buf.index, count, q->count);
        list_del(&buf->queue);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
@@ -315,7 +315,7 @@ static int cx23885_start_video_dma(struct cx23885_dev *dev,
        return 0;
 }
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -329,9 +329,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
        u32 line0_offset, line1_offset;
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        int field_tff;
@@ -401,7 +402,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                BUG();
        }
        dprintk(2, "[%p/%d] buffer_init - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index,
+               buf, buf->vb.vb2_buf.index,
                dev->width, dev->height, dev->fmt->depth, dev->fmt->name,
                (unsigned long)buf->risc.dma);
        return 0;
@@ -409,7 +410,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
-       struct cx23885_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
@@ -438,8 +440,9 @@ static void buffer_finish(struct vb2_buffer *vb)
  */
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
        struct cx23885_buffer   *prev;
        struct cx23885_dmaqueue *q    = &dev->vidq;
@@ -455,7 +458,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        if (list_empty(&q->active)) {
                list_add_tail(&buf->queue, &q->active);
                dprintk(2, "[%p/%d] buffer_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(q->active.prev, struct cx23885_buffer,
@@ -463,7 +466,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->queue, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                               buf, buf->vb.v4l2_buf.index);
+                               buf, buf->vb.vb2_buf.index);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
@@ -492,7 +495,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 027ead4..c5ba083 100644 (file)
@@ -170,7 +170,7 @@ struct cx23885_riscmem {
 /* buffer for one video frame */
 struct cx23885_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head queue;
 
        /* cx23885 specific */
index 24f964b..b602eba 100644 (file)
@@ -102,7 +102,7 @@ struct cx25821_audio_dev {
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
-static bool enable[SNDRV_CARDS] = { 1, [1 ... (SNDRV_CARDS - 1)] = 1 };
+static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 
 module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable cx25821 soundcard. default enabled.");
index 7bc495e..26e3e29 100644 (file)
@@ -130,10 +130,10 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
                        buf = list_entry(dmaq->active.next,
                                         struct cx25821_buffer, queue);
 
-                       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-                       buf->vb.v4l2_buf.sequence = dmaq->count++;
+                       v4l2_get_timestamp(&buf->vb.timestamp);
+                       buf->vb.sequence = dmaq->count++;
                        list_del(&buf->queue);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                }
                spin_unlock(&dev->slock);
                handled++;
@@ -141,10 +141,11 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
        return handled;
 }
 
-static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int cx25821_queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct cx25821_channel *chan = q->drv_priv;
        unsigned size = (chan->fmt->depth * chan->width * chan->height) >> 3;
 
@@ -159,10 +160,11 @@ static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fm
 
 static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        u32 line0_offset;
        int bpl_local = LINE_SIZE_D1;
@@ -176,7 +178,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_plane_size(vb, 0) < chan->height * buf->bpl)
                return -EINVAL;
        vb2_set_plane_payload(vb, 0, chan->height * buf->bpl);
-       buf->vb.v4l2_buf.field = chan->field;
+       buf->vb.field = chan->field;
 
        if (chan->pixel_formats == PIXEL_FRMT_411) {
                bpl_local = buf->bpl;
@@ -231,7 +233,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        }
 
        dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index, chan->width, chan->height,
+               buf, buf->vb.vb2_buf.index, chan->width, chan->height,
                chan->fmt->depth, chan->fmt->name,
                (unsigned long)buf->risc.dma);
 
@@ -240,8 +242,9 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 
 static void cx25821_buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
 
@@ -250,8 +253,9 @@ static void cx25821_buffer_finish(struct vb2_buffer *vb)
 
 static void cx25821_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *prev;
@@ -300,7 +304,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
                        struct cx25821_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index d81a08a..a513b68 100644 (file)
@@ -34,6 +34,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 #include "cx25821-reg.h"
@@ -127,7 +128,7 @@ struct cx25821_riscmem {
 /* buffer for one video frame */
 struct cx25821_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head queue;
 
        /* cx25821 specific */
index 7f8dc60..57ddf8a 100644 (file)
@@ -101,7 +101,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static const char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;        /* ID for this card */
-static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
+static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 
 module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled.");
index 24216ef..8b88913 100644 (file)
@@ -637,7 +637,7 @@ static int blackbird_stop_codec(struct cx8802_dev *dev)
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -653,16 +653,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -672,8 +674,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        cx8802_buf_queue(dev, buf);
 }
@@ -721,7 +724,7 @@ fail:
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
        return err;
@@ -749,7 +752,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index aab7cf4..9a43c78 100644 (file)
@@ -518,11 +518,11 @@ void cx88_wakeup(struct cx88_core *core,
 
        buf = list_entry(q->active.next,
                         struct cx88_buffer, list);
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       buf->vb.v4l2_buf.field = core->field;
-       buf->vb.v4l2_buf.sequence = q->count++;
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       buf->vb.field = core->field;
+       buf->vb.sequence = q->count++;
        list_del(&buf->list);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 void cx88_shutdown(struct cx88_core *core)
index 9dfa5ee..f048350 100644 (file)
@@ -82,7 +82,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -99,16 +99,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -118,8 +120,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        cx8802_buf_queue(dev, buf);
 }
@@ -149,7 +152,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 34f5057..9961b22 100644 (file)
@@ -214,7 +214,7 @@ static int cx8802_restart_queue(struct cx8802_dev    *dev,
 
        buf = list_entry(q->active.next, struct cx88_buffer, list);
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-               buf, buf->vb.v4l2_buf.index);
+               buf, buf->vb.vb2_buf.index);
        cx8802_start_dma(dev, q, buf);
        return 0;
 }
@@ -225,13 +225,13 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
                        struct cx88_buffer *buf)
 {
        int size = dev->ts_packet_size * dev->ts_packet_count;
-       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
        struct cx88_riscmem *risc = &buf->risc;
        int rc;
 
-       if (vb2_plane_size(&buf->vb, 0) < size)
+       if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
                return -EINVAL;
-       vb2_set_plane_payload(&buf->vb, 0, size);
+       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
 
        rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
                             dev->ts_packet_size, dev->ts_packet_count, 0);
@@ -259,7 +259,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
                dprintk( 1, "queue is empty - first active\n" );
                list_add_tail(&buf->list, &cx88q->active);
                dprintk(1,"[%p/%d] %s - first active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -268,7 +268,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
                list_add_tail(&buf->list, &cx88q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk( 1, "[%p/%d] %s - append to active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
        }
 }
 
@@ -284,7 +284,7 @@ static void do_cancel_buffers(struct cx8802_dev *dev)
        while (!list_empty(&q->active)) {
                buf = list_entry(q->active.next, struct cx88_buffer, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock,flags);
 }
index 7510e80..007a5ee 100644 (file)
@@ -100,14 +100,14 @@ int cx8800_restart_vbi_queue(struct cx8800_dev    *dev,
 
        buf = list_entry(q->active.next, struct cx88_buffer, list);
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-               buf, buf->vb.v4l2_buf.index);
+               buf, buf->vb.vb2_buf.index);
        cx8800_start_vbi_dma(dev, q, buf);
        return 0;
 }
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -125,8 +125,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        unsigned int lines;
        unsigned int size;
@@ -149,8 +150,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -160,8 +162,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_buffer    *prev;
        struct cx88_dmaqueue  *q    = &dev->vbiq;
 
@@ -174,7 +177,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                cx8800_start_vbi_dma(dev, q, buf);
                dprintk(2,"[%p/%d] vbi_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -182,7 +185,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2,"[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -213,7 +216,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 400e5ca..f3b12db 100644 (file)
@@ -420,7 +420,7 @@ static int restart_video_queue(struct cx8800_dev    *dev,
        if (!list_empty(&q->active)) {
                buf = list_entry(q->active.next, struct cx88_buffer, list);
                dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
                start_video_dma(dev, q, buf);
        }
        return 0;
@@ -429,7 +429,7 @@ static int restart_video_queue(struct cx8800_dev    *dev,
 
 /* ------------------------------------------------------------------ */
 
-static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *q, const void *parg,
                           unsigned int *num_buffers, unsigned int *num_planes,
                           unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -444,9 +444,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
        struct cx88_core *core = dev->core;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
 
        buf->bpl = core->width * dev->fmt->depth >> 3;
@@ -489,7 +490,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                break;
        }
        dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index,
+               buf, buf->vb.vb2_buf.index,
                core->width, core->height, dev->fmt->depth, dev->fmt->name,
                (unsigned long)buf->risc.dma);
        return 0;
@@ -497,8 +498,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -508,8 +510,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_buffer    *prev;
        struct cx88_core      *core = dev->core;
        struct cx88_dmaqueue  *q    = &dev->vidq;
@@ -522,7 +525,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        if (list_empty(&q->active)) {
                list_add_tail(&buf->list, &q->active);
                dprintk(2,"[%p/%d] buffer_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -530,7 +533,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -560,7 +563,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 785fe2e..2996eb3 100644 (file)
@@ -321,7 +321,7 @@ struct cx88_riscmem {
 /* buffer for one video frame */
 struct cx88_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head       list;
 
        /* cx88 specific */
index 8df6345..d84abde 100644 (file)
@@ -131,11 +131,12 @@ static int wait_i2c_reg(void __iomem *addr)
 }
 
 static int
-dt3155_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+dt3155_queue_setup(struct vb2_queue *vq, const void *parg,
                unsigned int *nbuffers, unsigned int *num_planes,
                unsigned int sizes[], void *alloc_ctxs[])
 
 {
+       const struct v4l2_format *fmt = parg;
        struct dt3155_priv *pd = vb2_get_drv_priv(vq);
        unsigned size = pd->width * pd->height;
 
@@ -160,7 +161,7 @@ static int dt3155_buf_prepare(struct vb2_buffer *vb)
 static int dt3155_start_streaming(struct vb2_queue *q, unsigned count)
 {
        struct dt3155_priv *pd = vb2_get_drv_priv(q);
-       struct vb2_buffer *vb = pd->curr_buf;
+       struct vb2_buffer *vb = &pd->curr_buf->vb2_buf;
        dma_addr_t dma_addr;
 
        pd->sequence = 0;
@@ -208,7 +209,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
 
        spin_lock_irq(&pd->lock);
        if (pd->curr_buf) {
-               vb2_buffer_done(pd->curr_buf, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&pd->curr_buf->vb2_buf, VB2_BUF_STATE_ERROR);
                pd->curr_buf = NULL;
        }
 
@@ -222,6 +223,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
 
 static void dt3155_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue);
 
        /*  pd->vidq.streaming = 1 when dt3155_buf_queue() is invoked  */
@@ -229,7 +231,7 @@ static void dt3155_buf_queue(struct vb2_buffer *vb)
        if (pd->curr_buf)
                list_add_tail(&vb->done_entry, &pd->dmaq);
        else
-               pd->curr_buf = vb;
+               pd->curr_buf = vbuf;
        spin_unlock_irq(&pd->lock);
 }
 
@@ -269,14 +271,14 @@ static irqreturn_t dt3155_irq_handler_even(int irq, void *dev_id)
 
        spin_lock(&ipd->lock);
        if (ipd->curr_buf && !list_empty(&ipd->dmaq)) {
-               v4l2_get_timestamp(&ipd->curr_buf->v4l2_buf.timestamp);
-               ipd->curr_buf->v4l2_buf.sequence = ipd->sequence++;
-               ipd->curr_buf->v4l2_buf.field = V4L2_FIELD_NONE;
-               vb2_buffer_done(ipd->curr_buf, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&ipd->curr_buf->timestamp);
+               ipd->curr_buf->sequence = ipd->sequence++;
+               ipd->curr_buf->field = V4L2_FIELD_NONE;
+               vb2_buffer_done(&ipd->curr_buf->vb2_buf, VB2_BUF_STATE_DONE);
 
                ivb = list_first_entry(&ipd->dmaq, typeof(*ivb), done_entry);
                list_del(&ivb->done_entry);
-               ipd->curr_buf = ivb;
+               ipd->curr_buf = to_vb2_v4l2_buffer(ivb);
                dma_addr = vb2_dma_contig_plane_dma_addr(ivb, 0);
                iowrite32(dma_addr, ipd->regs + EVEN_DMA_START);
                iowrite32(dma_addr + ipd->width, ipd->regs + ODD_DMA_START);
index 4e1f4d5..b3531e0 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-dev.h>
+#include <media/videobuf2-v4l2.h>
 
 #define DT3155_NAME "dt3155"
 #define DT3155_VER_MAJ 2
@@ -181,7 +182,7 @@ struct dt3155_priv {
        struct pci_dev *pdev;
        struct vb2_queue vidq;
        struct vb2_alloc_ctx *alloc_ctx;
-       struct vb2_buffer *curr_buf;
+       struct vb2_v4l2_buffer *curr_buf;
        struct mutex mux;
        struct list_head dmaq;
        spinlock_t lock;
index 41fa215..8a86b61 100644 (file)
@@ -41,6 +41,7 @@
 #include "ivtv-alsa-pcm.h"
 
 int ivtv_alsa_debug;
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 
 #define IVTV_DEBUG_ALSA_INFO(fmt, arg...) \
        do { \
@@ -54,6 +55,10 @@ MODULE_PARM_DESC(debug,
                 "\t\t\t  1/0x0001: warning\n"
                 "\t\t\t  2/0x0002: info\n");
 
+module_param_array(index, int, NULL, 0444);
+MODULE_PARM_DESC(index,
+                "Index value for IVTV ALSA capture interface(s).\n");
+
 MODULE_AUTHOR("Andy Walls");
 MODULE_DESCRIPTION("CX23415/CX23416 ALSA Interface");
 MODULE_SUPPORTED_DEVICE("CX23415/CX23416 MPEG2 encoder");
@@ -137,7 +142,7 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
        struct ivtv *itv = to_ivtv(v4l2_dev);
        struct snd_card *sc = NULL;
        struct snd_ivtv_card *itvsc;
-       int ret;
+       int ret, idx;
 
        /* Numbrs steps from "Writing an ALSA Driver" by Takashi Iwai */
 
@@ -145,8 +150,10 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
        /* This is a no-op for us.  We'll use the itv->instance */
 
        /* (2) Create a card instance */
+       /* use first available id if not specified otherwise*/
+       idx = index[itv->instance] == -1 ? SNDRV_DEFAULT_IDX1 : index[itv->instance];
        ret = snd_card_new(&itv->pdev->dev,
-                          SNDRV_DEFAULT_IDX1, /* use first available id */
+                          idx,
                           SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
                           THIS_MODULE, 0, &sc);
        if (ret) {
@@ -196,6 +203,9 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
                goto err_exit_free;
        }
 
+       IVTV_ALSA_INFO("%s: Instance %d registered as ALSA card %d\n",
+                        __func__, itv->instance, sc->number);
+
        return 0;
 
 err_exit_free:
index 2ad65eb..2b8e7b2 100644 (file)
@@ -75,15 +75,15 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
        ivtv_udma_get_page_info (&uv_dma, (unsigned long)args->uv_source, 360 * uv_decode_height);
 
        /* Get user pages for DMA Xfer */
-       down_read(&current->mm->mmap_sem);
-       y_pages = get_user_pages(current, current->mm, y_dma.uaddr, y_dma.page_count, 0, 1, &dma->map[0], NULL);
+       y_pages = get_user_pages_unlocked(current, current->mm,
+                               y_dma.uaddr, y_dma.page_count, 0, 1,
+                               &dma->map[0]);
        uv_pages = 0; /* silence gcc. value is set and consumed only if: */
        if (y_pages == y_dma.page_count) {
-               uv_pages = get_user_pages(current, current->mm,
-                                         uv_dma.uaddr, uv_dma.page_count, 0, 1,
-                                         &dma->map[y_pages], NULL);
+               uv_pages = get_user_pages_unlocked(current, current->mm,
+                                       uv_dma.uaddr, uv_dma.page_count, 0, 1,
+                                       &dma->map[y_pages]);
        }
-       up_read(&current->mm->mmap_sem);
 
        if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
                int rc = -EFAULT;
index fa95110..a67b281 100644 (file)
@@ -54,7 +54,7 @@ struct netup_dma {
        u8                      num;
        spinlock_t              lock;
        struct netup_unidvb_dev *ndev;
-       struct netup_dma_regs   *regs;
+       struct netup_dma_regs __iomem *regs;
        u32                     ring_buffer_size;
        u8                      *addr_virt;
        dma_addr_t              addr_phys;
@@ -82,7 +82,7 @@ struct netup_i2c {
        wait_queue_head_t               wq;
        struct i2c_adapter              adap;
        struct netup_unidvb_dev         *dev;
-       struct netup_i2c_regs           *regs;
+       struct netup_i2c_regs __iomem   *regs;
        struct i2c_msg                  *msg;
        enum netup_i2c_state            state;
        u32                             xmit_size;
index 751b51b..f46ffac 100644 (file)
@@ -147,7 +147,7 @@ static int netup_unidvb_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221,
 {
        struct netup_ci_state *state = en50221->data;
        struct netup_unidvb_dev *dev = state->dev;
-       u8 val = state->membase8_config[addr];
+       u8 val = *((u8 __force *)state->membase8_io + addr);
 
        dev_dbg(&dev->pci_dev->dev,
                "%s(): addr=0x%x val=0x%x\n", __func__, addr, val);
@@ -162,7 +162,7 @@ static int netup_unidvb_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221,
 
        dev_dbg(&dev->pci_dev->dev,
                "%s(): addr=0x%x data=0x%x\n", __func__, addr, data);
-       state->membase8_config[addr] = data;
+       *((u8 __force *)state->membase8_io + addr) = data;
        return 0;
 }
 
@@ -171,7 +171,7 @@ static int netup_unidvb_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221,
 {
        struct netup_ci_state *state = en50221->data;
        struct netup_unidvb_dev *dev = state->dev;
-       u8 val = state->membase8_io[addr];
+       u8 val = *((u8 __force *)state->membase8_io + addr);
 
        dev_dbg(&dev->pci_dev->dev,
                "%s(): addr=0x%x val=0x%x\n", __func__, addr, val);
@@ -186,7 +186,7 @@ static int netup_unidvb_ci_write_cam_ctl(struct dvb_ca_en50221 *en50221,
 
        dev_dbg(&dev->pci_dev->dev,
                "%s(): addr=0x%x data=0x%x\n", __func__, addr, data);
-       state->membase8_io[addr] = data;
+       *((u8 __force *)state->membase8_io + addr) = data;
        return 0;
 }
 
@@ -226,7 +226,7 @@ int netup_unidvb_ci_register(struct netup_unidvb_dev *dev,
                        __func__, result);
                return result;
        }
-       writew(NETUP_UNIDVB_IRQ_CI, (u16 *)(dev->bmmio0 + REG_IMASK_SET));
+       writew(NETUP_UNIDVB_IRQ_CI, dev->bmmio0 + REG_IMASK_SET);
        dev_info(&pci_dev->dev,
                "%s(): CI adapter %d init done\n", __func__, num);
        return 0;
index 6d8bf62..83c90d3 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/list.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-vmalloc.h>
 
 #include "netup_unidvb.h"
@@ -110,7 +111,7 @@ struct netup_dma_regs {
 } __packed __aligned(1);
 
 struct netup_unidvb_buffer {
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head        list;
        u32                     size;
 };
@@ -189,12 +190,10 @@ static void netup_unidvb_dma_enable(struct netup_dma *dma, int enable)
                "%s(): DMA%d enable %d\n", __func__, dma->num, enable);
        if (enable) {
                writel(BIT_DMA_RUN, &dma->regs->ctrlstat_set);
-               writew(irq_mask,
-                       (u16 *)(dma->ndev->bmmio0 + REG_IMASK_SET));
+               writew(irq_mask, dma->ndev->bmmio0 + REG_IMASK_SET);
        } else {
                writel(BIT_DMA_RUN, &dma->regs->ctrlstat_clear);
-               writew(irq_mask,
-                       (u16 *)(dma->ndev->bmmio0 + REG_IMASK_CLEAR));
+               writew(irq_mask, dma->ndev->bmmio0 + REG_IMASK_CLEAR);
        }
 }
 
@@ -278,7 +277,7 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)
 }
 
 static int netup_unidvb_queue_setup(struct vb2_queue *vq,
-                                   const struct v4l2_format *fmt,
+                                   const void *parg,
                                    unsigned int *nbuffers,
                                    unsigned int *nplanes,
                                    unsigned int sizes[],
@@ -300,7 +299,8 @@ static int netup_unidvb_queue_setup(struct vb2_queue *vq,
 static int netup_unidvb_buf_prepare(struct vb2_buffer *vb)
 {
        struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
-       struct netup_unidvb_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct netup_unidvb_buffer *buf = container_of(vbuf,
                                struct netup_unidvb_buffer, vb);
 
        dev_dbg(&dma->ndev->pci_dev->dev, "%s(): buf 0x%p\n", __func__, buf);
@@ -312,7 +312,8 @@ static void netup_unidvb_buf_queue(struct vb2_buffer *vb)
 {
        unsigned long flags;
        struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
-       struct netup_unidvb_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct netup_unidvb_buffer *buf = container_of(vbuf,
                                struct netup_unidvb_buffer, vb);
 
        dev_dbg(&dma->ndev->pci_dev->dev, "%s(): %p\n", __func__, buf);
@@ -509,7 +510,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
 {
        u32 copy_bytes, ring_bytes;
        u32 buff_bytes = NETUP_DMA_PACKETS_COUNT * 188 - buf->size;
-       u8 *p = vb2_plane_vaddr(&buf->vb, 0);
+       u8 *p = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
        struct netup_unidvb_dev *ndev = dma->ndev;
 
        if (p == NULL) {
@@ -522,7 +523,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
                ring_bytes = dma->ring_buffer_size - dma->data_offset;
                copy_bytes = (ring_bytes > buff_bytes) ?
                        buff_bytes : ring_bytes;
-               memcpy_fromio(p, dma->addr_virt + dma->data_offset, copy_bytes);
+               memcpy_fromio(p, (u8 __iomem *)(dma->addr_virt + dma->data_offset), copy_bytes);
                p += copy_bytes;
                buf->size += copy_bytes;
                buff_bytes -= copy_bytes;
@@ -535,7 +536,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
                ring_bytes = dma->data_size;
                copy_bytes = (ring_bytes > buff_bytes) ?
                                buff_bytes : ring_bytes;
-               memcpy_fromio(p, dma->addr_virt + dma->data_offset, copy_bytes);
+               memcpy_fromio(p, (u8 __iomem *)(dma->addr_virt + dma->data_offset), copy_bytes);
                buf->size += copy_bytes;
                dma->data_size -= copy_bytes;
                dma->data_offset += copy_bytes;
@@ -579,9 +580,9 @@ static void netup_unidvb_dma_worker(struct work_struct *work)
                        dev_dbg(&ndev->pci_dev->dev,
                                "%s(): buffer %p done, size %d\n",
                                __func__, buf, buf->size);
-                       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-                       vb2_set_plane_payload(&buf->vb, 0, buf->size);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+                       v4l2_get_timestamp(&buf->vb.timestamp);
+                       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, buf->size);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                }
        }
 work_done:
@@ -599,7 +600,7 @@ static void netup_unidvb_queue_cleanup(struct netup_dma *dma)
                buf = list_first_entry(&dma->free_buffers,
                        struct netup_unidvb_buffer, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dma->lock, flags);
 }
@@ -641,10 +642,10 @@ static int netup_unidvb_dma_init(struct netup_unidvb_dev *ndev, int num)
                __func__, num, dma->addr_virt,
                (unsigned long long)dma->addr_phys,
                dma->ring_buffer_size);
-       memset_io(dma->addr_virt, 0, dma->ring_buffer_size);
+       memset_io((u8 __iomem *)dma->addr_virt, 0, dma->ring_buffer_size);
        dma->addr_last = dma->addr_phys;
        dma->high_addr = (u32)(dma->addr_phys & 0xC0000000);
-       dma->regs = (struct netup_dma_regs *)(num == 0 ?
+       dma->regs = (struct netup_dma_regs __iomem *)(num == 0 ?
                ndev->bmmio0 + NETUP_DMA0_ADDR :
                ndev->bmmio0 + NETUP_DMA1_ADDR);
        writel((NETUP_DMA_BLOCKS_COUNT << 24) |
index eaaa2d0..c09c52b 100644 (file)
@@ -320,7 +320,7 @@ static int netup_i2c_init(struct netup_unidvb_dev *ndev, int bus_num)
        i2c = &ndev->i2c[bus_num];
        spin_lock_init(&i2c->lock);
        init_waitqueue_head(&i2c->wq);
-       i2c->regs = (struct netup_i2c_regs *)(ndev->bmmio0 +
+       i2c->regs = (struct netup_i2c_regs __iomem *)(ndev->bmmio0 +
                (bus_num == 0 ? NETUP_I2C_BUS0_ADDR : NETUP_I2C_BUS1_ADDR));
        netup_i2c_reset(i2c);
        i2c->adap = netup_i2c_adapter;
index 56773f3..f33c0de 100644 (file)
@@ -45,7 +45,7 @@ struct netup_spi_regs {
 struct netup_spi {
        struct device                   *dev;
        struct spi_master               *master;
-       struct netup_spi_regs           *regs;
+       struct netup_spi_regs __iomem   *regs;
        u8 __iomem                      *mmio;
        spinlock_t                      lock;
        wait_queue_head_t               waitq;
@@ -200,7 +200,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
        spin_lock_init(&nspi->lock);
        init_waitqueue_head(&nspi->waitq);
        nspi->master = master;
-       nspi->regs = (struct netup_spi_regs *)(ndev->bmmio0 + 0x4000);
+       nspi->regs = (struct netup_spi_regs __iomem *)(ndev->bmmio0 + 0x4000);
        writew(2, &nspi->regs->clock_divider);
        writew(NETUP_UNIDVB_IRQ_SPI, ndev->bmmio0 + REG_IMASK_SET);
        ndev->spi = nspi;
index c740576..29d2094 100644 (file)
@@ -5884,6 +5884,42 @@ struct saa7134_board saa7134_boards[] = {
                        .amux = LINE1,
                },
        },
+       [SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM] = {
+               .name           = "Leadtek Winfast TV2100 FM",
+               .audio_clock    = 0x00187de7,
+               .tuner_type     = TUNER_TNF_5335MF,
+               .radio_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .gpiomask       = 0x0d,
+               .inputs         = {{
+                       .name = name_tv_mono,
+                       .vmux = 1,
+                       .amux = LINE1,
+                       .gpio = 0x00,
+                       .tv   = 1,
+               }, {
+                       .name = name_comp1,
+                       .vmux = 3,
+                       .amux = LINE2,
+                       .gpio = 0x08,
+               }, {
+                       .name = name_svideo,
+                       .vmux = 8,
+                       .amux = LINE2,
+                       .gpio = 0x08,
+               } },
+               .radio = {
+                       .name = name_radio,
+                       .amux = LINE1,
+                       .gpio = 0x04,
+